Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Masti, Narayanraddi | e1892a5 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 26 | * |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 27 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 28 | |
| 29 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 30 | |
| 31 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 32 | /**======================================================================== |
| 33 | |
| 34 | \file wlan_hdd_cfg80211.c |
| 35 | |
| 36 | \brief WLAN Host Device Driver implementation |
| 37 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 38 | ========================================================================*/ |
| 39 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 40 | /**========================================================================= |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 41 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 42 | EDIT HISTORY FOR FILE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 43 | |
| 44 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 45 | This section contains comments describing changes made to the module. |
| 46 | Notice that changes are listed in reverse chronological order. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 47 | |
| 48 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 49 | $Header:$ $DateTime: $ $Author: $ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 50 | |
| 51 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 52 | when who what, where, why |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 53 | -------- --- -------------------------------------------------------- |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 54 | 21/12/09 Ashwani Created module. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | |
| 56 | 07/06/10 Kumar Deepak Implemented cfg80211 callbacks for ANDROID |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 57 | Ganesh K |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 58 | ==========================================================================*/ |
| 59 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 60 | |
| 61 | #include <linux/version.h> |
| 62 | #include <linux/module.h> |
| 63 | #include <linux/kernel.h> |
| 64 | #include <linux/init.h> |
| 65 | #include <linux/wireless.h> |
| 66 | #include <wlan_hdd_includes.h> |
| 67 | #include <net/arp.h> |
| 68 | #include <net/cfg80211.h> |
| 69 | #include <linux/wireless.h> |
| 70 | #include <wlan_hdd_wowl.h> |
| 71 | #include <aniGlobal.h> |
| 72 | #include "ccmApi.h" |
| 73 | #include "sirParams.h" |
| 74 | #include "dot11f.h" |
| 75 | #include "wlan_hdd_assoc.h" |
| 76 | #include "wlan_hdd_wext.h" |
| 77 | #include "sme_Api.h" |
| 78 | #include "wlan_hdd_p2p.h" |
| 79 | #include "wlan_hdd_cfg80211.h" |
| 80 | #include "wlan_hdd_hostapd.h" |
| 81 | #include "sapInternal.h" |
| 82 | #include "wlan_hdd_softap_tx_rx.h" |
| 83 | #include "wlan_hdd_main.h" |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 84 | #include "wlan_hdd_assoc.h" |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 85 | #include "wlan_hdd_power.h" |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 86 | #include "wlan_hdd_trace.h" |
| 87 | #include "vos_types.h" |
| 88 | #include "vos_trace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 89 | #ifdef WLAN_BTAMP_FEATURE |
| 90 | #include "bap_hdd_misc.h" |
| 91 | #endif |
| 92 | #include <qc_sap_ioctl.h> |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 93 | #include "wlan_hdd_tdls.h" |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 94 | #include "wlan_hdd_wmm.h" |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 95 | #include "wlan_qct_wda.h" |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 96 | #include "wlan_nv.h" |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 97 | #include "wlan_hdd_dev_pwr.h" |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 98 | #include "qwlan_version.h" |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 99 | #include "wlan_logging_sock_svc.h" |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 100 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 101 | |
| 102 | #define g_mode_rates_size (12) |
| 103 | #define a_mode_rates_size (8) |
| 104 | #define FREQ_BASE_80211G (2407) |
| 105 | #define FREQ_BAND_DIFF_80211G (5) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 106 | #define MAX_SCAN_SSID 9 |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 107 | #define MAX_PENDING_LOG 5 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 108 | #define GET_IE_LEN_IN_BSS_DESC(lenInBss) ( lenInBss + sizeof(lenInBss) - \ |
krunal soni | 2a6a906 | 2014-02-11 14:14:23 -0800 | [diff] [blame] | 109 | ((uintptr_t)OFFSET_OF( tSirBssDescription, ieFields))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 110 | |
| 111 | #define HDD2GHZCHAN(freq, chan, flag) { \ |
| 112 | .band = IEEE80211_BAND_2GHZ, \ |
| 113 | .center_freq = (freq), \ |
| 114 | .hw_value = (chan),\ |
| 115 | .flags = (flag), \ |
| 116 | .max_antenna_gain = 0 ,\ |
| 117 | .max_power = 30, \ |
| 118 | } |
| 119 | |
| 120 | #define HDD5GHZCHAN(freq, chan, flag) { \ |
| 121 | .band = IEEE80211_BAND_5GHZ, \ |
| 122 | .center_freq = (freq), \ |
| 123 | .hw_value = (chan),\ |
| 124 | .flags = (flag), \ |
| 125 | .max_antenna_gain = 0 ,\ |
| 126 | .max_power = 30, \ |
| 127 | } |
| 128 | |
| 129 | #define HDD_G_MODE_RATETAB(rate, rate_id, flag)\ |
| 130 | {\ |
| 131 | .bitrate = rate, \ |
| 132 | .hw_value = rate_id, \ |
| 133 | .flags = flag, \ |
| 134 | } |
| 135 | |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 136 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 137 | #define WLAN_AKM_SUITE_FT_8021X 0x000FAC03 |
| 138 | #define WLAN_AKM_SUITE_FT_PSK 0x000FAC04 |
| 139 | #endif |
| 140 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 141 | #define HDD_CHANNEL_14 14 |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 142 | #define WLAN_HDD_MAX_FEATURE_SET 8 |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 143 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 144 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 145 | /* |
| 146 | * Used to allocate the size of 4096 for the link layer stats. |
| 147 | * The size of 4096 is considered assuming that all data per |
| 148 | * respective event fit with in the limit.Please take a call |
| 149 | * on the limit based on the data requirements on link layer |
| 150 | * statistics. |
| 151 | */ |
| 152 | #define LL_STATS_EVENT_BUF_SIZE 4096 |
| 153 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 154 | #ifdef WLAN_FEATURE_EXTSCAN |
| 155 | /* |
| 156 | * Used to allocate the size of 4096 for the EXTScan NL data. |
| 157 | * The size of 4096 is considered assuming that all data per |
| 158 | * respective event fit with in the limit.Please take a call |
| 159 | * on the limit based on the data requirements. |
| 160 | */ |
| 161 | |
| 162 | #define EXTSCAN_EVENT_BUF_SIZE 4096 |
| 163 | #define EXTSCAN_MAX_CACHED_RESULTS_PER_IND 32 |
| 164 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 165 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 166 | /*EXT TDLS*/ |
| 167 | /* |
| 168 | * Used to allocate the size of 4096 for the TDLS. |
| 169 | * The size of 4096 is considered assuming that all data per |
| 170 | * respective event fit with in the limit.Please take a call |
| 171 | * on the limit based on the data requirements on link layer |
| 172 | * statistics. |
| 173 | */ |
| 174 | #define EXTTDLS_EVENT_BUF_SIZE 4096 |
| 175 | |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 176 | /* |
| 177 | * Values for Mac spoofing feature |
| 178 | * |
| 179 | */ |
| 180 | #define MAC_ADDR_SPOOFING_FW_HOST_DISABLE 0 |
| 181 | #define MAC_ADDR_SPOOFING_FW_HOST_ENABLE 1 |
| 182 | #define MAC_ADDR_SPOOFING_FW_ENABLE_HOST_DISABLE 2 |
Padma, Santhosh Kumar | db2d75b | 2015-11-17 12:18:10 +0530 | [diff] [blame] | 183 | #define MAC_ADDR_SPOOFING_DEFER_INTERVAL 10 //in ms |
| 184 | |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 185 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 186 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 187 | { |
| 188 | WLAN_CIPHER_SUITE_WEP40, |
| 189 | WLAN_CIPHER_SUITE_WEP104, |
| 190 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 191 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 192 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 193 | WLAN_CIPHER_SUITE_KRK, |
| 194 | WLAN_CIPHER_SUITE_CCMP, |
| 195 | #else |
| 196 | WLAN_CIPHER_SUITE_CCMP, |
| 197 | #endif |
| 198 | #ifdef FEATURE_WLAN_WAPI |
| 199 | WLAN_CIPHER_SUITE_SMS4, |
| 200 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 201 | #ifdef WLAN_FEATURE_11W |
| 202 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 203 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 204 | }; |
| 205 | |
| 206 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 207 | { |
| 208 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 209 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 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), |
| 300 | .band = IEEE80211_BAND_2GHZ, |
| 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), |
| 319 | .band = IEEE80211_BAND_5GHZ, |
| 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 | |
| 419 | /* By default, only single channel concurrency is allowed */ |
| 420 | static struct ieee80211_iface_combination |
| 421 | wlan_hdd_iface_combination = { |
| 422 | .limits = wlan_hdd_iface_limit, |
| 423 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 424 | /* |
| 425 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 426 | * and p2p0 interfaces during driver init |
| 427 | * Some vendors create separate interface for P2P operations. |
| 428 | * wlan0: STA interface |
| 429 | * p2p0: P2P Device interface, action frames goes |
| 430 | * through this interface. |
| 431 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 432 | * created for p2p operations(GO/CLIENT interface). |
| 433 | */ |
| 434 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 435 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 436 | .beacon_int_infra_match = false, |
| 437 | }; |
| 438 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 440 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 441 | |
| 442 | /* Data rate 100KBPS based on IE Index */ |
| 443 | struct index_data_rate_type |
| 444 | { |
| 445 | v_U8_t beacon_rate_index; |
| 446 | v_U16_t supported_rate[4]; |
| 447 | }; |
| 448 | |
| 449 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 450 | The IDX field is the rate index |
| 451 | The HI field is the rate when RSSI is strong or being ignored |
| 452 | (in this case we report actual rate) |
| 453 | The MID field is the rate when RSSI is moderate |
| 454 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 455 | The LO field is the rate when RSSI is low |
| 456 | (in this case we don't report rates, actual current rate used) |
| 457 | */ |
| 458 | static const struct |
| 459 | { |
| 460 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 461 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 462 | } supported_data_rate[] = |
| 463 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 464 | /* IDX HI HM LM LO (RSSI-based index */ |
| 465 | {2, { 10, 10, 10, 0}}, |
| 466 | {4, { 20, 20, 10, 0}}, |
| 467 | {11, { 55, 20, 10, 0}}, |
| 468 | {12, { 60, 55, 20, 0}}, |
| 469 | {18, { 90, 55, 20, 0}}, |
| 470 | {22, {110, 55, 20, 0}}, |
| 471 | {24, {120, 90, 60, 0}}, |
| 472 | {36, {180, 120, 60, 0}}, |
| 473 | {44, {220, 180, 60, 0}}, |
| 474 | {48, {240, 180, 90, 0}}, |
| 475 | {66, {330, 180, 90, 0}}, |
| 476 | {72, {360, 240, 90, 0}}, |
| 477 | {96, {480, 240, 120, 0}}, |
| 478 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 479 | }; |
| 480 | |
| 481 | /* MCS Based rate table */ |
| 482 | static struct index_data_rate_type supported_mcs_rate[] = |
| 483 | { |
| 484 | /* MCS L20 L40 S20 S40 */ |
| 485 | {0, {65, 135, 72, 150}}, |
| 486 | {1, {130, 270, 144, 300}}, |
| 487 | {2, {195, 405, 217, 450}}, |
| 488 | {3, {260, 540, 289, 600}}, |
| 489 | {4, {390, 810, 433, 900}}, |
| 490 | {5, {520, 1080, 578, 1200}}, |
| 491 | {6, {585, 1215, 650, 1350}}, |
| 492 | {7, {650, 1350, 722, 1500}} |
| 493 | }; |
| 494 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 495 | #ifdef WLAN_FEATURE_11AC |
| 496 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 497 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 498 | |
| 499 | struct index_vht_data_rate_type |
| 500 | { |
| 501 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 502 | v_U16_t supported_VHT80_rate[2]; |
| 503 | v_U16_t supported_VHT40_rate[2]; |
| 504 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 505 | }; |
| 506 | |
| 507 | typedef enum |
| 508 | { |
| 509 | DATA_RATE_11AC_MAX_MCS_7, |
| 510 | DATA_RATE_11AC_MAX_MCS_8, |
| 511 | DATA_RATE_11AC_MAX_MCS_9, |
| 512 | DATA_RATE_11AC_MAX_MCS_NA |
| 513 | } eDataRate11ACMaxMcs; |
| 514 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 515 | /* SSID broadcast type */ |
| 516 | typedef enum eSSIDBcastType |
| 517 | { |
| 518 | eBCAST_UNKNOWN = 0, |
| 519 | eBCAST_NORMAL = 1, |
| 520 | eBCAST_HIDDEN = 2, |
| 521 | } tSSIDBcastType; |
| 522 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 523 | /* MCS Based VHT rate table */ |
| 524 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 525 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 526 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 527 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 528 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 529 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 530 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 531 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 532 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 533 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 534 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 535 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 536 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 537 | }; |
| 538 | #endif /* WLAN_FEATURE_11AC */ |
| 539 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 540 | /*array index points to MCS and array value points respective rssi*/ |
| 541 | static int rssiMcsTbl[][10] = |
| 542 | { |
| 543 | /*MCS 0 1 2 3 4 5 6 7 8 9*/ |
| 544 | {-82, -79, -77, -74, -70, -66, -65, -64, -59, -57}, //20 |
| 545 | {-79, -76, -74, -71, -67, -63, -62, -61, -56, -54}, //40 |
| 546 | {-76, -73, -71, -68, -64, -60, -59, -58, -53, -51} //80 |
| 547 | }; |
| 548 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 549 | extern struct net_device_ops net_ops_struct; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 550 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 551 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter); |
| 552 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 553 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 554 | #ifdef WLAN_NL80211_TESTMODE |
| 555 | enum wlan_hdd_tm_attr |
| 556 | { |
| 557 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 558 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 559 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 560 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 561 | /* keep last */ |
| 562 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 563 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 564 | }; |
| 565 | |
| 566 | enum wlan_hdd_tm_cmd |
| 567 | { |
| 568 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 569 | }; |
| 570 | |
| 571 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 572 | |
| 573 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 574 | { |
| 575 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 576 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 577 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 578 | }; |
| 579 | #endif /* WLAN_NL80211_TESTMODE */ |
| 580 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 581 | #ifdef FEATURE_WLAN_CH_AVOID |
| 582 | /* |
| 583 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 584 | * This is called when wlan driver needs to send vendor specific |
| 585 | * avoid frequency range event to userspace |
| 586 | */ |
| 587 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 588 | tHddAvoidFreqList *pAvoidFreqList) |
| 589 | { |
| 590 | struct sk_buff *vendor_event; |
| 591 | |
| 592 | ENTER(); |
| 593 | |
| 594 | if (!pHddCtx) |
| 595 | { |
| 596 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 597 | "%s: HDD context is null", __func__); |
| 598 | return -1; |
| 599 | } |
| 600 | |
| 601 | if (!pAvoidFreqList) |
| 602 | { |
| 603 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 604 | "%s: pAvoidFreqList is null", __func__); |
| 605 | return -1; |
| 606 | } |
| 607 | |
| 608 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 609 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 610 | NULL, |
| 611 | #endif |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 612 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 613 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 614 | GFP_KERNEL); |
| 615 | if (!vendor_event) |
| 616 | { |
| 617 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 618 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 619 | return -1; |
| 620 | } |
| 621 | |
| 622 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 623 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 624 | |
| 625 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 626 | |
| 627 | EXIT(); |
| 628 | return 0; |
| 629 | } |
| 630 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 631 | |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 632 | /* |
| 633 | * FUNCTION: __wlan_hdd_cfg80211_nan_request |
| 634 | * This is called when wlan driver needs to send vendor specific |
| 635 | * nan request event. |
| 636 | */ |
| 637 | static int __wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 638 | struct wireless_dev *wdev, |
| 639 | const void *data, int data_len) |
| 640 | { |
| 641 | tNanRequestReq nan_req; |
| 642 | VOS_STATUS status; |
| 643 | int ret_val = -1; |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 644 | struct net_device *dev = wdev->netdev; |
| 645 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 646 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 647 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 648 | |
| 649 | if (0 == data_len) |
| 650 | { |
| 651 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 652 | FL("NAN - Invalid Request, length = 0")); |
| 653 | return ret_val; |
| 654 | } |
| 655 | |
| 656 | if (NULL == data) |
| 657 | { |
| 658 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 659 | FL("NAN - Invalid Request, data is NULL")); |
| 660 | return ret_val; |
| 661 | } |
| 662 | |
| 663 | status = wlan_hdd_validate_context(pHddCtx); |
| 664 | if (0 != status) |
| 665 | { |
| 666 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 667 | FL("HDD context is not valid")); |
| 668 | return -EINVAL; |
| 669 | } |
| 670 | |
| 671 | hddLog(LOG1, FL("Received NAN command")); |
| 672 | vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 673 | (tANI_U8 *)data, data_len); |
| 674 | |
| 675 | /* check the NAN Capability */ |
| 676 | if (TRUE != sme_IsFeatureSupportedByFW(NAN)) |
| 677 | { |
| 678 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 679 | FL("NAN is not supported by Firmware")); |
| 680 | return -EINVAL; |
| 681 | } |
| 682 | |
| 683 | nan_req.request_data_len = data_len; |
| 684 | nan_req.request_data = data; |
| 685 | |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 686 | status = sme_NanRequest(hHal, &nan_req, pAdapter->sessionId); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 687 | if (VOS_STATUS_SUCCESS == status) |
| 688 | { |
| 689 | ret_val = 0; |
| 690 | } |
| 691 | return ret_val; |
| 692 | } |
| 693 | |
| 694 | /* |
| 695 | * FUNCTION: wlan_hdd_cfg80211_nan_request |
| 696 | * Wrapper to protect the nan vendor command from ssr |
| 697 | */ |
| 698 | static int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 699 | struct wireless_dev *wdev, |
| 700 | const void *data, int data_len) |
| 701 | { |
| 702 | int ret; |
| 703 | |
| 704 | vos_ssr_protect(__func__); |
| 705 | ret = __wlan_hdd_cfg80211_nan_request(wiphy, wdev, data, data_len); |
| 706 | vos_ssr_unprotect(__func__); |
| 707 | |
| 708 | return ret; |
| 709 | } |
| 710 | |
| 711 | /* |
| 712 | * FUNCTION: wlan_hdd_cfg80211_nan_callback |
| 713 | * This is a callback function and it gets called |
| 714 | * when we need to report nan response event to |
| 715 | * upper layers. |
| 716 | */ |
| 717 | static void wlan_hdd_cfg80211_nan_callback(void* ctx, tSirNanEvent* msg) |
| 718 | { |
| 719 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 720 | struct sk_buff *vendor_event; |
| 721 | int status; |
| 722 | tSirNanEvent *data; |
| 723 | |
| 724 | ENTER(); |
| 725 | if (NULL == msg) |
| 726 | { |
| 727 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 728 | FL(" msg received here is null")); |
| 729 | return; |
| 730 | } |
| 731 | data = msg; |
| 732 | |
| 733 | status = wlan_hdd_validate_context(pHddCtx); |
| 734 | |
| 735 | if (0 != status) |
| 736 | { |
| 737 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 738 | FL("HDD context is not valid")); |
| 739 | return; |
| 740 | } |
| 741 | |
| 742 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 743 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 744 | NULL, |
| 745 | #endif |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 746 | data->event_data_len + |
| 747 | NLMSG_HDRLEN, |
| 748 | QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX, |
| 749 | GFP_KERNEL); |
| 750 | |
| 751 | if (!vendor_event) |
| 752 | { |
| 753 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 754 | FL("cfg80211_vendor_event_alloc failed")); |
| 755 | return; |
| 756 | } |
| 757 | if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NAN, |
| 758 | data->event_data_len, data->event_data)) |
| 759 | { |
| 760 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 761 | FL("QCA_WLAN_VENDOR_ATTR_NAN put fail")); |
| 762 | kfree_skb(vendor_event); |
| 763 | return; |
| 764 | } |
| 765 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 766 | EXIT(); |
| 767 | } |
| 768 | |
| 769 | /* |
| 770 | * FUNCTION: wlan_hdd_cfg80211_nan_init |
| 771 | * This function is called to register the callback to sme layer |
| 772 | */ |
| 773 | inline void wlan_hdd_cfg80211_nan_init(hdd_context_t *pHddCtx) |
| 774 | { |
| 775 | sme_NanRegisterCallback(pHddCtx->hHal, wlan_hdd_cfg80211_nan_callback); |
| 776 | } |
| 777 | |
| 778 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 779 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 780 | |
| 781 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 782 | struct sk_buff *vendor_event) |
| 783 | { |
| 784 | if (nla_put_u8(vendor_event, |
| 785 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 786 | stats->rate.preamble) || |
| 787 | nla_put_u8(vendor_event, |
| 788 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 789 | stats->rate.nss) || |
| 790 | nla_put_u8(vendor_event, |
| 791 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 792 | stats->rate.bw) || |
| 793 | nla_put_u8(vendor_event, |
| 794 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 795 | stats->rate.rateMcsIdx) || |
| 796 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 797 | stats->rate.bitrate ) || |
| 798 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 799 | stats->txMpdu ) || |
| 800 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 801 | stats->rxMpdu ) || |
| 802 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 803 | stats->mpduLost ) || |
| 804 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 805 | stats->retries) || |
| 806 | nla_put_u32(vendor_event, |
| 807 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 808 | stats->retriesShort ) || |
| 809 | nla_put_u32(vendor_event, |
| 810 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 811 | stats->retriesLong)) |
| 812 | { |
| 813 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 814 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 815 | return FALSE; |
| 816 | } |
| 817 | return TRUE; |
| 818 | } |
| 819 | |
| 820 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 821 | struct sk_buff *vendor_event) |
| 822 | { |
| 823 | u32 i = 0; |
| 824 | struct nlattr *rateInfo; |
| 825 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 826 | stats->type) || |
| 827 | nla_put(vendor_event, |
| 828 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 829 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 830 | nla_put_u32(vendor_event, |
| 831 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 832 | stats->capabilities) || |
| 833 | nla_put_u32(vendor_event, |
| 834 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 835 | stats->numRate)) |
| 836 | { |
| 837 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 838 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 839 | goto error; |
| 840 | } |
| 841 | |
| 842 | rateInfo = nla_nest_start(vendor_event, |
| 843 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 844 | if(!rateInfo) |
| 845 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 846 | for (i = 0; i < stats->numRate; i++) |
| 847 | { |
| 848 | struct nlattr *rates; |
| 849 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 850 | stats->rateStats + |
| 851 | (i * sizeof(tSirWifiRateStat))); |
| 852 | rates = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 853 | if(!rates) |
| 854 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 855 | |
| 856 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 857 | { |
| 858 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 859 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 860 | return FALSE; |
| 861 | } |
| 862 | nla_nest_end(vendor_event, rates); |
| 863 | } |
| 864 | nla_nest_end(vendor_event, rateInfo); |
| 865 | |
| 866 | return TRUE; |
| 867 | error: |
| 868 | return FALSE; |
| 869 | } |
| 870 | |
| 871 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 872 | struct sk_buff *vendor_event) |
| 873 | { |
| 874 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 875 | stats->ac ) || |
| 876 | nla_put_u32(vendor_event, |
| 877 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 878 | stats->txMpdu ) || |
| 879 | nla_put_u32(vendor_event, |
| 880 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 881 | stats->rxMpdu ) || |
| 882 | nla_put_u32(vendor_event, |
| 883 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 884 | stats->txMcast ) || |
| 885 | nla_put_u32(vendor_event, |
| 886 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 887 | stats->rxMcast ) || |
| 888 | nla_put_u32(vendor_event, |
| 889 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 890 | stats->rxAmpdu ) || |
| 891 | nla_put_u32(vendor_event, |
| 892 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 893 | stats->txAmpdu ) || |
| 894 | nla_put_u32(vendor_event, |
| 895 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 896 | stats->mpduLost )|| |
| 897 | nla_put_u32(vendor_event, |
| 898 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 899 | stats->retries ) || |
| 900 | nla_put_u32(vendor_event, |
| 901 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 902 | stats->retriesShort ) || |
| 903 | nla_put_u32(vendor_event, |
| 904 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 905 | stats->retriesLong ) || |
| 906 | nla_put_u32(vendor_event, |
| 907 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 908 | stats->contentionTimeMin ) || |
| 909 | nla_put_u32(vendor_event, |
| 910 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 911 | stats->contentionTimeMax ) || |
| 912 | nla_put_u32(vendor_event, |
| 913 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 914 | stats->contentionTimeAvg ) || |
| 915 | nla_put_u32(vendor_event, |
| 916 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 917 | stats->contentionNumSamples )) |
| 918 | { |
| 919 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 920 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 921 | return FALSE; |
| 922 | } |
| 923 | return TRUE; |
| 924 | } |
| 925 | |
| 926 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 927 | struct sk_buff *vendor_event) |
| 928 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 929 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 930 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 931 | nla_put(vendor_event, |
| 932 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 933 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 934 | nla_put_u32(vendor_event, |
| 935 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 936 | stats->state ) || |
| 937 | nla_put_u32(vendor_event, |
| 938 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 939 | stats->roaming ) || |
| 940 | nla_put_u32(vendor_event, |
| 941 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 942 | stats->capabilities ) || |
| 943 | nla_put(vendor_event, |
| 944 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 945 | strlen(stats->ssid), stats->ssid) || |
| 946 | nla_put(vendor_event, |
| 947 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 948 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 949 | nla_put(vendor_event, |
| 950 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 951 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 952 | nla_put(vendor_event, |
| 953 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 954 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 955 | ) |
| 956 | { |
| 957 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 958 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 959 | return FALSE; |
| 960 | } |
| 961 | return TRUE; |
| 962 | } |
| 963 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 964 | static v_BOOL_t put_wifi_iface_stats(hdd_adapter_t *pAdapter, |
| 965 | tpSirWifiIfaceStat pWifiIfaceStat, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 966 | struct sk_buff *vendor_event) |
| 967 | { |
| 968 | int i = 0; |
| 969 | struct nlattr *wmmInfo; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 970 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 971 | WLANTL_InterfaceStatsType *pWifiIfaceStatTL = NULL; |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 972 | tSirWifiWmmAcStat accessclassStats; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 973 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 974 | if (FALSE == put_wifi_interface_info( |
| 975 | &pWifiIfaceStat->info, |
| 976 | vendor_event)) |
| 977 | { |
| 978 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 979 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 980 | return FALSE; |
| 981 | |
| 982 | } |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 983 | pWifiIfaceStatTL = (WLANTL_InterfaceStatsType *) |
| 984 | vos_mem_malloc(sizeof(WLANTL_InterfaceStatsType)); |
| 985 | if (NULL == pWifiIfaceStatTL) |
| 986 | { |
| 987 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 988 | return FALSE; |
| 989 | } |
| 990 | |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 991 | accessclassStats = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK]; |
| 992 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK] = |
| 993 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE]; |
| 994 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE] = accessclassStats; |
| 995 | |
| 996 | accessclassStats.ac = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac; |
| 997 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac = |
| 998 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac; |
| 999 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac = accessclassStats.ac; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1000 | |
| 1001 | if ( pWifiIfaceStat->info.state == WIFI_ASSOCIATED) |
| 1002 | { |
| 1003 | if (VOS_STATUS_SUCCESS == |
| 1004 | WLANTL_CollectInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1005 | pHddStaCtx->conn_info.staId[0], pWifiIfaceStatTL)) |
| 1006 | { |
| 1007 | /* mgmtRx, MgmtActionRx, rxMcast, rxMpdu, rxAmpdu, rssiData are |
| 1008 | * obtained from TL structure |
| 1009 | */ |
| 1010 | |
| 1011 | pWifiIfaceStat->mgmtRx = pWifiIfaceStat->beaconRx + |
| 1012 | pWifiIfaceStatTL->mgmtRx; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1013 | pWifiIfaceStat->rssiData = pWifiIfaceStatTL->rssiData; |
| 1014 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1015 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMcast |
| 1016 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMcast; |
| 1017 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMcast |
| 1018 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMcast; |
| 1019 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMcast |
| 1020 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMcast; |
| 1021 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMcast |
| 1022 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMcast; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1023 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1024 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMpdu |
| 1025 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMpdu; |
| 1026 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMpdu |
| 1027 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMpdu; |
| 1028 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMpdu |
| 1029 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMpdu; |
| 1030 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMpdu |
| 1031 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1032 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1033 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxAmpdu |
| 1034 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxAmpdu; |
| 1035 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxAmpdu |
| 1036 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxAmpdu; |
| 1037 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxAmpdu |
| 1038 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxAmpdu; |
| 1039 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxAmpdu |
| 1040 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxAmpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1041 | } |
| 1042 | else |
| 1043 | { |
| 1044 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in getting stats from TL")); |
| 1045 | } |
| 1046 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1047 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMcast = |
| 1048 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO]; |
| 1049 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMcast = |
| 1050 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI]; |
| 1051 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMcast = |
| 1052 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE]; |
| 1053 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMcast = |
| 1054 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK]; |
| 1055 | } |
| 1056 | else |
| 1057 | { |
| 1058 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Interface not Associated")); |
| 1059 | } |
| 1060 | |
| 1061 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1062 | |
| 1063 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1064 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1065 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_IFACE) || |
| 1066 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1067 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 1068 | pWifiIfaceStat->beaconRx) || |
| 1069 | nla_put_u32(vendor_event, |
| 1070 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 1071 | pWifiIfaceStat->mgmtRx) || |
| 1072 | nla_put_u32(vendor_event, |
| 1073 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 1074 | pWifiIfaceStat->mgmtActionRx) || |
| 1075 | nla_put_u32(vendor_event, |
| 1076 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 1077 | pWifiIfaceStat->mgmtActionTx) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1078 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1079 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 1080 | pWifiIfaceStat->rssiMgmt) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1081 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1082 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 1083 | pWifiIfaceStat->rssiData) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1084 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1085 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 1086 | pWifiIfaceStat->rssiAck)) |
| 1087 | { |
| 1088 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mukul Sharma | f1bd932 | 2015-10-20 16:03:42 +0530 | [diff] [blame] | 1089 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1090 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1091 | return FALSE; |
| 1092 | } |
| 1093 | |
Mukul Sharma | f1bd932 | 2015-10-20 16:03:42 +0530 | [diff] [blame] | 1094 | #ifdef FEATURE_EXT_LL_STAT |
| 1095 | /* |
| 1096 | * Ensure when EXT_LL_STAT is supported by both host and fwr, |
| 1097 | * then host should send Leaky AP stats to upper layer, |
| 1098 | * otherwise no need to send these stats. |
| 1099 | */ |
| 1100 | if(sme_IsFeatureSupportedByFW(EXT_LL_STAT) && |
| 1101 | sme_IsFeatureSupportedByDriver(EXT_LL_STAT) |
| 1102 | ) |
| 1103 | { |
| 1104 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1105 | FL("EXT_LL_STAT is supported by fwr and host %u %u %u %llu"), |
| 1106 | pWifiIfaceStat->leakyApStat.is_leaky_ap, |
| 1107 | pWifiIfaceStat->leakyApStat.avg_rx_frms_leaked, |
| 1108 | pWifiIfaceStat->leakyApStat.rx_leak_window, |
| 1109 | pWifiIfaceStat->leakyApStat.avg_bcn_spread); |
| 1110 | if (nla_put_u32(vendor_event, |
| 1111 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_DETECTED, |
| 1112 | pWifiIfaceStat->leakyApStat.is_leaky_ap) || |
| 1113 | nla_put_u32(vendor_event, |
| 1114 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_AVG_NUM_FRAMES_LEAKED, |
| 1115 | pWifiIfaceStat->leakyApStat.avg_rx_frms_leaked) || |
| 1116 | nla_put_u32(vendor_event, |
| 1117 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_GUARD_TIME, |
| 1118 | pWifiIfaceStat->leakyApStat.rx_leak_window) || |
| 1119 | nla_put_u64(vendor_event, |
| 1120 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_AVERAGE_TSF_OFFSET, |
| 1121 | pWifiIfaceStat->leakyApStat.avg_bcn_spread)) |
| 1122 | { |
| 1123 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1124 | FL("EXT_LL_STAT put fail")); |
| 1125 | vos_mem_free(pWifiIfaceStatTL); |
| 1126 | return FALSE; |
| 1127 | } |
| 1128 | } |
| 1129 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1130 | wmmInfo = nla_nest_start(vendor_event, |
| 1131 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1132 | if(!wmmInfo) |
| 1133 | { |
| 1134 | vos_mem_free(pWifiIfaceStatTL); |
| 1135 | return FALSE; |
| 1136 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1137 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 1138 | { |
| 1139 | struct nlattr *wmmStats; |
| 1140 | wmmStats = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1141 | if(!wmmStats) |
| 1142 | { |
| 1143 | vos_mem_free(pWifiIfaceStatTL); |
| 1144 | return FALSE; |
| 1145 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1146 | if (FALSE == put_wifi_wmm_ac_stat( |
| 1147 | &pWifiIfaceStat->AccessclassStats[i], |
| 1148 | vendor_event)) |
| 1149 | { |
| 1150 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1151 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1152 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1153 | return FALSE; |
| 1154 | } |
| 1155 | |
| 1156 | nla_nest_end(vendor_event, wmmStats); |
| 1157 | } |
| 1158 | nla_nest_end(vendor_event, wmmInfo); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1159 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1160 | return TRUE; |
| 1161 | } |
| 1162 | |
| 1163 | static tSirWifiInterfaceMode |
| 1164 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 1165 | { |
| 1166 | switch (deviceMode) |
| 1167 | { |
| 1168 | case WLAN_HDD_INFRA_STATION: |
| 1169 | return WIFI_INTERFACE_STA; |
| 1170 | case WLAN_HDD_SOFTAP: |
| 1171 | return WIFI_INTERFACE_SOFTAP; |
| 1172 | case WLAN_HDD_P2P_CLIENT: |
| 1173 | return WIFI_INTERFACE_P2P_CLIENT; |
| 1174 | case WLAN_HDD_P2P_GO: |
| 1175 | return WIFI_INTERFACE_P2P_GO; |
| 1176 | case WLAN_HDD_IBSS: |
| 1177 | return WIFI_INTERFACE_IBSS; |
| 1178 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 1179 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1180 | } |
| 1181 | } |
| 1182 | |
| 1183 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 1184 | tpSirWifiInterfaceInfo pInfo) |
| 1185 | { |
| 1186 | v_U8_t *staMac = NULL; |
| 1187 | hdd_station_ctx_t *pHddStaCtx; |
| 1188 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1189 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1190 | |
| 1191 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 1192 | |
| 1193 | vos_mem_copy(pInfo->macAddr, |
| 1194 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 1195 | |
| 1196 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1197 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 1198 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 1199 | { |
| 1200 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1201 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 1202 | { |
| 1203 | pInfo->state = WIFI_DISCONNECTED; |
| 1204 | } |
| 1205 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 1206 | { |
| 1207 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1208 | "%s: Session ID %d, Connection is in progress", __func__, |
| 1209 | pAdapter->sessionId); |
| 1210 | pInfo->state = WIFI_ASSOCIATING; |
| 1211 | } |
| 1212 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1213 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 1214 | { |
| 1215 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 1216 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1217 | "%s: client " MAC_ADDRESS_STR |
| 1218 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 1219 | MAC_ADDR_ARRAY(staMac)); |
| 1220 | pInfo->state = WIFI_AUTHENTICATING; |
| 1221 | } |
| 1222 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1223 | { |
| 1224 | pInfo->state = WIFI_ASSOCIATED; |
| 1225 | vos_mem_copy(pInfo->bssid, |
| 1226 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 1227 | vos_mem_copy(pInfo->ssid, |
| 1228 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 1229 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 1230 | //NULL Terminate the string. |
| 1231 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 1232 | } |
| 1233 | } |
| 1234 | vos_mem_copy(pInfo->countryStr, |
| 1235 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1236 | |
| 1237 | vos_mem_copy(pInfo->apCountryStr, |
| 1238 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1239 | |
| 1240 | return TRUE; |
| 1241 | } |
| 1242 | |
| 1243 | /* |
| 1244 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 1245 | * receiving Link Layer Peer statistics from FW.This function converts |
| 1246 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1247 | * layers. |
| 1248 | */ |
| 1249 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 1250 | v_VOID_t *pData) |
| 1251 | { |
| 1252 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1253 | tpSirWifiPeerStat pWifiPeerStat; |
| 1254 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 1255 | struct nlattr *peerInfo; |
| 1256 | struct sk_buff *vendor_event; |
| 1257 | int status, i; |
| 1258 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1259 | ENTER(); |
| 1260 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1261 | status = wlan_hdd_validate_context(pHddCtx); |
| 1262 | if (0 != status) |
| 1263 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1264 | return; |
| 1265 | } |
| 1266 | |
| 1267 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 1268 | |
| 1269 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1270 | "LL_STATS_PEER_ALL : numPeers %u", |
| 1271 | pWifiPeerStat->numPeers); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1272 | /* |
| 1273 | * Allocate a size of 4096 for the peer stats comprising |
| 1274 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1275 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1276 | * NL attribute.The size of 4096 is considered assuming |
| 1277 | * that number of rates shall not exceed beyond 50 with |
| 1278 | * the sizeof (tSirWifiRateStat) being 32. |
| 1279 | */ |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1280 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1281 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1282 | if (!vendor_event) |
| 1283 | { |
| 1284 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1285 | "%s: cfg80211_vendor_cmd_alloc_reply_skb failed", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1286 | __func__); |
| 1287 | return; |
| 1288 | } |
| 1289 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1290 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1291 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_PEER) || |
| 1292 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1293 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1294 | pWifiPeerStat->numPeers)) |
| 1295 | { |
| 1296 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1297 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1298 | kfree_skb(vendor_event); |
| 1299 | return; |
| 1300 | } |
| 1301 | |
| 1302 | peerInfo = nla_nest_start(vendor_event, |
| 1303 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1304 | if(!peerInfo) |
| 1305 | { |
| 1306 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1307 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO put fail", |
| 1308 | __func__); |
| 1309 | kfree_skb(vendor_event); |
| 1310 | return; |
| 1311 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1312 | |
| 1313 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1314 | pWifiPeerStat->peerInfo); |
| 1315 | |
| 1316 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1317 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1318 | int numRate = pWifiPeerInfo->numRate; |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1319 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1320 | |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1321 | if(!peers) |
| 1322 | { |
| 1323 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1324 | "%s: peer stats put fail", |
| 1325 | __func__); |
| 1326 | kfree_skb(vendor_event); |
| 1327 | return; |
| 1328 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1329 | if (FALSE == put_wifi_peer_info( |
| 1330 | pWifiPeerInfo, vendor_event)) |
| 1331 | { |
| 1332 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1333 | "%s: put_wifi_peer_info put fail", __func__); |
| 1334 | kfree_skb(vendor_event); |
| 1335 | return; |
| 1336 | } |
| 1337 | |
| 1338 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1339 | pWifiPeerStat->peerInfo + |
| 1340 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1341 | (numRate * sizeof (tSirWifiRateStat))); |
| 1342 | nla_nest_end(vendor_event, peers); |
| 1343 | } |
| 1344 | nla_nest_end(vendor_event, peerInfo); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1345 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1346 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1347 | } |
| 1348 | |
| 1349 | /* |
| 1350 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1351 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1352 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1353 | * layers. |
| 1354 | */ |
| 1355 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1356 | v_VOID_t *pData) |
| 1357 | { |
| 1358 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1359 | struct sk_buff *vendor_event; |
| 1360 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1361 | int status; |
| 1362 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1363 | ENTER(); |
| 1364 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1365 | status = wlan_hdd_validate_context(pHddCtx); |
| 1366 | if (0 != status) |
| 1367 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1368 | return; |
| 1369 | } |
| 1370 | /* |
| 1371 | * Allocate a size of 4096 for the interface stats comprising |
| 1372 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1373 | * assuming that all these fit with in the limit.Please take |
| 1374 | * a call on the limit based on the data requirements on |
| 1375 | * interface statistics. |
| 1376 | */ |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1377 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1378 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1379 | if (!vendor_event) |
| 1380 | { |
| 1381 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1382 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed") ); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1383 | return; |
| 1384 | } |
| 1385 | |
| 1386 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1387 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1388 | |
| 1389 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1390 | &pWifiIfaceStat->info)) |
| 1391 | { |
| 1392 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1393 | FL("hdd_get_interface_info get fail") ); |
| 1394 | kfree_skb(vendor_event); |
| 1395 | return; |
| 1396 | } |
| 1397 | |
| 1398 | if (FALSE == put_wifi_iface_stats( pAdapter, pWifiIfaceStat, |
| 1399 | vendor_event)) |
| 1400 | { |
| 1401 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1402 | FL("put_wifi_iface_stats fail") ); |
| 1403 | kfree_skb(vendor_event); |
| 1404 | return; |
| 1405 | } |
| 1406 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1407 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1408 | "WMI_LINK_STATS_IFACE Data"); |
| 1409 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1410 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1411 | |
| 1412 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1413 | } |
| 1414 | |
| 1415 | /* |
| 1416 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1417 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1418 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1419 | * layers. |
| 1420 | */ |
| 1421 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1422 | v_VOID_t *pData) |
| 1423 | { |
| 1424 | int status, i; |
| 1425 | tpSirWifiRadioStat pWifiRadioStat; |
| 1426 | tpSirWifiChannelStats pWifiChannelStats; |
| 1427 | struct sk_buff *vendor_event; |
| 1428 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1429 | struct nlattr *chList; |
| 1430 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1431 | ENTER(); |
| 1432 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1433 | status = wlan_hdd_validate_context(pHddCtx); |
| 1434 | if (0 != status) |
| 1435 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1436 | return; |
| 1437 | } |
| 1438 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1439 | |
| 1440 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1441 | "LL_STATS_RADIO" |
| 1442 | " radio is %d onTime is %u " |
| 1443 | " txTime is %u rxTime is %u " |
| 1444 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1445 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1446 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1447 | " numChannels is %u", |
| 1448 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1449 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1450 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1451 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1452 | pWifiRadioStat->onTimeRoamScan, |
| 1453 | pWifiRadioStat->onTimePnoScan, |
| 1454 | pWifiRadioStat->onTimeHs20, |
| 1455 | pWifiRadioStat->numChannels); |
| 1456 | /* |
| 1457 | * Allocate a size of 4096 for the Radio stats comprising |
| 1458 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1459 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1460 | * NL attribute.The size of 4096 is considered assuming that |
| 1461 | * number of channels shall not exceed beyond 60 with the |
| 1462 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1463 | */ |
| 1464 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1465 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1466 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1467 | if (!vendor_event) |
| 1468 | { |
| 1469 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1470 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed") ); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1471 | return; |
| 1472 | } |
| 1473 | |
| 1474 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1475 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1476 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_RADIO) || |
| 1477 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1478 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1479 | pWifiRadioStat->radio) || |
| 1480 | nla_put_u32(vendor_event, |
| 1481 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1482 | pWifiRadioStat->onTime) || |
| 1483 | nla_put_u32(vendor_event, |
| 1484 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1485 | pWifiRadioStat->txTime) || |
| 1486 | nla_put_u32(vendor_event, |
| 1487 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1488 | pWifiRadioStat->rxTime) || |
| 1489 | nla_put_u32(vendor_event, |
| 1490 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1491 | pWifiRadioStat->onTimeScan) || |
| 1492 | nla_put_u32(vendor_event, |
| 1493 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1494 | pWifiRadioStat->onTimeNbd) || |
| 1495 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1496 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1497 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1498 | nla_put_u32(vendor_event, |
| 1499 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1500 | pWifiRadioStat->onTimeRoamScan) || |
| 1501 | nla_put_u32(vendor_event, |
| 1502 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1503 | pWifiRadioStat->onTimePnoScan) || |
| 1504 | nla_put_u32(vendor_event, |
| 1505 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1506 | pWifiRadioStat->onTimeHs20) || |
| 1507 | nla_put_u32(vendor_event, |
| 1508 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1509 | pWifiRadioStat->numChannels)) |
| 1510 | { |
| 1511 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1512 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1513 | kfree_skb(vendor_event); |
| 1514 | return ; |
| 1515 | } |
| 1516 | |
| 1517 | chList = nla_nest_start(vendor_event, |
| 1518 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1519 | if(!chList) |
| 1520 | { |
| 1521 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1522 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO put fail", |
| 1523 | __func__); |
| 1524 | kfree_skb(vendor_event); |
| 1525 | return; |
| 1526 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1527 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1528 | { |
| 1529 | struct nlattr *chInfo; |
| 1530 | |
| 1531 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1532 | pWifiRadioStat->channels + |
| 1533 | (i * sizeof(tSirWifiChannelStats))); |
| 1534 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1535 | chInfo = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1536 | if(!chInfo) |
| 1537 | { |
| 1538 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1539 | "%s: failed to put chInfo", |
| 1540 | __func__); |
| 1541 | kfree_skb(vendor_event); |
| 1542 | return; |
| 1543 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1544 | |
| 1545 | if (nla_put_u32(vendor_event, |
| 1546 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1547 | pWifiChannelStats->channel.width) || |
| 1548 | nla_put_u32(vendor_event, |
| 1549 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1550 | pWifiChannelStats->channel.centerFreq) || |
| 1551 | nla_put_u32(vendor_event, |
| 1552 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1553 | pWifiChannelStats->channel.centerFreq0) || |
| 1554 | nla_put_u32(vendor_event, |
| 1555 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1556 | pWifiChannelStats->channel.centerFreq1) || |
| 1557 | nla_put_u32(vendor_event, |
| 1558 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1559 | pWifiChannelStats->onTime) || |
| 1560 | nla_put_u32(vendor_event, |
| 1561 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1562 | pWifiChannelStats->ccaBusyTime)) |
| 1563 | { |
| 1564 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1565 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1566 | kfree_skb(vendor_event); |
| 1567 | return ; |
| 1568 | } |
| 1569 | nla_nest_end(vendor_event, chInfo); |
| 1570 | } |
| 1571 | nla_nest_end(vendor_event, chList); |
| 1572 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1573 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1574 | |
| 1575 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1576 | return; |
| 1577 | } |
| 1578 | |
| 1579 | /* |
| 1580 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1581 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1582 | * data to the NL data and send the same to the kernel/upper layers. |
| 1583 | */ |
| 1584 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1585 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1586 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1587 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1588 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1589 | hdd_adapter_t *pAdapter = NULL; |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1590 | struct hdd_ll_stats_context *context; |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1591 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1592 | int status; |
| 1593 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1594 | ENTER(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1595 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1596 | status = wlan_hdd_validate_context(pHddCtx); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1597 | if (0 != status) |
| 1598 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1599 | return; |
| 1600 | } |
| 1601 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1602 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1603 | if (NULL == pAdapter) |
| 1604 | { |
| 1605 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1606 | FL(" MAC address %pM does not exist with host"), |
| 1607 | macAddr); |
| 1608 | return; |
| 1609 | } |
| 1610 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1611 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1612 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1613 | pAdapter->dev->name, indType); |
| 1614 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1615 | switch (indType) |
| 1616 | { |
| 1617 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1618 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1619 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 1620 | "LL_STATS RESP paramID = 0x%x, ifaceId = %u MAC: %pM " |
| 1621 | "respId = %u, moreResultToFollow = %u", |
| 1622 | linkLayerStatsResults->paramId, linkLayerStatsResults->ifaceId, |
| 1623 | macAddr, linkLayerStatsResults->respId, |
| 1624 | linkLayerStatsResults->moreResultToFollow); |
| 1625 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1626 | spin_lock(&hdd_context_lock); |
| 1627 | context = &pHddCtx->ll_stats_context; |
| 1628 | /* validate response received from target */ |
| 1629 | if ((context->request_id != linkLayerStatsResults->respId) || |
| 1630 | !(context->request_bitmap & linkLayerStatsResults->paramId)) |
| 1631 | { |
| 1632 | spin_unlock(&hdd_context_lock); |
| 1633 | hddLog(LOGE, |
| 1634 | FL("Error : Request id %d response id %d request bitmap 0x%x" |
| 1635 | "response bitmap 0x%x"), |
| 1636 | context->request_id, linkLayerStatsResults->respId, |
| 1637 | context->request_bitmap, linkLayerStatsResults->paramId); |
| 1638 | return; |
| 1639 | } |
| 1640 | spin_unlock(&hdd_context_lock); |
| 1641 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1642 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1643 | { |
| 1644 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1645 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1646 | spin_lock(&hdd_context_lock); |
| 1647 | context->request_bitmap &= ~(WMI_LINK_STATS_RADIO); |
| 1648 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1649 | } |
| 1650 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1651 | { |
| 1652 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1653 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1654 | spin_lock(&hdd_context_lock); |
| 1655 | context->request_bitmap &= ~(WMI_LINK_STATS_IFACE); |
| 1656 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1657 | } |
| 1658 | else if ( linkLayerStatsResults->paramId & |
| 1659 | WMI_LINK_STATS_ALL_PEER ) |
| 1660 | { |
| 1661 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1662 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1663 | spin_lock(&hdd_context_lock); |
| 1664 | context->request_bitmap &= ~(WMI_LINK_STATS_ALL_PEER); |
| 1665 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1666 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1667 | else |
| 1668 | { |
| 1669 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1670 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1671 | } |
| 1672 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1673 | spin_lock(&hdd_context_lock); |
| 1674 | /* complete response event if all requests are completed */ |
| 1675 | if (0 == context->request_bitmap) |
| 1676 | complete(&context->response_event); |
| 1677 | spin_unlock(&hdd_context_lock); |
| 1678 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1679 | break; |
| 1680 | } |
| 1681 | default: |
| 1682 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1683 | break; |
| 1684 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1685 | |
| 1686 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1687 | return; |
| 1688 | } |
| 1689 | |
| 1690 | const struct |
| 1691 | nla_policy |
| 1692 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1693 | { |
| 1694 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1695 | { .type = NLA_U32 }, |
| 1696 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1697 | { .type = NLA_U32 }, |
| 1698 | }; |
| 1699 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1700 | static int __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1701 | struct wireless_dev *wdev, |
| 1702 | const void *data, |
| 1703 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1704 | { |
| 1705 | int status; |
| 1706 | 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] | 1707 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1708 | struct net_device *dev = wdev->netdev; |
| 1709 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1710 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1711 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1712 | ENTER(); |
| 1713 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1714 | status = wlan_hdd_validate_context(pHddCtx); |
| 1715 | if (0 != status) |
| 1716 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1717 | return -EINVAL; |
| 1718 | } |
| 1719 | |
| 1720 | if (NULL == pAdapter) |
| 1721 | { |
| 1722 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1723 | FL("HDD adapter is Null")); |
| 1724 | return -ENODEV; |
| 1725 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1726 | /* check the LLStats Capability */ |
| 1727 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1728 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1729 | { |
| 1730 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1731 | FL("Link Layer Statistics not supported by Firmware")); |
| 1732 | return -EINVAL; |
| 1733 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1734 | |
| 1735 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1736 | (struct nlattr *)data, |
| 1737 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1738 | { |
| 1739 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1740 | return -EINVAL; |
| 1741 | } |
| 1742 | if (!tb_vendor |
| 1743 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1744 | { |
| 1745 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1746 | return -EINVAL; |
| 1747 | } |
| 1748 | if (!tb_vendor[ |
| 1749 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1750 | { |
| 1751 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1752 | return -EINVAL; |
| 1753 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1754 | // 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] | 1755 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1756 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1757 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1758 | nla_get_u32( |
| 1759 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1760 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1761 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1762 | nla_get_u32( |
| 1763 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1764 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1765 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1766 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1767 | |
| 1768 | |
| 1769 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 1770 | "LL_STATS_SET reqId = %d, MAC = %pM, mpduSizeThreshold = %d " |
| 1771 | "Statistics Gathering = %d ", |
| 1772 | linkLayerStatsSetReq.reqId, linkLayerStatsSetReq.macAddr, |
| 1773 | linkLayerStatsSetReq.mpduSizeThreshold, |
| 1774 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1775 | |
| 1776 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1777 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1778 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1779 | { |
| 1780 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1781 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1782 | return -EINVAL; |
| 1783 | |
| 1784 | } |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1785 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1786 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1787 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1788 | { |
| 1789 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1790 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1791 | return -EINVAL; |
| 1792 | } |
| 1793 | |
| 1794 | pAdapter->isLinkLayerStatsSet = 1; |
| 1795 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1796 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1797 | return 0; |
| 1798 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1799 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1800 | struct wireless_dev *wdev, |
| 1801 | const void *data, |
| 1802 | int data_len) |
| 1803 | { |
| 1804 | int ret = 0; |
| 1805 | |
| 1806 | vos_ssr_protect(__func__); |
| 1807 | ret = __wlan_hdd_cfg80211_ll_stats_set(wiphy, wdev, data, data_len); |
| 1808 | vos_ssr_unprotect(__func__); |
| 1809 | |
| 1810 | return ret; |
| 1811 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1812 | |
| 1813 | const struct |
| 1814 | nla_policy |
| 1815 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1816 | { |
| 1817 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1818 | * command. When reporting |
| 1819 | * the stats results, the driver uses the same value to indicate |
| 1820 | * which GET request the results |
| 1821 | * correspond to. |
| 1822 | */ |
| 1823 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1824 | |
| 1825 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1826 | requested for retrieval */ |
| 1827 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1828 | }; |
| 1829 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1830 | static int __wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1831 | struct wireless_dev *wdev, |
| 1832 | const void *data, |
| 1833 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1834 | { |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1835 | unsigned long rc; |
| 1836 | struct hdd_ll_stats_context *context; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1837 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1838 | 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] | 1839 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1840 | struct net_device *dev = wdev->netdev; |
| 1841 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 1842 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1843 | int status; |
| 1844 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1845 | ENTER(); |
| 1846 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1847 | status = wlan_hdd_validate_context(pHddCtx); |
| 1848 | if (0 != status) |
| 1849 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1850 | return -EINVAL ; |
| 1851 | } |
| 1852 | |
| 1853 | if (NULL == pAdapter) |
| 1854 | { |
| 1855 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1856 | "%s: HDD adapter is Null", __func__); |
| 1857 | return -ENODEV; |
| 1858 | } |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 1859 | |
| 1860 | if (pHddStaCtx == NULL) |
| 1861 | { |
| 1862 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1863 | "%s: HddStaCtx is Null", __func__); |
| 1864 | return -ENODEV; |
| 1865 | } |
| 1866 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1867 | /* check the LLStats Capability */ |
| 1868 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1869 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1870 | { |
| 1871 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1872 | FL("Link Layer Statistics not supported by Firmware")); |
| 1873 | return -EINVAL; |
| 1874 | } |
| 1875 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1876 | |
| 1877 | if (!pAdapter->isLinkLayerStatsSet) |
| 1878 | { |
Sushant Kaushik | dc3184b | 2015-10-09 12:00:21 +0530 | [diff] [blame] | 1879 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1880 | "%s: isLinkLayerStatsSet : %d", |
| 1881 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1882 | return -EINVAL; |
| 1883 | } |
| 1884 | |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 1885 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 1886 | { |
| 1887 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1888 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 1889 | return -EBUSY; |
| 1890 | } |
| 1891 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1892 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 1893 | (struct nlattr *)data, |
| 1894 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 1895 | { |
| 1896 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1897 | return -EINVAL; |
| 1898 | } |
| 1899 | |
| 1900 | if (!tb_vendor |
| 1901 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 1902 | { |
| 1903 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 1904 | return -EINVAL; |
| 1905 | } |
| 1906 | |
| 1907 | if (!tb_vendor |
| 1908 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 1909 | { |
| 1910 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 1911 | return -EINVAL; |
| 1912 | } |
| 1913 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1914 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1915 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1916 | nla_get_u32( tb_vendor[ |
| 1917 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1918 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1919 | nla_get_u32( tb_vendor[ |
| 1920 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 1921 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1922 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 1923 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1924 | |
| 1925 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 1926 | "LL_STATS_GET reqId = %d, MAC = %pM, paramIdMask = %d", |
| 1927 | linkLayerStatsGetReq.reqId, linkLayerStatsGetReq.macAddr, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1928 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1929 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1930 | spin_lock(&hdd_context_lock); |
| 1931 | context = &pHddCtx->ll_stats_context; |
| 1932 | context->request_id = linkLayerStatsGetReq.reqId; |
| 1933 | context->request_bitmap = linkLayerStatsGetReq.paramIdMask; |
| 1934 | INIT_COMPLETION(context->response_event); |
| 1935 | spin_unlock(&hdd_context_lock); |
| 1936 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1937 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1938 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1939 | { |
| 1940 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1941 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1942 | return -EINVAL; |
| 1943 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1944 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1945 | rc = wait_for_completion_timeout(&context->response_event, |
| 1946 | msecs_to_jiffies(WLAN_WAIT_TIME_LL_STATS)); |
| 1947 | if (!rc) |
| 1948 | { |
| 1949 | hddLog(LOGE, |
| 1950 | FL("Target response timed out request id %d request bitmap 0x%x"), |
| 1951 | context->request_id, context->request_bitmap); |
| 1952 | return -ETIMEDOUT; |
| 1953 | } |
| 1954 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1955 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1956 | return 0; |
| 1957 | } |
| 1958 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1959 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1960 | struct wireless_dev *wdev, |
| 1961 | const void *data, |
| 1962 | int data_len) |
| 1963 | { |
| 1964 | int ret = 0; |
| 1965 | |
| 1966 | vos_ssr_protect(__func__); |
| 1967 | ret = __wlan_hdd_cfg80211_ll_stats_get(wiphy, wdev, data, data_len); |
| 1968 | vos_ssr_unprotect(__func__); |
| 1969 | |
| 1970 | return ret; |
| 1971 | } |
| 1972 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1973 | const struct |
| 1974 | nla_policy |
| 1975 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 1976 | { |
| 1977 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 1978 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 1979 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 1980 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 1981 | }; |
| 1982 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1983 | static int __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 1984 | struct wireless_dev *wdev, |
| 1985 | const void *data, |
| 1986 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1987 | { |
| 1988 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1989 | 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] | 1990 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1991 | struct net_device *dev = wdev->netdev; |
| 1992 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1993 | u32 statsClearReqMask; |
| 1994 | u8 stopReq; |
| 1995 | int status; |
| 1996 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1997 | ENTER(); |
| 1998 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1999 | status = wlan_hdd_validate_context(pHddCtx); |
| 2000 | if (0 != status) |
| 2001 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2002 | return -EINVAL; |
| 2003 | } |
| 2004 | |
| 2005 | if (NULL == pAdapter) |
| 2006 | { |
| 2007 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2008 | "%s: HDD adapter is Null", __func__); |
| 2009 | return -ENODEV; |
| 2010 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2011 | /* check the LLStats Capability */ |
| 2012 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 2013 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 2014 | { |
| 2015 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2016 | FL("Enable LLStats Capability")); |
| 2017 | return -EINVAL; |
| 2018 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2019 | |
| 2020 | if (!pAdapter->isLinkLayerStatsSet) |
| 2021 | { |
| 2022 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2023 | "%s: isLinkLayerStatsSet : %d", |
| 2024 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2025 | return -EINVAL; |
| 2026 | } |
| 2027 | |
| 2028 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 2029 | (struct nlattr *)data, |
| 2030 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 2031 | { |
| 2032 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2033 | return -EINVAL; |
| 2034 | } |
| 2035 | |
| 2036 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 2037 | |
| 2038 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 2039 | { |
| 2040 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 2041 | return -EINVAL; |
| 2042 | |
| 2043 | } |
| 2044 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2045 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2046 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2047 | nla_get_u32( |
| 2048 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 2049 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2050 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2051 | nla_get_u8( |
| 2052 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 2053 | |
| 2054 | // 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] | 2055 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2056 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2057 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 2058 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2059 | |
| 2060 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 2061 | "LL_STATS_CLEAR reqId = %d, MAC = %pM," |
| 2062 | "statsClearReqMask = 0x%X, stopReq = %d", |
| 2063 | linkLayerStatsClearReq.reqId, |
| 2064 | linkLayerStatsClearReq.macAddr, |
| 2065 | linkLayerStatsClearReq.statsClearReqMask, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2066 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2067 | |
| 2068 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2069 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2070 | { |
| 2071 | struct sk_buff *temp_skbuff; |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2072 | hdd_station_ctx_t *pHddStaCtx; |
| 2073 | |
| 2074 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2075 | if (VOS_STATUS_SUCCESS != |
| 2076 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 2077 | pHddStaCtx->conn_info.staId[0], statsClearReqMask)) |
| 2078 | { |
| 2079 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2080 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 2081 | return -EINVAL; |
| 2082 | } |
| 2083 | if ((statsClearReqMask & WIFI_STATS_IFACE_AC) || |
| 2084 | (statsClearReqMask & WIFI_STATS_IFACE)) { |
| 2085 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 2086 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 2087 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 2088 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 2089 | } |
| 2090 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2091 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 2092 | 2 * sizeof(u32) + |
| 2093 | NLMSG_HDRLEN); |
| 2094 | |
| 2095 | if (temp_skbuff != NULL) |
| 2096 | { |
| 2097 | |
| 2098 | if (nla_put_u32(temp_skbuff, |
| 2099 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 2100 | statsClearReqMask) || |
| 2101 | nla_put_u32(temp_skbuff, |
| 2102 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 2103 | stopReq)) |
| 2104 | { |
| 2105 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 2106 | kfree_skb(temp_skbuff); |
| 2107 | return -EINVAL; |
| 2108 | } |
| 2109 | /* If the ask is to stop the stats collection as part of clear |
| 2110 | * (stopReq = 1) , ensure that no further requests of get |
| 2111 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 2112 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2113 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2114 | * case the firmware is just asked to clear the statistics. |
| 2115 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2116 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2117 | pAdapter->isLinkLayerStatsSet = 0; |
| 2118 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 2119 | } |
| 2120 | return -ENOMEM; |
| 2121 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2122 | |
| 2123 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2124 | return -EINVAL; |
| 2125 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2126 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2127 | struct wireless_dev *wdev, |
| 2128 | const void *data, |
| 2129 | int data_len) |
| 2130 | { |
| 2131 | int ret = 0; |
| 2132 | |
| 2133 | vos_ssr_protect(__func__); |
| 2134 | ret = __wlan_hdd_cfg80211_ll_stats_clear(wiphy, wdev, data, data_len); |
| 2135 | vos_ssr_unprotect(__func__); |
| 2136 | |
| 2137 | return ret; |
| 2138 | |
| 2139 | |
| 2140 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2141 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 2142 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2143 | #ifdef WLAN_FEATURE_EXTSCAN |
| 2144 | static const struct nla_policy |
| 2145 | wlan_hdd_extscan_config_policy |
| 2146 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 2147 | { |
| 2148 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 2149 | { .type = NLA_U32 }, |
| 2150 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 2151 | { .type = NLA_U32 }, |
| 2152 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 2153 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 2154 | { .type = NLA_U32 }, |
| 2155 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 2156 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 2157 | |
| 2158 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 2159 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 2160 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 2161 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 2162 | { .type = NLA_U8 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2163 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD] = |
| 2164 | { .type = NLA_U32 }, |
| 2165 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT] = |
| 2166 | { .type = NLA_U32 }, |
| 2167 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT] = |
| 2168 | { .type = NLA_U32 }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2169 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 2170 | { .type = NLA_U32 }, |
| 2171 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 2172 | { .type = NLA_U32 }, |
| 2173 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 2174 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2175 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT] = |
| 2176 | { .type = NLA_U8 }, |
| 2177 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS] = |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2178 | { .type = NLA_U8 }, |
| 2179 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 2180 | { .type = NLA_U8 }, |
| 2181 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 2182 | { .type = NLA_U8 }, |
| 2183 | |
| 2184 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 2185 | { .type = NLA_U32 }, |
| 2186 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 2187 | { .type = NLA_UNSPEC }, |
| 2188 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 2189 | { .type = NLA_S32 }, |
| 2190 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2191 | { .type = NLA_S32 }, |
| 2192 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 2193 | { .type = NLA_U32 }, |
| 2194 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 2195 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2196 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE] = |
| 2197 | { .type = NLA_U32 }, |
| 2198 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID] = |
| 2199 | { .type = NLA_BINARY, |
| 2200 | .len = IEEE80211_MAX_SSID_LEN + 1 }, |
| 2201 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE] = |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2202 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2203 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID] = |
| 2204 | { .type = NLA_U32 }, |
| 2205 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND] = |
| 2206 | { .type = NLA_U8 }, |
| 2207 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW] = |
| 2208 | { .type = NLA_S32 }, |
| 2209 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2210 | { .type = NLA_S32 }, |
| 2211 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CONFIGURATION_FLAGS] = |
| 2212 | { .type = NLA_U32 }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2213 | }; |
| 2214 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2215 | /** |
| 2216 | * wlan_hdd_cfg80211_extscan_get_capabilities_rsp() - response from target |
| 2217 | * @ctx: hdd global context |
| 2218 | * @data: capabilities data |
| 2219 | * |
| 2220 | * Return: none |
| 2221 | */ |
| 2222 | static void |
| 2223 | wlan_hdd_cfg80211_extscan_get_capabilities_rsp(void *ctx, void *pMsg) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2224 | { |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2225 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2226 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2227 | tSirEXTScanCapabilitiesEvent *data = |
| 2228 | (tSirEXTScanCapabilitiesEvent *) pMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2229 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2230 | ENTER(); |
| 2231 | |
| 2232 | if (wlan_hdd_validate_context(pHddCtx)) |
| 2233 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2234 | return; |
| 2235 | } |
| 2236 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2237 | if (!pMsg) |
| 2238 | { |
| 2239 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2240 | return; |
| 2241 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2242 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2243 | vos_spin_lock_acquire(&hdd_context_lock); |
| 2244 | |
| 2245 | context = &pHddCtx->ext_scan_context; |
| 2246 | /* validate response received from target*/ |
| 2247 | if (context->request_id != data->requestId) |
| 2248 | { |
| 2249 | vos_spin_lock_release(&hdd_context_lock); |
| 2250 | hddLog(LOGE, |
| 2251 | FL("Target response id did not match: request_id %d resposne_id %d"), |
| 2252 | context->request_id, data->requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2253 | return; |
| 2254 | } |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2255 | else |
| 2256 | { |
| 2257 | context->capability_response = *data; |
| 2258 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2259 | } |
| 2260 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2261 | vos_spin_lock_release(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2262 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2263 | return; |
| 2264 | } |
| 2265 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2266 | /* |
| 2267 | * define short names for the global vendor params |
| 2268 | * used by wlan_hdd_send_ext_scan_capability() |
| 2269 | */ |
| 2270 | #define PARAM_REQUEST_ID \ |
| 2271 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID |
| 2272 | #define PARAM_STATUS \ |
| 2273 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS |
| 2274 | #define MAX_SCAN_CACHE_SIZE \ |
| 2275 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE |
| 2276 | #define MAX_SCAN_BUCKETS \ |
| 2277 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS |
| 2278 | #define MAX_AP_CACHE_PER_SCAN \ |
| 2279 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN |
| 2280 | #define MAX_RSSI_SAMPLE_SIZE \ |
| 2281 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE |
| 2282 | #define MAX_SCAN_RPT_THRHOLD \ |
| 2283 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD |
| 2284 | #define MAX_HOTLIST_BSSIDS \ |
| 2285 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_BSSIDS |
| 2286 | #define MAX_BSSID_HISTORY_ENTRIES \ |
| 2287 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES |
| 2288 | #define MAX_HOTLIST_SSIDS \ |
| 2289 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_SSIDS |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2290 | #define MAX_SIGNIFICANT_WIFI_CHANGE_APS \ |
| 2291 | 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] | 2292 | |
| 2293 | static int wlan_hdd_send_ext_scan_capability(void *ctx) |
| 2294 | { |
| 2295 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2296 | struct sk_buff *skb = NULL; |
| 2297 | int ret; |
| 2298 | tSirEXTScanCapabilitiesEvent *data; |
| 2299 | tANI_U32 nl_buf_len; |
| 2300 | |
| 2301 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2302 | if (0 != ret) |
| 2303 | { |
| 2304 | return ret; |
| 2305 | } |
| 2306 | |
| 2307 | data = &(pHddCtx->ext_scan_context.capability_response); |
| 2308 | |
| 2309 | nl_buf_len = NLMSG_HDRLEN; |
| 2310 | nl_buf_len += (sizeof(data->requestId) + NLA_HDRLEN) + |
| 2311 | (sizeof(data->status) + NLA_HDRLEN) + |
| 2312 | (sizeof(data->scanCacheSize) + NLA_HDRLEN) + |
| 2313 | (sizeof(data->scanBuckets) + NLA_HDRLEN) + |
| 2314 | (sizeof(data->maxApPerScan) + NLA_HDRLEN) + |
| 2315 | (sizeof(data->maxRssiSampleSize) + NLA_HDRLEN) + |
| 2316 | (sizeof(data->maxScanReportingThreshold) + NLA_HDRLEN) + |
| 2317 | (sizeof(data->maxHotlistAPs) + NLA_HDRLEN) + |
| 2318 | (sizeof(data->maxBsidHistoryEntries) + NLA_HDRLEN) + |
| 2319 | (sizeof(data->maxHotlistSSIDs) + NLA_HDRLEN); |
| 2320 | |
| 2321 | skb = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, nl_buf_len); |
| 2322 | |
| 2323 | if (!skb) |
| 2324 | { |
| 2325 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 2326 | return -ENOMEM; |
| 2327 | } |
| 2328 | |
| 2329 | hddLog(LOG1, "Req Id (%u) Status (%u)", data->requestId, data->status); |
| 2330 | hddLog(LOG1, "Scan cache size (%u) Scan buckets (%u) Max AP per scan (%u)", |
| 2331 | data->scanCacheSize, data->scanBuckets, data->maxApPerScan); |
| 2332 | hddLog(LOG1, "max_rssi_sample_size (%u) max_scan_reporting_threshold (%u)", |
| 2333 | data->maxRssiSampleSize, data->maxScanReportingThreshold); |
| 2334 | hddLog(LOG1, "max_hotlist_bssids (%u) max_bssid_history_entries (%u)" |
| 2335 | "max_hotlist_ssids (%u)", data->maxHotlistAPs, |
| 2336 | data->maxBsidHistoryEntries, data->maxHotlistSSIDs); |
| 2337 | |
| 2338 | if (nla_put_u32(skb, PARAM_REQUEST_ID, data->requestId) || |
| 2339 | nla_put_u32(skb, PARAM_STATUS, data->status) || |
| 2340 | nla_put_u32(skb, MAX_SCAN_CACHE_SIZE, data->scanCacheSize) || |
| 2341 | nla_put_u32(skb, MAX_SCAN_BUCKETS, data->scanBuckets) || |
| 2342 | nla_put_u32(skb, MAX_AP_CACHE_PER_SCAN, |
| 2343 | data->maxApPerScan) || |
| 2344 | nla_put_u32(skb, MAX_RSSI_SAMPLE_SIZE, |
| 2345 | data->maxRssiSampleSize) || |
| 2346 | nla_put_u32(skb, MAX_SCAN_RPT_THRHOLD, |
| 2347 | data->maxScanReportingThreshold) || |
| 2348 | nla_put_u32(skb, MAX_HOTLIST_BSSIDS, data->maxHotlistAPs) || |
| 2349 | nla_put_u32(skb, MAX_BSSID_HISTORY_ENTRIES, |
| 2350 | data->maxBsidHistoryEntries) || |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2351 | nla_put_u32(skb, MAX_HOTLIST_SSIDS, data->maxHotlistSSIDs) || |
| 2352 | nla_put_u32(skb, MAX_SIGNIFICANT_WIFI_CHANGE_APS, 0)) |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2353 | { |
| 2354 | hddLog(LOGE, FL("nla put fail")); |
| 2355 | goto nla_put_failure; |
| 2356 | } |
| 2357 | |
| 2358 | cfg80211_vendor_cmd_reply(skb); |
| 2359 | return 0; |
| 2360 | |
| 2361 | nla_put_failure: |
| 2362 | kfree_skb(skb); |
| 2363 | return -EINVAL;; |
| 2364 | } |
| 2365 | |
| 2366 | /* |
| 2367 | * done with short names for the global vendor params |
| 2368 | * used by wlan_hdd_send_ext_scan_capability() |
| 2369 | */ |
| 2370 | #undef PARAM_REQUEST_ID |
| 2371 | #undef PARAM_STATUS |
| 2372 | #undef MAX_SCAN_CACHE_SIZE |
| 2373 | #undef MAX_SCAN_BUCKETS |
| 2374 | #undef MAX_AP_CACHE_PER_SCAN |
| 2375 | #undef MAX_RSSI_SAMPLE_SIZE |
| 2376 | #undef MAX_SCAN_RPT_THRHOLD |
| 2377 | #undef MAX_HOTLIST_BSSIDS |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2378 | #undef MAX_BSSID_HISTORY_ENTRIES |
| 2379 | #undef MAX_HOTLIST_SSIDS |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2380 | |
| 2381 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2382 | { |
| 2383 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2384 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2385 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2386 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2387 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2388 | ENTER(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2389 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2390 | if (wlan_hdd_validate_context(pHddCtx)) |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2391 | return; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2392 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2393 | if (!pMsg) |
| 2394 | { |
| 2395 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2396 | return; |
| 2397 | } |
| 2398 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2399 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2400 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2401 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2402 | context = &pHddCtx->ext_scan_context; |
| 2403 | spin_lock(&hdd_context_lock); |
| 2404 | if (context->request_id == pData->requestId) { |
| 2405 | context->response_status = pData->status ? -EINVAL : 0; |
| 2406 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2407 | } |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2408 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2409 | |
| 2410 | /* |
| 2411 | * Store the Request ID for comparing with the requestID obtained |
| 2412 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2413 | * request is issued with a different requestId as that of the |
| 2414 | * extscan_start request. Also, This requestId shall be used while |
| 2415 | * indicating the full scan results to the upper layers. |
| 2416 | * The requestId is stored with the assumption that the firmware |
| 2417 | * shall return the ext scan start request's requestId in ext scan |
| 2418 | * start response. |
| 2419 | */ |
| 2420 | if (pData->status == 0) |
| 2421 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2422 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2423 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2424 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2425 | } |
| 2426 | |
| 2427 | |
| 2428 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2429 | { |
| 2430 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2431 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2432 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2433 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2434 | ENTER(); |
| 2435 | |
| 2436 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2437 | return; |
| 2438 | } |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2439 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2440 | if (!pMsg) |
| 2441 | { |
| 2442 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2443 | return; |
| 2444 | } |
| 2445 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2446 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2447 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2448 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2449 | context = &pHddCtx->ext_scan_context; |
| 2450 | spin_lock(&hdd_context_lock); |
| 2451 | if (context->request_id == pData->requestId) { |
| 2452 | context->response_status = pData->status ? -EINVAL : 0; |
| 2453 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2454 | } |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2455 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2456 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2457 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2458 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2459 | } |
| 2460 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2461 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2462 | void *pMsg) |
| 2463 | { |
| 2464 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2465 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2466 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2467 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2468 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2469 | ENTER(); |
| 2470 | |
| 2471 | if (wlan_hdd_validate_context(pHddCtx)){ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2472 | return; |
| 2473 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2474 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2475 | if (!pMsg) |
| 2476 | { |
| 2477 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2478 | return; |
| 2479 | } |
| 2480 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2481 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2482 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2483 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2484 | context = &pHddCtx->ext_scan_context; |
| 2485 | spin_lock(&hdd_context_lock); |
| 2486 | if (context->request_id == pData->requestId) { |
| 2487 | context->response_status = pData->status ? -EINVAL : 0; |
| 2488 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2489 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2490 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2491 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2492 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2493 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2494 | } |
| 2495 | |
| 2496 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2497 | void *pMsg) |
| 2498 | { |
| 2499 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2500 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2501 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2502 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2503 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2504 | ENTER(); |
| 2505 | |
| 2506 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2507 | return; |
| 2508 | } |
| 2509 | if (!pMsg) |
| 2510 | { |
| 2511 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2512 | return; |
| 2513 | } |
| 2514 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2515 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2516 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2517 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2518 | context = &pHddCtx->ext_scan_context; |
| 2519 | spin_lock(&hdd_context_lock); |
| 2520 | if (context->request_id == pData->requestId) { |
| 2521 | context->response_status = pData->status ? -EINVAL : 0; |
| 2522 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2523 | } |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2524 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2525 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2526 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2527 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2528 | } |
| 2529 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 2530 | static void wlan_hdd_cfg80211_extscan_set_ssid_hotlist_rsp(void *ctx, |
| 2531 | void *pMsg) |
| 2532 | { |
| 2533 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2534 | tpSirEXTScanSetSsidHotListRspParams pData = |
| 2535 | (tpSirEXTScanSetSsidHotListRspParams) pMsg; |
| 2536 | struct hdd_ext_scan_context *context; |
| 2537 | |
| 2538 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2539 | return; |
| 2540 | } |
| 2541 | |
| 2542 | if (!pMsg) |
| 2543 | { |
| 2544 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2545 | return; |
| 2546 | } |
| 2547 | |
| 2548 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2549 | pData->status); |
| 2550 | |
| 2551 | context = &pHddCtx->ext_scan_context; |
| 2552 | spin_lock(&hdd_context_lock); |
| 2553 | if (context->request_id == pData->requestId) { |
| 2554 | context->response_status = pData->status ? -EINVAL : 0; |
| 2555 | complete(&context->response_event); |
| 2556 | } |
| 2557 | spin_unlock(&hdd_context_lock); |
| 2558 | |
| 2559 | return; |
| 2560 | } |
| 2561 | |
| 2562 | static void wlan_hdd_cfg80211_extscan_reset_ssid_hotlist_rsp(void *ctx, |
| 2563 | void *pMsg) |
| 2564 | { |
| 2565 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2566 | tpSirEXTScanResetSsidHotlistRspParams pData = |
| 2567 | (tpSirEXTScanResetSsidHotlistRspParams) pMsg; |
| 2568 | struct hdd_ext_scan_context *context; |
| 2569 | |
| 2570 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2571 | return; |
| 2572 | } |
| 2573 | if (!pMsg) |
| 2574 | { |
| 2575 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2576 | return; |
| 2577 | } |
| 2578 | |
| 2579 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2580 | pData->status); |
| 2581 | |
| 2582 | context = &pHddCtx->ext_scan_context; |
| 2583 | spin_lock(&hdd_context_lock); |
| 2584 | if (context->request_id == pData->requestId) { |
| 2585 | context->response_status = pData->status ? -EINVAL : 0; |
| 2586 | complete(&context->response_event); |
| 2587 | } |
| 2588 | spin_unlock(&hdd_context_lock); |
| 2589 | |
| 2590 | return; |
| 2591 | } |
| 2592 | |
| 2593 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2594 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2595 | void *pMsg) |
| 2596 | { |
| 2597 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2598 | struct sk_buff *skb = NULL; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2599 | tANI_U32 i = 0, j, resultsPerEvent, scan_id_index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2600 | tANI_S32 totalResults; |
| 2601 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2602 | tpSirWifiScanResult pSirWifiScanResult, head_ptr; |
| 2603 | struct hdd_ext_scan_context *context; |
| 2604 | bool ignore_cached_results = false; |
| 2605 | tExtscanCachedScanResult *result; |
| 2606 | struct nlattr *nla_results; |
| 2607 | tANI_U16 ieLength= 0; |
| 2608 | tANI_U8 *ie = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2609 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2610 | ENTER(); |
| 2611 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2612 | if (wlan_hdd_validate_context(pHddCtx)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2613 | return; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2614 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2615 | if (!pMsg) |
| 2616 | { |
| 2617 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2618 | return; |
| 2619 | } |
| 2620 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2621 | spin_lock(&hdd_context_lock); |
| 2622 | context = &pHddCtx->ext_scan_context; |
| 2623 | ignore_cached_results = context->ignore_cached_results; |
| 2624 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2625 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2626 | if (ignore_cached_results) { |
| 2627 | hddLog(LOGE, |
| 2628 | FL("Ignore the cached results received after timeout")); |
| 2629 | return; |
| 2630 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2631 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2632 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u More Data %u No of scan ids %u", |
| 2633 | pData->requestId, pData->moreData, pData->scanResultSize); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2634 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2635 | result = (tExtscanCachedScanResult *)&(pData->result); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2636 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2637 | for (scan_id_index = 0; scan_id_index < pData->scanResultSize; |
| 2638 | scan_id_index++) { |
| 2639 | result+= scan_id_index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2640 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2641 | totalResults = result->num_results; |
| 2642 | hddLog(VOS_TRACE_LEVEL_INFO, "scan_id %u flags %u Num results %u", |
| 2643 | result->scan_id, result->flags, totalResults); |
| 2644 | i = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2645 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2646 | do{ |
| 2647 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2648 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2649 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2650 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2651 | skb = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 2652 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN); |
| 2653 | |
| 2654 | if (!skb) { |
| 2655 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2656 | FL("cfg80211_vendor_event_alloc failed")); |
| 2657 | return; |
| 2658 | } |
| 2659 | |
| 2660 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2661 | |
| 2662 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2663 | pData->requestId) || |
| 2664 | nla_put_u32(skb, |
| 2665 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2666 | resultsPerEvent)) { |
| 2667 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2668 | goto fail; |
| 2669 | } |
| 2670 | if (nla_put_u8(skb, |
| 2671 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2672 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2673 | { |
| 2674 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2675 | goto fail; |
| 2676 | } |
| 2677 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2678 | if (nla_put_u32(skb, |
| 2679 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_SCAN_ID, |
| 2680 | result->scan_id)) { |
| 2681 | hddLog(LOGE, FL("put fail")); |
| 2682 | goto fail; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2683 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2684 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2685 | nla_results = nla_nest_start(skb, |
| 2686 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_LIST); |
| 2687 | if (!nla_results) |
| 2688 | goto fail; |
| 2689 | |
| 2690 | if (resultsPerEvent) { |
| 2691 | struct nlattr *aps; |
| 2692 | struct nlattr *nla_result; |
| 2693 | |
| 2694 | nla_result = nla_nest_start(skb, scan_id_index); |
| 2695 | if(!nla_result) |
| 2696 | goto fail; |
| 2697 | |
| 2698 | if (nla_put_u32(skb, |
| 2699 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_SCAN_ID, |
| 2700 | result->scan_id) || |
| 2701 | nla_put_u32(skb, |
| 2702 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_FLAGS, |
| 2703 | result->flags) || |
| 2704 | nla_put_u32(skb, |
| 2705 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2706 | totalResults)) { |
| 2707 | hddLog(LOGE, FL("put fail")); |
| 2708 | goto fail; |
| 2709 | } |
| 2710 | |
| 2711 | aps = nla_nest_start(skb, |
| 2712 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2713 | if (!aps) |
| 2714 | { |
| 2715 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2716 | goto fail; |
| 2717 | } |
| 2718 | |
| 2719 | head_ptr = (tpSirWifiScanResult) &(result->ap); |
| 2720 | |
| 2721 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2722 | struct nlattr *ap; |
| 2723 | pSirWifiScanResult = head_ptr + i; |
| 2724 | |
| 2725 | /* |
Srinivas Dasari | 91727c1 | 2016-03-23 17:59:06 +0530 | [diff] [blame] | 2726 | * Firmware returns timestamp from extscan_start till |
| 2727 | * BSSID was cached (in micro seconds). Add this with |
| 2728 | * time gap between system boot up to extscan_start |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2729 | * to derive the time since boot when the |
| 2730 | * BSSID was cached. |
| 2731 | */ |
Srinivas Dasari | 91727c1 | 2016-03-23 17:59:06 +0530 | [diff] [blame] | 2732 | pSirWifiScanResult->ts += |
| 2733 | pHddCtx->extscan_start_time_since_boot; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2734 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2735 | "Ssid (%s)" |
| 2736 | "Bssid: %pM " |
| 2737 | "Channel (%u)" |
| 2738 | "Rssi (%d)" |
| 2739 | "RTT (%u)" |
| 2740 | "RTT_SD (%u)" |
| 2741 | "Beacon Period %u" |
| 2742 | "Capability 0x%x " |
| 2743 | "Ie length %d", |
| 2744 | i, |
| 2745 | pSirWifiScanResult->ts, |
| 2746 | pSirWifiScanResult->ssid, |
| 2747 | pSirWifiScanResult->bssid, |
| 2748 | pSirWifiScanResult->channel, |
| 2749 | pSirWifiScanResult->rssi, |
| 2750 | pSirWifiScanResult->rtt, |
| 2751 | pSirWifiScanResult->rtt_sd, |
| 2752 | pSirWifiScanResult->beaconPeriod, |
| 2753 | pSirWifiScanResult->capability, |
| 2754 | ieLength); |
| 2755 | |
| 2756 | ap = nla_nest_start(skb, j + 1); |
| 2757 | if (!ap) |
| 2758 | { |
| 2759 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2760 | goto fail; |
| 2761 | } |
| 2762 | |
| 2763 | if (nla_put_u64(skb, |
| 2764 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2765 | pSirWifiScanResult->ts) ) |
| 2766 | { |
| 2767 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2768 | goto fail; |
| 2769 | } |
| 2770 | if (nla_put(skb, |
| 2771 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2772 | sizeof(pSirWifiScanResult->ssid), |
| 2773 | pSirWifiScanResult->ssid) ) |
| 2774 | { |
| 2775 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2776 | goto fail; |
| 2777 | } |
| 2778 | if (nla_put(skb, |
| 2779 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2780 | sizeof(pSirWifiScanResult->bssid), |
| 2781 | pSirWifiScanResult->bssid) ) |
| 2782 | { |
| 2783 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2784 | goto fail; |
| 2785 | } |
| 2786 | if (nla_put_u32(skb, |
| 2787 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2788 | pSirWifiScanResult->channel) ) |
| 2789 | { |
| 2790 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2791 | goto fail; |
| 2792 | } |
| 2793 | if (nla_put_s32(skb, |
| 2794 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2795 | pSirWifiScanResult->rssi) ) |
| 2796 | { |
| 2797 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2798 | goto fail; |
| 2799 | } |
| 2800 | if (nla_put_u32(skb, |
| 2801 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2802 | pSirWifiScanResult->rtt) ) |
| 2803 | { |
| 2804 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2805 | goto fail; |
| 2806 | } |
| 2807 | if (nla_put_u32(skb, |
| 2808 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2809 | pSirWifiScanResult->rtt_sd)) |
| 2810 | { |
| 2811 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2812 | goto fail; |
| 2813 | } |
| 2814 | if (nla_put_u32(skb, |
| 2815 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 2816 | pSirWifiScanResult->beaconPeriod)) |
| 2817 | { |
| 2818 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2819 | goto fail; |
| 2820 | } |
| 2821 | if (nla_put_u32(skb, |
| 2822 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 2823 | pSirWifiScanResult->capability)) |
| 2824 | { |
| 2825 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2826 | goto fail; |
| 2827 | } |
| 2828 | if (nla_put_u32(skb, |
| 2829 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 2830 | ieLength)) |
| 2831 | { |
| 2832 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2833 | goto fail; |
| 2834 | } |
| 2835 | |
| 2836 | if (ieLength) |
| 2837 | if (nla_put(skb, |
| 2838 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 2839 | ieLength, ie)) { |
| 2840 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2841 | goto fail; |
| 2842 | } |
| 2843 | |
| 2844 | nla_nest_end(skb, ap); |
| 2845 | } |
| 2846 | nla_nest_end(skb, aps); |
| 2847 | nla_nest_end(skb, nla_result); |
| 2848 | } |
| 2849 | |
| 2850 | nla_nest_end(skb, nla_results); |
| 2851 | |
| 2852 | cfg80211_vendor_cmd_reply(skb); |
| 2853 | |
| 2854 | } while (totalResults > 0); |
| 2855 | } |
| 2856 | |
| 2857 | if (!pData->moreData) { |
| 2858 | spin_lock(&hdd_context_lock); |
| 2859 | context->response_status = 0; |
| 2860 | complete(&context->response_event); |
| 2861 | spin_unlock(&hdd_context_lock); |
| 2862 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2863 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2864 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2865 | return; |
| 2866 | fail: |
| 2867 | kfree_skb(skb); |
| 2868 | return; |
| 2869 | } |
| 2870 | |
| 2871 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2872 | void *pMsg) |
| 2873 | { |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2874 | tpSirEXTScanHotlistMatch pData = (tpSirEXTScanHotlistMatch) pMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2875 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2876 | struct sk_buff *skb = NULL; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2877 | tANI_U32 i, index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2878 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2879 | ENTER(); |
| 2880 | |
| 2881 | if (wlan_hdd_validate_context(pHddCtx)) { |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2882 | hddLog(LOGE, |
| 2883 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2884 | return; |
| 2885 | } |
| 2886 | if (!pMsg) |
| 2887 | { |
| 2888 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2889 | return; |
| 2890 | } |
| 2891 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2892 | if (pData->bss_found) |
| 2893 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX; |
| 2894 | else |
| 2895 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST_INDEX; |
| 2896 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2897 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2898 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2899 | NULL, |
| 2900 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2901 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2902 | index, GFP_KERNEL); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2903 | |
| 2904 | if (!skb) { |
| 2905 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2906 | FL("cfg80211_vendor_event_alloc failed")); |
| 2907 | return; |
| 2908 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2909 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2910 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2911 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numHotlistBss); |
| 2912 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2913 | hddLog(VOS_TRACE_LEVEL_INFO, "ap_found %u", pData->bss_found); |
| 2914 | |
| 2915 | for (i = 0; i < pData->numHotlistBss; i++) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2916 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2917 | "Ssid (%s) " |
| 2918 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2919 | "Channel (%u) " |
| 2920 | "Rssi (%d) " |
| 2921 | "RTT (%u) " |
| 2922 | "RTT_SD (%u) ", |
| 2923 | i, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2924 | pData->bssHotlist[i].ts, |
| 2925 | pData->bssHotlist[i].ssid, |
| 2926 | MAC_ADDR_ARRAY(pData->bssHotlist[i].bssid), |
| 2927 | pData->bssHotlist[i].channel, |
| 2928 | pData->bssHotlist[i].rssi, |
| 2929 | pData->bssHotlist[i].rtt, |
| 2930 | pData->bssHotlist[i].rtt_sd); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2931 | } |
| 2932 | |
| 2933 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2934 | pData->requestId) || |
| 2935 | nla_put_u32(skb, |
| 2936 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2937 | pData->numHotlistBss)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2938 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2939 | goto fail; |
| 2940 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2941 | if (pData->numHotlistBss) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2942 | struct nlattr *aps; |
| 2943 | |
| 2944 | aps = nla_nest_start(skb, |
| 2945 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2946 | if (!aps) |
| 2947 | goto fail; |
| 2948 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2949 | for (i = 0; i < pData->numHotlistBss; i++) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2950 | struct nlattr *ap; |
| 2951 | |
| 2952 | ap = nla_nest_start(skb, i + 1); |
| 2953 | if (!ap) |
| 2954 | goto fail; |
| 2955 | |
| 2956 | if (nla_put_u64(skb, |
| 2957 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2958 | pData->bssHotlist[i].ts) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2959 | nla_put(skb, |
| 2960 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2961 | sizeof(pData->bssHotlist[i].ssid), |
| 2962 | pData->bssHotlist[i].ssid) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2963 | nla_put(skb, |
| 2964 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2965 | sizeof(pData->bssHotlist[i].bssid), |
| 2966 | pData->bssHotlist[i].bssid) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2967 | nla_put_u32(skb, |
| 2968 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2969 | pData->bssHotlist[i].channel) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2970 | nla_put_s32(skb, |
| 2971 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2972 | pData->bssHotlist[i].rssi) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2973 | nla_put_u32(skb, |
| 2974 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2975 | pData->bssHotlist[i].rtt) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2976 | nla_put_u32(skb, |
| 2977 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2978 | pData->bssHotlist[i].rtt_sd)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2979 | goto fail; |
| 2980 | |
| 2981 | nla_nest_end(skb, ap); |
| 2982 | } |
| 2983 | nla_nest_end(skb, aps); |
| 2984 | |
| 2985 | if (nla_put_u8(skb, |
| 2986 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2987 | pData->moreData)) |
| 2988 | goto fail; |
| 2989 | } |
| 2990 | |
| 2991 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2992 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2993 | return; |
| 2994 | |
| 2995 | fail: |
| 2996 | kfree_skb(skb); |
| 2997 | return; |
| 2998 | |
| 2999 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3000 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3001 | /** |
| 3002 | * wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind() - |
| 3003 | * Handle an SSID hotlist match event |
| 3004 | * @ctx: HDD context registered with SME |
| 3005 | * @event: The SSID hotlist match event |
| 3006 | * |
| 3007 | * This function will take an SSID match event that was generated by |
| 3008 | * firmware and will convert it into a cfg80211 vendor event which is |
| 3009 | * sent to userspace. |
| 3010 | * |
| 3011 | * Return: none |
| 3012 | */ |
| 3013 | static void |
| 3014 | wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind(void *ctx, |
| 3015 | void *pMsg) |
| 3016 | { |
| 3017 | hdd_context_t *hdd_ctx = ctx; |
| 3018 | struct sk_buff *skb; |
| 3019 | tANI_U32 i, index; |
| 3020 | tpSirEXTScanSsidHotlistMatch pData = (tpSirEXTScanSsidHotlistMatch) pMsg; |
| 3021 | |
| 3022 | ENTER(); |
| 3023 | |
| 3024 | if (wlan_hdd_validate_context(hdd_ctx)) { |
| 3025 | hddLog(LOGE, |
| 3026 | FL("HDD context is not valid or response")); |
| 3027 | return; |
| 3028 | } |
| 3029 | if (!pMsg) |
| 3030 | { |
| 3031 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 3032 | return; |
| 3033 | } |
| 3034 | |
| 3035 | if (pData->ssid_found) { |
| 3036 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND_INDEX; |
| 3037 | hddLog(LOG1, "SSID hotlist found"); |
| 3038 | } else { |
| 3039 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST_INDEX; |
| 3040 | hddLog(LOG1, "SSID hotlist lost"); |
| 3041 | } |
| 3042 | |
| 3043 | skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, |
| 3044 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3045 | NULL, |
| 3046 | #endif |
| 3047 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3048 | index, GFP_KERNEL); |
| 3049 | |
| 3050 | if (!skb) { |
| 3051 | hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed")); |
| 3052 | return; |
| 3053 | } |
| 3054 | hddLog(LOG1, "Req Id %u, Num of SSIDs %u, More Data (%u)", |
| 3055 | pData->requestId, pData->numHotlistSsid, pData->moreData); |
| 3056 | |
| 3057 | for (i = 0; i < pData->numHotlistSsid; i++) { |
| 3058 | hddLog(LOG1, "[i=%d] Timestamp %llu " |
| 3059 | "Ssid: %s " |
| 3060 | "Bssid (" MAC_ADDRESS_STR ") " |
| 3061 | "Channel %u " |
| 3062 | "Rssi %d " |
| 3063 | "RTT %u " |
| 3064 | "RTT_SD %u", |
| 3065 | i, |
| 3066 | pData->ssidHotlist[i].ts, |
| 3067 | pData->ssidHotlist[i].ssid, |
| 3068 | MAC_ADDR_ARRAY(pData->ssidHotlist[i].bssid), |
| 3069 | pData->ssidHotlist[i].channel, |
| 3070 | pData->ssidHotlist[i].rssi, |
| 3071 | pData->ssidHotlist[i].rtt, |
| 3072 | pData->ssidHotlist[i].rtt_sd); |
| 3073 | } |
| 3074 | |
| 3075 | if (nla_put_u32(skb, |
| 3076 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3077 | pData->requestId) || |
| 3078 | nla_put_u32(skb, |
| 3079 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3080 | pData->numHotlistSsid)) { |
| 3081 | hddLog(LOGE, FL("put fail")); |
| 3082 | goto fail; |
| 3083 | } |
| 3084 | |
| 3085 | if (pData->numHotlistSsid) { |
| 3086 | struct nlattr *aps; |
| 3087 | aps = nla_nest_start(skb, |
| 3088 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 3089 | if (!aps) { |
| 3090 | hddLog(LOGE, FL("nest fail")); |
| 3091 | goto fail; |
| 3092 | } |
| 3093 | |
| 3094 | for (i = 0; i < pData->numHotlistSsid; i++) { |
| 3095 | struct nlattr *ap; |
| 3096 | |
| 3097 | ap = nla_nest_start(skb, i); |
| 3098 | if (!ap) { |
| 3099 | hddLog(LOGE, FL("nest fail")); |
| 3100 | goto fail; |
| 3101 | } |
| 3102 | |
| 3103 | if (nla_put_u64(skb, |
| 3104 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3105 | pData->ssidHotlist[i].ts) || |
| 3106 | nla_put(skb, |
| 3107 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3108 | sizeof(pData->ssidHotlist[i].ssid), |
| 3109 | pData->ssidHotlist[i].ssid) || |
| 3110 | nla_put(skb, |
| 3111 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3112 | sizeof(pData->ssidHotlist[i].bssid), |
| 3113 | pData->ssidHotlist[i].bssid) || |
| 3114 | nla_put_u32(skb, |
| 3115 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3116 | pData->ssidHotlist[i].channel) || |
| 3117 | nla_put_s32(skb, |
| 3118 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 3119 | pData->ssidHotlist[i].rssi) || |
| 3120 | nla_put_u32(skb, |
| 3121 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3122 | pData->ssidHotlist[i].rtt) || |
| 3123 | nla_put_u32(skb, |
| 3124 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3125 | pData->ssidHotlist[i].rtt_sd)) { |
| 3126 | hddLog(LOGE, FL("put fail")); |
| 3127 | goto fail; |
| 3128 | } |
| 3129 | nla_nest_end(skb, ap); |
| 3130 | } |
| 3131 | nla_nest_end(skb, aps); |
| 3132 | |
| 3133 | if (nla_put_u8(skb, |
| 3134 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3135 | pData->moreData)) { |
| 3136 | hddLog(LOGE, FL("put fail")); |
| 3137 | goto fail; |
| 3138 | } |
| 3139 | } |
| 3140 | |
| 3141 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 3142 | return; |
| 3143 | |
| 3144 | fail: |
| 3145 | kfree_skb(skb); |
| 3146 | return; |
| 3147 | |
| 3148 | } |
| 3149 | |
| 3150 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3151 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 3152 | void *pMsg) |
| 3153 | { |
| 3154 | struct sk_buff *skb; |
| 3155 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3156 | tpSirWifiFullScanResultEvent pData = |
| 3157 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 3158 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3159 | ENTER(); |
| 3160 | |
| 3161 | if (wlan_hdd_validate_context(pHddCtx)) { |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3162 | hddLog(LOGE, |
| 3163 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3164 | return; |
| 3165 | } |
| 3166 | if (!pMsg) |
| 3167 | { |
| 3168 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3169 | return; |
| 3170 | } |
| 3171 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3172 | /* |
| 3173 | * If the full scan result including IE data exceeds NL 4K size |
| 3174 | * limitation, drop that beacon/probe rsp frame. |
| 3175 | */ |
| 3176 | if ((sizeof(*pData) + pData->ieLength) >= EXTSCAN_EVENT_BUF_SIZE) { |
| 3177 | hddLog(LOGE, FL("Frame exceeded NL size limilation, drop it!")); |
| 3178 | return; |
| 3179 | } |
| 3180 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3181 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3182 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3183 | NULL, |
| 3184 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3185 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3186 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 3187 | GFP_KERNEL); |
| 3188 | |
| 3189 | if (!skb) { |
| 3190 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3191 | FL("cfg80211_vendor_event_alloc failed")); |
| 3192 | return; |
| 3193 | } |
| 3194 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3195 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 3196 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 3197 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 3198 | "Ssid (%s)" |
| 3199 | "Bssid (" MAC_ADDRESS_STR ")" |
| 3200 | "Channel (%u)" |
| 3201 | "Rssi (%d)" |
| 3202 | "RTT (%u)" |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3203 | "RTT_SD (%u)" |
| 3204 | "Bcn Period %d" |
| 3205 | "Capability 0x%X "), |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3206 | pData->ap.ts, |
| 3207 | pData->ap.ssid, |
| 3208 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 3209 | pData->ap.channel, |
| 3210 | pData->ap.rssi, |
| 3211 | pData->ap.rtt, |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3212 | pData->ap.rtt_sd, |
| 3213 | pData->ap.beaconPeriod, |
| 3214 | pData->ap.capability); |
| 3215 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3216 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 3217 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3218 | pData->requestId) || |
| 3219 | nla_put_u64(skb, |
| 3220 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3221 | pData->ap.ts) || |
| 3222 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3223 | sizeof(pData->ap.ssid), |
| 3224 | pData->ap.ssid) || |
| 3225 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3226 | WNI_CFG_BSSID_LEN, |
| 3227 | pData->ap.bssid) || |
| 3228 | nla_put_u32(skb, |
| 3229 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3230 | pData->ap.channel) || |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 3231 | 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] | 3232 | pData->ap.rssi) || |
| 3233 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3234 | pData->ap.rtt) || |
| 3235 | nla_put_u32(skb, |
| 3236 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3237 | pData->ap.rtt_sd) || |
| 3238 | nla_put_u16(skb, |
| 3239 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 3240 | pData->ap.beaconPeriod) || |
| 3241 | nla_put_u16(skb, |
| 3242 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 3243 | pData->ap.capability) || |
| 3244 | nla_put_u32(skb, |
| 3245 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3246 | pData->ieLength) || |
| 3247 | nla_put_u8(skb, |
| 3248 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3249 | pData->moreData)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3250 | { |
| 3251 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3252 | goto nla_put_failure; |
| 3253 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3254 | |
| 3255 | if (pData->ieLength) { |
| 3256 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 3257 | pData->ieLength, |
| 3258 | pData->ie)) |
| 3259 | { |
| 3260 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3261 | goto nla_put_failure; |
| 3262 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3263 | } |
| 3264 | |
| 3265 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3266 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3267 | return; |
| 3268 | |
| 3269 | nla_put_failure: |
| 3270 | kfree_skb(skb); |
| 3271 | return; |
| 3272 | } |
| 3273 | |
| 3274 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 3275 | void *pMsg) |
| 3276 | { |
| 3277 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3278 | struct sk_buff *skb = NULL; |
| 3279 | tpSirEXTScanResultsAvailableIndParams pData = |
| 3280 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 3281 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3282 | ENTER(); |
| 3283 | |
| 3284 | if (wlan_hdd_validate_context(pHddCtx)){ |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3285 | hddLog(LOGE, |
| 3286 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3287 | return; |
| 3288 | } |
| 3289 | if (!pMsg) |
| 3290 | { |
| 3291 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3292 | return; |
| 3293 | } |
| 3294 | |
| 3295 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3296 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3297 | NULL, |
| 3298 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3299 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3300 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 3301 | GFP_KERNEL); |
| 3302 | |
| 3303 | if (!skb) { |
| 3304 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3305 | FL("cfg80211_vendor_event_alloc failed")); |
| 3306 | return; |
| 3307 | } |
| 3308 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3309 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3310 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 3311 | pData->numResultsAvailable); |
| 3312 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3313 | pData->requestId) || |
| 3314 | nla_put_u32(skb, |
| 3315 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3316 | pData->numResultsAvailable)) { |
| 3317 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3318 | goto nla_put_failure; |
| 3319 | } |
| 3320 | |
| 3321 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3322 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3323 | return; |
| 3324 | |
| 3325 | nla_put_failure: |
| 3326 | kfree_skb(skb); |
| 3327 | return; |
| 3328 | } |
| 3329 | |
| 3330 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 3331 | { |
| 3332 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3333 | struct sk_buff *skb = NULL; |
| 3334 | tpSirEXTScanProgressIndParams pData = |
| 3335 | (tpSirEXTScanProgressIndParams) pMsg; |
| 3336 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3337 | ENTER(); |
| 3338 | |
| 3339 | if (wlan_hdd_validate_context(pHddCtx)){ |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3340 | hddLog(LOGE, |
| 3341 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3342 | return; |
| 3343 | } |
| 3344 | if (!pMsg) |
| 3345 | { |
| 3346 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3347 | return; |
| 3348 | } |
| 3349 | |
| 3350 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3351 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3352 | NULL, |
| 3353 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3354 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3355 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 3356 | GFP_KERNEL); |
| 3357 | |
| 3358 | if (!skb) { |
| 3359 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3360 | FL("cfg80211_vendor_event_alloc failed")); |
| 3361 | return; |
| 3362 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3363 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Request Id (%u) "), pData->requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3364 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 3365 | pData->extScanEventType); |
| 3366 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 3367 | pData->status); |
| 3368 | |
| 3369 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 3370 | pData->extScanEventType) || |
| 3371 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 3372 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3373 | pData->requestId) || |
| 3374 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3375 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 3376 | pData->status)) { |
| 3377 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3378 | goto nla_put_failure; |
| 3379 | } |
| 3380 | |
| 3381 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3382 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3383 | return; |
| 3384 | |
| 3385 | nla_put_failure: |
| 3386 | kfree_skb(skb); |
| 3387 | return; |
| 3388 | } |
| 3389 | |
| 3390 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 3391 | void *pMsg) |
| 3392 | { |
| 3393 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3394 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3395 | ENTER(); |
| 3396 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3397 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3398 | return; |
| 3399 | } |
| 3400 | |
| 3401 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 3402 | |
| 3403 | |
| 3404 | switch(evType) { |
| 3405 | case SIR_HAL_EXTSCAN_START_RSP: |
| 3406 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 3407 | break; |
| 3408 | |
| 3409 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 3410 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 3411 | break; |
| 3412 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 3413 | /* There is no need to send this response to upper layer |
| 3414 | Just log the message */ |
| 3415 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3416 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 3417 | break; |
| 3418 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 3419 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 3420 | break; |
| 3421 | |
| 3422 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 3423 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 3424 | break; |
| 3425 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3426 | case SIR_HAL_EXTSCAN_SET_SSID_HOTLIST_RSP: |
| 3427 | wlan_hdd_cfg80211_extscan_set_ssid_hotlist_rsp(ctx, pMsg); |
| 3428 | break; |
| 3429 | |
| 3430 | case SIR_HAL_EXTSCAN_RESET_SSID_HOTLIST_RSP: |
| 3431 | wlan_hdd_cfg80211_extscan_reset_ssid_hotlist_rsp(ctx, pMsg); |
| 3432 | break; |
| 3433 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3434 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3435 | wlan_hdd_cfg80211_extscan_get_capabilities_rsp(ctx, pMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3436 | break; |
| 3437 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 3438 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 3439 | break; |
| 3440 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 3441 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 3442 | break; |
| 3443 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 3444 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 3445 | break; |
| 3446 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 3447 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 3448 | break; |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3449 | case SIR_HAL_EXTSCAN_SSID_HOTLIST_MATCH_IND: |
| 3450 | wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind(ctx, pMsg); |
| 3451 | break; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3452 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 3453 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 3454 | break; |
| 3455 | default: |
| 3456 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 3457 | break; |
| 3458 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3459 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3460 | } |
| 3461 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3462 | static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3463 | struct wireless_dev *wdev, |
| 3464 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3465 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3466 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3467 | struct net_device *dev = wdev->netdev; |
| 3468 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3469 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3470 | struct nlattr |
| 3471 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3472 | eHalStatus status; |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3473 | struct hdd_ext_scan_context *context; |
| 3474 | unsigned long rc; |
| 3475 | int ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3476 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3477 | ENTER(); |
| 3478 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3479 | status = wlan_hdd_validate_context(pHddCtx); |
| 3480 | if (0 != status) |
| 3481 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3482 | return -EINVAL; |
| 3483 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3484 | /* check the EXTScan Capability */ |
| 3485 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3486 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3487 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3488 | { |
| 3489 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3490 | FL("EXTScan not enabled/supported by Firmware")); |
| 3491 | return -EINVAL; |
| 3492 | } |
| 3493 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3494 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3495 | data, dataLen, |
| 3496 | wlan_hdd_extscan_config_policy)) { |
| 3497 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3498 | return -EINVAL; |
| 3499 | } |
| 3500 | |
| 3501 | /* Parse and fetch request Id */ |
| 3502 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3503 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3504 | return -EINVAL; |
| 3505 | } |
| 3506 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3507 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3508 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3509 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3510 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3511 | reqMsg.sessionId = pAdapter->sessionId; |
| 3512 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3513 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3514 | vos_spin_lock_acquire(&hdd_context_lock); |
| 3515 | context = &pHddCtx->ext_scan_context; |
| 3516 | context->request_id = reqMsg.requestId; |
| 3517 | INIT_COMPLETION(context->response_event); |
| 3518 | vos_spin_lock_release(&hdd_context_lock); |
| 3519 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3520 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3521 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3522 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3523 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3524 | return -EINVAL; |
| 3525 | } |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3526 | |
| 3527 | rc = wait_for_completion_timeout(&context->response_event, |
| 3528 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 3529 | if (!rc) { |
| 3530 | hddLog(LOGE, FL("Target response timed out")); |
| 3531 | return -ETIMEDOUT; |
| 3532 | } |
| 3533 | |
| 3534 | ret = wlan_hdd_send_ext_scan_capability(pHddCtx); |
| 3535 | if (ret) |
| 3536 | hddLog(LOGE, FL("Failed to send ext scan capability to user space")); |
| 3537 | |
| 3538 | return ret; |
| 3539 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3540 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3541 | return 0; |
| 3542 | } |
| 3543 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3544 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3545 | struct wireless_dev *wdev, |
| 3546 | const void *data, int dataLen) |
| 3547 | { |
| 3548 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3549 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3550 | vos_ssr_protect(__func__); |
| 3551 | ret = __wlan_hdd_cfg80211_extscan_get_capabilities(wiphy, wdev, data, dataLen); |
| 3552 | vos_ssr_unprotect(__func__); |
| 3553 | |
| 3554 | return ret; |
| 3555 | } |
| 3556 | |
| 3557 | static int __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3558 | struct wireless_dev *wdev, |
| 3559 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3560 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3561 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3562 | struct net_device *dev = wdev->netdev; |
| 3563 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3564 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3565 | struct nlattr |
| 3566 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3567 | eHalStatus status; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3568 | struct hdd_ext_scan_context *context; |
| 3569 | unsigned long rc; |
| 3570 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3571 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3572 | ENTER(); |
| 3573 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3574 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 3575 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 3576 | return -EINVAL; |
| 3577 | } |
| 3578 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3579 | status = wlan_hdd_validate_context(pHddCtx); |
| 3580 | if (0 != status) |
| 3581 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3582 | return -EINVAL; |
| 3583 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3584 | /* check the EXTScan Capability */ |
| 3585 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3586 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3587 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3588 | { |
| 3589 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3590 | FL("EXTScan not enabled/supported by Firmware")); |
| 3591 | return -EINVAL; |
| 3592 | } |
| 3593 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3594 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3595 | data, dataLen, |
| 3596 | wlan_hdd_extscan_config_policy)) { |
| 3597 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3598 | return -EINVAL; |
| 3599 | } |
| 3600 | /* Parse and fetch request Id */ |
| 3601 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3602 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3603 | return -EINVAL; |
| 3604 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3605 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3606 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3607 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3608 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3609 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3610 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3611 | reqMsg.sessionId = pAdapter->sessionId; |
| 3612 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3613 | |
| 3614 | /* Parse and fetch flush parameter */ |
| 3615 | if (!tb |
| 3616 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3617 | { |
| 3618 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3619 | goto failed; |
| 3620 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3621 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3622 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3623 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3624 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3625 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3626 | spin_lock(&hdd_context_lock); |
| 3627 | context = &pHddCtx->ext_scan_context; |
| 3628 | context->request_id = reqMsg.requestId; |
| 3629 | context->ignore_cached_results = false; |
| 3630 | INIT_COMPLETION(context->response_event); |
| 3631 | spin_unlock(&hdd_context_lock); |
| 3632 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3633 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3634 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3635 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3636 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3637 | return -EINVAL; |
| 3638 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3639 | |
| 3640 | rc = wait_for_completion_timeout(&context->response_event, |
| 3641 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 3642 | if (!rc) { |
| 3643 | hddLog(LOGE, FL("Target response timed out")); |
| 3644 | retval = -ETIMEDOUT; |
| 3645 | spin_lock(&hdd_context_lock); |
| 3646 | context->ignore_cached_results = true; |
| 3647 | spin_unlock(&hdd_context_lock); |
| 3648 | } else { |
| 3649 | spin_lock(&hdd_context_lock); |
| 3650 | retval = context->response_status; |
| 3651 | spin_unlock(&hdd_context_lock); |
| 3652 | } |
| 3653 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3654 | EXIT(); |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3655 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3656 | |
| 3657 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3658 | return -EINVAL; |
| 3659 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3660 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3661 | struct wireless_dev *wdev, |
| 3662 | const void *data, int dataLen) |
| 3663 | { |
| 3664 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3665 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3666 | vos_ssr_protect(__func__); |
| 3667 | ret = __wlan_hdd_cfg80211_extscan_get_cached_results(wiphy, wdev, data, dataLen); |
| 3668 | vos_ssr_unprotect(__func__); |
| 3669 | |
| 3670 | return ret; |
| 3671 | } |
| 3672 | |
| 3673 | static int __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3674 | struct wireless_dev *wdev, |
Edhar, Mahesh Kumar | ed8631f | 2015-01-20 14:31:47 +0530 | [diff] [blame] | 3675 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3676 | { |
| 3677 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3678 | struct net_device *dev = wdev->netdev; |
| 3679 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3680 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3681 | struct nlattr |
| 3682 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3683 | struct nlattr |
| 3684 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3685 | struct nlattr *apTh; |
| 3686 | eHalStatus status; |
| 3687 | tANI_U8 i = 0; |
| 3688 | int rem; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3689 | struct hdd_ext_scan_context *context; |
| 3690 | tANI_U32 request_id; |
| 3691 | unsigned long rc; |
| 3692 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3693 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3694 | ENTER(); |
| 3695 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3696 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 3697 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 3698 | return -EINVAL; |
| 3699 | } |
| 3700 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3701 | status = wlan_hdd_validate_context(pHddCtx); |
| 3702 | if (0 != status) |
| 3703 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3704 | return -EINVAL; |
| 3705 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3706 | /* check the EXTScan Capability */ |
| 3707 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3708 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3709 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3710 | { |
| 3711 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3712 | FL("EXTScan not enabled/supported by Firmware")); |
| 3713 | return -EINVAL; |
| 3714 | } |
| 3715 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3716 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3717 | data, dataLen, |
| 3718 | wlan_hdd_extscan_config_policy)) { |
| 3719 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3720 | return -EINVAL; |
| 3721 | } |
| 3722 | |
| 3723 | /* Parse and fetch request Id */ |
| 3724 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3725 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3726 | return -EINVAL; |
| 3727 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3728 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3729 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3730 | if (!pReqMsg) { |
| 3731 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3732 | return -ENOMEM; |
| 3733 | } |
| 3734 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3735 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3736 | pReqMsg->requestId = nla_get_u32( |
| 3737 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3738 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3739 | |
| 3740 | /* Parse and fetch number of APs */ |
| 3741 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3742 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3743 | goto fail; |
| 3744 | } |
| 3745 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3746 | /* Parse and fetch lost ap sample size */ |
| 3747 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE]) { |
| 3748 | hddLog(LOGE, FL("attr lost ap sample size failed")); |
| 3749 | goto fail; |
| 3750 | } |
| 3751 | |
| 3752 | pReqMsg->lostBssidSampleSize = nla_get_u32( |
| 3753 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3754 | hddLog(LOG1, FL("Lost ap sample size %d"), pReqMsg->lostBssidSampleSize); |
| 3755 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3756 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3757 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3758 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3759 | pReqMsg->numBssid = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3760 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3761 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numBssid); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3762 | |
| 3763 | nla_for_each_nested(apTh, |
| 3764 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3765 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3766 | nla_data(apTh), nla_len(apTh), |
| 3767 | NULL)) { |
| 3768 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3769 | goto fail; |
| 3770 | } |
| 3771 | |
| 3772 | /* Parse and fetch MAC address */ |
| 3773 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3774 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3775 | goto fail; |
| 3776 | } |
| 3777 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3778 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3779 | sizeof(tSirMacAddr)); |
| 3780 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3781 | |
| 3782 | /* Parse and fetch low RSSI */ |
| 3783 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3784 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3785 | goto fail; |
| 3786 | } |
| 3787 | pReqMsg->ap[i].low = nla_get_s32( |
| 3788 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3789 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3790 | |
| 3791 | /* Parse and fetch high RSSI */ |
| 3792 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3793 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3794 | goto fail; |
| 3795 | } |
| 3796 | pReqMsg->ap[i].high = nla_get_s32( |
| 3797 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3798 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3799 | pReqMsg->ap[i].high); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3800 | i++; |
| 3801 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3802 | |
| 3803 | context = &pHddCtx->ext_scan_context; |
| 3804 | spin_lock(&hdd_context_lock); |
| 3805 | INIT_COMPLETION(context->response_event); |
| 3806 | context->request_id = request_id = pReqMsg->requestId; |
| 3807 | spin_unlock(&hdd_context_lock); |
| 3808 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3809 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3810 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3811 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3812 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3813 | vos_mem_free(pReqMsg); |
| 3814 | return -EINVAL; |
| 3815 | } |
| 3816 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3817 | /* request was sent -- wait for the response */ |
| 3818 | rc = wait_for_completion_timeout(&context->response_event, |
| 3819 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 3820 | |
| 3821 | if (!rc) { |
| 3822 | hddLog(LOGE, FL("sme_SetBssHotlist timed out")); |
| 3823 | retval = -ETIMEDOUT; |
| 3824 | } else { |
| 3825 | spin_lock(&hdd_context_lock); |
| 3826 | if (context->request_id == request_id) |
| 3827 | retval = context->response_status; |
| 3828 | else |
| 3829 | retval = -EINVAL; |
| 3830 | spin_unlock(&hdd_context_lock); |
| 3831 | } |
| 3832 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3833 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3834 | EXIT(); |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3835 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3836 | |
| 3837 | fail: |
| 3838 | vos_mem_free(pReqMsg); |
| 3839 | return -EINVAL; |
| 3840 | } |
| 3841 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3842 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3843 | struct wireless_dev *wdev, |
| 3844 | const void *data, int dataLen) |
| 3845 | { |
| 3846 | int ret = 0; |
| 3847 | |
| 3848 | vos_ssr_protect(__func__); |
| 3849 | ret = __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(wiphy, wdev, data, |
| 3850 | dataLen); |
| 3851 | vos_ssr_unprotect(__func__); |
| 3852 | |
| 3853 | return ret; |
| 3854 | } |
| 3855 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3856 | /* |
| 3857 | * define short names for the global vendor params |
| 3858 | * used by wlan_hdd_cfg80211_extscan_set_ssid_hotlist() |
| 3859 | */ |
| 3860 | #define PARAM_MAX \ |
| 3861 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX |
| 3862 | #define PARAM_REQUEST_ID \ |
| 3863 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID |
| 3864 | #define PARAMS_LOST_SSID_SAMPLE_SIZE \ |
| 3865 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE |
| 3866 | #define PARAMS_NUM_SSID \ |
| 3867 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID |
| 3868 | #define THRESHOLD_PARAM \ |
| 3869 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM |
| 3870 | #define PARAM_SSID \ |
| 3871 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID |
| 3872 | #define PARAM_BAND \ |
| 3873 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND |
| 3874 | #define PARAM_RSSI_LOW \ |
| 3875 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW |
| 3876 | #define PARAM_RSSI_HIGH \ |
| 3877 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH |
| 3878 | |
| 3879 | /** |
| 3880 | * __wlan_hdd_cfg80211_extscan_set_ssid_hotlist() - set ssid hot list |
| 3881 | * @wiphy: Pointer to wireless phy |
| 3882 | * @wdev: Pointer to wireless device |
| 3883 | * @data: Pointer to data |
| 3884 | * @data_len: Data length |
| 3885 | * |
| 3886 | * Return: 0 on success, negative errno on failure |
| 3887 | */ |
| 3888 | static int |
| 3889 | __wlan_hdd_cfg80211_extscan_set_ssid_hotlist(struct wiphy *wiphy, |
| 3890 | struct wireless_dev *wdev, |
| 3891 | const void *data, |
| 3892 | int data_len) |
| 3893 | { |
| 3894 | tSirEXTScanSetSsidHotListReqParams *request; |
| 3895 | struct net_device *dev = wdev->netdev; |
| 3896 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3897 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 3898 | struct nlattr *tb[PARAM_MAX + 1]; |
| 3899 | struct nlattr *tb2[PARAM_MAX + 1]; |
| 3900 | struct nlattr *ssids; |
| 3901 | struct hdd_ext_scan_context *context; |
| 3902 | uint32_t request_id; |
| 3903 | char ssid_string[SIR_MAC_MAX_SSID_LENGTH + 1] = {'\0'}; |
| 3904 | int ssid_len; |
| 3905 | eHalStatus status; |
| 3906 | int i, rem, retval; |
| 3907 | unsigned long rc; |
| 3908 | |
| 3909 | ENTER(); |
| 3910 | |
| 3911 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 3912 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 3913 | return -EINVAL; |
| 3914 | } |
| 3915 | |
| 3916 | retval = wlan_hdd_validate_context(hdd_ctx); |
| 3917 | if (0 != retval) { |
| 3918 | hddLog(LOGE, FL("HDD context is not valid")); |
| 3919 | return -EINVAL; |
| 3920 | } |
| 3921 | |
| 3922 | /* check the EXTScan Capability */ |
| 3923 | if ( (TRUE != hdd_ctx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3924 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3925 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3926 | { |
| 3927 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3928 | FL("EXTScan not enabled/supported by Firmware")); |
| 3929 | return -EINVAL; |
| 3930 | } |
| 3931 | |
| 3932 | if (nla_parse(tb, PARAM_MAX, |
| 3933 | data, data_len, |
| 3934 | wlan_hdd_extscan_config_policy)) { |
| 3935 | hddLog(LOGE, FL("Invalid ATTR")); |
| 3936 | return -EINVAL; |
| 3937 | } |
| 3938 | |
| 3939 | request = vos_mem_malloc(sizeof(*request)); |
| 3940 | if (!request) { |
| 3941 | hddLog(LOGE, FL("vos_mem_malloc failed")); |
| 3942 | return -ENOMEM; |
| 3943 | } |
| 3944 | |
| 3945 | /* Parse and fetch request Id */ |
| 3946 | if (!tb[PARAM_REQUEST_ID]) { |
| 3947 | hddLog(LOGE, FL("attr request id failed")); |
| 3948 | goto fail; |
| 3949 | } |
| 3950 | |
| 3951 | request->request_id = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 3952 | hddLog(LOG1, FL("Request Id %d"), request->request_id); |
| 3953 | |
| 3954 | /* Parse and fetch lost SSID sample size */ |
| 3955 | if (!tb[PARAMS_LOST_SSID_SAMPLE_SIZE]) { |
| 3956 | hddLog(LOGE, FL("attr number of Ssid failed")); |
| 3957 | goto fail; |
| 3958 | } |
| 3959 | request->lost_ssid_sample_size = |
| 3960 | nla_get_u32(tb[PARAMS_LOST_SSID_SAMPLE_SIZE]); |
| 3961 | hddLog(LOG1, FL("Lost SSID Sample Size %d"), |
| 3962 | request->lost_ssid_sample_size); |
| 3963 | |
| 3964 | /* Parse and fetch number of hotlist SSID */ |
| 3965 | if (!tb[PARAMS_NUM_SSID]) { |
| 3966 | hddLog(LOGE, FL("attr number of Ssid failed")); |
| 3967 | goto fail; |
| 3968 | } |
| 3969 | request->ssid_count = nla_get_u32(tb[PARAMS_NUM_SSID]); |
| 3970 | hddLog(LOG1, FL("Number of SSID %d"), request->ssid_count); |
| 3971 | |
| 3972 | request->session_id = adapter->sessionId; |
| 3973 | hddLog(LOG1, FL("Session Id (%d)"), request->session_id); |
| 3974 | |
| 3975 | i = 0; |
| 3976 | nla_for_each_nested(ssids, tb[THRESHOLD_PARAM], rem) { |
| 3977 | if (i >= WLAN_EXTSCAN_MAX_HOTLIST_SSIDS) { |
| 3978 | hddLog(LOGE, |
| 3979 | FL("Too Many SSIDs, %d exceeds %d"), |
| 3980 | i, WLAN_EXTSCAN_MAX_HOTLIST_SSIDS); |
| 3981 | break; |
| 3982 | } |
| 3983 | if (nla_parse(tb2, PARAM_MAX, |
| 3984 | nla_data(ssids), nla_len(ssids), |
| 3985 | wlan_hdd_extscan_config_policy)) { |
| 3986 | hddLog(LOGE, FL("nla_parse failed")); |
| 3987 | goto fail; |
| 3988 | } |
| 3989 | |
| 3990 | /* Parse and fetch SSID */ |
| 3991 | if (!tb2[PARAM_SSID]) { |
| 3992 | hddLog(LOGE, FL("attr ssid failed")); |
| 3993 | goto fail; |
| 3994 | } |
| 3995 | nla_memcpy(ssid_string, |
| 3996 | tb2[PARAM_SSID], |
| 3997 | sizeof(ssid_string)); |
| 3998 | hddLog(LOG1, FL("SSID %s"), |
| 3999 | ssid_string); |
| 4000 | ssid_len = strlen(ssid_string); |
| 4001 | memcpy(request->ssid[i].ssid.ssId, ssid_string, ssid_len); |
| 4002 | request->ssid[i].ssid.length = ssid_len; |
| 4003 | request->ssid[i].ssid.ssId[ssid_len] = '\0'; |
| 4004 | hddLog(LOG1, FL("After copying SSID %s"), |
| 4005 | request->ssid[i].ssid.ssId); |
| 4006 | hddLog(LOG1, FL("After copying length: %d"), |
| 4007 | ssid_len); |
| 4008 | |
| 4009 | /* Parse and fetch low RSSI */ |
| 4010 | if (!tb2[PARAM_BAND]) { |
| 4011 | hddLog(LOGE, FL("attr band failed")); |
| 4012 | goto fail; |
| 4013 | } |
| 4014 | request->ssid[i].band = nla_get_u8(tb2[PARAM_BAND]); |
| 4015 | hddLog(LOG1, FL("band %d"), request->ssid[i].band); |
| 4016 | |
| 4017 | /* Parse and fetch low RSSI */ |
| 4018 | if (!tb2[PARAM_RSSI_LOW]) { |
| 4019 | hddLog(LOGE, FL("attr low RSSI failed")); |
| 4020 | goto fail; |
| 4021 | } |
| 4022 | request->ssid[i].rssi_low = nla_get_s32(tb2[PARAM_RSSI_LOW]); |
| 4023 | hddLog(LOG1, FL("RSSI low %d"), request->ssid[i].rssi_low); |
| 4024 | |
| 4025 | /* Parse and fetch high RSSI */ |
| 4026 | if (!tb2[PARAM_RSSI_HIGH]) { |
| 4027 | hddLog(LOGE, FL("attr high RSSI failed")); |
| 4028 | goto fail; |
| 4029 | } |
| 4030 | request->ssid[i].rssi_high = nla_get_u32(tb2[PARAM_RSSI_HIGH]); |
| 4031 | hddLog(LOG1, FL("RSSI high %d"), request->ssid[i].rssi_high); |
| 4032 | i++; |
| 4033 | } |
| 4034 | |
| 4035 | context = &hdd_ctx->ext_scan_context; |
| 4036 | spin_lock(&hdd_context_lock); |
| 4037 | INIT_COMPLETION(context->response_event); |
| 4038 | context->request_id = request_id = request->request_id; |
| 4039 | spin_unlock(&hdd_context_lock); |
| 4040 | |
| 4041 | status = sme_set_ssid_hotlist(hdd_ctx->hHal, request); |
| 4042 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4043 | hddLog(LOGE, |
| 4044 | FL("sme_set_ssid_hotlist failed(err=%d)"), status); |
| 4045 | goto fail; |
| 4046 | } |
| 4047 | |
| 4048 | vos_mem_free(request); |
| 4049 | |
| 4050 | /* request was sent -- wait for the response */ |
| 4051 | rc = wait_for_completion_timeout(&context->response_event, |
| 4052 | msecs_to_jiffies |
| 4053 | (WLAN_WAIT_TIME_EXTSCAN)); |
| 4054 | if (!rc) { |
| 4055 | hddLog(LOGE, FL("sme_set_ssid_hotlist timed out")); |
| 4056 | retval = -ETIMEDOUT; |
| 4057 | } else { |
| 4058 | spin_lock(&hdd_context_lock); |
| 4059 | if (context->request_id == request_id) |
| 4060 | retval = context->response_status; |
| 4061 | else |
| 4062 | retval = -EINVAL; |
| 4063 | spin_unlock(&hdd_context_lock); |
| 4064 | } |
| 4065 | |
| 4066 | return retval; |
| 4067 | |
| 4068 | fail: |
| 4069 | vos_mem_free(request); |
| 4070 | return -EINVAL; |
| 4071 | } |
| 4072 | |
| 4073 | /* |
| 4074 | * done with short names for the global vendor params |
| 4075 | * used by wlan_hdd_cfg80211_extscan_set_ssid_hotlist() |
| 4076 | */ |
| 4077 | #undef PARAM_MAX |
| 4078 | #undef PARAM_REQUEST_ID |
| 4079 | #undef PARAMS_NUM_SSID |
| 4080 | #undef THRESHOLD_PARAM |
| 4081 | #undef PARAM_SSID |
| 4082 | #undef PARAM_BAND |
| 4083 | #undef PARAM_RSSI_LOW |
| 4084 | #undef PARAM_RSSI_HIGH |
| 4085 | |
| 4086 | static int wlan_hdd_cfg80211_extscan_set_ssid_hotlist(struct wiphy *wiphy, |
| 4087 | struct wireless_dev *wdev, |
| 4088 | const void *data, int dataLen) |
| 4089 | { |
| 4090 | int ret = 0; |
| 4091 | |
| 4092 | vos_ssr_protect(__func__); |
| 4093 | ret = __wlan_hdd_cfg80211_extscan_set_ssid_hotlist(wiphy, wdev, data, |
| 4094 | dataLen); |
| 4095 | vos_ssr_unprotect(__func__); |
| 4096 | |
| 4097 | return ret; |
| 4098 | } |
| 4099 | |
| 4100 | static int |
| 4101 | __wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(struct wiphy *wiphy, |
| 4102 | struct wireless_dev *wdev, |
| 4103 | const void *data, |
| 4104 | int data_len) |
| 4105 | { |
| 4106 | tSirEXTScanResetSsidHotlistReqParams request; |
| 4107 | struct net_device *dev = wdev->netdev; |
| 4108 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4109 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 4110 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4111 | struct hdd_ext_scan_context *context; |
| 4112 | uint32_t request_id; |
| 4113 | eHalStatus status; |
| 4114 | int retval; |
| 4115 | unsigned long rc; |
| 4116 | |
| 4117 | ENTER(); |
| 4118 | |
| 4119 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4120 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4121 | return -EINVAL; |
| 4122 | } |
| 4123 | |
| 4124 | retval = wlan_hdd_validate_context(hdd_ctx); |
| 4125 | if (0 != retval) { |
| 4126 | hddLog(LOGE, FL("HDD context is not valid")); |
| 4127 | return -EINVAL; |
| 4128 | } |
| 4129 | |
| 4130 | /* check the EXTScan Capability */ |
| 4131 | if ( (TRUE != hdd_ctx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4132 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4133 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 4134 | { |
| 4135 | hddLog(LOGE, |
| 4136 | FL("EXTScan not enabled/supported by Firmware")); |
| 4137 | return -EINVAL; |
| 4138 | } |
| 4139 | |
| 4140 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4141 | data, data_len, |
| 4142 | wlan_hdd_extscan_config_policy)) { |
| 4143 | hddLog(LOGE, FL("Invalid ATTR")); |
| 4144 | return -EINVAL; |
| 4145 | } |
| 4146 | |
| 4147 | /* Parse and fetch request Id */ |
| 4148 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4149 | hddLog(LOGE, FL("attr request id failed")); |
| 4150 | return -EINVAL; |
| 4151 | } |
| 4152 | |
| 4153 | request.requestId = nla_get_u32( |
| 4154 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4155 | request.sessionId = adapter->sessionId; |
| 4156 | hddLog(LOG1, FL("Request Id %d Session Id %d"), request.requestId, |
| 4157 | request.sessionId); |
| 4158 | |
| 4159 | context = &hdd_ctx->ext_scan_context; |
| 4160 | spin_lock(&hdd_context_lock); |
| 4161 | INIT_COMPLETION(context->response_event); |
| 4162 | context->request_id = request_id = request.requestId; |
| 4163 | spin_unlock(&hdd_context_lock); |
| 4164 | |
| 4165 | status = sme_reset_ssid_hotlist(hdd_ctx->hHal, &request); |
| 4166 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4167 | hddLog(LOGE, |
| 4168 | FL("sme_reset_ssid_hotlist failed(err=%d)"), status); |
| 4169 | return -EINVAL; |
| 4170 | } |
| 4171 | |
| 4172 | /* request was sent -- wait for the response */ |
| 4173 | rc = wait_for_completion_timeout(&context->response_event, |
| 4174 | msecs_to_jiffies |
| 4175 | (WLAN_WAIT_TIME_EXTSCAN)); |
| 4176 | if (!rc) { |
| 4177 | hddLog(LOGE, FL("sme_reset_ssid_hotlist timed out")); |
| 4178 | retval = -ETIMEDOUT; |
| 4179 | } else { |
| 4180 | spin_lock(&hdd_context_lock); |
| 4181 | if (context->request_id == request_id) |
| 4182 | retval = context->response_status; |
| 4183 | else |
| 4184 | retval = -EINVAL; |
| 4185 | spin_unlock(&hdd_context_lock); |
| 4186 | } |
| 4187 | |
| 4188 | return retval; |
| 4189 | } |
| 4190 | |
| 4191 | static int |
| 4192 | wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(struct wiphy *wiphy, |
| 4193 | struct wireless_dev *wdev, |
| 4194 | const void *data, |
| 4195 | int data_len) |
| 4196 | { |
| 4197 | int ret; |
| 4198 | |
| 4199 | vos_ssr_protect(__func__); |
| 4200 | ret = __wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(wiphy, wdev, |
| 4201 | data, data_len); |
| 4202 | vos_ssr_unprotect(__func__); |
| 4203 | |
| 4204 | return ret; |
| 4205 | } |
| 4206 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4207 | static int __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4208 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4209 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4210 | { |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame^] | 4211 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4212 | struct net_device *dev = wdev->netdev; |
| 4213 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4214 | uint32_t chan_list[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 4215 | uint8_t num_channels = 0; |
| 4216 | uint8_t num_chan_new = 0; |
| 4217 | uint8_t buf[256] = {0}; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4218 | 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] | 4219 | tANI_U32 requestId, maxChannels; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4220 | tWifiBand wifiBand; |
| 4221 | eHalStatus status; |
| 4222 | struct sk_buff *replySkb; |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame^] | 4223 | tANI_U8 i,j,k; |
| 4224 | int ret,len = 0;; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4225 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4226 | ENTER(); |
| 4227 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4228 | status = wlan_hdd_validate_context(pHddCtx); |
| 4229 | if (0 != status) |
| 4230 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4231 | return -EINVAL; |
| 4232 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4233 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4234 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4235 | data, dataLen, |
| 4236 | wlan_hdd_extscan_config_policy)) { |
| 4237 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4238 | return -EINVAL; |
| 4239 | } |
| 4240 | |
| 4241 | /* Parse and fetch request Id */ |
| 4242 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4243 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4244 | return -EINVAL; |
| 4245 | } |
| 4246 | requestId = nla_get_u32( |
| 4247 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4248 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 4249 | |
| 4250 | /* Parse and fetch wifi band */ |
| 4251 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 4252 | { |
| 4253 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 4254 | return -EINVAL; |
| 4255 | } |
| 4256 | wifiBand = nla_get_u32( |
| 4257 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 4258 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 4259 | |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4260 | /* Parse and fetch max channels */ |
| 4261 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]) |
| 4262 | { |
| 4263 | hddLog(LOGE, FL("attr max channels failed")); |
| 4264 | return -EINVAL; |
| 4265 | } |
| 4266 | maxChannels = nla_get_u32( |
| 4267 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]); |
| 4268 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max channels %d"), maxChannels); |
| 4269 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4270 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame^] | 4271 | wifiBand, chan_list, |
| 4272 | &num_channels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4273 | if (eHAL_STATUS_SUCCESS != status) { |
| 4274 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4275 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 4276 | return -EINVAL; |
| 4277 | } |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4278 | |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame^] | 4279 | num_channels = VOS_MIN(num_channels, maxChannels); |
| 4280 | num_chan_new = num_channels; |
| 4281 | /* remove the indoor only channels if iface is SAP */ |
| 4282 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 4283 | { |
| 4284 | num_chan_new = 0; |
| 4285 | for (i = 0; i < num_channels; i++) |
| 4286 | for (j = 0; j < IEEE80211_NUM_BANDS; j++) { |
| 4287 | if (wiphy->bands[j] == NULL) |
| 4288 | continue; |
| 4289 | for (k = 0; k < wiphy->bands[j]->n_channels; k++) { |
| 4290 | if ((chan_list[i] == |
| 4291 | wiphy->bands[j]->channels[k].center_freq) && |
| 4292 | (!(wiphy->bands[j]->channels[k].flags & |
| 4293 | IEEE80211_CHAN_INDOOR_ONLY))) { |
| 4294 | chan_list[num_chan_new] = chan_list[i]; |
| 4295 | num_chan_new++; |
| 4296 | } |
| 4297 | } |
| 4298 | } |
| 4299 | } |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4300 | |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame^] | 4301 | hddLog(LOG1, FL("Number of channels: %d"), num_chan_new); |
| 4302 | for (i = 0; i < num_chan_new; i++) |
| 4303 | len += scnprintf(buf + len, sizeof(buf) - len, "%u ", chan_list[i]); |
| 4304 | hddLog(LOG1, "Channels: %s", buf); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4305 | |
| 4306 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame^] | 4307 | sizeof(u32) * num_chan_new + |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4308 | NLMSG_HDRLEN); |
| 4309 | |
| 4310 | if (!replySkb) { |
| 4311 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4312 | FL("valid channels: buffer alloc fail")); |
| 4313 | return -EINVAL; |
| 4314 | } |
| 4315 | if (nla_put_u32(replySkb, |
| 4316 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame^] | 4317 | num_chan_new) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4318 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
Agrawal Ashish | 16abf78 | 2016-08-18 22:42:59 +0530 | [diff] [blame^] | 4319 | sizeof(u32) * num_chan_new, chan_list)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4320 | |
| 4321 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4322 | kfree_skb(replySkb); |
| 4323 | return -EINVAL; |
| 4324 | } |
| 4325 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4326 | ret = cfg80211_vendor_cmd_reply(replySkb); |
| 4327 | |
| 4328 | EXIT(); |
| 4329 | return ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4330 | } |
| 4331 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4332 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 4333 | struct wireless_dev *wdev, |
| 4334 | const void *data, int dataLen) |
| 4335 | { |
| 4336 | int ret = 0; |
| 4337 | |
| 4338 | vos_ssr_protect(__func__); |
| 4339 | ret = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev, data, |
| 4340 | dataLen); |
| 4341 | vos_ssr_unprotect(__func__); |
| 4342 | |
| 4343 | return ret; |
| 4344 | } |
| 4345 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4346 | static int hdd_extscan_start_fill_bucket_channel_spec( |
| 4347 | hdd_context_t *pHddCtx, |
| 4348 | tpSirEXTScanStartReqParams pReqMsg, |
| 4349 | struct nlattr **tb) |
| 4350 | { |
| 4351 | struct nlattr *bucket[ |
| 4352 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4353 | struct nlattr *channel[ |
| 4354 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4355 | struct nlattr *buckets; |
| 4356 | struct nlattr *channels; |
| 4357 | int rem1, rem2; |
| 4358 | eHalStatus status; |
| 4359 | tANI_U8 bktIndex, j, numChannels; |
| 4360 | tANI_U32 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 4361 | tANI_U32 passive_max_chn_time, active_max_chn_time; |
| 4362 | |
| 4363 | bktIndex = 0; |
| 4364 | |
| 4365 | nla_for_each_nested(buckets, |
| 4366 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 4367 | if (nla_parse(bucket, |
| 4368 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4369 | nla_data(buckets), nla_len(buckets), NULL)) { |
| 4370 | hddLog(LOGE, FL("nla_parse failed")); |
| 4371 | return -EINVAL; |
| 4372 | } |
| 4373 | |
| 4374 | /* Parse and fetch bucket spec */ |
| 4375 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 4376 | hddLog(LOGE, FL("attr bucket index failed")); |
| 4377 | return -EINVAL; |
| 4378 | } |
| 4379 | pReqMsg->buckets[bktIndex].bucket = nla_get_u8( |
| 4380 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 4381 | hddLog(LOG1, FL("Bucket spec Index %d"), |
| 4382 | pReqMsg->buckets[bktIndex].bucket); |
| 4383 | |
| 4384 | /* Parse and fetch wifi band */ |
| 4385 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 4386 | hddLog(LOGE, FL("attr wifi band failed")); |
| 4387 | return -EINVAL; |
| 4388 | } |
| 4389 | pReqMsg->buckets[bktIndex].band = nla_get_u8( |
| 4390 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 4391 | hddLog(LOG1, FL("Wifi band %d"), |
| 4392 | pReqMsg->buckets[bktIndex].band); |
| 4393 | |
| 4394 | /* Parse and fetch period */ |
| 4395 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 4396 | hddLog(LOGE, FL("attr period failed")); |
| 4397 | return -EINVAL; |
| 4398 | } |
| 4399 | pReqMsg->buckets[bktIndex].period = nla_get_u32( |
| 4400 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 4401 | hddLog(LOG1, FL("period %d"), |
| 4402 | pReqMsg->buckets[bktIndex].period); |
| 4403 | |
| 4404 | /* Parse and fetch report events */ |
| 4405 | if (!bucket[ |
| 4406 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 4407 | hddLog(LOGE, FL("attr report events failed")); |
| 4408 | return -EINVAL; |
| 4409 | } |
| 4410 | pReqMsg->buckets[bktIndex].reportEvents = nla_get_u8( |
| 4411 | bucket[ |
| 4412 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 4413 | hddLog(LOG1, FL("report events %d"), |
| 4414 | pReqMsg->buckets[bktIndex].reportEvents); |
| 4415 | |
| 4416 | /* Parse and fetch max period */ |
| 4417 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]) { |
| 4418 | hddLog(LOGE, FL("attr max period failed")); |
| 4419 | return -EINVAL; |
| 4420 | } |
| 4421 | pReqMsg->buckets[bktIndex].max_period = nla_get_u32( |
| 4422 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]); |
| 4423 | hddLog(LOG1, FL("max period %u"), |
| 4424 | pReqMsg->buckets[bktIndex].max_period); |
| 4425 | |
| 4426 | /* Parse and fetch exponent */ |
| 4427 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]) { |
| 4428 | hddLog(LOGE, FL("attr exponent failed")); |
| 4429 | return -EINVAL; |
| 4430 | } |
| 4431 | pReqMsg->buckets[bktIndex].exponent = nla_get_u32( |
| 4432 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]); |
| 4433 | hddLog(LOG1, FL("exponent %u"), |
| 4434 | pReqMsg->buckets[bktIndex].exponent); |
| 4435 | |
| 4436 | /* Parse and fetch step count */ |
| 4437 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]) { |
| 4438 | hddLog(LOGE, FL("attr step count failed")); |
| 4439 | return -EINVAL; |
| 4440 | } |
| 4441 | pReqMsg->buckets[bktIndex].step_count = nla_get_u32( |
| 4442 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]); |
| 4443 | hddLog(LOG1, FL("Step count %u"), |
| 4444 | pReqMsg->buckets[bktIndex].step_count); |
| 4445 | |
| 4446 | ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &passive_max_chn_time); |
| 4447 | ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &active_max_chn_time); |
| 4448 | |
| 4449 | /* Framework shall pass the channel list if the input WiFi band is |
| 4450 | * WIFI_BAND_UNSPECIFIED. |
| 4451 | * If the input WiFi band is specified (any value other than |
| 4452 | * WIFI_BAND_UNSPECIFIED) then driver populates the channel list |
| 4453 | */ |
| 4454 | if (pReqMsg->buckets[bktIndex].band != WIFI_BAND_UNSPECIFIED) { |
| 4455 | numChannels = 0; |
| 4456 | hddLog(LOG1, "WiFi band is specified, driver to fill channel list"); |
| 4457 | status = sme_GetValidChannelsByBand(pHddCtx->hHal, |
| 4458 | pReqMsg->buckets[bktIndex].band, |
| 4459 | chanList, &numChannels); |
| 4460 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4461 | hddLog(LOGE, |
| 4462 | FL("sme_GetValidChannelsByBand failed (err=%d)"), |
| 4463 | status); |
| 4464 | return -EINVAL; |
| 4465 | } |
| 4466 | |
| 4467 | pReqMsg->buckets[bktIndex].numChannels = |
| 4468 | VOS_MIN(numChannels, WLAN_EXTSCAN_MAX_CHANNELS); |
| 4469 | hddLog(LOG1, FL("Num channels %d"), |
| 4470 | pReqMsg->buckets[bktIndex].numChannels); |
| 4471 | |
| 4472 | for (j = 0; j < pReqMsg->buckets[bktIndex].numChannels; |
| 4473 | j++) { |
| 4474 | pReqMsg->buckets[bktIndex].channels[j].channel = |
| 4475 | chanList[j]; |
| 4476 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4477 | chnlClass = 0; |
| 4478 | if (CSR_IS_CHANNEL_DFS( |
| 4479 | vos_freq_to_chan(chanList[j]))) { |
| 4480 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4481 | passive = 1; |
| 4482 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4483 | dwellTimeMs = passive_max_chn_time; |
| 4484 | } else { |
| 4485 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4486 | passive = 0; |
| 4487 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4488 | dwellTimeMs = active_max_chn_time; |
| 4489 | } |
| 4490 | |
| 4491 | hddLog(LOG1, |
| 4492 | "Channel %u Passive %u Dwell time %u ms", |
| 4493 | pReqMsg->buckets[bktIndex].channels[j].channel, |
| 4494 | pReqMsg->buckets[bktIndex].channels[j].passive, |
| 4495 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs); |
| 4496 | } |
| 4497 | |
| 4498 | bktIndex++; |
| 4499 | continue; |
| 4500 | } |
| 4501 | |
| 4502 | /* Parse and fetch number of channels */ |
| 4503 | if (!bucket[ |
| 4504 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) { |
| 4505 | hddLog(LOGE, FL("attr num channels failed")); |
| 4506 | return -EINVAL; |
| 4507 | } |
| 4508 | |
| 4509 | pReqMsg->buckets[bktIndex].numChannels = |
| 4510 | nla_get_u32(bucket[ |
| 4511 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 4512 | hddLog(LOG1, FL("num channels %d"), |
| 4513 | pReqMsg->buckets[bktIndex].numChannels); |
| 4514 | |
| 4515 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 4516 | hddLog(LOGE, FL("attr channel spec failed")); |
| 4517 | return -EINVAL; |
| 4518 | } |
| 4519 | |
| 4520 | j = 0; |
| 4521 | nla_for_each_nested(channels, |
| 4522 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 4523 | if (nla_parse(channel, |
| 4524 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4525 | nla_data(channels), nla_len(channels), |
| 4526 | wlan_hdd_extscan_config_policy)) { |
| 4527 | hddLog(LOGE, FL("nla_parse failed")); |
| 4528 | return -EINVAL; |
| 4529 | } |
| 4530 | |
| 4531 | /* Parse and fetch channel */ |
| 4532 | if (!channel[ |
| 4533 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 4534 | hddLog(LOGE, FL("attr channel failed")); |
| 4535 | return -EINVAL; |
| 4536 | } |
| 4537 | pReqMsg->buckets[bktIndex].channels[j].channel = |
| 4538 | nla_get_u32(channel[ |
| 4539 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 4540 | hddLog(LOG1, FL("channel %u"), |
| 4541 | pReqMsg->buckets[bktIndex].channels[j].channel); |
| 4542 | |
| 4543 | /* Parse and fetch dwell time */ |
| 4544 | if (!channel[ |
| 4545 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 4546 | hddLog(LOGE, FL("attr dwelltime failed")); |
| 4547 | return -EINVAL; |
| 4548 | } |
| 4549 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs = |
| 4550 | nla_get_u32(channel[ |
| 4551 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 4552 | |
| 4553 | hddLog(LOG1, FL("Dwell time (%u ms)"), |
| 4554 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs); |
| 4555 | |
| 4556 | |
| 4557 | /* Parse and fetch channel spec passive */ |
| 4558 | if (!channel[ |
| 4559 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 4560 | hddLog(LOGE, |
| 4561 | FL("attr channel spec passive failed")); |
| 4562 | return -EINVAL; |
| 4563 | } |
| 4564 | pReqMsg->buckets[bktIndex].channels[j].passive = |
| 4565 | nla_get_u8(channel[ |
| 4566 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 4567 | hddLog(LOG1, FL("Chnl spec passive %u"), |
| 4568 | pReqMsg->buckets[bktIndex].channels[j].passive); |
| 4569 | |
| 4570 | j++; |
| 4571 | } |
| 4572 | |
| 4573 | bktIndex++; |
| 4574 | } |
| 4575 | |
| 4576 | return 0; |
| 4577 | } |
| 4578 | |
| 4579 | |
| 4580 | /* |
| 4581 | * define short names for the global vendor params |
| 4582 | * used by wlan_hdd_cfg80211_extscan_start() |
| 4583 | */ |
| 4584 | #define PARAM_MAX \ |
| 4585 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX |
| 4586 | #define PARAM_REQUEST_ID \ |
| 4587 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID |
| 4588 | #define PARAM_BASE_PERIOD \ |
| 4589 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD |
| 4590 | #define PARAM_MAX_AP_PER_SCAN \ |
| 4591 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN |
| 4592 | #define PARAM_RPT_THRHLD_PERCENT \ |
| 4593 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT |
| 4594 | #define PARAM_RPT_THRHLD_NUM_SCANS \ |
| 4595 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS |
| 4596 | #define PARAM_NUM_BUCKETS \ |
| 4597 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS |
| 4598 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4599 | static int __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4600 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4601 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4602 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4603 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4604 | struct net_device *dev = wdev->netdev; |
| 4605 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4606 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4607 | struct nlattr *tb[PARAM_MAX + 1]; |
| 4608 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4609 | eHalStatus status; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4610 | tANI_U32 request_id; |
| 4611 | struct hdd_ext_scan_context *context; |
| 4612 | unsigned long rc; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4613 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4614 | ENTER(); |
| 4615 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4616 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4617 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4618 | return -EINVAL; |
| 4619 | } |
| 4620 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4621 | status = wlan_hdd_validate_context(pHddCtx); |
| 4622 | if (0 != status) |
| 4623 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4624 | return -EINVAL; |
| 4625 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4626 | /* check the EXTScan Capability */ |
| 4627 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4628 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4629 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4630 | { |
| 4631 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4632 | FL("EXTScan not enabled/supported by Firmware")); |
| 4633 | return -EINVAL; |
| 4634 | } |
| 4635 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4636 | if (nla_parse(tb, PARAM_MAX, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4637 | data, dataLen, |
| 4638 | wlan_hdd_extscan_config_policy)) { |
| 4639 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4640 | return -EINVAL; |
| 4641 | } |
| 4642 | |
| 4643 | /* Parse and fetch request Id */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4644 | if (!tb[PARAM_REQUEST_ID]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4645 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4646 | return -EINVAL; |
| 4647 | } |
| 4648 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4649 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 4650 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4651 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4652 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 4653 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4654 | } |
| 4655 | |
| 4656 | pReqMsg->requestId = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4657 | tb[PARAM_REQUEST_ID]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4658 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 4659 | |
| 4660 | pReqMsg->sessionId = pAdapter->sessionId; |
| 4661 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 4662 | |
| 4663 | /* Parse and fetch base period */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4664 | if (!tb[PARAM_BASE_PERIOD]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4665 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 4666 | goto fail; |
| 4667 | } |
| 4668 | pReqMsg->basePeriod = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4669 | tb[PARAM_BASE_PERIOD]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4670 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 4671 | pReqMsg->basePeriod); |
| 4672 | |
| 4673 | /* Parse and fetch max AP per scan */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4674 | if (!tb[PARAM_MAX_AP_PER_SCAN]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4675 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 4676 | goto fail; |
| 4677 | } |
| 4678 | pReqMsg->maxAPperScan = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4679 | tb[PARAM_MAX_AP_PER_SCAN]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4680 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 4681 | pReqMsg->maxAPperScan); |
| 4682 | |
| 4683 | /* Parse and fetch report threshold */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4684 | if (!tb[PARAM_RPT_THRHLD_PERCENT]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4685 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 4686 | goto fail; |
| 4687 | } |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4688 | pReqMsg->reportThresholdPercent = nla_get_u8( |
| 4689 | tb[PARAM_RPT_THRHLD_PERCENT]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4690 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4691 | pReqMsg->reportThresholdPercent); |
| 4692 | |
| 4693 | /* Parse and fetch report threshold num scans */ |
| 4694 | if (!tb[PARAM_RPT_THRHLD_NUM_SCANS]) { |
| 4695 | hddLog(LOGE, FL("attr report_threshold num scans failed")); |
| 4696 | goto fail; |
| 4697 | } |
| 4698 | pReqMsg->reportThresholdNumScans = nla_get_u8( |
| 4699 | tb[PARAM_RPT_THRHLD_NUM_SCANS]); |
| 4700 | hddLog(LOG1, FL("Report Threshold num scans %d"), |
| 4701 | pReqMsg->reportThresholdNumScans); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4702 | |
| 4703 | /* Parse and fetch number of buckets */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4704 | if (!tb[PARAM_NUM_BUCKETS]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4705 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 4706 | goto fail; |
| 4707 | } |
| 4708 | pReqMsg->numBuckets = nla_get_u8( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4709 | tb[PARAM_NUM_BUCKETS]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4710 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 4711 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 4712 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 4713 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 4714 | } |
| 4715 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 4716 | pReqMsg->numBuckets); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4717 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4718 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 4719 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 4720 | goto fail; |
| 4721 | } |
| 4722 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4723 | pReqMsg->homeAwayTime = pHddCtx->cfg_ini->nRestTimeConc; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4724 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4725 | if (hdd_extscan_start_fill_bucket_channel_spec(pHddCtx, pReqMsg, tb)) |
| 4726 | goto fail; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4727 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4728 | context = &pHddCtx->ext_scan_context; |
| 4729 | spin_lock(&hdd_context_lock); |
| 4730 | INIT_COMPLETION(context->response_event); |
| 4731 | context->request_id = request_id = pReqMsg->requestId; |
| 4732 | spin_unlock(&hdd_context_lock); |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4733 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4734 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 4735 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4736 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4737 | FL("sme_EXTScanStart failed(err=%d)"), status); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4738 | goto fail; |
| 4739 | } |
| 4740 | |
Srinivas Dasari | 91727c1 | 2016-03-23 17:59:06 +0530 | [diff] [blame] | 4741 | pHddCtx->extscan_start_time_since_boot = vos_get_monotonic_boottime(); |
| 4742 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4743 | /* request was sent -- wait for the response */ |
| 4744 | rc = wait_for_completion_timeout(&context->response_event, |
| 4745 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 4746 | |
| 4747 | if (!rc) { |
| 4748 | hddLog(LOGE, FL("sme_ExtScanStart timed out")); |
| 4749 | retval = -ETIMEDOUT; |
| 4750 | } else { |
| 4751 | spin_lock(&hdd_context_lock); |
| 4752 | if (context->request_id == request_id) |
| 4753 | retval = context->response_status; |
| 4754 | else |
| 4755 | retval = -EINVAL; |
| 4756 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4757 | } |
| 4758 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4759 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4760 | EXIT(); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4761 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4762 | |
| 4763 | fail: |
| 4764 | vos_mem_free(pReqMsg); |
| 4765 | return -EINVAL; |
| 4766 | } |
| 4767 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4768 | /* |
| 4769 | * done with short names for the global vendor params |
| 4770 | * used by wlan_hdd_cfg80211_extscan_start() |
| 4771 | */ |
| 4772 | #undef PARAM_MAX |
| 4773 | #undef PARAM_REQUEST_ID |
| 4774 | #undef PARAM_BASE_PERIOD |
| 4775 | #undef PARAMS_MAX_AP_PER_SCAN |
| 4776 | #undef PARAMS_RPT_THRHLD_PERCENT |
| 4777 | #undef PARAMS_RPT_THRHLD_NUM_SCANS |
| 4778 | #undef PARAMS_NUM_BUCKETS |
| 4779 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4780 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 4781 | struct wireless_dev *wdev, |
| 4782 | const void *data, int dataLen) |
| 4783 | { |
| 4784 | int ret = 0; |
| 4785 | |
| 4786 | vos_ssr_protect(__func__); |
| 4787 | ret = __wlan_hdd_cfg80211_extscan_start(wiphy, wdev, data, dataLen); |
| 4788 | vos_ssr_unprotect(__func__); |
| 4789 | |
| 4790 | return ret; |
| 4791 | } |
| 4792 | |
| 4793 | static int __wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4794 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4795 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4796 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4797 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4798 | struct net_device *dev = wdev->netdev; |
| 4799 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4800 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4801 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4802 | eHalStatus status; |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4803 | int retval; |
| 4804 | unsigned long rc; |
| 4805 | struct hdd_ext_scan_context *context; |
| 4806 | tANI_U32 request_id; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4807 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4808 | ENTER(); |
| 4809 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4810 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4811 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4812 | return -EINVAL; |
| 4813 | } |
| 4814 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4815 | status = wlan_hdd_validate_context(pHddCtx); |
| 4816 | if (0 != status) |
| 4817 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4818 | return -EINVAL; |
| 4819 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4820 | /* check the EXTScan Capability */ |
| 4821 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4822 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4823 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4824 | { |
| 4825 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4826 | FL("EXTScan not enabled/supported by Firmware")); |
| 4827 | return -EINVAL; |
| 4828 | } |
| 4829 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4830 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4831 | data, dataLen, |
| 4832 | wlan_hdd_extscan_config_policy)) { |
| 4833 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4834 | return -EINVAL; |
| 4835 | } |
| 4836 | |
| 4837 | /* Parse and fetch request Id */ |
| 4838 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4839 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4840 | return -EINVAL; |
| 4841 | } |
| 4842 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4843 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4844 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4845 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4846 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4847 | reqMsg.sessionId = pAdapter->sessionId; |
| 4848 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4849 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4850 | context = &pHddCtx->ext_scan_context; |
| 4851 | spin_lock(&hdd_context_lock); |
| 4852 | INIT_COMPLETION(context->response_event); |
Sravanti Palakonda | 7539fb9 | 2016-02-26 17:49:21 +0530 | [diff] [blame] | 4853 | context->request_id = request_id = reqMsg.requestId; |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4854 | spin_unlock(&hdd_context_lock); |
| 4855 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4856 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4857 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4858 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4859 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4860 | return -EINVAL; |
| 4861 | } |
| 4862 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4863 | /* request was sent -- wait for the response */ |
| 4864 | rc = wait_for_completion_timeout(&context->response_event, |
| 4865 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 4866 | |
| 4867 | if (!rc) { |
| 4868 | hddLog(LOGE, FL("sme_ExtScanStop timed out")); |
| 4869 | retval = -ETIMEDOUT; |
| 4870 | } else { |
| 4871 | spin_lock(&hdd_context_lock); |
| 4872 | if (context->request_id == request_id) |
| 4873 | retval = context->response_status; |
| 4874 | else |
| 4875 | retval = -EINVAL; |
| 4876 | spin_unlock(&hdd_context_lock); |
| 4877 | } |
| 4878 | |
| 4879 | return retval; |
| 4880 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4881 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4882 | return 0; |
| 4883 | } |
| 4884 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4885 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 4886 | struct wireless_dev *wdev, |
| 4887 | const void *data, int dataLen) |
| 4888 | { |
| 4889 | int ret = 0; |
| 4890 | |
| 4891 | vos_ssr_protect(__func__); |
| 4892 | ret = __wlan_hdd_cfg80211_extscan_stop(wiphy, wdev, data, dataLen); |
| 4893 | vos_ssr_unprotect(__func__); |
| 4894 | |
| 4895 | return ret; |
| 4896 | } |
| 4897 | |
| 4898 | static int __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4899 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4900 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4901 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4902 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4903 | struct net_device *dev = wdev->netdev; |
| 4904 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4905 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4906 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4907 | eHalStatus status; |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4908 | struct hdd_ext_scan_context *context; |
| 4909 | tANI_U32 request_id; |
| 4910 | unsigned long rc; |
| 4911 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4912 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4913 | ENTER(); |
| 4914 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4915 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4916 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4917 | return -EINVAL; |
| 4918 | } |
| 4919 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4920 | status = wlan_hdd_validate_context(pHddCtx); |
| 4921 | if (0 != status) |
| 4922 | { |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4923 | hddLog(LOGE, FL("HDD context is not valid")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4924 | return -EINVAL; |
| 4925 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4926 | /* check the EXTScan Capability */ |
| 4927 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4928 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4929 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4930 | { |
| 4931 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4932 | FL("EXTScan not enabled/supported by Firmware")); |
| 4933 | return -EINVAL; |
| 4934 | } |
| 4935 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4936 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4937 | data, dataLen, |
| 4938 | wlan_hdd_extscan_config_policy)) { |
| 4939 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4940 | return -EINVAL; |
| 4941 | } |
| 4942 | |
| 4943 | /* Parse and fetch request Id */ |
| 4944 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4945 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4946 | return -EINVAL; |
| 4947 | } |
| 4948 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4949 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4950 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4951 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4952 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4953 | reqMsg.sessionId = pAdapter->sessionId; |
| 4954 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4955 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4956 | context = &pHddCtx->ext_scan_context; |
| 4957 | spin_lock(&hdd_context_lock); |
| 4958 | INIT_COMPLETION(context->response_event); |
| 4959 | context->request_id = request_id = reqMsg.requestId; |
| 4960 | spin_unlock(&hdd_context_lock); |
| 4961 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4962 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4963 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4964 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4965 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4966 | return -EINVAL; |
| 4967 | } |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4968 | |
| 4969 | /* request was sent -- wait for the response */ |
| 4970 | rc = wait_for_completion_timeout(&context->response_event, |
| 4971 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 4972 | if (!rc) { |
| 4973 | hddLog(LOGE, FL("sme_ResetBssHotlist timed out")); |
| 4974 | retval = -ETIMEDOUT; |
| 4975 | } else { |
| 4976 | spin_lock(&hdd_context_lock); |
| 4977 | if (context->request_id == request_id) |
| 4978 | retval = context->response_status; |
| 4979 | else |
| 4980 | retval = -EINVAL; |
| 4981 | spin_unlock(&hdd_context_lock); |
| 4982 | } |
| 4983 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4984 | EXIT(); |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4985 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4986 | } |
| 4987 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4988 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 4989 | struct wireless_dev *wdev, |
| 4990 | const void *data, int dataLen) |
| 4991 | { |
| 4992 | int ret = 0; |
| 4993 | |
| 4994 | vos_ssr_protect(__func__); |
| 4995 | ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev, data, dataLen); |
| 4996 | vos_ssr_unprotect(__func__); |
| 4997 | |
| 4998 | return ret; |
| 4999 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 5000 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 5001 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5002 | /*EXT TDLS*/ |
| 5003 | static const struct nla_policy |
| 5004 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 5005 | { |
| 5006 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 5007 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 5008 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 5009 | {.type = NLA_S32 }, |
| 5010 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 5011 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 5012 | |
| 5013 | }; |
| 5014 | |
| 5015 | static const struct nla_policy |
| 5016 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 5017 | { |
| 5018 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 5019 | |
| 5020 | }; |
| 5021 | |
| 5022 | static const struct nla_policy |
| 5023 | wlan_hdd_tdls_config_state_change_policy[ |
| 5024 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 5025 | { |
| 5026 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 5027 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 5028 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5029 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL] = {.type = NLA_S32 }, |
| 5030 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS] = |
| 5031 | {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5032 | |
| 5033 | }; |
| 5034 | |
| 5035 | static const struct nla_policy |
| 5036 | wlan_hdd_tdls_config_get_status_policy[ |
| 5037 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 5038 | { |
| 5039 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 5040 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 5041 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5042 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL] = {.type = NLA_S32 }, |
| 5043 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS] |
| 5044 | = {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5045 | |
| 5046 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5047 | |
| 5048 | static const struct nla_policy |
| 5049 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 5050 | { |
| 5051 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC }, |
| 5052 | }; |
| 5053 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5054 | static int __wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5055 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5056 | const void *data, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5057 | int data_len) |
| 5058 | { |
| 5059 | |
| 5060 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5061 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 5062 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5063 | ENTER(); |
| 5064 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5065 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5066 | return -EINVAL; |
| 5067 | } |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 5068 | if (0 == pHddCtx->cfg_ini->enableMacSpoofing) { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 5069 | hddLog(VOS_TRACE_LEVEL_INFO, FL("MAC_SPOOFED_SCAN disabled in ini")); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5070 | return -ENOTSUPP; |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5071 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5072 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 5073 | 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] | 5074 | return -ENOTSUPP; |
| 5075 | } |
| 5076 | |
| 5077 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 5078 | data, data_len, wlan_hdd_mac_config)) { |
| 5079 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5080 | return -EINVAL; |
| 5081 | } |
| 5082 | |
| 5083 | /* Parse and fetch mac address */ |
| 5084 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 5085 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5086 | return -EINVAL; |
| 5087 | } |
| 5088 | |
| 5089 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 5090 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 5091 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 5092 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5093 | pHddCtx->spoofMacAddr.isEnabled = TRUE; |
| 5094 | |
| 5095 | 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] | 5096 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 5097 | VOS_MAC_ADDR_FIRST_3_BYTES); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5098 | if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) && |
| 5099 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) && |
| 5100 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0)) |
| 5101 | { |
| 5102 | hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing")); |
| 5103 | vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 5104 | VOS_MAC_ADDRESS_LEN); |
| 5105 | pHddCtx->spoofMacAddr.isEnabled = FALSE; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5106 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5107 | |
Padma, Santhosh Kumar | db2d75b | 2015-11-17 12:18:10 +0530 | [diff] [blame] | 5108 | schedule_delayed_work(&pHddCtx->spoof_mac_addr_work, |
| 5109 | msecs_to_jiffies(MAC_ADDR_SPOOFING_DEFER_INTERVAL)); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5110 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5111 | EXIT(); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5112 | return 0; |
| 5113 | } |
| 5114 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5115 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 5116 | struct wireless_dev *wdev, |
| 5117 | const void *data, |
| 5118 | int data_len) |
| 5119 | { |
| 5120 | int ret = 0; |
| 5121 | |
| 5122 | vos_ssr_protect(__func__); |
| 5123 | ret = __wlan_hdd_cfg80211_set_spoofed_mac_oui(wiphy, wdev, data, data_len); |
| 5124 | vos_ssr_unprotect(__func__); |
| 5125 | |
| 5126 | return ret; |
| 5127 | } |
| 5128 | |
| 5129 | static int __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5130 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5131 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5132 | int data_len) |
| 5133 | { |
| 5134 | u8 peer[6] = {0}; |
| 5135 | struct net_device *dev = wdev->netdev; |
| 5136 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5137 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5138 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 5139 | eHalStatus ret; |
| 5140 | tANI_S32 state; |
| 5141 | tANI_S32 reason; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5142 | tANI_S32 global_operating_class = 0; |
| 5143 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5144 | struct sk_buff *skb = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5145 | int retVal; |
| 5146 | |
| 5147 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5148 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5149 | if (!pAdapter) { |
| 5150 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5151 | return -EINVAL; |
| 5152 | } |
| 5153 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5154 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5155 | if (0 != ret) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5156 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5157 | return -EINVAL; |
| 5158 | } |
| 5159 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5160 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5161 | return -ENOTSUPP; |
| 5162 | } |
| 5163 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 5164 | data, data_len, |
| 5165 | wlan_hdd_tdls_config_get_status_policy)) { |
| 5166 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5167 | return -EINVAL; |
| 5168 | } |
| 5169 | |
| 5170 | /* Parse and fetch mac address */ |
| 5171 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 5172 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5173 | return -EINVAL; |
| 5174 | } |
| 5175 | |
| 5176 | memcpy(peer, nla_data( |
| 5177 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 5178 | sizeof(peer)); |
| 5179 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5180 | |
Konamki, Sreelakshmi | abb59ed | 2015-06-12 12:13:23 +0530 | [diff] [blame] | 5181 | wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5182 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5183 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5184 | 4 * sizeof(s32) + |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5185 | NLMSG_HDRLEN); |
| 5186 | |
| 5187 | if (!skb) { |
| 5188 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5189 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 5190 | return -EINVAL; |
| 5191 | } |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5192 | 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] | 5193 | reason, |
| 5194 | state, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5195 | global_operating_class, |
| 5196 | channel, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5197 | MAC_ADDR_ARRAY(peer)); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5198 | if (nla_put_s32(skb, |
| 5199 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, |
| 5200 | state) || |
| 5201 | nla_put_s32(skb, |
| 5202 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, |
| 5203 | reason) || |
| 5204 | nla_put_s32(skb, |
| 5205 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, |
| 5206 | global_operating_class) || |
| 5207 | nla_put_s32(skb, |
| 5208 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, |
| 5209 | channel)) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5210 | |
| 5211 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 5212 | goto nla_put_failure; |
| 5213 | } |
| 5214 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5215 | retVal = cfg80211_vendor_cmd_reply(skb); |
| 5216 | EXIT(); |
| 5217 | return retVal; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5218 | |
| 5219 | nla_put_failure: |
| 5220 | kfree_skb(skb); |
| 5221 | return -EINVAL; |
| 5222 | } |
| 5223 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5224 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 5225 | struct wireless_dev *wdev, |
| 5226 | const void *data, |
| 5227 | int data_len) |
| 5228 | { |
| 5229 | int ret = 0; |
| 5230 | |
| 5231 | vos_ssr_protect(__func__); |
| 5232 | ret = __wlan_hdd_cfg80211_exttdls_get_status(wiphy, wdev, data, data_len); |
| 5233 | vos_ssr_unprotect(__func__); |
| 5234 | |
| 5235 | return ret; |
| 5236 | } |
| 5237 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 5238 | static int wlan_hdd_cfg80211_exttdls_callback( |
| 5239 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 5240 | const tANI_U8* mac, |
| 5241 | #else |
| 5242 | tANI_U8* mac, |
| 5243 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5244 | tANI_S32 state, |
| 5245 | tANI_S32 reason, |
| 5246 | void *ctx) |
| 5247 | { |
| 5248 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5249 | struct sk_buff *skb = NULL; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5250 | tANI_S32 global_operating_class = 0; |
| 5251 | tANI_S32 channel = 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5252 | hdd_context_t *pHddCtx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5253 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5254 | ENTER(); |
| 5255 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5256 | if (!pAdapter) { |
| 5257 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5258 | return -EINVAL; |
| 5259 | } |
| 5260 | |
| 5261 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5262 | if (wlan_hdd_validate_context(pHddCtx)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5263 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5264 | return -EINVAL; |
| 5265 | } |
| 5266 | |
| 5267 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5268 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5269 | return -ENOTSUPP; |
| 5270 | } |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 5271 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 5272 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 5273 | NULL, |
| 5274 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5275 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 5276 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 5277 | GFP_KERNEL); |
| 5278 | |
| 5279 | if (!skb) { |
| 5280 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5281 | FL("cfg80211_vendor_event_alloc failed")); |
| 5282 | return -EINVAL; |
| 5283 | } |
| 5284 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5285 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason: (%d) Status: (%d) Class: (%d) Channel: (%d)", |
| 5286 | reason, |
| 5287 | state, |
| 5288 | global_operating_class, |
| 5289 | channel); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5290 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 5291 | MAC_ADDR_ARRAY(mac)); |
| 5292 | |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5293 | if (nla_put(skb, |
| 5294 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 5295 | VOS_MAC_ADDR_SIZE, mac) || |
| 5296 | nla_put_s32(skb, |
| 5297 | QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, |
| 5298 | state) || |
| 5299 | nla_put_s32(skb, |
| 5300 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, |
| 5301 | reason) || |
| 5302 | nla_put_s32(skb, |
| 5303 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, |
| 5304 | channel) || |
| 5305 | nla_put_s32(skb, |
| 5306 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, |
| 5307 | global_operating_class) |
| 5308 | ) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5309 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 5310 | goto nla_put_failure; |
| 5311 | } |
| 5312 | |
| 5313 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5314 | EXIT(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5315 | return (0); |
| 5316 | |
| 5317 | nla_put_failure: |
| 5318 | kfree_skb(skb); |
| 5319 | return -EINVAL; |
| 5320 | } |
| 5321 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5322 | static int __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5323 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5324 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5325 | int data_len) |
| 5326 | { |
| 5327 | u8 peer[6] = {0}; |
| 5328 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5329 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5330 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 5331 | eHalStatus status; |
| 5332 | tdls_req_params_t pReqMsg = {0}; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5333 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5334 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5335 | |
| 5336 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5337 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5338 | if (!dev) { |
| 5339 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 5340 | return -EINVAL; |
| 5341 | } |
| 5342 | |
| 5343 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5344 | if (!pAdapter) { |
| 5345 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5346 | return -EINVAL; |
| 5347 | } |
| 5348 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5349 | status = wlan_hdd_validate_context(pHddCtx); |
| 5350 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5351 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5352 | return -EINVAL; |
| 5353 | } |
| 5354 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5355 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5356 | return -ENOTSUPP; |
| 5357 | } |
| 5358 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 5359 | data, data_len, |
| 5360 | wlan_hdd_tdls_config_enable_policy)) { |
| 5361 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5362 | return -EINVAL; |
| 5363 | } |
| 5364 | |
| 5365 | /* Parse and fetch mac address */ |
| 5366 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 5367 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5368 | return -EINVAL; |
| 5369 | } |
| 5370 | |
| 5371 | memcpy(peer, nla_data( |
| 5372 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 5373 | sizeof(peer)); |
| 5374 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5375 | |
| 5376 | /* Parse and fetch channel */ |
| 5377 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 5378 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 5379 | return -EINVAL; |
| 5380 | } |
| 5381 | pReqMsg.channel = nla_get_s32( |
| 5382 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 5383 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 5384 | |
| 5385 | /* Parse and fetch global operating class */ |
| 5386 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 5387 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 5388 | return -EINVAL; |
| 5389 | } |
| 5390 | pReqMsg.global_operating_class = nla_get_s32( |
| 5391 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 5392 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 5393 | pReqMsg.global_operating_class); |
| 5394 | |
| 5395 | /* Parse and fetch latency ms */ |
| 5396 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 5397 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 5398 | return -EINVAL; |
| 5399 | } |
| 5400 | pReqMsg.max_latency_ms = nla_get_s32( |
| 5401 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 5402 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 5403 | pReqMsg.max_latency_ms); |
| 5404 | |
| 5405 | /* Parse and fetch required bandwidth kbps */ |
| 5406 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 5407 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 5408 | return -EINVAL; |
| 5409 | } |
| 5410 | |
| 5411 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 5412 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 5413 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 5414 | pReqMsg.min_bandwidth_kbps); |
| 5415 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5416 | ret = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5417 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 5418 | &pReqMsg, |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5419 | wlan_hdd_cfg80211_exttdls_callback); |
| 5420 | |
| 5421 | EXIT(); |
| 5422 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5423 | } |
| 5424 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5425 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 5426 | struct wireless_dev *wdev, |
| 5427 | const void *data, |
| 5428 | int data_len) |
| 5429 | { |
| 5430 | int ret = 0; |
| 5431 | |
| 5432 | vos_ssr_protect(__func__); |
| 5433 | ret = __wlan_hdd_cfg80211_exttdls_enable(wiphy, wdev, data, data_len); |
| 5434 | vos_ssr_unprotect(__func__); |
| 5435 | |
| 5436 | return ret; |
| 5437 | } |
| 5438 | |
| 5439 | static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5440 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5441 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5442 | int data_len) |
| 5443 | { |
| 5444 | u8 peer[6] = {0}; |
| 5445 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5446 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5447 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 5448 | eHalStatus status; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5449 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5450 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5451 | |
| 5452 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5453 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5454 | if (!dev) { |
| 5455 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 5456 | return -EINVAL; |
| 5457 | } |
| 5458 | |
| 5459 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5460 | if (!pAdapter) { |
| 5461 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 5462 | return -EINVAL; |
| 5463 | } |
| 5464 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5465 | status = wlan_hdd_validate_context(pHddCtx); |
| 5466 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5467 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5468 | return -EINVAL; |
| 5469 | } |
| 5470 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5471 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5472 | return -ENOTSUPP; |
| 5473 | } |
| 5474 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 5475 | data, data_len, |
| 5476 | wlan_hdd_tdls_config_disable_policy)) { |
| 5477 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5478 | return -EINVAL; |
| 5479 | } |
| 5480 | /* Parse and fetch mac address */ |
| 5481 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 5482 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5483 | return -EINVAL; |
| 5484 | } |
| 5485 | |
| 5486 | memcpy(peer, nla_data( |
| 5487 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 5488 | sizeof(peer)); |
| 5489 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5490 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5491 | ret = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
| 5492 | |
| 5493 | EXIT(); |
| 5494 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5495 | } |
| 5496 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5497 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 5498 | struct wireless_dev *wdev, |
| 5499 | const void *data, |
| 5500 | int data_len) |
| 5501 | { |
| 5502 | int ret = 0; |
| 5503 | |
| 5504 | vos_ssr_protect(__func__); |
| 5505 | ret = __wlan_hdd_cfg80211_exttdls_disable(wiphy, wdev, data, data_len); |
| 5506 | vos_ssr_unprotect(__func__); |
| 5507 | |
| 5508 | return ret; |
| 5509 | } |
| 5510 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5511 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5512 | __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5513 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5514 | const void *data, int data_len) |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5515 | { |
| 5516 | struct net_device *dev = wdev->netdev; |
| 5517 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5518 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5519 | struct sk_buff *skb = NULL; |
| 5520 | tANI_U32 fset = 0; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5521 | int ret = 0; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5522 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5523 | ENTER(); |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5524 | |
| 5525 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5526 | if (0 != ret) |
| 5527 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5528 | return ret; |
| 5529 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5530 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 5531 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 5532 | fset |= WIFI_FEATURE_INFRA; |
| 5533 | } |
| 5534 | |
| 5535 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 5536 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 5537 | fset |= WIFI_FEATURE_INFRA_5G; |
| 5538 | } |
| 5539 | |
| 5540 | #ifdef WLAN_FEATURE_P2P |
| 5541 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 5542 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 5543 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 5544 | fset |= WIFI_FEATURE_P2P; |
| 5545 | } |
| 5546 | #endif |
| 5547 | |
| 5548 | /* Soft-AP is supported currently by default */ |
| 5549 | fset |= WIFI_FEATURE_SOFT_AP; |
| 5550 | |
Kanchanapally, Vidyullatha | 683aed0 | 2015-03-24 16:58:38 +0530 | [diff] [blame] | 5551 | /* HOTSPOT is a supplicant feature, enable it by default */ |
| 5552 | fset |= WIFI_FEATURE_HOTSPOT; |
| 5553 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5554 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5555 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 5556 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN) && |
| 5557 | sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)) { |
| 5558 | hddLog(LOG1, FL("Enhanced EXTScan is supported by firmware")); |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5559 | fset |= WIFI_FEATURE_EXTSCAN; |
| 5560 | } |
| 5561 | #endif |
| 5562 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5563 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 5564 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 5565 | fset |= WIFI_FEATURE_NAN; |
| 5566 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5567 | |
| 5568 | /* D2D RTT is not supported currently by default */ |
| 5569 | if (sme_IsFeatureSupportedByFW(RTT)) { |
| 5570 | hddLog(LOG1, FL("RTT is supported by firmware")); |
| 5571 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 5572 | } |
| 5573 | |
Padma, Santhosh Kumar | aac4c4d | 2015-12-08 16:07:47 +0530 | [diff] [blame] | 5574 | if (sme_IsFeatureSupportedByFW(RTT3)) { |
| 5575 | hddLog(LOG1, FL("RTT3 is supported by firmware")); |
| 5576 | fset |= WIFI_FEATURE_RTT3; |
| 5577 | } |
| 5578 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5579 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 5580 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 5581 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 5582 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 5583 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 5584 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 5585 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 5586 | } |
| 5587 | #endif |
| 5588 | |
| 5589 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 5590 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 5591 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 5592 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 5593 | fset |= WIFI_FEATURE_PNO; |
| 5594 | } |
| 5595 | #endif |
| 5596 | |
| 5597 | /* STA+STA is supported currently by default */ |
| 5598 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 5599 | |
| 5600 | #ifdef FEATURE_WLAN_TDLS |
| 5601 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 5602 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 5603 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 5604 | fset |= WIFI_FEATURE_TDLS; |
| 5605 | } |
| 5606 | |
| 5607 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 5608 | #endif |
| 5609 | |
| 5610 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 5611 | /* AP+STA concurrency is supported currently by default */ |
| 5612 | fset |= WIFI_FEATURE_AP_STA; |
| 5613 | #endif |
| 5614 | |
Mukul Sharma | 5add053 | 2015-08-17 15:57:47 +0530 | [diff] [blame] | 5615 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5616 | fset |= WIFI_FEATURE_LINK_LAYER_STATS; |
| 5617 | hddLog(LOG1, FL("Link layer stats is supported by driver")); |
| 5618 | #endif |
| 5619 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5620 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 5621 | NLMSG_HDRLEN); |
| 5622 | |
| 5623 | if (!skb) { |
| 5624 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 5625 | return -EINVAL; |
| 5626 | } |
| 5627 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 5628 | |
| 5629 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 5630 | hddLog(LOGE, FL("nla put fail")); |
| 5631 | goto nla_put_failure; |
| 5632 | } |
| 5633 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5634 | ret = cfg80211_vendor_cmd_reply(skb); |
| 5635 | EXIT(); |
| 5636 | return ret; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5637 | |
| 5638 | nla_put_failure: |
| 5639 | kfree_skb(skb); |
| 5640 | return -EINVAL; |
| 5641 | } |
| 5642 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5643 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5644 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 5645 | struct wireless_dev *wdev, |
| 5646 | const void *data, int data_len) |
| 5647 | { |
| 5648 | int ret = 0; |
| 5649 | |
| 5650 | vos_ssr_protect(__func__); |
| 5651 | ret = __wlan_hdd_cfg80211_get_supported_features(wiphy, wdev, data, data_len); |
| 5652 | vos_ssr_unprotect(__func__); |
| 5653 | |
| 5654 | return ret; |
| 5655 | } |
| 5656 | |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 5657 | |
| 5658 | static const struct |
| 5659 | nla_policy |
| 5660 | qca_wlan_vendor_wifi_logger_get_ring_data_policy |
| 5661 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1] = { |
| 5662 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID] |
| 5663 | = {.type = NLA_U32 }, |
| 5664 | }; |
| 5665 | |
| 5666 | static int |
| 5667 | __wlan_hdd_cfg80211_wifi_logger_get_ring_data(struct wiphy *wiphy, |
| 5668 | struct wireless_dev *wdev, |
| 5669 | const void *data, |
| 5670 | int data_len) |
| 5671 | { |
| 5672 | int ret; |
| 5673 | VOS_STATUS status; |
| 5674 | uint32_t ring_id; |
| 5675 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 5676 | struct nlattr *tb |
| 5677 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1]; |
| 5678 | |
| 5679 | ENTER(); |
| 5680 | |
| 5681 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5682 | if (0 != ret) { |
| 5683 | return ret; |
| 5684 | } |
| 5685 | |
| 5686 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX, |
| 5687 | data, data_len, |
| 5688 | qca_wlan_vendor_wifi_logger_get_ring_data_policy)) { |
| 5689 | hddLog(LOGE, FL("Invalid attribute")); |
| 5690 | return -EINVAL; |
| 5691 | } |
| 5692 | |
| 5693 | /* Parse and fetch ring id */ |
| 5694 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]) { |
| 5695 | hddLog(LOGE, FL("attr ATTR failed")); |
| 5696 | return -EINVAL; |
| 5697 | } |
| 5698 | |
| 5699 | ring_id = nla_get_u32( |
| 5700 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]); |
| 5701 | |
| 5702 | hddLog(LOG1, FL("Bug report triggered by framework")); |
| 5703 | |
| 5704 | status = vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL, |
| 5705 | WLAN_LOG_INDICATOR_FRAMEWORK, |
| 5706 | WLAN_LOG_REASON_CODE_FRAMEWORK, |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 5707 | TRUE, TRUE |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 5708 | ); |
| 5709 | if (VOS_STATUS_SUCCESS != status) { |
| 5710 | hddLog(LOGE, FL("Failed to trigger bug report")); |
| 5711 | |
| 5712 | return -EINVAL; |
| 5713 | } |
| 5714 | |
| 5715 | return 0; |
| 5716 | |
| 5717 | |
| 5718 | } |
| 5719 | |
| 5720 | |
| 5721 | static int |
| 5722 | wlan_hdd_cfg80211_wifi_logger_get_ring_data(struct wiphy *wiphy, |
| 5723 | struct wireless_dev *wdev, |
| 5724 | const void *data, |
| 5725 | int data_len) |
| 5726 | { |
| 5727 | int ret = 0; |
| 5728 | |
| 5729 | vos_ssr_protect(__func__); |
| 5730 | ret = __wlan_hdd_cfg80211_wifi_logger_get_ring_data(wiphy, |
| 5731 | wdev, data, data_len); |
| 5732 | vos_ssr_unprotect(__func__); |
| 5733 | |
| 5734 | return ret; |
| 5735 | |
| 5736 | } |
| 5737 | |
| 5738 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5739 | static int |
| 5740 | __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5741 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5742 | const void *data, int data_len) |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5743 | { |
| 5744 | uint32_t feature_set_matrix[WLAN_HDD_MAX_FEATURE_SET] = {0}; |
| 5745 | uint8_t i, feature_sets, max_feature_sets; |
| 5746 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1]; |
| 5747 | struct sk_buff *reply_skb; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5748 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5749 | int ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5750 | |
| 5751 | ENTER(); |
| 5752 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5753 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5754 | if (0 != ret) |
| 5755 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5756 | return ret; |
| 5757 | } |
| 5758 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5759 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX, |
| 5760 | data, data_len, NULL)) { |
| 5761 | hddLog(LOGE, FL("Invalid ATTR")); |
| 5762 | return -EINVAL; |
| 5763 | } |
| 5764 | |
| 5765 | /* Parse and fetch max feature set */ |
| 5766 | if (!tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]) { |
| 5767 | hddLog(LOGE, FL("Attr max feature set size failed")); |
| 5768 | return -EINVAL; |
| 5769 | } |
| 5770 | max_feature_sets = nla_get_u32( |
| 5771 | tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]); |
| 5772 | hddLog(LOG1, FL("Max feature set size (%d)"), max_feature_sets); |
| 5773 | |
| 5774 | /* Fill feature combination matrix */ |
| 5775 | feature_sets = 0; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5776 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5777 | WIFI_FEATURE_P2P; |
| 5778 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5779 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5780 | WIFI_FEATURE_SOFT_AP; |
| 5781 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5782 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P | |
| 5783 | WIFI_FEATURE_SOFT_AP; |
| 5784 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5785 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5786 | WIFI_FEATURE_SOFT_AP | |
| 5787 | WIFI_FEATURE_P2P; |
| 5788 | |
| 5789 | /* Add more feature combinations here */ |
| 5790 | |
| 5791 | feature_sets = VOS_MIN(feature_sets, max_feature_sets); |
| 5792 | hddLog(LOG1, FL("Number of feature sets (%d)"), feature_sets); |
| 5793 | hddLog(LOG1, "Feature set matrix"); |
| 5794 | for (i = 0; i < feature_sets; i++) |
| 5795 | hddLog(LOG1, "[%d] 0x%02X", i, feature_set_matrix[i]); |
| 5796 | |
| 5797 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 5798 | sizeof(u32) * feature_sets + |
| 5799 | NLMSG_HDRLEN); |
| 5800 | |
| 5801 | if (reply_skb) { |
| 5802 | if (nla_put_u32(reply_skb, |
| 5803 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE, |
| 5804 | feature_sets) || |
| 5805 | nla_put(reply_skb, |
| 5806 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET, |
| 5807 | sizeof(u32) * feature_sets, feature_set_matrix)) { |
| 5808 | hddLog(LOGE, FL("nla put fail")); |
| 5809 | kfree_skb(reply_skb); |
| 5810 | return -EINVAL; |
| 5811 | } |
| 5812 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5813 | ret = cfg80211_vendor_cmd_reply(reply_skb); |
| 5814 | EXIT(); |
| 5815 | return ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5816 | } |
| 5817 | hddLog(LOGE, FL("Feature set matrix: buffer alloc fail")); |
| 5818 | return -ENOMEM; |
| 5819 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5820 | } |
| 5821 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5822 | static int |
| 5823 | wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
| 5824 | struct wireless_dev *wdev, |
| 5825 | const void *data, int data_len) |
| 5826 | { |
| 5827 | int ret = 0; |
| 5828 | |
| 5829 | vos_ssr_protect(__func__); |
| 5830 | ret = __wlan_hdd_cfg80211_get_concurrency_matrix(wiphy, wdev, data, |
| 5831 | data_len); |
| 5832 | vos_ssr_unprotect(__func__); |
| 5833 | |
| 5834 | return ret; |
| 5835 | } |
| 5836 | |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5837 | |
| 5838 | static int |
| 5839 | __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy, |
| 5840 | struct wireless_dev *wdev, |
| 5841 | const void *data, int data_len) |
| 5842 | { |
| 5843 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5844 | int ret; |
| 5845 | ENTER(); |
| 5846 | |
| 5847 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5848 | if (0 != ret) |
| 5849 | { |
| 5850 | return ret; |
| 5851 | } |
| 5852 | |
| 5853 | if( !pHddCtx->cfg_ini->enableFwrMemDump || |
| 5854 | (FALSE == sme_IsFeatureSupportedByFW(MEMORY_DUMP_SUPPORTED))) |
| 5855 | { |
| 5856 | hddLog(VOS_TRACE_LEVEL_INFO, FL("FW dump Logging not supported")); |
| 5857 | return -EINVAL; |
| 5858 | } |
| 5859 | /*call common API for FW mem dump req*/ |
| 5860 | ret = wlan_hdd_fw_mem_dump_req(pHddCtx); |
| 5861 | |
Abhishek Singh | c783fa7 | 2015-12-09 18:07:34 +0530 | [diff] [blame] | 5862 | if (!ret) |
c_manjee | 04b4c5c | 2015-10-13 18:35:01 +0530 | [diff] [blame] | 5863 | { |
| 5864 | /*indicate to userspace the status of fw mem dump */ |
| 5865 | wlan_indicate_mem_dump_complete(true); |
| 5866 | } |
| 5867 | else |
| 5868 | { |
| 5869 | /*else send failure to userspace */ |
| 5870 | wlan_indicate_mem_dump_complete(false); |
| 5871 | } |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5872 | EXIT(); |
| 5873 | return ret; |
| 5874 | } |
| 5875 | |
| 5876 | /** |
| 5877 | * wlan_hdd_cfg80211_get_fw_mem_dump() - Get FW memory dump |
| 5878 | * @wiphy: pointer to wireless wiphy structure. |
| 5879 | * @wdev: pointer to wireless_dev structure. |
| 5880 | * @data: Pointer to the NL data. |
| 5881 | * @data_len:Length of @data |
| 5882 | * |
| 5883 | * This is called when wlan driver needs to get the firmware memory dump |
| 5884 | * via vendor specific command. |
| 5885 | * |
| 5886 | * Return: 0 on success, error number otherwise. |
| 5887 | */ |
| 5888 | |
| 5889 | static int |
| 5890 | wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy, |
| 5891 | struct wireless_dev *wdev, |
| 5892 | const void *data, int data_len) |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5893 | { |
| 5894 | int ret = 0; |
| 5895 | vos_ssr_protect(__func__); |
| 5896 | ret = __wlan_hdd_cfg80211_get_fw_mem_dump(wiphy, wdev, data, |
| 5897 | data_len); |
| 5898 | vos_ssr_unprotect(__func__); |
| 5899 | return ret; |
| 5900 | } |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5901 | |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5902 | static const struct |
| 5903 | nla_policy |
| 5904 | qca_wlan_vendor_wifi_logger_start_policy |
| 5905 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1] = { |
| 5906 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID] |
| 5907 | = {.type = NLA_U32 }, |
| 5908 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL] |
| 5909 | = {.type = NLA_U32 }, |
| 5910 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS] |
| 5911 | = {.type = NLA_U32 }, |
| 5912 | }; |
| 5913 | |
| 5914 | /** |
| 5915 | * __wlan_hdd_cfg80211_wifi_logger_start() - This function is used to enable |
| 5916 | * or disable the collection of packet statistics from the firmware |
| 5917 | * @wiphy: WIPHY structure pointer |
| 5918 | * @wdev: Wireless device structure pointer |
| 5919 | * @data: Pointer to the data received |
| 5920 | * @data_len: Length of the data received |
| 5921 | * |
| 5922 | * This function is used to enable or disable the collection of packet |
| 5923 | * statistics from the firmware |
| 5924 | * |
| 5925 | * Return: 0 on success and errno on failure |
| 5926 | */ |
| 5927 | static int __wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy, |
| 5928 | struct wireless_dev *wdev, |
| 5929 | const void *data, |
| 5930 | int data_len) |
| 5931 | { |
| 5932 | eHalStatus status; |
| 5933 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 5934 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1]; |
| 5935 | tAniWifiStartLog start_log; |
| 5936 | |
| 5937 | status = wlan_hdd_validate_context(hdd_ctx); |
| 5938 | if (0 != status) { |
| 5939 | return -EINVAL; |
| 5940 | } |
| 5941 | |
| 5942 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX, |
| 5943 | data, data_len, |
| 5944 | qca_wlan_vendor_wifi_logger_start_policy)) { |
| 5945 | hddLog(LOGE, FL("Invalid attribute")); |
| 5946 | return -EINVAL; |
| 5947 | } |
| 5948 | |
| 5949 | /* Parse and fetch ring id */ |
| 5950 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]) { |
| 5951 | hddLog(LOGE, FL("attr ATTR failed")); |
| 5952 | return -EINVAL; |
| 5953 | } |
| 5954 | start_log.ringId = nla_get_u32( |
| 5955 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]); |
| 5956 | hddLog(LOG1, FL("Ring ID=%d"), start_log.ringId); |
| 5957 | |
| 5958 | /* Parse and fetch verbose level */ |
| 5959 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]) { |
| 5960 | hddLog(LOGE, FL("attr verbose_level failed")); |
| 5961 | return -EINVAL; |
| 5962 | } |
| 5963 | start_log.verboseLevel = nla_get_u32( |
| 5964 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]); |
| 5965 | hddLog(LOG1, FL("verbose_level=%d"), start_log.verboseLevel); |
| 5966 | |
| 5967 | /* Parse and fetch flag */ |
| 5968 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]) { |
| 5969 | hddLog(LOGE, FL("attr flag failed")); |
| 5970 | return -EINVAL; |
| 5971 | } |
| 5972 | start_log.flag = nla_get_u32( |
| 5973 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]); |
| 5974 | hddLog(LOG1, FL("flag=%d"), start_log.flag); |
| 5975 | |
| 5976 | if ((RING_ID_PER_PACKET_STATS == start_log.ringId) && |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 5977 | (!hdd_ctx->cfg_ini->wlanPerPktStatsLogEnable || |
| 5978 | !vos_isPktStatsEnabled())) |
| 5979 | |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5980 | { |
| 5981 | hddLog(LOGE, FL("per pkt stats not enabled")); |
| 5982 | return -EINVAL; |
| 5983 | } |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5984 | |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 5985 | vos_set_ring_log_level(start_log.ringId, start_log.verboseLevel); |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5986 | return 0; |
| 5987 | } |
| 5988 | |
| 5989 | /** |
| 5990 | * wlan_hdd_cfg80211_wifi_logger_start() - Wrapper function used to enable |
| 5991 | * or disable the collection of packet statistics from the firmware |
| 5992 | * @wiphy: WIPHY structure pointer |
| 5993 | * @wdev: Wireless device structure pointer |
| 5994 | * @data: Pointer to the data received |
| 5995 | * @data_len: Length of the data received |
| 5996 | * |
| 5997 | * This function is used to enable or disable the collection of packet |
| 5998 | * statistics from the firmware |
| 5999 | * |
| 6000 | * Return: 0 on success and errno on failure |
| 6001 | */ |
| 6002 | static int wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy, |
| 6003 | struct wireless_dev *wdev, |
| 6004 | const void *data, |
| 6005 | int data_len) |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6006 | { |
| 6007 | int ret = 0; |
| 6008 | |
| 6009 | vos_ssr_protect(__func__); |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 6010 | |
| 6011 | ret = __wlan_hdd_cfg80211_wifi_logger_start(wiphy, |
| 6012 | wdev, data, data_len); |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6013 | vos_ssr_unprotect(__func__); |
| 6014 | |
| 6015 | return ret; |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 6016 | } |
| 6017 | |
| 6018 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6019 | static const struct nla_policy |
| 6020 | wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX |
| 6021 | +1] = |
| 6022 | { |
| 6023 | [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 }, |
| 6024 | }; |
| 6025 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6026 | static int __wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6027 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 6028 | const void *data, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6029 | int data_len) |
| 6030 | { |
| 6031 | struct net_device *dev = wdev->netdev; |
| 6032 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6033 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6034 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6035 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; |
| 6036 | eHalStatus status; |
| 6037 | u32 dfsFlag = 0; |
| 6038 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6039 | ENTER(); |
| 6040 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6041 | status = wlan_hdd_validate_context(pHddCtx); |
| 6042 | if (0 != status) { |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6043 | return -EINVAL; |
| 6044 | } |
| 6045 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX, |
| 6046 | data, data_len, |
| 6047 | wlan_hdd_set_no_dfs_flag_config_policy)) { |
| 6048 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 6049 | return -EINVAL; |
| 6050 | } |
| 6051 | |
| 6052 | /* Parse and fetch required bandwidth kbps */ |
| 6053 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]) { |
| 6054 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dfs flag failed")); |
| 6055 | return -EINVAL; |
| 6056 | } |
| 6057 | |
| 6058 | dfsFlag = nla_get_u32( |
| 6059 | tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]); |
| 6060 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" DFS flag (%d)"), |
| 6061 | dfsFlag); |
| 6062 | |
| 6063 | pHddCtx->disable_dfs_flag = dfsFlag; |
| 6064 | |
| 6065 | sme_disable_dfs_channel(hHal, dfsFlag); |
| 6066 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6067 | |
| 6068 | EXIT(); |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6069 | return 0; |
| 6070 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 6071 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6072 | static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
| 6073 | struct wireless_dev *wdev, |
| 6074 | const void *data, |
| 6075 | int data_len) |
| 6076 | { |
| 6077 | int ret = 0; |
| 6078 | |
| 6079 | vos_ssr_protect(__func__); |
| 6080 | ret = __wlan_hdd_cfg80211_disable_dfs_channels(wiphy, wdev, data, data_len); |
| 6081 | vos_ssr_unprotect(__func__); |
| 6082 | |
| 6083 | return ret; |
| 6084 | |
| 6085 | } |
| 6086 | |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6087 | const struct |
| 6088 | nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = |
| 6089 | { |
| 6090 | [QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = { .type = NLA_U32 }, |
| 6091 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 6092 | }; |
| 6093 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6094 | static int __wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 6095 | struct wireless_dev *wdev, const void *data, int data_len) |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6096 | { |
| 6097 | |
| 6098 | u8 bssid[6] = {0}; |
| 6099 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6100 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 6101 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6102 | v_U32_t isFwrRoamEnabled = FALSE; |
| 6103 | int ret; |
| 6104 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6105 | ENTER(); |
| 6106 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6107 | ret = wlan_hdd_validate_context(pHddCtx); |
| 6108 | if (0 != ret) { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6109 | return ret; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6110 | } |
| 6111 | |
| 6112 | ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, |
| 6113 | data, data_len, |
| 6114 | qca_wlan_vendor_attr); |
| 6115 | if (ret){ |
| 6116 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 6117 | return -EINVAL; |
| 6118 | } |
| 6119 | |
| 6120 | /* Parse and fetch Enable flag */ |
| 6121 | if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) { |
| 6122 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr enable failed")); |
| 6123 | return -EINVAL; |
| 6124 | } |
| 6125 | |
| 6126 | isFwrRoamEnabled = nla_get_u32( |
| 6127 | tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]); |
| 6128 | |
| 6129 | hddLog(VOS_TRACE_LEVEL_INFO, FL("isFwrRoamEnabled (%d)"), isFwrRoamEnabled); |
| 6130 | |
| 6131 | /* Parse and fetch bssid */ |
| 6132 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 6133 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bss id failed")); |
| 6134 | return -EINVAL; |
| 6135 | } |
| 6136 | |
| 6137 | memcpy(bssid, nla_data( |
| 6138 | tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 6139 | sizeof(bssid)); |
| 6140 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(bssid)); |
| 6141 | |
| 6142 | //Update roaming |
| 6143 | status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled); |
Abhishek Singh | c6ab38f | 2016-06-28 17:48:16 +0530 | [diff] [blame] | 6144 | if (!HAL_STATUS_SUCCESS(status)) { |
| 6145 | hddLog(LOGE, |
| 6146 | FL("sme_ConfigFwrRoaming failed (err=%d)"), status); |
| 6147 | return -EINVAL; |
| 6148 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6149 | EXIT(); |
Abhishek Singh | c6ab38f | 2016-06-28 17:48:16 +0530 | [diff] [blame] | 6150 | return 0; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6151 | } |
| 6152 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6153 | static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
| 6154 | struct wireless_dev *wdev, const void *data, int data_len) |
| 6155 | { |
| 6156 | int ret = 0; |
| 6157 | |
| 6158 | vos_ssr_protect(__func__); |
| 6159 | ret = __wlan_hdd_cfg80211_firmware_roaming(wiphy, wdev, data, data_len); |
| 6160 | vos_ssr_unprotect(__func__); |
| 6161 | |
| 6162 | return ret; |
| 6163 | } |
| 6164 | |
Sushant Kaushik | 847890c | 2015-09-28 16:05:17 +0530 | [diff] [blame] | 6165 | static const struct |
| 6166 | nla_policy |
| 6167 | qca_wlan_vendor_get_wifi_info_policy[ |
| 6168 | QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX +1] = { |
| 6169 | [QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION] = {.type = NLA_U8 }, |
| 6170 | [QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION] = {.type = NLA_U8 }, |
| 6171 | }; |
| 6172 | |
| 6173 | |
| 6174 | /** |
| 6175 | * __wlan_hdd_cfg80211_get_wifi_info() - Get the wifi driver related info |
| 6176 | * @wiphy: pointer to wireless wiphy structure. |
| 6177 | * @wdev: pointer to wireless_dev structure. |
| 6178 | * @data: Pointer to the data to be passed via vendor interface |
| 6179 | * @data_len:Length of the data to be passed |
| 6180 | * |
| 6181 | * This is called when wlan driver needs to send wifi driver related info |
| 6182 | * (driver/fw version) to the user space application upon request. |
| 6183 | * |
| 6184 | * Return: Return the Success or Failure code. |
| 6185 | */ |
| 6186 | static int __wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy, |
| 6187 | struct wireless_dev *wdev, |
| 6188 | const void *data, int data_len) |
| 6189 | { |
| 6190 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6191 | struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX + 1]; |
| 6192 | tSirVersionString version; |
| 6193 | uint32 version_len; |
| 6194 | uint8 attr; |
| 6195 | int status; |
| 6196 | struct sk_buff *reply_skb = NULL; |
| 6197 | |
| 6198 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 6199 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 6200 | return -EINVAL; |
| 6201 | } |
| 6202 | |
| 6203 | status = wlan_hdd_validate_context(hdd_ctx); |
| 6204 | if (0 != status) { |
| 6205 | hddLog(LOGE, FL("HDD context is not valid")); |
| 6206 | return -EINVAL; |
| 6207 | } |
| 6208 | |
| 6209 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX, data, |
| 6210 | data_len, qca_wlan_vendor_get_wifi_info_policy)) { |
| 6211 | hddLog(LOGE, FL("WIFI_INFO_GET NL CMD parsing failed")); |
| 6212 | return -EINVAL; |
| 6213 | } |
| 6214 | |
| 6215 | if (tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION]) { |
| 6216 | hddLog(LOG1, FL("Rcvd req for Driver version Driver version is %s"), |
| 6217 | QWLAN_VERSIONSTR); |
| 6218 | strlcpy(version, QWLAN_VERSIONSTR, sizeof(version)); |
| 6219 | attr = QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION; |
| 6220 | } else if (tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION]) { |
| 6221 | hddLog(LOG1, FL("Rcvd req for FW version FW version is %s"), |
| 6222 | hdd_ctx->fw_Version); |
| 6223 | strlcpy(version, hdd_ctx->fw_Version, sizeof(version)); |
| 6224 | attr = QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION; |
| 6225 | } else { |
| 6226 | hddLog(LOGE, FL("Invalid attribute in get wifi info request")); |
| 6227 | return -EINVAL; |
| 6228 | } |
| 6229 | |
| 6230 | version_len = strlen(version); |
| 6231 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 6232 | version_len + NLA_HDRLEN + NLMSG_HDRLEN); |
| 6233 | if (!reply_skb) { |
| 6234 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 6235 | return -ENOMEM; |
| 6236 | } |
| 6237 | |
| 6238 | if (nla_put(reply_skb, attr, version_len, version)) { |
| 6239 | hddLog(LOGE, FL("nla put fail")); |
| 6240 | kfree_skb(reply_skb); |
| 6241 | return -EINVAL; |
| 6242 | } |
| 6243 | |
| 6244 | return cfg80211_vendor_cmd_reply(reply_skb); |
| 6245 | } |
| 6246 | |
| 6247 | /** |
| 6248 | * __wlan_hdd_cfg80211_get_wifi_info() - Get the wifi driver related info |
| 6249 | * @wiphy: pointer to wireless wiphy structure. |
| 6250 | * @wdev: pointer to wireless_dev structure. |
| 6251 | * @data: Pointer to the data to be passed via vendor interface |
| 6252 | * @data_len:Length of the data to be passed |
| 6253 | * @data_len: Length of the data received |
| 6254 | * |
| 6255 | * This function is used to enable or disable the collection of packet |
| 6256 | * statistics from the firmware |
| 6257 | * |
| 6258 | * Return: 0 on success and errno on failure |
| 6259 | */ |
| 6260 | |
| 6261 | static int |
| 6262 | wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy, |
| 6263 | struct wireless_dev *wdev, |
| 6264 | const void *data, int data_len) |
| 6265 | |
| 6266 | |
| 6267 | { |
| 6268 | int ret = 0; |
| 6269 | |
| 6270 | vos_ssr_protect(__func__); |
| 6271 | ret = __wlan_hdd_cfg80211_get_wifi_info(wiphy, |
| 6272 | wdev, data, data_len); |
| 6273 | vos_ssr_unprotect(__func__); |
| 6274 | |
| 6275 | return ret; |
| 6276 | } |
| 6277 | |
| 6278 | |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6279 | /* |
| 6280 | * define short names for the global vendor params |
| 6281 | * used by __wlan_hdd_cfg80211_monitor_rssi() |
| 6282 | */ |
| 6283 | #define PARAM_MAX QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX |
| 6284 | #define PARAM_REQUEST_ID QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID |
| 6285 | #define PARAM_CONTROL QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL |
| 6286 | #define PARAM_MIN_RSSI QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MIN_RSSI |
| 6287 | #define PARAM_MAX_RSSI QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX_RSSI |
| 6288 | |
| 6289 | /**--------------------------------------------------------------------------- |
| 6290 | |
| 6291 | \brief hdd_rssi_monitor_start_done - callback to be executed when rssi |
| 6292 | monitor start is completed successfully. |
| 6293 | |
| 6294 | \return - None |
| 6295 | |
| 6296 | --------------------------------------------------------------------------*/ |
| 6297 | void hdd_rssi_monitor_start_done(void *fwRssiMonitorCbContext, VOS_STATUS status) |
| 6298 | { |
| 6299 | hdd_context_t* pHddCtx = (hdd_context_t*)fwRssiMonitorCbContext; |
| 6300 | |
| 6301 | if (NULL == pHddCtx) |
| 6302 | { |
| 6303 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6304 | "%s: HDD context is NULL",__func__); |
| 6305 | return; |
| 6306 | } |
| 6307 | |
| 6308 | if (VOS_STATUS_SUCCESS == status) |
| 6309 | { |
| 6310 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rssi Monitor start successful")); |
| 6311 | } |
| 6312 | else |
| 6313 | { |
| 6314 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Rssi Monitor start not successful")); |
| 6315 | } |
| 6316 | |
| 6317 | return; |
| 6318 | } |
| 6319 | |
| 6320 | /**--------------------------------------------------------------------------- |
| 6321 | |
| 6322 | \brief hdd_rssi_monitor_stop_done - callback to be executed when rssi monitor |
| 6323 | stop is completed successfully. |
| 6324 | |
| 6325 | \return - None |
| 6326 | |
| 6327 | --------------------------------------------------------------------------*/ |
| 6328 | void hdd_rssi_monitor_stop_done(void *fwRssiMonitorCbContext, VOS_STATUS status) |
| 6329 | { |
| 6330 | hdd_context_t* pHddCtx = (hdd_context_t*)fwRssiMonitorCbContext; |
| 6331 | |
| 6332 | if (NULL == pHddCtx) |
| 6333 | { |
| 6334 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6335 | "%s: HDD context is NULL",__func__); |
| 6336 | return; |
| 6337 | } |
| 6338 | |
| 6339 | if (VOS_STATUS_SUCCESS == status) |
| 6340 | { |
| 6341 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rssi Monitor stop successful")); |
| 6342 | } |
| 6343 | else |
| 6344 | { |
| 6345 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Rssi Monitor stop not successful")); |
| 6346 | } |
| 6347 | |
| 6348 | return; |
| 6349 | } |
| 6350 | |
| 6351 | /** |
| 6352 | * __wlan_hdd_cfg80211_monitor_rssi() - monitor rssi |
| 6353 | * @wiphy: Pointer to wireless phy |
| 6354 | * @wdev: Pointer to wireless device |
| 6355 | * @data: Pointer to data |
| 6356 | * @data_len: Data length |
| 6357 | * |
| 6358 | * Return: 0 on success, negative errno on failure |
| 6359 | */ |
| 6360 | |
| 6361 | static int |
| 6362 | __wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy, |
| 6363 | struct wireless_dev *wdev, |
| 6364 | const void *data, |
| 6365 | int data_len) |
| 6366 | { |
| 6367 | struct net_device *dev = wdev->netdev; |
| 6368 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6369 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6370 | hdd_station_ctx_t *pHddStaCtx; |
| 6371 | struct nlattr *tb[PARAM_MAX + 1]; |
| 6372 | tpSirRssiMonitorReq pReq; |
| 6373 | eHalStatus status; |
| 6374 | int ret; |
| 6375 | uint32_t control; |
| 6376 | static const struct nla_policy policy[PARAM_MAX + 1] = { |
| 6377 | [PARAM_REQUEST_ID] = { .type = NLA_U32 }, |
| 6378 | [PARAM_CONTROL] = { .type = NLA_U32 }, |
| 6379 | [PARAM_MIN_RSSI] = { .type = NLA_S8 }, |
| 6380 | [PARAM_MAX_RSSI] = { .type = NLA_S8 }, |
| 6381 | }; |
| 6382 | |
| 6383 | ENTER(); |
| 6384 | |
| 6385 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6386 | if (0 != ret) { |
| 6387 | return -EINVAL; |
| 6388 | } |
| 6389 | |
| 6390 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) { |
| 6391 | hddLog(LOGE, FL("Not in Connected state!")); |
| 6392 | return -ENOTSUPP; |
| 6393 | } |
| 6394 | |
| 6395 | if (nla_parse(tb, PARAM_MAX, data, data_len, policy)) { |
| 6396 | hddLog(LOGE, FL("Invalid ATTR")); |
| 6397 | return -EINVAL; |
| 6398 | } |
| 6399 | |
| 6400 | if (!tb[PARAM_REQUEST_ID]) { |
| 6401 | hddLog(LOGE, FL("attr request id failed")); |
| 6402 | return -EINVAL; |
| 6403 | } |
| 6404 | |
| 6405 | if (!tb[PARAM_CONTROL]) { |
| 6406 | hddLog(LOGE, FL("attr control failed")); |
| 6407 | return -EINVAL; |
| 6408 | } |
| 6409 | |
| 6410 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6411 | |
| 6412 | pReq = vos_mem_malloc(sizeof(tSirRssiMonitorReq)); |
| 6413 | if(NULL == pReq) |
| 6414 | { |
| 6415 | hddLog(LOGE, |
| 6416 | FL("vos_mem_alloc failed ")); |
| 6417 | return eHAL_STATUS_FAILED_ALLOC; |
| 6418 | } |
| 6419 | vos_mem_set(pReq, sizeof(tSirRssiMonitorReq), 0); |
| 6420 | |
| 6421 | pReq->requestId = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 6422 | pReq->sessionId = pAdapter->sessionId; |
| 6423 | pReq->rssiMonitorCbContext = hdd_ctx; |
| 6424 | control = nla_get_u32(tb[PARAM_CONTROL]); |
| 6425 | vos_mem_copy( &pReq->currentBssId, pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 6426 | |
| 6427 | hddLog(LOG1, FL("Request Id: %u Session_id: %d Control: %d"), |
| 6428 | pReq->requestId, pReq->sessionId, control); |
| 6429 | |
| 6430 | if (control == QCA_WLAN_RSSI_MONITORING_START) { |
| 6431 | if (!tb[PARAM_MIN_RSSI]) { |
| 6432 | hddLog(LOGE, FL("attr min rssi failed")); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6433 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6434 | } |
| 6435 | |
| 6436 | if (!tb[PARAM_MAX_RSSI]) { |
| 6437 | hddLog(LOGE, FL("attr max rssi failed")); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6438 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6439 | } |
| 6440 | |
| 6441 | pReq->minRssi = nla_get_s8(tb[PARAM_MIN_RSSI]); |
| 6442 | pReq->maxRssi = nla_get_s8(tb[PARAM_MAX_RSSI]); |
| 6443 | pReq->rssiMonitorCallback = hdd_rssi_monitor_start_done; |
| 6444 | |
| 6445 | if (!(pReq->minRssi < pReq->maxRssi)) { |
| 6446 | hddLog(LOGW, FL("min_rssi: %d must be less than max_rssi: %d"), |
| 6447 | pReq->minRssi, pReq->maxRssi); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6448 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6449 | } |
| 6450 | hddLog(LOG1, FL("Min_rssi: %d Max_rssi: %d"), |
| 6451 | pReq->minRssi, pReq->maxRssi); |
| 6452 | status = sme_StartRssiMonitoring(hdd_ctx->hHal, pReq); |
| 6453 | |
| 6454 | } |
| 6455 | else if (control == QCA_WLAN_RSSI_MONITORING_STOP) { |
| 6456 | pReq->rssiMonitorCallback = hdd_rssi_monitor_stop_done; |
| 6457 | status = sme_StopRssiMonitoring(hdd_ctx->hHal, pReq); |
| 6458 | } |
| 6459 | else { |
| 6460 | hddLog(LOGE, FL("Invalid control cmd: %d"), control); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6461 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6462 | } |
| 6463 | |
| 6464 | if (!HAL_STATUS_SUCCESS(status)) { |
| 6465 | hddLog(LOGE, |
| 6466 | FL("sme_set_rssi_monitoring failed(err=%d)"), status); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6467 | goto fail; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6468 | } |
| 6469 | |
| 6470 | return 0; |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6471 | fail: |
| 6472 | vos_mem_free(pReq); |
| 6473 | return -EINVAL; |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6474 | } |
| 6475 | |
| 6476 | /* |
| 6477 | * done with short names for the global vendor params |
| 6478 | * used by __wlan_hdd_cfg80211_monitor_rssi() |
| 6479 | */ |
| 6480 | #undef PARAM_MAX |
| 6481 | #undef PARAM_CONTROL |
| 6482 | #undef PARAM_REQUEST_ID |
| 6483 | #undef PARAM_MAX_RSSI |
| 6484 | #undef PARAM_MIN_RSSI |
| 6485 | |
| 6486 | /** |
| 6487 | * wlan_hdd_cfg80211_monitor_rssi() - SSR wrapper to rssi monitoring |
| 6488 | * @wiphy: wiphy structure pointer |
| 6489 | * @wdev: Wireless device structure pointer |
| 6490 | * @data: Pointer to the data received |
| 6491 | * @data_len: Length of @data |
| 6492 | * |
| 6493 | * Return: 0 on success; errno on failure |
| 6494 | */ |
| 6495 | static int |
| 6496 | wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 6497 | const void *data, int data_len) |
| 6498 | { |
| 6499 | int ret; |
| 6500 | |
| 6501 | vos_ssr_protect(__func__); |
| 6502 | ret = __wlan_hdd_cfg80211_monitor_rssi(wiphy, wdev, data, data_len); |
| 6503 | vos_ssr_unprotect(__func__); |
| 6504 | |
| 6505 | return ret; |
| 6506 | } |
| 6507 | |
| 6508 | /** |
| 6509 | * hdd_rssi_threshold_breached_cb() - rssi breached NL event |
| 6510 | * @hddctx: HDD context |
| 6511 | * @data: rssi breached event data |
| 6512 | * |
| 6513 | * This function reads the rssi breached event %data and fill in the skb with |
| 6514 | * NL attributes and send up the NL event. |
| 6515 | * This callback execute in atomic context and must not invoke any |
| 6516 | * blocking calls. |
| 6517 | * |
| 6518 | * Return: none |
| 6519 | */ |
| 6520 | void hdd_rssi_threshold_breached_cb(void *hddctx, |
| 6521 | struct rssi_breach_event *data) |
| 6522 | { |
| 6523 | hdd_context_t *pHddCtx = (hdd_context_t *)hddctx; |
| 6524 | int status; |
| 6525 | struct sk_buff *skb; |
| 6526 | |
| 6527 | ENTER(); |
| 6528 | status = wlan_hdd_validate_context(pHddCtx); |
| 6529 | |
| 6530 | if (0 != status) { |
| 6531 | return; |
| 6532 | } |
| 6533 | |
| 6534 | if (!data) { |
| 6535 | hddLog(LOGE, FL("data is null")); |
| 6536 | return; |
| 6537 | } |
| 6538 | |
| 6539 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 6540 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 6541 | NULL, |
| 6542 | #endif |
| 6543 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 6544 | QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX, |
| 6545 | GFP_KERNEL); |
| 6546 | |
| 6547 | if (!skb) { |
| 6548 | hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed")); |
| 6549 | return; |
| 6550 | } |
| 6551 | |
| 6552 | hddLog(LOG1, "Req Id: %u Current rssi: %d", |
| 6553 | data->request_id, data->curr_rssi); |
| 6554 | hddLog(LOG1, "Current BSSID: "MAC_ADDRESS_STR, |
| 6555 | MAC_ADDR_ARRAY(data->curr_bssid.bytes)); |
| 6556 | |
| 6557 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID, |
| 6558 | data->request_id) || |
| 6559 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_BSSID, |
| 6560 | sizeof(data->curr_bssid), data->curr_bssid.bytes) || |
| 6561 | nla_put_s8(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_RSSI, |
| 6562 | data->curr_rssi)) { |
| 6563 | hddLog(LOGE, FL("nla put fail")); |
| 6564 | goto fail; |
| 6565 | } |
| 6566 | |
| 6567 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 6568 | return; |
| 6569 | |
| 6570 | fail: |
| 6571 | kfree_skb(skb); |
| 6572 | return; |
| 6573 | } |
| 6574 | |
| 6575 | |
| 6576 | |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 6577 | /** |
| 6578 | * __wlan_hdd_cfg80211_setband() - set band |
| 6579 | * @wiphy: Pointer to wireless phy |
| 6580 | * @wdev: Pointer to wireless device |
| 6581 | * @data: Pointer to data |
| 6582 | * @data_len: Data length |
| 6583 | * |
| 6584 | * Return: 0 on success, negative errno on failure |
| 6585 | */ |
| 6586 | static int |
| 6587 | __wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 6588 | struct wireless_dev *wdev, |
| 6589 | const void *data, |
| 6590 | int data_len) |
| 6591 | { |
| 6592 | struct net_device *dev = wdev->netdev; |
| 6593 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6594 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 6595 | int ret; |
| 6596 | static const struct nla_policy policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] |
| 6597 | = {[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE] = { .type = NLA_U32 }}; |
| 6598 | |
| 6599 | ENTER(); |
| 6600 | |
| 6601 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6602 | if (0 != ret) { |
| 6603 | hddLog(LOGE, FL("HDD context is not valid")); |
| 6604 | return ret; |
| 6605 | } |
| 6606 | |
| 6607 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, |
| 6608 | policy)) { |
| 6609 | hddLog(LOGE, FL("Invalid ATTR")); |
| 6610 | return -EINVAL; |
| 6611 | } |
| 6612 | |
| 6613 | if (!tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE]) { |
| 6614 | hddLog(LOGE, FL("attr QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE failed")); |
| 6615 | return -EINVAL; |
| 6616 | } |
| 6617 | |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 6618 | hdd_ctx->isSetBandByNL = TRUE; |
| 6619 | ret = hdd_setBand(dev, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 6620 | nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE])); |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 6621 | hdd_ctx->isSetBandByNL = FALSE; |
| 6622 | |
| 6623 | EXIT(); |
| 6624 | return ret; |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 6625 | } |
| 6626 | |
| 6627 | /** |
| 6628 | * wlan_hdd_cfg80211_setband() - Wrapper to offload packets |
| 6629 | * @wiphy: wiphy structure pointer |
| 6630 | * @wdev: Wireless device structure pointer |
| 6631 | * @data: Pointer to the data received |
| 6632 | * @data_len: Length of @data |
| 6633 | * |
| 6634 | * Return: 0 on success; errno on failure |
| 6635 | */ |
| 6636 | static int wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 6637 | struct wireless_dev *wdev, |
| 6638 | const void *data, |
| 6639 | int data_len) |
| 6640 | { |
| 6641 | int ret = 0; |
| 6642 | |
| 6643 | vos_ssr_protect(__func__); |
| 6644 | ret = __wlan_hdd_cfg80211_setband(wiphy, |
| 6645 | wdev, data, data_len); |
| 6646 | vos_ssr_unprotect(__func__); |
| 6647 | |
| 6648 | return ret; |
| 6649 | } |
| 6650 | |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 6651 | #ifdef WLAN_FEATURE_OFFLOAD_PACKETS |
| 6652 | /** |
| 6653 | * hdd_map_req_id_to_pattern_id() - map request id to pattern id |
| 6654 | * @hdd_ctx: HDD context |
| 6655 | * @request_id: [input] request id |
| 6656 | * @pattern_id: [output] pattern id |
| 6657 | * |
| 6658 | * This function loops through request id to pattern id array |
| 6659 | * if the slot is available, store the request id and return pattern id |
| 6660 | * if entry exists, return the pattern id |
| 6661 | * |
| 6662 | * Return: 0 on success and errno on failure |
| 6663 | */ |
| 6664 | static int hdd_map_req_id_to_pattern_id(hdd_context_t *hdd_ctx, |
| 6665 | uint32_t request_id, |
| 6666 | uint8_t *pattern_id) |
| 6667 | { |
| 6668 | uint32_t i; |
| 6669 | |
| 6670 | mutex_lock(&hdd_ctx->op_ctx.op_lock); |
| 6671 | for (i = 0; i < MAXNUM_PERIODIC_TX_PTRNS; i++) |
| 6672 | { |
| 6673 | if (hdd_ctx->op_ctx.op_table[i].request_id == 0) |
| 6674 | { |
| 6675 | hdd_ctx->op_ctx.op_table[i].request_id = request_id; |
| 6676 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 6677 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6678 | return 0; |
| 6679 | } else if (hdd_ctx->op_ctx.op_table[i].request_id == |
| 6680 | request_id) { |
| 6681 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 6682 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6683 | return 0; |
| 6684 | } |
| 6685 | } |
| 6686 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6687 | return -EINVAL; |
| 6688 | } |
| 6689 | |
| 6690 | /** |
| 6691 | * hdd_unmap_req_id_to_pattern_id() - unmap request id to pattern id |
| 6692 | * @hdd_ctx: HDD context |
| 6693 | * @request_id: [input] request id |
| 6694 | * @pattern_id: [output] pattern id |
| 6695 | * |
| 6696 | * This function loops through request id to pattern id array |
| 6697 | * reset request id to 0 (slot available again) and |
| 6698 | * return pattern id |
| 6699 | * |
| 6700 | * Return: 0 on success and errno on failure |
| 6701 | */ |
| 6702 | static int hdd_unmap_req_id_to_pattern_id(hdd_context_t *hdd_ctx, |
| 6703 | uint32_t request_id, |
| 6704 | uint8_t *pattern_id) |
| 6705 | { |
| 6706 | uint32_t i; |
| 6707 | |
| 6708 | mutex_lock(&hdd_ctx->op_ctx.op_lock); |
| 6709 | for (i = 0; i < MAXNUM_PERIODIC_TX_PTRNS; i++) |
| 6710 | { |
| 6711 | if (hdd_ctx->op_ctx.op_table[i].request_id == request_id) |
| 6712 | { |
| 6713 | hdd_ctx->op_ctx.op_table[i].request_id = 0; |
| 6714 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 6715 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6716 | return 0; |
| 6717 | } |
| 6718 | } |
| 6719 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6720 | return -EINVAL; |
| 6721 | } |
| 6722 | |
| 6723 | |
| 6724 | /* |
| 6725 | * define short names for the global vendor params |
| 6726 | * used by __wlan_hdd_cfg80211_offloaded_packets() |
| 6727 | */ |
| 6728 | #define PARAM_MAX QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_MAX |
| 6729 | #define PARAM_REQUEST_ID \ |
| 6730 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_REQUEST_ID |
| 6731 | #define PARAM_CONTROL \ |
| 6732 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SENDING_CONTROL |
| 6733 | #define PARAM_IP_PACKET \ |
| 6734 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_IP_PACKET_DATA |
| 6735 | #define PARAM_SRC_MAC_ADDR \ |
| 6736 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SRC_MAC_ADDR |
| 6737 | #define PARAM_DST_MAC_ADDR \ |
| 6738 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_DST_MAC_ADDR |
| 6739 | #define PARAM_PERIOD QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_PERIOD |
| 6740 | |
| 6741 | /** |
| 6742 | * wlan_hdd_add_tx_ptrn() - add tx pattern |
| 6743 | * @adapter: adapter pointer |
| 6744 | * @hdd_ctx: hdd context |
| 6745 | * @tb: nl attributes |
| 6746 | * |
| 6747 | * This function reads the NL attributes and forms a AddTxPtrn message |
| 6748 | * posts it to SME. |
| 6749 | * |
| 6750 | */ |
| 6751 | static int |
| 6752 | wlan_hdd_add_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx, |
| 6753 | struct nlattr **tb) |
| 6754 | { |
| 6755 | struct sSirAddPeriodicTxPtrn *add_req; |
| 6756 | eHalStatus status; |
| 6757 | uint32_t request_id, ret, len; |
| 6758 | uint8_t pattern_id = 0; |
| 6759 | v_MACADDR_t dst_addr; |
| 6760 | uint16_t eth_type = htons(ETH_P_IP); |
| 6761 | |
| 6762 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) |
| 6763 | { |
| 6764 | hddLog(LOGE, FL("Not in Connected state!")); |
| 6765 | return -ENOTSUPP; |
| 6766 | } |
| 6767 | |
| 6768 | add_req = vos_mem_malloc(sizeof(*add_req)); |
| 6769 | if (!add_req) |
| 6770 | { |
| 6771 | hddLog(LOGE, FL("memory allocation failed")); |
| 6772 | return -ENOMEM; |
| 6773 | } |
| 6774 | |
| 6775 | /* Parse and fetch request Id */ |
| 6776 | if (!tb[PARAM_REQUEST_ID]) |
| 6777 | { |
| 6778 | hddLog(LOGE, FL("attr request id failed")); |
| 6779 | goto fail; |
| 6780 | } |
| 6781 | |
| 6782 | request_id = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 6783 | hddLog(LOG1, FL("Request Id: %u"), request_id); |
| 6784 | if (request_id == 0) |
| 6785 | { |
| 6786 | hddLog(LOGE, FL("request_id cannot be zero")); |
Sreelakshmi Konamki | deb2253 | 2016-04-14 14:59:13 +0530 | [diff] [blame] | 6787 | goto fail; |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 6788 | } |
| 6789 | |
| 6790 | if (!tb[PARAM_PERIOD]) |
| 6791 | { |
| 6792 | hddLog(LOGE, FL("attr period failed")); |
| 6793 | goto fail; |
| 6794 | } |
| 6795 | add_req->usPtrnIntervalMs = nla_get_u32(tb[PARAM_PERIOD]); |
| 6796 | hddLog(LOG1, FL("Period: %u ms"), add_req->usPtrnIntervalMs); |
| 6797 | if (add_req->usPtrnIntervalMs == 0) |
| 6798 | { |
| 6799 | hddLog(LOGE, FL("Invalid interval zero, return failure")); |
| 6800 | goto fail; |
| 6801 | } |
| 6802 | |
| 6803 | if (!tb[PARAM_SRC_MAC_ADDR]) |
| 6804 | { |
| 6805 | hddLog(LOGE, FL("attr source mac address failed")); |
| 6806 | goto fail; |
| 6807 | } |
| 6808 | nla_memcpy(add_req->macAddress, tb[PARAM_SRC_MAC_ADDR], |
| 6809 | VOS_MAC_ADDR_SIZE); |
| 6810 | hddLog(LOG1, "input src mac address: "MAC_ADDRESS_STR, |
| 6811 | MAC_ADDR_ARRAY(add_req->macAddress)); |
| 6812 | |
| 6813 | if (memcmp(add_req->macAddress, adapter->macAddressCurrent.bytes, |
| 6814 | VOS_MAC_ADDR_SIZE)) |
| 6815 | { |
| 6816 | hddLog(LOGE, |
| 6817 | FL("input src mac address and connected ap bssid are different")); |
| 6818 | goto fail; |
| 6819 | } |
| 6820 | |
| 6821 | if (!tb[PARAM_DST_MAC_ADDR]) |
| 6822 | { |
| 6823 | hddLog(LOGE, FL("attr dst mac address failed")); |
| 6824 | goto fail; |
| 6825 | } |
| 6826 | nla_memcpy(dst_addr.bytes, tb[PARAM_DST_MAC_ADDR], VOS_MAC_ADDR_SIZE); |
| 6827 | hddLog(LOG1, "input dst mac address: "MAC_ADDRESS_STR, |
| 6828 | MAC_ADDR_ARRAY(dst_addr.bytes)); |
| 6829 | |
| 6830 | if (!tb[PARAM_IP_PACKET]) |
| 6831 | { |
| 6832 | hddLog(LOGE, FL("attr ip packet failed")); |
| 6833 | goto fail; |
| 6834 | } |
| 6835 | add_req->ucPtrnSize = nla_len(tb[PARAM_IP_PACKET]); |
| 6836 | hddLog(LOG1, FL("IP packet len: %u"), add_req->ucPtrnSize); |
| 6837 | |
| 6838 | if (add_req->ucPtrnSize < 0 || |
| 6839 | add_req->ucPtrnSize > (PERIODIC_TX_PTRN_MAX_SIZE - |
| 6840 | HDD_ETH_HEADER_LEN)) |
| 6841 | { |
| 6842 | hddLog(LOGE, FL("Invalid IP packet len: %d"), |
| 6843 | add_req->ucPtrnSize); |
| 6844 | goto fail; |
| 6845 | } |
| 6846 | |
| 6847 | len = 0; |
| 6848 | vos_mem_copy(&add_req->ucPattern[0], dst_addr.bytes, VOS_MAC_ADDR_SIZE); |
| 6849 | len += VOS_MAC_ADDR_SIZE; |
| 6850 | vos_mem_copy(&add_req->ucPattern[len], add_req->macAddress, |
| 6851 | VOS_MAC_ADDR_SIZE); |
| 6852 | len += VOS_MAC_ADDR_SIZE; |
| 6853 | vos_mem_copy(&add_req->ucPattern[len], ð_type, 2); |
| 6854 | len += 2; |
| 6855 | |
| 6856 | /* |
| 6857 | * This is the IP packet, add 14 bytes Ethernet (802.3) header |
| 6858 | * ------------------------------------------------------------ |
| 6859 | * | 14 bytes Ethernet (802.3) header | IP header and payload | |
| 6860 | * ------------------------------------------------------------ |
| 6861 | */ |
| 6862 | vos_mem_copy(&add_req->ucPattern[len], |
| 6863 | nla_data(tb[PARAM_IP_PACKET]), |
| 6864 | add_req->ucPtrnSize); |
| 6865 | add_req->ucPtrnSize += len; |
| 6866 | |
| 6867 | VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6868 | add_req->ucPattern, add_req->ucPtrnSize); |
| 6869 | |
| 6870 | ret = hdd_map_req_id_to_pattern_id(hdd_ctx, request_id, &pattern_id); |
| 6871 | if (ret) |
| 6872 | { |
| 6873 | hddLog(LOGW, FL("req id to pattern id failed (ret=%d)"), ret); |
| 6874 | goto fail; |
| 6875 | } |
| 6876 | add_req->ucPtrnId = pattern_id; |
| 6877 | hddLog(LOG1, FL("pattern id: %d"), add_req->ucPtrnId); |
| 6878 | |
| 6879 | status = sme_AddPeriodicTxPtrn(hdd_ctx->hHal, add_req); |
| 6880 | if (!HAL_STATUS_SUCCESS(status)) |
| 6881 | { |
| 6882 | hddLog(LOGE, |
| 6883 | FL("sme_AddPeriodicTxPtrn failed (err=%d)"), status); |
| 6884 | goto fail; |
| 6885 | } |
| 6886 | |
| 6887 | EXIT(); |
| 6888 | vos_mem_free(add_req); |
| 6889 | return 0; |
| 6890 | |
| 6891 | fail: |
| 6892 | vos_mem_free(add_req); |
| 6893 | return -EINVAL; |
| 6894 | } |
| 6895 | |
| 6896 | /** |
| 6897 | * wlan_hdd_del_tx_ptrn() - delete tx pattern |
| 6898 | * @adapter: adapter pointer |
| 6899 | * @hdd_ctx: hdd context |
| 6900 | * @tb: nl attributes |
| 6901 | * |
| 6902 | * This function reads the NL attributes and forms a DelTxPtrn message |
| 6903 | * posts it to SME. |
| 6904 | * |
| 6905 | */ |
| 6906 | static int |
| 6907 | wlan_hdd_del_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx, |
| 6908 | struct nlattr **tb) |
| 6909 | { |
| 6910 | struct sSirDelPeriodicTxPtrn *del_req; |
| 6911 | eHalStatus status; |
| 6912 | uint32_t request_id, ret; |
| 6913 | uint8_t pattern_id = 0; |
| 6914 | |
| 6915 | /* Parse and fetch request Id */ |
| 6916 | if (!tb[PARAM_REQUEST_ID]) |
| 6917 | { |
| 6918 | hddLog(LOGE, FL("attr request id failed")); |
| 6919 | return -EINVAL; |
| 6920 | } |
| 6921 | request_id = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 6922 | if (request_id == 0) |
| 6923 | { |
| 6924 | hddLog(LOGE, FL("request_id cannot be zero")); |
| 6925 | return -EINVAL; |
| 6926 | } |
| 6927 | |
| 6928 | ret = hdd_unmap_req_id_to_pattern_id(hdd_ctx, request_id, &pattern_id); |
| 6929 | if (ret) |
| 6930 | { |
| 6931 | hddLog(LOGW, FL("req id to pattern id failed (ret=%d)"), ret); |
| 6932 | return -EINVAL; |
| 6933 | } |
| 6934 | |
| 6935 | del_req = vos_mem_malloc(sizeof(*del_req)); |
| 6936 | if (!del_req) |
| 6937 | { |
| 6938 | hddLog(LOGE, FL("memory allocation failed")); |
| 6939 | return -ENOMEM; |
| 6940 | } |
| 6941 | |
| 6942 | vos_mem_set(del_req, sizeof(*del_req), 0); |
| 6943 | vos_mem_copy(del_req->macAddress, adapter->macAddressCurrent.bytes, |
| 6944 | VOS_MAC_ADDR_SIZE); |
| 6945 | hddLog(LOG1, MAC_ADDRESS_STR, MAC_ADDR_ARRAY(del_req->macAddress)); |
| 6946 | del_req->ucPatternIdBitmap |= (0x1 << pattern_id); |
| 6947 | hddLog(LOG1, FL("Request Id: %u Pattern id: %d, bitmap %04x"), |
| 6948 | request_id, pattern_id, del_req->ucPatternIdBitmap); |
| 6949 | |
| 6950 | status = sme_DelPeriodicTxPtrn(hdd_ctx->hHal, del_req); |
| 6951 | if (!HAL_STATUS_SUCCESS(status)) |
| 6952 | { |
| 6953 | hddLog(LOGE, |
| 6954 | FL("sme_DelPeriodicTxPtrn failed (err=%d)"), status); |
| 6955 | goto fail; |
| 6956 | } |
| 6957 | |
| 6958 | EXIT(); |
| 6959 | vos_mem_free(del_req); |
| 6960 | return 0; |
| 6961 | |
| 6962 | fail: |
| 6963 | vos_mem_free(del_req); |
| 6964 | return -EINVAL; |
| 6965 | } |
| 6966 | |
| 6967 | |
| 6968 | /** |
| 6969 | * __wlan_hdd_cfg80211_offloaded_packets() - send offloaded packets |
| 6970 | * @wiphy: Pointer to wireless phy |
| 6971 | * @wdev: Pointer to wireless device |
| 6972 | * @data: Pointer to data |
| 6973 | * @data_len: Data length |
| 6974 | * |
| 6975 | * Return: 0 on success, negative errno on failure |
| 6976 | */ |
| 6977 | static int |
| 6978 | __wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy, |
| 6979 | struct wireless_dev *wdev, |
| 6980 | const void *data, |
| 6981 | int data_len) |
| 6982 | { |
| 6983 | struct net_device *dev = wdev->netdev; |
| 6984 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6985 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6986 | struct nlattr *tb[PARAM_MAX + 1]; |
| 6987 | uint8_t control; |
| 6988 | int ret; |
| 6989 | static const struct nla_policy policy[PARAM_MAX + 1] = |
| 6990 | { |
| 6991 | [PARAM_REQUEST_ID] = { .type = NLA_U32 }, |
| 6992 | [PARAM_CONTROL] = { .type = NLA_U32 }, |
| 6993 | [PARAM_SRC_MAC_ADDR] = { .type = NLA_BINARY, |
| 6994 | .len = VOS_MAC_ADDR_SIZE }, |
| 6995 | [PARAM_DST_MAC_ADDR] = { .type = NLA_BINARY, |
| 6996 | .len = VOS_MAC_ADDR_SIZE }, |
| 6997 | [PARAM_PERIOD] = { .type = NLA_U32 }, |
| 6998 | }; |
| 6999 | |
| 7000 | ENTER(); |
| 7001 | |
| 7002 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 7003 | if (0 != ret) |
| 7004 | { |
| 7005 | hddLog(LOGE, FL("HDD context is not valid")); |
| 7006 | return ret; |
| 7007 | } |
| 7008 | |
| 7009 | if (!sme_IsFeatureSupportedByFW(WLAN_PERIODIC_TX_PTRN)) |
| 7010 | { |
| 7011 | hddLog(LOGE, |
| 7012 | FL("Periodic Tx Pattern Offload feature is not supported in FW!")); |
| 7013 | return -ENOTSUPP; |
| 7014 | } |
| 7015 | |
| 7016 | if (nla_parse(tb, PARAM_MAX, data, data_len, policy)) |
| 7017 | { |
| 7018 | hddLog(LOGE, FL("Invalid ATTR")); |
| 7019 | return -EINVAL; |
| 7020 | } |
| 7021 | |
| 7022 | if (!tb[PARAM_CONTROL]) |
| 7023 | { |
| 7024 | hddLog(LOGE, FL("attr control failed")); |
| 7025 | return -EINVAL; |
| 7026 | } |
| 7027 | control = nla_get_u32(tb[PARAM_CONTROL]); |
| 7028 | hddLog(LOG1, FL("Control: %d"), control); |
| 7029 | |
| 7030 | if (control == WLAN_START_OFFLOADED_PACKETS) |
| 7031 | return wlan_hdd_add_tx_ptrn(adapter, hdd_ctx, tb); |
| 7032 | else if (control == WLAN_STOP_OFFLOADED_PACKETS) |
| 7033 | return wlan_hdd_del_tx_ptrn(adapter, hdd_ctx, tb); |
| 7034 | else |
| 7035 | { |
| 7036 | hddLog(LOGE, FL("Invalid control: %d"), control); |
| 7037 | return -EINVAL; |
| 7038 | } |
| 7039 | } |
| 7040 | |
| 7041 | /* |
| 7042 | * done with short names for the global vendor params |
| 7043 | * used by __wlan_hdd_cfg80211_offloaded_packets() |
| 7044 | */ |
| 7045 | #undef PARAM_MAX |
| 7046 | #undef PARAM_REQUEST_ID |
| 7047 | #undef PARAM_CONTROL |
| 7048 | #undef PARAM_IP_PACKET |
| 7049 | #undef PARAM_SRC_MAC_ADDR |
| 7050 | #undef PARAM_DST_MAC_ADDR |
| 7051 | #undef PARAM_PERIOD |
| 7052 | |
| 7053 | /** |
| 7054 | * wlan_hdd_cfg80211_offloaded_packets() - Wrapper to offload packets |
| 7055 | * @wiphy: wiphy structure pointer |
| 7056 | * @wdev: Wireless device structure pointer |
| 7057 | * @data: Pointer to the data received |
| 7058 | * @data_len: Length of @data |
| 7059 | * |
| 7060 | * Return: 0 on success; errno on failure |
| 7061 | */ |
| 7062 | static int wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy, |
| 7063 | struct wireless_dev *wdev, |
| 7064 | const void *data, |
| 7065 | int data_len) |
| 7066 | { |
| 7067 | int ret = 0; |
| 7068 | |
| 7069 | vos_ssr_protect(__func__); |
| 7070 | ret = __wlan_hdd_cfg80211_offloaded_packets(wiphy, |
| 7071 | wdev, data, data_len); |
| 7072 | vos_ssr_unprotect(__func__); |
| 7073 | |
| 7074 | return ret; |
| 7075 | } |
| 7076 | #endif |
| 7077 | |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7078 | static const struct |
| 7079 | nla_policy |
| 7080 | qca_wlan_vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_MAX+1] = { |
| 7081 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 7082 | }; |
| 7083 | |
| 7084 | /** |
| 7085 | * wlan_hdd_cfg80211_get_link_properties() - This function is used to |
| 7086 | * get link properties like nss, rate flags and operating frequency for |
| 7087 | * the connection with the given peer. |
| 7088 | * @wiphy: WIPHY structure pointer |
| 7089 | * @wdev: Wireless device structure pointer |
| 7090 | * @data: Pointer to the data received |
| 7091 | * @data_len: Length of the data received |
| 7092 | * |
| 7093 | * This function return the above link properties on success. |
| 7094 | * |
| 7095 | * Return: 0 on success and errno on failure |
| 7096 | */ |
| 7097 | static int wlan_hdd_cfg80211_get_link_properties(struct wiphy *wiphy, |
| 7098 | struct wireless_dev *wdev, |
| 7099 | const void *data, |
| 7100 | int data_len) |
| 7101 | { |
| 7102 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 7103 | struct net_device *dev = wdev->netdev; |
| 7104 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7105 | hdd_station_ctx_t *hdd_sta_ctx; |
| 7106 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX+1]; |
| 7107 | uint8_t peer_mac[VOS_MAC_ADDR_SIZE]; |
| 7108 | uint32_t sta_id; |
| 7109 | struct sk_buff *reply_skb; |
| 7110 | uint32_t rate_flags = 0; |
| 7111 | uint8_t nss; |
| 7112 | uint8_t final_rate_flags = 0; |
| 7113 | uint32_t freq; |
| 7114 | v_CONTEXT_t pVosContext = NULL; |
| 7115 | ptSapContext pSapCtx = NULL; |
| 7116 | |
| 7117 | if (0 != wlan_hdd_validate_context(hdd_ctx)) { |
| 7118 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid")); |
| 7119 | return -EINVAL; |
| 7120 | } |
| 7121 | |
| 7122 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, |
| 7123 | qca_wlan_vendor_attr_policy)) { |
| 7124 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid attribute")); |
| 7125 | return -EINVAL; |
| 7126 | } |
| 7127 | |
| 7128 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 7129 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7130 | FL("Attribute peerMac not provided for mode=%d"), |
| 7131 | adapter->device_mode); |
| 7132 | return -EINVAL; |
| 7133 | } |
| 7134 | |
| 7135 | memcpy(peer_mac, nla_data(tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 7136 | sizeof(peer_mac)); |
| 7137 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7138 | FL("peerMac="MAC_ADDRESS_STR" for device_mode:%d"), |
| 7139 | MAC_ADDR_ARRAY(peer_mac), adapter->device_mode); |
| 7140 | |
| 7141 | if (adapter->device_mode == WLAN_HDD_INFRA_STATION || |
| 7142 | adapter->device_mode == WLAN_HDD_P2P_CLIENT) { |
| 7143 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 7144 | if ((hdd_sta_ctx->conn_info.connState != |
| 7145 | eConnectionState_Associated) || |
| 7146 | !vos_mem_compare(hdd_sta_ctx->conn_info.bssId, peer_mac, |
| 7147 | VOS_MAC_ADDRESS_LEN)) { |
| 7148 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7149 | FL("Not Associated to mac "MAC_ADDRESS_STR), |
| 7150 | MAC_ADDR_ARRAY(peer_mac)); |
| 7151 | return -EINVAL; |
| 7152 | } |
| 7153 | |
| 7154 | nss = 1; //pronto supports only one spatial stream |
| 7155 | freq = vos_chan_to_freq( |
| 7156 | hdd_sta_ctx->conn_info.operationChannel); |
| 7157 | rate_flags = hdd_sta_ctx->conn_info.rate_flags; |
| 7158 | |
| 7159 | } else if (adapter->device_mode == WLAN_HDD_P2P_GO || |
| 7160 | adapter->device_mode == WLAN_HDD_SOFTAP) { |
| 7161 | |
| 7162 | pVosContext = ( WLAN_HDD_GET_CTX(adapter))->pvosContext; |
| 7163 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 7164 | if(pSapCtx == NULL){ |
| 7165 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7166 | FL("psapCtx is NULL")); |
| 7167 | return -ENOENT; |
| 7168 | } |
| 7169 | |
| 7170 | |
| 7171 | for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT; sta_id++) { |
| 7172 | if (pSapCtx->aStaInfo[sta_id].isUsed && |
| 7173 | !vos_is_macaddr_broadcast( |
| 7174 | &pSapCtx->aStaInfo[sta_id].macAddrSTA) && |
| 7175 | vos_mem_compare( |
| 7176 | &pSapCtx->aStaInfo[sta_id].macAddrSTA, |
| 7177 | peer_mac, VOS_MAC_ADDRESS_LEN)) |
| 7178 | break; |
| 7179 | } |
| 7180 | |
| 7181 | if (WLAN_MAX_STA_COUNT == sta_id) { |
| 7182 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7183 | FL("No active peer with mac="MAC_ADDRESS_STR), |
| 7184 | MAC_ADDR_ARRAY(peer_mac)); |
| 7185 | return -EINVAL; |
| 7186 | } |
| 7187 | |
| 7188 | nss = 1; //pronto supports only one spatial stream |
| 7189 | freq = vos_chan_to_freq( |
| 7190 | (WLAN_HDD_GET_AP_CTX_PTR(adapter))->operatingChannel); |
| 7191 | rate_flags = pSapCtx->aStaInfo[sta_id].rate_flags; |
| 7192 | } else { |
| 7193 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7194 | FL("Not Associated! with mac"MAC_ADDRESS_STR), |
| 7195 | MAC_ADDR_ARRAY(peer_mac)); |
| 7196 | return -EINVAL; |
| 7197 | } |
| 7198 | |
| 7199 | if (!(rate_flags & eHAL_TX_RATE_LEGACY)) { |
| 7200 | if (rate_flags & eHAL_TX_RATE_VHT80) { |
| 7201 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7202 | final_rate_flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 7203 | } else if (rate_flags & eHAL_TX_RATE_VHT40) { |
| 7204 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7205 | final_rate_flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7206 | } else if (rate_flags & eHAL_TX_RATE_VHT20) { |
| 7207 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7208 | } else if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) { |
| 7209 | final_rate_flags |= RATE_INFO_FLAGS_MCS; |
| 7210 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 7211 | final_rate_flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7212 | } |
| 7213 | |
| 7214 | if (rate_flags & eHAL_TX_RATE_SGI) { |
| 7215 | if (!(final_rate_flags & RATE_INFO_FLAGS_VHT_MCS)) |
| 7216 | final_rate_flags |= RATE_INFO_FLAGS_MCS; |
| 7217 | final_rate_flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 7218 | } |
| 7219 | } |
| 7220 | |
| 7221 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 7222 | sizeof(u8) + sizeof(u8) + sizeof(u32) + NLMSG_HDRLEN); |
| 7223 | |
| 7224 | if (NULL == reply_skb) { |
| 7225 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7226 | FL("getLinkProperties: skb alloc failed")); |
| 7227 | return -EINVAL; |
| 7228 | } |
| 7229 | |
| 7230 | if (nla_put_u8(reply_skb, |
| 7231 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_NSS, |
| 7232 | nss) || |
| 7233 | nla_put_u8(reply_skb, |
| 7234 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_RATE_FLAGS, |
| 7235 | final_rate_flags) || |
| 7236 | nla_put_u32(reply_skb, |
| 7237 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_FREQ, |
| 7238 | freq)) { |
| 7239 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_put failed")); |
| 7240 | kfree_skb(reply_skb); |
| 7241 | return -EINVAL; |
| 7242 | } |
| 7243 | |
| 7244 | return cfg80211_vendor_cmd_reply(reply_skb); |
| 7245 | } |
| 7246 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7247 | #define PARAM_WIFICONFIG_MAX QCA_WLAN_VENDOR_ATTR_CONFIG_MAX |
| 7248 | #define PARAM_MODULATED_DTIM QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM |
| 7249 | #define PARAM_STATS_AVG_FACTOR QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR |
| 7250 | #define PARAM_GUARD_TIME QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7251 | #define PARAM_BCNMISS_PENALTY_PARAM_COUNT \ |
| 7252 | QCA_WLAN_VENDOR_ATTR_CONFIG_PENALIZE_AFTER_NCONS_BEACON_MISS |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7253 | |
| 7254 | /** |
| 7255 | * __wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration |
| 7256 | * vendor command |
| 7257 | * |
| 7258 | * @wiphy: wiphy device pointer |
| 7259 | * @wdev: wireless device pointer |
| 7260 | * @data: Vendor command data buffer |
| 7261 | * @data_len: Buffer length |
| 7262 | * |
| 7263 | * Handles QCA_WLAN_VENDOR_ATTR_CONFIG_MAX. |
| 7264 | * |
| 7265 | * Return: EOK or other error codes. |
| 7266 | */ |
| 7267 | |
| 7268 | static int __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, |
| 7269 | struct wireless_dev *wdev, |
| 7270 | const void *data, |
| 7271 | int data_len) |
| 7272 | { |
| 7273 | struct net_device *dev = wdev->netdev; |
| 7274 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7275 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 7276 | hdd_station_ctx_t *pHddStaCtx; |
| 7277 | struct nlattr *tb[PARAM_WIFICONFIG_MAX + 1]; |
| 7278 | tpSetWifiConfigParams pReq; |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7279 | tModifyRoamParamsReqParams modifyRoamParamsReq; |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7280 | eHalStatus status; |
| 7281 | int ret_val; |
| 7282 | static const struct nla_policy policy[PARAM_WIFICONFIG_MAX + 1] = { |
| 7283 | [PARAM_STATS_AVG_FACTOR] = { .type = NLA_U16 }, |
| 7284 | [PARAM_MODULATED_DTIM] = { .type = NLA_U32 }, |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7285 | [PARAM_GUARD_TIME] = { .type = NLA_U32}, |
| 7286 | [PARAM_BCNMISS_PENALTY_PARAM_COUNT] = |
| 7287 | { .type = NLA_U32}, |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7288 | }; |
| 7289 | |
| 7290 | ENTER(); |
| 7291 | |
| 7292 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 7293 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 7294 | return -EINVAL; |
| 7295 | } |
| 7296 | |
| 7297 | ret_val = wlan_hdd_validate_context(pHddCtx); |
| 7298 | if (ret_val) { |
| 7299 | return ret_val; |
| 7300 | } |
| 7301 | |
| 7302 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7303 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7304 | if (nla_parse(tb, PARAM_WIFICONFIG_MAX, data, data_len, policy)) { |
| 7305 | hddLog(LOGE, FL("Invalid ATTR")); |
| 7306 | return -EINVAL; |
| 7307 | } |
| 7308 | |
| 7309 | /* check the Wifi Capability */ |
| 7310 | if ( (TRUE != pHddCtx->cfg_ini->fEnableWifiConfig) && |
| 7311 | (TRUE != sme_IsFeatureSupportedByFW(WIFI_CONFIG))) |
| 7312 | { |
| 7313 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7314 | FL("WIFICONFIG not supported by Firmware")); |
| 7315 | return -EINVAL; |
| 7316 | } |
| 7317 | |
Mahesh A Saptasagar | 41f9ddd | 2016-02-09 14:01:03 +0530 | [diff] [blame] | 7318 | if (tb[PARAM_BCNMISS_PENALTY_PARAM_COUNT]) { |
| 7319 | modifyRoamParamsReq.param = WIFI_CONFIG_SET_BCNMISS_PENALTY_COUNT; |
| 7320 | modifyRoamParamsReq.value = |
| 7321 | nla_get_u32(tb[PARAM_BCNMISS_PENALTY_PARAM_COUNT]); |
| 7322 | |
| 7323 | if (eHAL_STATUS_SUCCESS != |
| 7324 | sme_setBcnMissPenaltyCount(pHddCtx->hHal,&modifyRoamParamsReq)) |
| 7325 | { |
| 7326 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Failed", __func__); |
| 7327 | ret_val = -EINVAL; |
| 7328 | } |
| 7329 | return ret_val; |
| 7330 | } |
| 7331 | |
| 7332 | /* Moved this down in order to provide provision to set beacon |
| 7333 | * miss penalty count irrespective of connection state. |
| 7334 | */ |
| 7335 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) { |
| 7336 | hddLog(LOGE, FL("Not in Connected state!")); |
| 7337 | return -ENOTSUPP; |
| 7338 | } |
| 7339 | |
| 7340 | pReq = vos_mem_malloc(sizeof(tSetWifiConfigParams)); |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7341 | |
| 7342 | if (!pReq) { |
| 7343 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 7344 | "%s: Not able to allocate memory for tSetWifiConfigParams", |
| 7345 | __func__); |
| 7346 | return eHAL_STATUS_E_MALLOC_FAILED; |
| 7347 | } |
| 7348 | |
| 7349 | vos_mem_set(pReq, sizeof(tSetWifiConfigParams), 0); |
| 7350 | |
| 7351 | pReq->sessionId = pAdapter->sessionId; |
| 7352 | vos_mem_copy( &pReq->bssId, pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 7353 | |
| 7354 | if (tb[PARAM_MODULATED_DTIM]) { |
| 7355 | pReq->paramValue = nla_get_u32( |
| 7356 | tb[PARAM_MODULATED_DTIM]); |
| 7357 | hddLog(LOG1, FL("Modulated DTIM: pReq->paramValue:%d "), |
| 7358 | pReq->paramValue); |
Arun Khandavalli | 876886f | 2015-11-23 11:42:27 +0530 | [diff] [blame] | 7359 | pHddCtx->cfg_ini->enableDynamicDTIM = pReq->paramValue; |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7360 | hdd_set_pwrparams(pHddCtx); |
| 7361 | if (BMPS == pmcGetPmcState(pHddCtx->hHal)) { |
| 7362 | hddLog( LOG1, FL("WifiConfig: Requesting FullPower!")); |
| 7363 | |
| 7364 | sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7365 | iw_full_power_cbfn, pAdapter, |
| 7366 | eSME_FULL_PWR_NEEDED_BY_HDD); |
| 7367 | } |
| 7368 | else |
| 7369 | { |
| 7370 | hddLog( LOG1, FL("WifiConfig Not in BMPS state")); |
| 7371 | } |
| 7372 | } |
| 7373 | |
| 7374 | if (tb[PARAM_STATS_AVG_FACTOR]) { |
| 7375 | pReq->paramType = WIFI_CONFIG_SET_AVG_STATS_FACTOR; |
| 7376 | pReq->paramValue = nla_get_u16( |
| 7377 | tb[PARAM_STATS_AVG_FACTOR]); |
| 7378 | hddLog(LOG1, FL("AVG_STATS_FACTOR pReq->paramType:%d,pReq->paramValue:%d "), |
| 7379 | pReq->paramType, pReq->paramValue); |
| 7380 | status = sme_set_wificonfig_params(pHddCtx->hHal, pReq); |
| 7381 | |
| 7382 | if (eHAL_STATUS_SUCCESS != status) |
| 7383 | { |
| 7384 | vos_mem_free(pReq); |
| 7385 | pReq = NULL; |
| 7386 | ret_val = -EPERM; |
| 7387 | return ret_val; |
| 7388 | } |
| 7389 | } |
| 7390 | |
| 7391 | |
| 7392 | if (tb[PARAM_GUARD_TIME]) { |
| 7393 | pReq->paramType = WIFI_CONFIG_SET_GUARD_TIME; |
| 7394 | pReq->paramValue = nla_get_u32( |
| 7395 | tb[PARAM_GUARD_TIME]); |
| 7396 | hddLog(LOG1, FL("GUARD_TIME pReq->paramType:%d,pReq->paramValue:%d "), |
| 7397 | pReq->paramType, pReq->paramValue); |
| 7398 | status = sme_set_wificonfig_params(pHddCtx->hHal, pReq); |
| 7399 | |
| 7400 | if (eHAL_STATUS_SUCCESS != status) |
| 7401 | { |
| 7402 | vos_mem_free(pReq); |
| 7403 | pReq = NULL; |
| 7404 | ret_val = -EPERM; |
| 7405 | return ret_val; |
| 7406 | } |
| 7407 | |
| 7408 | } |
| 7409 | |
| 7410 | EXIT(); |
| 7411 | return ret_val; |
| 7412 | } |
| 7413 | |
| 7414 | /** |
| 7415 | * wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration |
| 7416 | * vendor command |
| 7417 | * |
| 7418 | * @wiphy: wiphy device pointer |
| 7419 | * @wdev: wireless device pointer |
| 7420 | * @data: Vendor command data buffer |
| 7421 | * @data_len: Buffer length |
| 7422 | * |
| 7423 | * Handles QCA_WLAN_VENDOR_ATTR_CONFIG_MAX. |
| 7424 | * |
| 7425 | * Return: EOK or other error codes. |
| 7426 | */ |
| 7427 | static int wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, |
| 7428 | struct wireless_dev *wdev, |
| 7429 | const void *data, |
| 7430 | int data_len) |
| 7431 | { |
| 7432 | int ret; |
| 7433 | |
| 7434 | vos_ssr_protect(__func__); |
| 7435 | ret = __wlan_hdd_cfg80211_wifi_configuration_set(wiphy, wdev, |
| 7436 | data, data_len); |
| 7437 | vos_ssr_unprotect(__func__); |
| 7438 | |
| 7439 | return ret; |
| 7440 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7441 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 7442 | { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 7443 | { |
| 7444 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7445 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING, |
| 7446 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7447 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7448 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7449 | .doit = wlan_hdd_cfg80211_firmware_roaming |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 7450 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 7451 | |
| 7452 | { |
| 7453 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7454 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN, |
| 7455 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7456 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7457 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7458 | .doit = wlan_hdd_cfg80211_nan_request |
| 7459 | }, |
| 7460 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7461 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 7462 | { |
| 7463 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7464 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 7465 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7466 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7467 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7468 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7469 | }, |
| 7470 | |
| 7471 | { |
| 7472 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7473 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 7474 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7475 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7476 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7477 | .doit = wlan_hdd_cfg80211_ll_stats_set |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7478 | }, |
| 7479 | |
| 7480 | { |
| 7481 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7482 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 7483 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7484 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7485 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7486 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7487 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7488 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7489 | #ifdef WLAN_FEATURE_EXTSCAN |
| 7490 | { |
| 7491 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7492 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 7493 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7494 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7495 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7496 | .doit = wlan_hdd_cfg80211_extscan_start |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7497 | }, |
| 7498 | { |
| 7499 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7500 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 7501 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7502 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7503 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7504 | .doit = wlan_hdd_cfg80211_extscan_stop |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7505 | }, |
| 7506 | { |
| 7507 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7508 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 7509 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7510 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7511 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7512 | }, |
| 7513 | { |
| 7514 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7515 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 7516 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7517 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7518 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7519 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7520 | }, |
| 7521 | { |
| 7522 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7523 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 7524 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7525 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7526 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7527 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7528 | }, |
| 7529 | { |
| 7530 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7531 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 7532 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7533 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7534 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7535 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7536 | }, |
| 7537 | { |
| 7538 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7539 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 7540 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7541 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7542 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7543 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7544 | }, |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 7545 | { |
| 7546 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7547 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SSID_HOTLIST, |
| 7548 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7549 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7550 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7551 | .doit = wlan_hdd_cfg80211_extscan_set_ssid_hotlist |
| 7552 | }, |
| 7553 | { |
| 7554 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7555 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SSID_HOTLIST, |
| 7556 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7557 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7558 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7559 | .doit = wlan_hdd_cfg80211_extscan_reset_ssid_hotlist |
| 7560 | }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7561 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7562 | /*EXT TDLS*/ |
| 7563 | { |
| 7564 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7565 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 7566 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7567 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7568 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7569 | .doit = wlan_hdd_cfg80211_exttdls_enable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7570 | }, |
| 7571 | { |
| 7572 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7573 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 7574 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7575 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7576 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7577 | .doit = wlan_hdd_cfg80211_exttdls_disable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7578 | }, |
| 7579 | { |
| 7580 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7581 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 7582 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7583 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7584 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7585 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 7586 | { |
| 7587 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7588 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 7589 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7590 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7591 | .doit = wlan_hdd_cfg80211_get_supported_features |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 7592 | }, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 7593 | { |
| 7594 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7595 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG, |
| 7596 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7597 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7598 | .doit = wlan_hdd_cfg80211_disable_dfs_channels |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 7599 | }, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 7600 | { |
| 7601 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7602 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 7603 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7604 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7605 | .doit = wlan_hdd_cfg80211_set_spoofed_mac_oui |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 7606 | }, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 7607 | { |
| 7608 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7609 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX, |
| 7610 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7611 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7612 | .doit = wlan_hdd_cfg80211_get_concurrency_matrix |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 7613 | }, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 7614 | { |
| 7615 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 7616 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP, |
| 7617 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7618 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7619 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7620 | .doit = wlan_hdd_cfg80211_get_fw_mem_dump |
| 7621 | }, |
| 7622 | { |
| 7623 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 7624 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SETBAND, |
| 7625 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7626 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7627 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7628 | .doit = wlan_hdd_cfg80211_setband |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 7629 | }, |
| 7630 | { |
| 7631 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7632 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_START, |
| 7633 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7634 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 7635 | .doit = wlan_hdd_cfg80211_wifi_logger_start |
| 7636 | }, |
Sushant Kaushik | 847890c | 2015-09-28 16:05:17 +0530 | [diff] [blame] | 7637 | { |
| 7638 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7639 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO, |
| 7640 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7641 | WIPHY_VENDOR_CMD_NEED_NETDEV| |
| 7642 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7643 | .doit = wlan_hdd_cfg80211_get_wifi_info |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 7644 | }, |
| 7645 | { |
| 7646 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7647 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_RING_DATA, |
| 7648 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7649 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7650 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7651 | .doit = wlan_hdd_cfg80211_wifi_logger_get_ring_data |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 7652 | }, |
| 7653 | { |
| 7654 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7655 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI, |
| 7656 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7657 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7658 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7659 | .doit = wlan_hdd_cfg80211_monitor_rssi |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 7660 | }, |
| 7661 | #ifdef WLAN_FEATURE_OFFLOAD_PACKETS |
| 7662 | { |
| 7663 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7664 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_OFFLOADED_PACKETS, |
| 7665 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7666 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7667 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7668 | .doit = wlan_hdd_cfg80211_offloaded_packets |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7669 | }, |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 7670 | #endif |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7671 | { |
| 7672 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7673 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES, |
| 7674 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7675 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7676 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7677 | .doit = wlan_hdd_cfg80211_get_link_properties |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7678 | }, |
| 7679 | { |
| 7680 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7681 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION, |
| 7682 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7683 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7684 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7685 | .doit = wlan_hdd_cfg80211_wifi_configuration_set |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7686 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7687 | }; |
| 7688 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 7689 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7690 | static const |
| 7691 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 7692 | { |
| 7693 | #ifdef FEATURE_WLAN_CH_AVOID |
| 7694 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7695 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7696 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 7697 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7698 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 7699 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 7700 | { |
| 7701 | /* Index = 1*/ |
| 7702 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7703 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 7704 | }, |
| 7705 | { |
| 7706 | /* Index = 2*/ |
| 7707 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7708 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 7709 | }, |
| 7710 | { |
| 7711 | /* Index = 3*/ |
| 7712 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7713 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 7714 | }, |
| 7715 | { |
| 7716 | /* Index = 4*/ |
| 7717 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7718 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 7719 | }, |
| 7720 | { |
| 7721 | /* Index = 5*/ |
| 7722 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7723 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 7724 | }, |
| 7725 | { |
| 7726 | /* Index = 6*/ |
| 7727 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7728 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 7729 | }, |
| 7730 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7731 | #ifdef WLAN_FEATURE_EXTSCAN |
| 7732 | { |
| 7733 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7734 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 7735 | }, |
| 7736 | { |
| 7737 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7738 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 7739 | }, |
| 7740 | { |
| 7741 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7742 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 7743 | }, |
| 7744 | { |
| 7745 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7746 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 7747 | }, |
| 7748 | { |
| 7749 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7750 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 7751 | }, |
| 7752 | { |
| 7753 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7754 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 7755 | }, |
| 7756 | { |
| 7757 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7758 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 7759 | }, |
| 7760 | { |
| 7761 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7762 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 7763 | }, |
| 7764 | { |
| 7765 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7766 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 7767 | }, |
| 7768 | { |
| 7769 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7770 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 7771 | }, |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 7772 | { |
| 7773 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7774 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SSID_HOTLIST |
| 7775 | }, |
| 7776 | { |
| 7777 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7778 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SSID_HOTLIST |
| 7779 | }, |
| 7780 | [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND_INDEX] = { |
| 7781 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7782 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND |
| 7783 | }, |
| 7784 | [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST_INDEX] = { |
| 7785 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7786 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST |
| 7787 | }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7788 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7789 | /*EXT TDLS*/ |
| 7790 | { |
| 7791 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7792 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 7793 | }, |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 7794 | [QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP_INDEX] = { |
| 7795 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7796 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP |
| 7797 | }, |
| 7798 | |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 7799 | |
| 7800 | { |
| 7801 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7802 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN |
| 7803 | }, |
| 7804 | |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 7805 | { |
| 7806 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7807 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO, |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 7808 | }, |
| 7809 | [QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX] = { |
| 7810 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7811 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI |
| 7812 | }, |
Padma, Santhosh Kumar | 7bbc7d9 | 2015-12-08 20:23:19 +0530 | [diff] [blame] | 7813 | [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST_INDEX] = { |
| 7814 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7815 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST |
| 7816 | }, |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 7817 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 7818 | }; |
| 7819 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7820 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 7821 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7822 | * This function is called by hdd_wlan_startup() |
| 7823 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 7824 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7825 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 7826 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7827 | { |
| 7828 | struct wiphy *wiphy; |
| 7829 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7830 | /* |
| 7831 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7832 | */ |
| 7833 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 7834 | |
| 7835 | if (!wiphy) |
| 7836 | { |
| 7837 | /* Print error and jump into err label and free the memory */ |
| 7838 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 7839 | return NULL; |
| 7840 | } |
| 7841 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7842 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7843 | return wiphy; |
| 7844 | } |
| 7845 | |
| 7846 | /* |
| 7847 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7848 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7849 | * private ioctl to change the band value |
| 7850 | */ |
| 7851 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 7852 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 7853 | int i, j; |
| 7854 | eNVChannelEnabledType channelEnabledState; |
| 7855 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7856 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7857 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 7858 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7859 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 7860 | |
| 7861 | if (NULL == wiphy->bands[i]) |
| 7862 | { |
| 7863 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 7864 | __func__, i); |
| 7865 | continue; |
| 7866 | } |
| 7867 | |
| 7868 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 7869 | { |
| 7870 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 7871 | |
| 7872 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 7873 | band->channels[j].hw_value); |
| 7874 | |
| 7875 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 7876 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 7877 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 7878 | continue; |
| 7879 | } |
| 7880 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 7881 | { |
| 7882 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 7883 | continue; |
| 7884 | } |
| 7885 | |
| 7886 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 7887 | NV_CHANNEL_INVALID == channelEnabledState) |
| 7888 | { |
| 7889 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 7890 | } |
| 7891 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 7892 | { |
| 7893 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 7894 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 7895 | } |
| 7896 | else |
| 7897 | { |
| 7898 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 7899 | |IEEE80211_CHAN_RADAR); |
| 7900 | } |
| 7901 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7902 | } |
| 7903 | return 0; |
| 7904 | } |
| 7905 | /* |
| 7906 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7907 | * This function is called by hdd_wlan_startup() |
| 7908 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7909 | * This function is used to initialize and register wiphy structure. |
| 7910 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 7911 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7912 | struct wiphy *wiphy, |
| 7913 | hdd_config_t *pCfg |
| 7914 | ) |
| 7915 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 7916 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 7917 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 7918 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7919 | ENTER(); |
| 7920 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7921 | /* Now bind the underlying wlan device with wiphy */ |
| 7922 | set_wiphy_dev(wiphy, dev); |
| 7923 | |
| 7924 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7925 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 7926 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 7927 | /* the flag for the other case would be initialzed in |
| 7928 | vos_init_wiphy_from_nv_bin */ |
Manjeet Singh | 9e19de6 | 2016-08-18 18:26:41 +0530 | [diff] [blame] | 7929 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 7930 | wiphy->regulatory_flags |= REGULATORY_STRICT_REG; |
| 7931 | #else |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 7932 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 7933 | #endif |
Manjeet Singh | 9e19de6 | 2016-08-18 18:26:41 +0530 | [diff] [blame] | 7934 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 7935 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7936 | /* This will disable updating of NL channels from passive to |
| 7937 | * active if a beacon is received on passive channel. */ |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 7938 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 7939 | wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS; |
| 7940 | #else |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7941 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 7942 | #endif |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7943 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 7944 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7945 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 7946 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 7947 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 7948 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7949 | | WIPHY_FLAG_OFFCHAN_TX; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 7950 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
Rajeev Kumar Sirasanagandla | 0d6dd75 | 2016-08-17 15:01:39 +0530 | [diff] [blame] | 7951 | wiphy->regulatory_flags |= REGULATORY_COUNTRY_IE_IGNORE; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 7952 | #else |
| 7953 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
| 7954 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7955 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 7956 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7957 | #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] | 7958 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 7959 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 7960 | || pCfg->isFastRoamIniFeatureEnabled |
| 7961 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7962 | #ifdef FEATURE_WLAN_ESE |
| 7963 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 7964 | #endif |
| 7965 | ) |
| 7966 | { |
| 7967 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 7968 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 7969 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7970 | #ifdef FEATURE_WLAN_TDLS |
| 7971 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 7972 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 7973 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7974 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 7975 | if (pCfg->configPNOScanSupport) |
| 7976 | { |
| 7977 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 7978 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 7979 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 7980 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 7981 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7982 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7983 | |
Abhishek Singh | 10d8597 | 2015-04-17 10:27:23 +0530 | [diff] [blame] | 7984 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 7985 | wiphy->features |= NL80211_FEATURE_HT_IBSS; |
| 7986 | #endif |
| 7987 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7988 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 7989 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 7990 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7991 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 7992 | driver need to determine what to do with both |
| 7993 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7994 | |
| 7995 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 7996 | #else |
| 7997 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7998 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7999 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8000 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 8001 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 8002 | wiphy->max_scan_ie_len = SIR_MAC_MAX_ADD_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8003 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 8004 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 8005 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8006 | /* Supports STATION & AD-HOC modes right now */ |
Bhargav Shah | 0d2e3e5 | 2015-07-24 16:51:01 +0530 | [diff] [blame] | 8007 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
| 8008 | | BIT(NL80211_IFTYPE_ADHOC) |
| 8009 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 8010 | | BIT(NL80211_IFTYPE_P2P_GO) |
| 8011 | | BIT(NL80211_IFTYPE_AP); |
| 8012 | |
| 8013 | if (VOS_MONITOR_MODE == hdd_get_conparam()) |
| 8014 | { |
| 8015 | wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); |
| 8016 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8017 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 8018 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 8019 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 8020 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 8021 | if( pCfg->enableMCC ) |
| 8022 | { |
| 8023 | /* Currently, supports up to two channels */ |
| 8024 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 8025 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 8026 | if( !pCfg->allowMCCGODiffBI ) |
| 8027 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 8028 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 8029 | } |
| 8030 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 8031 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 8032 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 8033 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 8034 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8035 | /* Before registering we need to update the ht capabilitied based |
| 8036 | * on ini values*/ |
| 8037 | if( !pCfg->ShortGI20MhzEnable ) |
| 8038 | { |
| 8039 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 8040 | 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] | 8041 | } |
| 8042 | |
| 8043 | if( !pCfg->ShortGI40MhzEnable ) |
| 8044 | { |
| 8045 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 8046 | } |
| 8047 | |
| 8048 | if( !pCfg->nChannelBondingMode5GHz ) |
| 8049 | { |
| 8050 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 8051 | } |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 8052 | /* |
| 8053 | * In case of static linked driver at the time of driver unload, |
| 8054 | * module exit doesn't happens. Module cleanup helps in cleaning |
| 8055 | * of static memory. |
| 8056 | * If driver load happens statically, at the time of driver unload, |
| 8057 | * wiphy flags don't get reset because of static memory. |
| 8058 | * It's better not to store channel in static memory. |
| 8059 | */ |
| 8060 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
| 8061 | wiphy->bands[IEEE80211_BAND_2GHZ]->channels = |
| 8062 | (struct ieee80211_channel *)vos_mem_malloc(sizeof(hdd_channels_2_4_GHZ)); |
| 8063 | if (wiphy->bands[IEEE80211_BAND_2GHZ]->channels == NULL) |
| 8064 | { |
| 8065 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8066 | FL("Not enough memory to allocate channels")); |
| 8067 | return -ENOMEM; |
| 8068 | } |
| 8069 | vos_mem_copy(wiphy->bands[IEEE80211_BAND_2GHZ]->channels, |
| 8070 | &hdd_channels_2_4_GHZ[0], |
| 8071 | sizeof(hdd_channels_2_4_GHZ)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8072 | |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 8073 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 8074 | { |
| 8075 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 8076 | wiphy->bands[IEEE80211_BAND_5GHZ]->channels = |
| 8077 | (struct ieee80211_channel *)vos_mem_malloc(sizeof(hdd_channels_5_GHZ)); |
| 8078 | if (wiphy->bands[IEEE80211_BAND_5GHZ]->channels == NULL) |
| 8079 | { |
| 8080 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8081 | FL("Not enough memory to allocate channels")); |
| 8082 | vos_mem_free(wiphy->bands[IEEE80211_BAND_2GHZ]->channels); |
| 8083 | wiphy->bands[IEEE80211_BAND_2GHZ]->channels = NULL; |
| 8084 | return -ENOMEM; |
| 8085 | } |
| 8086 | vos_mem_copy(wiphy->bands[IEEE80211_BAND_5GHZ]->channels, |
| 8087 | &hdd_channels_5_GHZ[0], |
| 8088 | sizeof(hdd_channels_5_GHZ)); |
| 8089 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 8090 | |
| 8091 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 8092 | { |
| 8093 | |
| 8094 | if (NULL == wiphy->bands[i]) |
| 8095 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 8096 | 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] | 8097 | __func__, i); |
| 8098 | continue; |
| 8099 | } |
| 8100 | |
| 8101 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 8102 | { |
| 8103 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 8104 | |
| 8105 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 8106 | { |
| 8107 | // Enable social channels for P2P |
| 8108 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 8109 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 8110 | else |
| 8111 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 8112 | continue; |
| 8113 | } |
| 8114 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 8115 | { |
| 8116 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 8117 | continue; |
| 8118 | } |
| 8119 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8120 | } |
| 8121 | /*Initialise the supported cipher suite details*/ |
| 8122 | wiphy->cipher_suites = hdd_cipher_suites; |
| 8123 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 8124 | |
| 8125 | /*signal strength in mBm (100*dBm) */ |
| 8126 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 8127 | |
| 8128 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 8129 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8130 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8131 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8132 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 8133 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 8134 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 8135 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 8136 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8137 | EXIT(); |
| 8138 | return 0; |
| 8139 | } |
| 8140 | |
| 8141 | /* In this function we are registering wiphy. */ |
| 8142 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 8143 | { |
| 8144 | ENTER(); |
| 8145 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8146 | if (0 > wiphy_register(wiphy)) |
| 8147 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8148 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8149 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 8150 | return -EIO; |
| 8151 | } |
| 8152 | |
| 8153 | EXIT(); |
| 8154 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8155 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8156 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8157 | /* In this function we are updating channel list when, |
| 8158 | regulatory domain is FCC and country code is US. |
| 8159 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 8160 | As per FCC smart phone is not a indoor device. |
| 8161 | GO should not opeate on indoor channels */ |
| 8162 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 8163 | { |
| 8164 | int j; |
| 8165 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 8166 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 8167 | //Default counrtycode from NV at the time of wiphy initialization. |
| 8168 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 8169 | &defaultCountryCode[0])) |
| 8170 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8171 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8172 | } |
| 8173 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 8174 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8175 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 8176 | { |
| 8177 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 8178 | return; |
| 8179 | } |
| 8180 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 8181 | { |
| 8182 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 8183 | // Mark UNII -1 band channel as passive |
| 8184 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 8185 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 8186 | } |
| 8187 | } |
| 8188 | } |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 8189 | /* This function registers for all frame which supplicant is interested in */ |
| 8190 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8191 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8192 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8193 | /* Register for all P2P action, public action etc frames */ |
| 8194 | 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] | 8195 | ENTER(); |
Abhishek Singh | 16e0576 | 2015-11-30 14:29:27 +0530 | [diff] [blame] | 8196 | /* Register frame indication call back */ |
| 8197 | sme_register_mgmt_frame_ind_callback(hHal, hdd_indicate_mgmt_frame); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8198 | /* Right now we are registering these frame when driver is getting |
| 8199 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 8200 | frame register ops, we will move this code as a part of that */ |
| 8201 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8202 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8203 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 8204 | |
| 8205 | /* GAS Initial Response */ |
| 8206 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8207 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8208 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8209 | /* GAS Comeback Request */ |
| 8210 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8211 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 8212 | |
| 8213 | /* GAS Comeback Response */ |
| 8214 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8215 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 8216 | |
| 8217 | /* P2P Public Action */ |
| 8218 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8219 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8220 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 8221 | |
| 8222 | /* P2P Action */ |
| 8223 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8224 | (v_U8_t*)P2P_ACTION_FRAME, |
| 8225 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8226 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 8227 | /* WNM BSS Transition Request frame */ |
| 8228 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8229 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 8230 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 8231 | |
| 8232 | /* WNM-Notification */ |
| 8233 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8234 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 8235 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8236 | } |
| 8237 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 8238 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8239 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8240 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8241 | /* Register for all P2P action, public action etc frames */ |
| 8242 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 8243 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8244 | ENTER(); |
| 8245 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8246 | /* Right now we are registering these frame when driver is getting |
| 8247 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 8248 | frame register ops, we will move this code as a part of that */ |
| 8249 | /* GAS Initial Request */ |
| 8250 | |
| 8251 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8252 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 8253 | |
| 8254 | /* GAS Initial Response */ |
| 8255 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8256 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8257 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8258 | /* GAS Comeback Request */ |
| 8259 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8260 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 8261 | |
| 8262 | /* GAS Comeback Response */ |
| 8263 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8264 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 8265 | |
| 8266 | /* P2P Public Action */ |
| 8267 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8268 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8269 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 8270 | |
| 8271 | /* P2P Action */ |
| 8272 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8273 | (v_U8_t*)P2P_ACTION_FRAME, |
| 8274 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 8275 | /* WNM-Notification */ |
| 8276 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8277 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 8278 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8279 | } |
| 8280 | |
| 8281 | #ifdef FEATURE_WLAN_WAPI |
| 8282 | 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] | 8283 | const u8 *mac_addr, const u8 *key , int key_Len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8284 | { |
| 8285 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8286 | tCsrRoamSetKey setKey; |
| 8287 | v_BOOL_t isConnected = TRUE; |
| 8288 | int status = 0; |
| 8289 | v_U32_t roamId= 0xFF; |
| 8290 | tANI_U8 *pKeyPtr = NULL; |
| 8291 | int n = 0; |
| 8292 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8293 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 8294 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8295 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8296 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 8297 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8298 | setKey.keyId = key_index; // Store Key ID |
| 8299 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 8300 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 8301 | setKey.paeRole = 0 ; // the PAE role |
| 8302 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 8303 | { |
| 8304 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 8305 | } |
| 8306 | else |
| 8307 | { |
| 8308 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 8309 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 8310 | } |
| 8311 | setKey.keyLength = key_Len; |
| 8312 | pKeyPtr = setKey.Key; |
| 8313 | memcpy( pKeyPtr, key, key_Len); |
| 8314 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8315 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8316 | __func__, key_Len); |
| 8317 | for (n = 0 ; n < key_Len; n++) |
| 8318 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 8319 | __func__,n,setKey.Key[n]); |
| 8320 | |
| 8321 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 8322 | if ( isConnected ) |
| 8323 | { |
| 8324 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8325 | pAdapter->sessionId, &setKey, &roamId ); |
| 8326 | } |
| 8327 | if ( status != 0 ) |
| 8328 | { |
| 8329 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8330 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 8331 | __LINE__, status ); |
| 8332 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 8333 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8334 | /* Need to clear any trace of key value in the memory. |
| 8335 | * Thus zero out the memory even though it is local |
| 8336 | * variable. |
| 8337 | */ |
| 8338 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8339 | } |
| 8340 | #endif /* FEATURE_WLAN_WAPI*/ |
| 8341 | |
| 8342 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8343 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8344 | beacon_data_t **ppBeacon, |
| 8345 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8346 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8347 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8348 | beacon_data_t **ppBeacon, |
| 8349 | struct cfg80211_beacon_data *params, |
| 8350 | int dtim_period) |
| 8351 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8352 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8353 | int size; |
| 8354 | beacon_data_t *beacon = NULL; |
| 8355 | beacon_data_t *old = NULL; |
| 8356 | int head_len,tail_len; |
| 8357 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8358 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8359 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8360 | { |
| 8361 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8362 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8363 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8364 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8365 | |
| 8366 | old = pAdapter->sessionCtx.ap.beacon; |
| 8367 | |
| 8368 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8369 | { |
| 8370 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8371 | FL("session(%d) old and new heads points to NULL"), |
| 8372 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8373 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8374 | } |
| 8375 | |
| 8376 | if (params->tail && !params->tail_len) |
| 8377 | { |
| 8378 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8379 | FL("tail_len is zero but tail is not NULL")); |
| 8380 | return -EINVAL; |
| 8381 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8382 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8383 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 8384 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 8385 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8386 | { |
| 8387 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8388 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8389 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8390 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8391 | #endif |
| 8392 | |
| 8393 | if(params->head) |
| 8394 | head_len = params->head_len; |
| 8395 | else |
| 8396 | head_len = old->head_len; |
| 8397 | |
| 8398 | if(params->tail || !old) |
| 8399 | tail_len = params->tail_len; |
| 8400 | else |
| 8401 | tail_len = old->tail_len; |
| 8402 | |
| 8403 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 8404 | |
| 8405 | beacon = kzalloc(size, GFP_KERNEL); |
| 8406 | |
| 8407 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8408 | { |
| 8409 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8410 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8411 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8412 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8413 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8414 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8415 | if(params->dtim_period || !old ) |
| 8416 | beacon->dtim_period = params->dtim_period; |
| 8417 | else |
| 8418 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8419 | #else |
| 8420 | if(dtim_period || !old ) |
| 8421 | beacon->dtim_period = dtim_period; |
| 8422 | else |
| 8423 | beacon->dtim_period = old->dtim_period; |
| 8424 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8425 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8426 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 8427 | beacon->tail = beacon->head + head_len; |
| 8428 | beacon->head_len = head_len; |
| 8429 | beacon->tail_len = tail_len; |
| 8430 | |
| 8431 | if(params->head) { |
| 8432 | memcpy (beacon->head,params->head,beacon->head_len); |
| 8433 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8434 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8435 | if(old) |
| 8436 | memcpy (beacon->head,old->head,beacon->head_len); |
| 8437 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8438 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8439 | if(params->tail) { |
| 8440 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 8441 | } |
| 8442 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8443 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8444 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 8445 | } |
| 8446 | |
| 8447 | *ppBeacon = beacon; |
| 8448 | |
| 8449 | kfree(old); |
| 8450 | |
| 8451 | return 0; |
| 8452 | |
| 8453 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8454 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 8455 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr( |
| 8456 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 8457 | const v_U8_t *pIes, |
| 8458 | #else |
| 8459 | v_U8_t *pIes, |
| 8460 | #endif |
| 8461 | int length, v_U8_t eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8462 | { |
| 8463 | int left = length; |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 8464 | v_U8_t *ptr = (v_U8_t *)pIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8465 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8466 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8467 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8468 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8469 | elem_id = ptr[0]; |
| 8470 | elem_len = ptr[1]; |
| 8471 | left -= 2; |
| 8472 | if(elem_len > left) |
| 8473 | { |
| 8474 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 8475 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8476 | eid,elem_len,left); |
| 8477 | return NULL; |
| 8478 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8479 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8480 | { |
| 8481 | return ptr; |
| 8482 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8483 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8484 | left -= elem_len; |
| 8485 | ptr += (elem_len + 2); |
| 8486 | } |
| 8487 | return NULL; |
| 8488 | } |
| 8489 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8490 | /* Check if rate is 11g rate or not */ |
| 8491 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 8492 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 8493 | 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] | 8494 | u8 i; |
| 8495 | for (i = 0; i < 8; i++) |
| 8496 | { |
| 8497 | if(rate == gRateArray[i]) |
| 8498 | return TRUE; |
| 8499 | } |
| 8500 | return FALSE; |
| 8501 | } |
| 8502 | |
| 8503 | /* Check for 11g rate and set proper 11g only mode */ |
| 8504 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 8505 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 8506 | { |
| 8507 | u8 i, num_rates = pIe[0]; |
| 8508 | |
| 8509 | pIe += 1; |
| 8510 | for ( i = 0; i < num_rates; i++) |
| 8511 | { |
| 8512 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 8513 | { |
| 8514 | /* If rate set have 11g rate than change the mode to 11G */ |
| 8515 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 8516 | if (pIe[i] & BASIC_RATE_MASK) |
| 8517 | { |
| 8518 | /* If we have 11g rate as basic rate, it means mode |
| 8519 | is 11g only mode. |
| 8520 | */ |
| 8521 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 8522 | *pCheckRatesfor11g = FALSE; |
| 8523 | } |
| 8524 | } |
| 8525 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 8526 | { |
| 8527 | *require_ht = TRUE; |
| 8528 | } |
| 8529 | } |
| 8530 | return; |
| 8531 | } |
| 8532 | |
| 8533 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 8534 | { |
| 8535 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 8536 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 8537 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 8538 | u8 checkRatesfor11g = TRUE; |
| 8539 | u8 require_ht = FALSE; |
| 8540 | u8 *pIe=NULL; |
| 8541 | |
| 8542 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 8543 | |
| 8544 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 8545 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 8546 | if (pIe != NULL) |
| 8547 | { |
| 8548 | pIe += 1; |
| 8549 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 8550 | &pConfig->SapHw_mode); |
| 8551 | } |
| 8552 | |
| 8553 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 8554 | WLAN_EID_EXT_SUPP_RATES); |
| 8555 | if (pIe != NULL) |
| 8556 | { |
| 8557 | |
| 8558 | pIe += 1; |
| 8559 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 8560 | &pConfig->SapHw_mode); |
| 8561 | } |
| 8562 | |
| 8563 | if( pConfig->channel > 14 ) |
| 8564 | { |
| 8565 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 8566 | } |
| 8567 | |
| 8568 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 8569 | WLAN_EID_HT_CAPABILITY); |
| 8570 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8571 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8572 | { |
| 8573 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 8574 | if(require_ht) |
| 8575 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 8576 | } |
| 8577 | } |
| 8578 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8579 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 8580 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 8581 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 8582 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8583 | v_U8_t *pIe = NULL; |
| 8584 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 8585 | |
| 8586 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 8587 | pBeacon->tail, pBeacon->tail_len); |
| 8588 | |
| 8589 | if (pIe) |
| 8590 | { |
| 8591 | ielen = pIe[1] + 2; |
| 8592 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 8593 | { |
| 8594 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 8595 | } |
| 8596 | else |
| 8597 | { |
| 8598 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 8599 | return -EINVAL; |
| 8600 | } |
| 8601 | *total_ielen += ielen; |
| 8602 | } |
| 8603 | return 0; |
| 8604 | } |
| 8605 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 8606 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 8607 | v_U8_t *genie, v_U8_t *total_ielen) |
| 8608 | { |
| 8609 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 8610 | int left = pBeacon->tail_len; |
| 8611 | v_U8_t *ptr = pBeacon->tail; |
| 8612 | v_U8_t elem_id, elem_len; |
| 8613 | v_U16_t ielen = 0; |
| 8614 | |
| 8615 | if ( NULL == ptr || 0 == left ) |
| 8616 | return; |
| 8617 | |
| 8618 | while (left >= 2) |
| 8619 | { |
| 8620 | elem_id = ptr[0]; |
| 8621 | elem_len = ptr[1]; |
| 8622 | left -= 2; |
| 8623 | if (elem_len > left) |
| 8624 | { |
| 8625 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 8626 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 8627 | elem_id, elem_len, left); |
| 8628 | return; |
| 8629 | } |
| 8630 | if (IE_EID_VENDOR == elem_id) |
| 8631 | { |
| 8632 | /* skipping the VSIE's which we don't want to include or |
| 8633 | * it will be included by existing code |
| 8634 | */ |
| 8635 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 8636 | #ifdef WLAN_FEATURE_WFD |
| 8637 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 8638 | #endif |
| 8639 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 8640 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 8641 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 8642 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 8643 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 8644 | { |
| 8645 | ielen = ptr[1] + 2; |
| 8646 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 8647 | { |
| 8648 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 8649 | *total_ielen += ielen; |
| 8650 | } |
| 8651 | else |
| 8652 | { |
| 8653 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 8654 | "IE Length is too big " |
| 8655 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 8656 | elem_id, elem_len, *total_ielen); |
| 8657 | } |
| 8658 | } |
| 8659 | } |
| 8660 | |
| 8661 | left -= elem_len; |
| 8662 | ptr += (elem_len + 2); |
| 8663 | } |
| 8664 | return; |
| 8665 | } |
| 8666 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8667 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8668 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 8669 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8670 | #else |
| 8671 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 8672 | struct cfg80211_beacon_data *params) |
| 8673 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8674 | { |
| 8675 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8676 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8677 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8678 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8679 | |
| 8680 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 8681 | |
| 8682 | if(genie == NULL) { |
| 8683 | |
| 8684 | return -ENOMEM; |
| 8685 | } |
| 8686 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8687 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 8688 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8689 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8690 | hddLog(LOGE, |
| 8691 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8692 | ret = -EINVAL; |
| 8693 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8694 | } |
| 8695 | |
| 8696 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8697 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 8698 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 8699 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8700 | hddLog(LOGE, |
| 8701 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8702 | ret = -EINVAL; |
| 8703 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8704 | } |
| 8705 | #endif |
| 8706 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8707 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 8708 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8709 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8710 | hddLog(LOGE, |
| 8711 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8712 | ret = -EINVAL; |
| 8713 | goto done; |
| 8714 | } |
| 8715 | |
| 8716 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 8717 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 8718 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8719 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8720 | |
| 8721 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8722 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 8723 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 8724 | { |
| 8725 | hddLog(LOGE, |
| 8726 | "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] | 8727 | ret = -EINVAL; |
| 8728 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8729 | } |
| 8730 | |
| 8731 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8732 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 8733 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 8734 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 8735 | ==eHAL_STATUS_FAILURE) |
| 8736 | { |
| 8737 | hddLog(LOGE, |
| 8738 | "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] | 8739 | ret = -EINVAL; |
| 8740 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8741 | } |
| 8742 | |
| 8743 | // Added for ProResp IE |
| 8744 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 8745 | { |
| 8746 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 8747 | u8 probe_rsp_ie_len[3] = {0}; |
| 8748 | u8 counter = 0; |
| 8749 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 8750 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 8751 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 8752 | Store More then 255 bytes into One Variable. |
| 8753 | */ |
| 8754 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 8755 | { |
| 8756 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 8757 | { |
| 8758 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 8759 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 8760 | } |
| 8761 | else |
| 8762 | { |
| 8763 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 8764 | rem_probe_resp_ie_len = 0; |
| 8765 | } |
| 8766 | } |
| 8767 | |
| 8768 | rem_probe_resp_ie_len = 0; |
| 8769 | |
| 8770 | if (probe_rsp_ie_len[0] > 0) |
| 8771 | { |
| 8772 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8773 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 8774 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 8775 | probe_rsp_ie_len[0], NULL, |
| 8776 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 8777 | { |
| 8778 | hddLog(LOGE, |
| 8779 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8780 | ret = -EINVAL; |
| 8781 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8782 | } |
| 8783 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 8784 | } |
| 8785 | |
| 8786 | if (probe_rsp_ie_len[1] > 0) |
| 8787 | { |
| 8788 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8789 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 8790 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 8791 | probe_rsp_ie_len[1], NULL, |
| 8792 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 8793 | { |
| 8794 | hddLog(LOGE, |
| 8795 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8796 | ret = -EINVAL; |
| 8797 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8798 | } |
| 8799 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 8800 | } |
| 8801 | |
| 8802 | if (probe_rsp_ie_len[2] > 0) |
| 8803 | { |
| 8804 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8805 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 8806 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 8807 | probe_rsp_ie_len[2], NULL, |
| 8808 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 8809 | { |
| 8810 | hddLog(LOGE, |
| 8811 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8812 | ret = -EINVAL; |
| 8813 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8814 | } |
| 8815 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 8816 | } |
| 8817 | |
| 8818 | if (probe_rsp_ie_len[1] == 0 ) |
| 8819 | { |
| 8820 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8821 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 8822 | eANI_BOOLEAN_FALSE) ) |
| 8823 | { |
| 8824 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8825 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8826 | } |
| 8827 | } |
| 8828 | |
| 8829 | if (probe_rsp_ie_len[2] == 0 ) |
| 8830 | { |
| 8831 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8832 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 8833 | eANI_BOOLEAN_FALSE) ) |
| 8834 | { |
| 8835 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8836 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8837 | } |
| 8838 | } |
| 8839 | |
| 8840 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8841 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 8842 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 8843 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 8844 | == eHAL_STATUS_FAILURE) |
| 8845 | { |
| 8846 | hddLog(LOGE, |
| 8847 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8848 | ret = -EINVAL; |
| 8849 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8850 | } |
| 8851 | } |
| 8852 | else |
| 8853 | { |
| 8854 | // Reset WNI_CFG_PROBE_RSP Flags |
| 8855 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 8856 | |
| 8857 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8858 | "%s: No Probe Response IE received in set beacon", |
| 8859 | __func__); |
| 8860 | } |
| 8861 | |
| 8862 | // Added for AssocResp IE |
| 8863 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 8864 | { |
| 8865 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8866 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 8867 | params->assocresp_ies_len, NULL, |
| 8868 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 8869 | { |
| 8870 | hddLog(LOGE, |
| 8871 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8872 | ret = -EINVAL; |
| 8873 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8874 | } |
| 8875 | |
| 8876 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8877 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 8878 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 8879 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 8880 | == eHAL_STATUS_FAILURE) |
| 8881 | { |
| 8882 | hddLog(LOGE, |
| 8883 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8884 | ret = -EINVAL; |
| 8885 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8886 | } |
| 8887 | } |
| 8888 | else |
| 8889 | { |
| 8890 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8891 | "%s: No Assoc Response IE received in set beacon", |
| 8892 | __func__); |
| 8893 | |
| 8894 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8895 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 8896 | eANI_BOOLEAN_FALSE) ) |
| 8897 | { |
| 8898 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8899 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8900 | } |
| 8901 | } |
| 8902 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8903 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8904 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8905 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8906 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8907 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8908 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8909 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 8910 | * called by wlan_hdd_cfg80211_start_bss() and |
| 8911 | * wlan_hdd_cfg80211_set_channel() |
| 8912 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8913 | * channel list. |
| 8914 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 8915 | 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] | 8916 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8917 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8918 | v_U32_t num_ch = 0; |
| 8919 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 8920 | u32 indx = 0; |
| 8921 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8922 | v_U8_t fValidChannel = FALSE, count = 0; |
| 8923 | 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] | 8924 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8925 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 8926 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8927 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8928 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8929 | /* Validate the channel */ |
| 8930 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8931 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8932 | if ( channel == rfChannels[count].channelNum ) |
| 8933 | { |
| 8934 | fValidChannel = TRUE; |
| 8935 | break; |
| 8936 | } |
| 8937 | } |
| 8938 | if (fValidChannel != TRUE) |
| 8939 | { |
| 8940 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8941 | "%s: Invalid Channel [%d]", __func__, channel); |
| 8942 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8943 | } |
| 8944 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8945 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8946 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8947 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 8948 | valid_ch, &num_ch)) |
| 8949 | { |
| 8950 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8951 | "%s: failed to get valid channel list", __func__); |
| 8952 | return VOS_STATUS_E_FAILURE; |
| 8953 | } |
| 8954 | for (indx = 0; indx < num_ch; indx++) |
| 8955 | { |
| 8956 | if (channel == valid_ch[indx]) |
| 8957 | { |
| 8958 | break; |
| 8959 | } |
| 8960 | } |
| 8961 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 8962 | if (indx >= num_ch) |
| 8963 | { |
| 8964 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 8965 | { |
| 8966 | eCsrBand band; |
| 8967 | unsigned int freq; |
| 8968 | |
| 8969 | sme_GetFreqBand(hHal, &band); |
| 8970 | |
| 8971 | if (eCSR_BAND_5G == band) |
| 8972 | { |
| 8973 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 8974 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 8975 | { |
| 8976 | freq = ieee80211_channel_to_frequency(channel, |
| 8977 | IEEE80211_BAND_2GHZ); |
| 8978 | } |
| 8979 | else |
| 8980 | { |
| 8981 | freq = ieee80211_channel_to_frequency(channel, |
| 8982 | IEEE80211_BAND_5GHZ); |
| 8983 | } |
| 8984 | #else |
| 8985 | freq = ieee80211_channel_to_frequency(channel); |
| 8986 | #endif |
| 8987 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 8988 | return VOS_STATUS_SUCCESS; |
| 8989 | } |
| 8990 | } |
| 8991 | |
| 8992 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8993 | "%s: Invalid Channel [%d]", __func__, channel); |
| 8994 | return VOS_STATUS_E_FAILURE; |
| 8995 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8996 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 8997 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8998 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8999 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9000 | } |
| 9001 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9002 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9003 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9004 | * This function is used to set the channel number |
| 9005 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9006 | 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] | 9007 | struct ieee80211_channel *chan, |
| 9008 | enum nl80211_channel_type channel_type |
| 9009 | ) |
| 9010 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9011 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9012 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9013 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9014 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9015 | hdd_context_t *pHddCtx; |
| 9016 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9017 | |
| 9018 | ENTER(); |
| 9019 | |
| 9020 | if( NULL == dev ) |
| 9021 | { |
| 9022 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9023 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9024 | return -ENODEV; |
| 9025 | } |
| 9026 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9027 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9028 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9029 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 9030 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9031 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9032 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 9033 | hdd_device_modetoString(pAdapter->device_mode), |
| 9034 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9035 | |
| 9036 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9037 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9038 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9039 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9040 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9041 | } |
| 9042 | |
| 9043 | /* |
| 9044 | * Do freq to chan conversion |
| 9045 | * TODO: for 11a |
| 9046 | */ |
| 9047 | |
| 9048 | channel = ieee80211_frequency_to_channel(freq); |
| 9049 | |
| 9050 | /* Check freq range */ |
| 9051 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 9052 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 9053 | { |
| 9054 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9055 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9056 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 9057 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 9058 | return -EINVAL; |
| 9059 | } |
| 9060 | |
| 9061 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 9062 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 9063 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 9064 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9065 | { |
| 9066 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 9067 | { |
| 9068 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9069 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9070 | return -EINVAL; |
| 9071 | } |
| 9072 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 9073 | "%s: set channel to [%d] for device mode =%d", |
| 9074 | __func__, channel,pAdapter->device_mode); |
| 9075 | } |
| 9076 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9077 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9078 | ) |
| 9079 | { |
| 9080 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9081 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 9082 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9083 | |
| 9084 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 9085 | { |
| 9086 | /* Link is up then return cant set channel*/ |
| 9087 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9088 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9089 | return -EINVAL; |
| 9090 | } |
| 9091 | |
| 9092 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 9093 | pHddStaCtx->conn_info.operationChannel = channel; |
| 9094 | pRoamProfile->ChannelInfo.ChannelList = |
| 9095 | &pHddStaCtx->conn_info.operationChannel; |
| 9096 | } |
| 9097 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9098 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9099 | ) |
| 9100 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9101 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 9102 | { |
| 9103 | if(VOS_STATUS_SUCCESS != |
| 9104 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 9105 | { |
| 9106 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9107 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9108 | return -EINVAL; |
| 9109 | } |
| 9110 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 9111 | } |
| 9112 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9113 | { |
| 9114 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 9115 | |
| 9116 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 9117 | channel set by supplicant |
| 9118 | */ |
| 9119 | if ( cfg_param->apAutoChannelSelection ) |
| 9120 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9121 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 9122 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9123 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9124 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 9125 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9126 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9127 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9128 | else |
| 9129 | { |
| 9130 | if(VOS_STATUS_SUCCESS != |
| 9131 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 9132 | { |
| 9133 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9134 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9135 | return -EINVAL; |
| 9136 | } |
| 9137 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 9138 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9139 | } |
| 9140 | } |
| 9141 | else |
| 9142 | { |
| 9143 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 9144 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 9145 | return -EINVAL; |
| 9146 | } |
| 9147 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9148 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9149 | } |
| 9150 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9151 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 9152 | struct net_device *dev, |
| 9153 | struct ieee80211_channel *chan, |
| 9154 | enum nl80211_channel_type channel_type |
| 9155 | ) |
| 9156 | { |
| 9157 | int ret; |
| 9158 | |
| 9159 | vos_ssr_protect(__func__); |
| 9160 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 9161 | vos_ssr_unprotect(__func__); |
| 9162 | |
| 9163 | return ret; |
| 9164 | } |
| 9165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9166 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9167 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 9168 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9169 | #else |
| 9170 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 9171 | struct cfg80211_beacon_data *params, |
| 9172 | const u8 *ssid, size_t ssid_len, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 9173 | enum nl80211_hidden_ssid hidden_ssid, |
| 9174 | v_U8_t auth_type) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9175 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9176 | { |
| 9177 | tsap_Config_t *pConfig; |
| 9178 | beacon_data_t *pBeacon = NULL; |
| 9179 | struct ieee80211_mgmt *pMgmt_frame; |
| 9180 | v_U8_t *pIe=NULL; |
| 9181 | v_U16_t capab_info; |
| 9182 | eCsrAuthType RSNAuthType; |
| 9183 | eCsrEncryptionType RSNEncryptType; |
| 9184 | eCsrEncryptionType mcRSNEncryptType; |
| 9185 | int status = VOS_STATUS_SUCCESS; |
| 9186 | tpWLAN_SAPEventCB pSapEventCallback; |
| 9187 | hdd_hostapd_state_t *pHostapdState; |
| 9188 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 9189 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 9190 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9191 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 9192 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9193 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 9194 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 9195 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 9196 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 9197 | v_BOOL_t MFPRequired = VOS_FALSE; |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 9198 | v_BOOL_t sapEnable11AC = |
| 9199 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9200 | ENTER(); |
| 9201 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 9202 | iniConfig = pHddCtx->cfg_ini; |
| 9203 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9204 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 9205 | |
| 9206 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 9207 | |
| 9208 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 9209 | |
| 9210 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 9211 | |
| 9212 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 9213 | |
| 9214 | //channel is already set in the set_channel Call back |
| 9215 | //pConfig->channel = pCommitConfig->channel; |
| 9216 | |
| 9217 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9218 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9219 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 9220 | |
| 9221 | pConfig->dtim_period = pBeacon->dtim_period; |
| 9222 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9223 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9224 | pConfig->dtim_period); |
| 9225 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 9226 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9227 | { |
| 9228 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9229 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 9230 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 9231 | { |
| 9232 | tANI_BOOLEAN restartNeeded; |
| 9233 | pConfig->ieee80211d = 1; |
| 9234 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 9235 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 9236 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 9237 | } |
| 9238 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9239 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9240 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9241 | pConfig->ieee80211d = 1; |
| 9242 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 9243 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 9244 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9245 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9246 | else |
| 9247 | { |
| 9248 | pConfig->ieee80211d = 0; |
| 9249 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 9250 | /* |
| 9251 | * If auto channel is configured i.e. channel is 0, |
| 9252 | * so skip channel validation. |
| 9253 | */ |
| 9254 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 9255 | { |
| 9256 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 9257 | { |
| 9258 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9259 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 9260 | return -EINVAL; |
| 9261 | } |
| 9262 | } |
| 9263 | else |
| 9264 | { |
| 9265 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 9266 | { |
| 9267 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 9268 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 9269 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 9270 | } |
| 9271 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 9272 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9273 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9274 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9275 | { |
| 9276 | pConfig->ieee80211d = 0; |
| 9277 | } |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 9278 | |
| 9279 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9280 | if (params->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 9281 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 9282 | else if (params->auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 9283 | pConfig->authType = eSAP_SHARED_KEY; |
| 9284 | else |
| 9285 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 9286 | #else |
| 9287 | if (auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 9288 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 9289 | else if (auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 9290 | pConfig->authType = eSAP_SHARED_KEY; |
| 9291 | else |
| 9292 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 9293 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9294 | |
| 9295 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9296 | |
| 9297 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9298 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 9299 | |
| 9300 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 9301 | |
| 9302 | /*Set wps station to configured*/ |
| 9303 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 9304 | |
| 9305 | if(pIe) |
| 9306 | { |
| 9307 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 9308 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9309 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9310 | return -EINVAL; |
| 9311 | } |
| 9312 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 9313 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 9314 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9315 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 9316 | * WPS state |
| 9317 | */ |
| 9318 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 9319 | { |
| 9320 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 9321 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 9322 | { |
| 9323 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 9324 | } |
| 9325 | } |
| 9326 | } |
| 9327 | else |
| 9328 | { |
| 9329 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 9330 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9331 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9332 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 9333 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 9334 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 9335 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 9336 | eCSR_ENCRYPT_TYPE_NONE; |
| 9337 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9338 | pConfig->RSNWPAReqIELength = 0; |
| 9339 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9340 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9341 | WLAN_EID_RSN); |
| 9342 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9343 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9344 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 9345 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 9346 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9347 | /* The actual processing may eventually be more extensive than |
| 9348 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9349 | * by the app. |
| 9350 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9351 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9352 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 9353 | &RSNEncryptType, |
| 9354 | &mcRSNEncryptType, |
| 9355 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 9356 | &MFPCapable, |
| 9357 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9358 | pConfig->pRSNWPAReqIE[1]+2, |
| 9359 | pConfig->pRSNWPAReqIE ); |
| 9360 | |
| 9361 | if( VOS_STATUS_SUCCESS == status ) |
| 9362 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9363 | /* Now copy over all the security attributes you have |
| 9364 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9365 | * */ |
| 9366 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 9367 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 9368 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 9369 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 9370 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9371 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9372 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 9373 | } |
| 9374 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9375 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9376 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 9377 | pBeacon->tail, pBeacon->tail_len); |
| 9378 | |
| 9379 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 9380 | { |
| 9381 | if (pConfig->pRSNWPAReqIE) |
| 9382 | { |
| 9383 | /*Mixed mode WPA/WPA2*/ |
| 9384 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 9385 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 9386 | } |
| 9387 | else |
| 9388 | { |
| 9389 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 9390 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 9391 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9392 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9393 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 9394 | &RSNEncryptType, |
| 9395 | &mcRSNEncryptType, |
| 9396 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 9397 | &MFPCapable, |
| 9398 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9399 | pConfig->pRSNWPAReqIE[1]+2, |
| 9400 | pConfig->pRSNWPAReqIE ); |
| 9401 | |
| 9402 | if( VOS_STATUS_SUCCESS == status ) |
| 9403 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9404 | /* Now copy over all the security attributes you have |
| 9405 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9406 | * */ |
| 9407 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 9408 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 9409 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 9410 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 9411 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9412 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9413 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 9414 | } |
| 9415 | } |
| 9416 | } |
| 9417 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9418 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 9419 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 9420 | return -EINVAL; |
| 9421 | } |
| 9422 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9423 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 9424 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9425 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9426 | if (params->ssid != NULL) |
| 9427 | { |
| 9428 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 9429 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 9430 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 9431 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 9432 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9433 | #else |
| 9434 | if (ssid != NULL) |
| 9435 | { |
| 9436 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 9437 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 9438 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 9439 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 9440 | } |
| 9441 | #endif |
| 9442 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9443 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9444 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9445 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9446 | /* default value */ |
| 9447 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 9448 | pConfig->num_accept_mac = 0; |
| 9449 | pConfig->num_deny_mac = 0; |
| 9450 | |
| 9451 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 9452 | pBeacon->tail, pBeacon->tail_len); |
| 9453 | |
| 9454 | /* pIe for black list is following form: |
| 9455 | type : 1 byte |
| 9456 | length : 1 byte |
| 9457 | OUI : 4 bytes |
| 9458 | acl type : 1 byte |
| 9459 | no of mac addr in black list: 1 byte |
| 9460 | 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] | 9461 | */ |
| 9462 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9463 | { |
| 9464 | pConfig->SapMacaddr_acl = pIe[6]; |
| 9465 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9466 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9467 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 9468 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 9469 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9470 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 9471 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 9472 | { |
| 9473 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 9474 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9475 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9476 | } |
| 9477 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 9478 | pBeacon->tail, pBeacon->tail_len); |
| 9479 | |
| 9480 | /* pIe for white list is following form: |
| 9481 | type : 1 byte |
| 9482 | length : 1 byte |
| 9483 | OUI : 4 bytes |
| 9484 | acl type : 1 byte |
| 9485 | no of mac addr in white list: 1 byte |
| 9486 | 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] | 9487 | */ |
| 9488 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9489 | { |
| 9490 | pConfig->SapMacaddr_acl = pIe[6]; |
| 9491 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9492 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9493 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 9494 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 9495 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9496 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 9497 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 9498 | { |
| 9499 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 9500 | acl_entry++; |
| 9501 | } |
| 9502 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 9503 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9504 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 9505 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9506 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 9507 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 9508 | * This is valid only if mode is set to 11n in hostapd, sapEnable11AC |
| 9509 | * 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] | 9510 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 9511 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 9512 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 9513 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 9514 | (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 9515 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9516 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 9517 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9518 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 9519 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 9520 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 9521 | /* If ACS disable and selected channel <= 14 |
| 9522 | * OR |
| 9523 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 9524 | * AND |
| 9525 | * VHT in 2.4G Disabled |
| 9526 | * THEN |
| 9527 | * Fallback to 11N mode |
| 9528 | */ |
| 9529 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 9530 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 9531 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 9532 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 9533 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 9534 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 9535 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 9536 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 9537 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9538 | } |
| 9539 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9540 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9541 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 9542 | pConfig->ht_capab = |
| 9543 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 9544 | |
| 9545 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 9546 | { |
| 9547 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 9548 | return -EINVAL; |
| 9549 | } |
| 9550 | |
| 9551 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9552 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9553 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 9554 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9555 | pConfig->obssProtEnabled = |
| 9556 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9557 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 9558 | #ifdef WLAN_FEATURE_11W |
| 9559 | pConfig->mfpCapable = MFPCapable; |
| 9560 | pConfig->mfpRequired = MFPRequired; |
| 9561 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 9562 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 9563 | #endif |
| 9564 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9565 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9566 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9567 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 9568 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 9569 | (int)pConfig->channel); |
| 9570 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 9571 | pConfig->SapHw_mode, pConfig->privacy, |
| 9572 | pConfig->authType); |
| 9573 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 9574 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 9575 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 9576 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9577 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9578 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9579 | { |
| 9580 | //Bss already started. just return. |
| 9581 | //TODO Probably it should update some beacon params. |
| 9582 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 9583 | EXIT(); |
| 9584 | return 0; |
| 9585 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9586 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 9587 | if (vos_max_concurrent_connections_reached()) { |
| 9588 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 9589 | return -EINVAL; |
| 9590 | } |
| 9591 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9592 | pConfig->persona = pHostapdAdapter->device_mode; |
| 9593 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 9594 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 9595 | if ( NULL != psmeConfig) |
| 9596 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 9597 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 9598 | sme_GetConfigParam(hHal, psmeConfig); |
| 9599 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 9600 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 9601 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 9602 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 9603 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 9604 | { |
| 9605 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 9606 | sme_UpdateConfig (hHal, psmeConfig); |
| 9607 | } |
| 9608 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 9609 | vos_mem_free(psmeConfig); |
| 9610 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 9611 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 9612 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9613 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 9614 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 9615 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 9616 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9617 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9618 | return -EINVAL; |
| 9619 | } |
| 9620 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9621 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9622 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 9623 | |
| 9624 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9625 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9626 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9627 | { |
| 9628 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9629 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 9630 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9631 | VOS_ASSERT(0); |
| 9632 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9633 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9634 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 9635 | /* Initialize WMM configuation */ |
| 9636 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 9637 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9638 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 9639 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 9640 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 9641 | { |
| 9642 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 9643 | { |
| 9644 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 9645 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 9646 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 9647 | } |
| 9648 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 9649 | { |
| 9650 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 9651 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 9652 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 9653 | } |
| 9654 | } |
| 9655 | #endif |
| 9656 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9657 | pHostapdState->bCommit = TRUE; |
| 9658 | EXIT(); |
| 9659 | |
| 9660 | return 0; |
| 9661 | } |
| 9662 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9663 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9664 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9665 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9666 | struct beacon_parameters *params) |
| 9667 | { |
| 9668 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9669 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9670 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9671 | |
| 9672 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9673 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9674 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9675 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 9676 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9677 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 9678 | hdd_device_modetoString(pAdapter->device_mode), |
| 9679 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9680 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9681 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9682 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9683 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9684 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9685 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9686 | } |
| 9687 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 9688 | if (vos_max_concurrent_connections_reached()) { |
| 9689 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 9690 | return -EINVAL; |
| 9691 | } |
| 9692 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9693 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9694 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9695 | ) |
| 9696 | { |
| 9697 | beacon_data_t *old,*new; |
| 9698 | |
| 9699 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9700 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9701 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9702 | { |
| 9703 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 9704 | FL("already beacon info added to session(%d)"), |
| 9705 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9706 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9707 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9708 | |
| 9709 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 9710 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9711 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9712 | { |
| 9713 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9714 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9715 | return -EINVAL; |
| 9716 | } |
| 9717 | |
| 9718 | pAdapter->sessionCtx.ap.beacon = new; |
| 9719 | |
| 9720 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 9721 | } |
| 9722 | |
| 9723 | EXIT(); |
| 9724 | return status; |
| 9725 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9726 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9727 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 9728 | struct net_device *dev, |
| 9729 | struct beacon_parameters *params) |
| 9730 | { |
| 9731 | int ret; |
| 9732 | |
| 9733 | vos_ssr_protect(__func__); |
| 9734 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 9735 | vos_ssr_unprotect(__func__); |
| 9736 | |
| 9737 | return ret; |
| 9738 | } |
| 9739 | |
| 9740 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9741 | struct net_device *dev, |
| 9742 | struct beacon_parameters *params) |
| 9743 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9744 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9745 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9746 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9747 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9748 | |
| 9749 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9750 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9751 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9752 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 9753 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 9754 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9755 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9756 | pAdapter->device_mode); |
| 9757 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9758 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9759 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9760 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9761 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9762 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9763 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9764 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9765 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9766 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9767 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9768 | { |
| 9769 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9771 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9772 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9773 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9774 | { |
| 9775 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9776 | FL("session(%d) old and new heads points to NULL"), |
| 9777 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9778 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9779 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9780 | |
| 9781 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 9782 | |
| 9783 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9784 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9785 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9786 | return -EINVAL; |
| 9787 | } |
| 9788 | |
| 9789 | pAdapter->sessionCtx.ap.beacon = new; |
| 9790 | |
| 9791 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 9792 | } |
| 9793 | |
| 9794 | EXIT(); |
| 9795 | return status; |
| 9796 | } |
| 9797 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9798 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 9799 | struct net_device *dev, |
| 9800 | struct beacon_parameters *params) |
| 9801 | { |
| 9802 | int ret; |
| 9803 | |
| 9804 | vos_ssr_protect(__func__); |
| 9805 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 9806 | vos_ssr_unprotect(__func__); |
| 9807 | |
| 9808 | return ret; |
| 9809 | } |
| 9810 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9811 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9812 | |
| 9813 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9814 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9815 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9816 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9817 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9818 | struct net_device *dev) |
| 9819 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9820 | { |
| 9821 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9822 | hdd_context_t *pHddCtx = NULL; |
| 9823 | hdd_scaninfo_t *pScanInfo = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9824 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9825 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9826 | |
| 9827 | ENTER(); |
| 9828 | |
| 9829 | if (NULL == pAdapter) |
| 9830 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9831 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9832 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9833 | return -ENODEV; |
| 9834 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9835 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9836 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9837 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 9838 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9839 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9840 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9841 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9842 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9843 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9844 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9845 | |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9846 | pScanInfo = &pHddCtx->scan_info; |
| 9847 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9848 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9849 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9850 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9851 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9852 | ret = wlan_hdd_scan_abort(pAdapter); |
| 9853 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 9854 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9855 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9856 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9857 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9858 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9859 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9860 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9861 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9862 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 9863 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9864 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9865 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9866 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9867 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9868 | } |
| 9869 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 9870 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 9871 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 9872 | hdd_hostapd_stop(dev); |
| 9873 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9874 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9875 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9876 | ) |
| 9877 | { |
| 9878 | beacon_data_t *old; |
| 9879 | |
| 9880 | old = pAdapter->sessionCtx.ap.beacon; |
| 9881 | |
| 9882 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9883 | { |
| 9884 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9885 | FL("session(%d) beacon data points to NULL"), |
| 9886 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9887 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9888 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9889 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9890 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9891 | |
| 9892 | mutex_lock(&pHddCtx->sap_lock); |
| 9893 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 9894 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9895 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9896 | { |
| 9897 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 9898 | |
| 9899 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 9900 | |
| 9901 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 9902 | { |
| 9903 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9904 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9905 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9906 | } |
| 9907 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9908 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 9909 | /* BSS stopped, clear the active sessions for this device mode */ |
| 9910 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9911 | } |
| 9912 | mutex_unlock(&pHddCtx->sap_lock); |
| 9913 | |
| 9914 | if(status != VOS_STATUS_SUCCESS) |
| 9915 | { |
| 9916 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9917 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9918 | return -EINVAL; |
| 9919 | } |
| 9920 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9921 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9922 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 9923 | ==eHAL_STATUS_FAILURE) |
| 9924 | { |
| 9925 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9926 | "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] | 9927 | } |
| 9928 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9929 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9930 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 9931 | eANI_BOOLEAN_FALSE) ) |
| 9932 | { |
| 9933 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9934 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9935 | } |
| 9936 | |
| 9937 | // Reset WNI_CFG_PROBE_RSP Flags |
| 9938 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 9939 | |
| 9940 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 9941 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 9942 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 9943 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 9944 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 9945 | { |
| 9946 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 9947 | "GO got removed"); |
| 9948 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 9949 | } |
| 9950 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9951 | } |
| 9952 | EXIT(); |
| 9953 | return status; |
| 9954 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9955 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9956 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9957 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 9958 | struct net_device *dev) |
| 9959 | { |
| 9960 | int ret; |
| 9961 | |
| 9962 | vos_ssr_protect(__func__); |
| 9963 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 9964 | vos_ssr_unprotect(__func__); |
| 9965 | |
| 9966 | return ret; |
| 9967 | } |
| 9968 | #else |
| 9969 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 9970 | struct net_device *dev) |
| 9971 | { |
| 9972 | int ret; |
| 9973 | |
| 9974 | vos_ssr_protect(__func__); |
| 9975 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 9976 | vos_ssr_unprotect(__func__); |
| 9977 | |
| 9978 | return ret; |
| 9979 | } |
| 9980 | #endif |
| 9981 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9982 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 9983 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9984 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9985 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9986 | struct cfg80211_ap_settings *params) |
| 9987 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9988 | hdd_adapter_t *pAdapter; |
| 9989 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9990 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9991 | |
| 9992 | ENTER(); |
| 9993 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 9994 | if (NULL == dev || NULL == params) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 9995 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9996 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 9997 | "%s: Device or params is Null", __func__); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9998 | return -ENODEV; |
| 9999 | } |
| 10000 | |
| 10001 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10002 | if (NULL == pAdapter) |
| 10003 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10004 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10005 | "%s: HDD adapter is Null", __func__); |
| 10006 | return -ENODEV; |
| 10007 | } |
| 10008 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10009 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10010 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 10011 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10012 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 10013 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10014 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10015 | "%s: HDD adapter magic is invalid", __func__); |
| 10016 | return -ENODEV; |
| 10017 | } |
| 10018 | |
| 10019 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10020 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10021 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10022 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10023 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10024 | } |
| 10025 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10026 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 10027 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10028 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10029 | |
| 10030 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10031 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10032 | ) |
| 10033 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10034 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10035 | |
| 10036 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10037 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10038 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10039 | { |
| 10040 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 10041 | FL("already beacon info added to session(%d)"), |
| 10042 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10043 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10044 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10045 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 10046 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 10047 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 10048 | &new, |
| 10049 | ¶ms->beacon); |
| 10050 | #else |
| 10051 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 10052 | &new, |
| 10053 | ¶ms->beacon, |
| 10054 | params->dtim_period); |
| 10055 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10056 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10057 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10058 | { |
| 10059 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 10060 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10061 | return -EINVAL; |
| 10062 | } |
| 10063 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10064 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 10065 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 10066 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 10067 | params->channel, params->channel_type); |
| 10068 | #else |
| 10069 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 10070 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10071 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10072 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 10073 | params->ssid_len, params->hidden_ssid, |
| 10074 | params->auth_type); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10075 | } |
| 10076 | |
| 10077 | EXIT(); |
| 10078 | return status; |
| 10079 | } |
| 10080 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10081 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 10082 | struct net_device *dev, |
| 10083 | struct cfg80211_ap_settings *params) |
| 10084 | { |
| 10085 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10086 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10087 | vos_ssr_protect(__func__); |
| 10088 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 10089 | vos_ssr_unprotect(__func__); |
| 10090 | |
| 10091 | return ret; |
| 10092 | } |
| 10093 | |
| 10094 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10095 | struct net_device *dev, |
| 10096 | struct cfg80211_beacon_data *params) |
| 10097 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10098 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10099 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10100 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10101 | |
| 10102 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10103 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10104 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10105 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 10106 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10107 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10108 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10109 | |
| 10110 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10111 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10112 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 10113 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10114 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 10115 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10116 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10117 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10118 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10119 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10120 | { |
| 10121 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10122 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10123 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10124 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10125 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10126 | { |
| 10127 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10128 | FL("session(%d) beacon data points to NULL"), |
| 10129 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10130 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10131 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10132 | |
| 10133 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 10134 | |
| 10135 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10136 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10137 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10138 | return -EINVAL; |
| 10139 | } |
| 10140 | |
| 10141 | pAdapter->sessionCtx.ap.beacon = new; |
| 10142 | |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 10143 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0, |
| 10144 | pAdapter->sessionCtx.ap.sapConfig.authType); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10145 | } |
| 10146 | |
| 10147 | EXIT(); |
| 10148 | return status; |
| 10149 | } |
| 10150 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10151 | static int wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
| 10152 | struct net_device *dev, |
| 10153 | struct cfg80211_beacon_data *params) |
| 10154 | { |
| 10155 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10156 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10157 | vos_ssr_protect(__func__); |
| 10158 | ret = __wlan_hdd_cfg80211_change_beacon(wiphy, dev, params); |
| 10159 | vos_ssr_unprotect(__func__); |
| 10160 | |
| 10161 | return ret; |
| 10162 | } |
| 10163 | |
| 10164 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10165 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 10166 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10167 | struct net_device *dev, |
| 10168 | struct bss_parameters *params) |
| 10169 | { |
| 10170 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10171 | hdd_context_t *pHddCtx; |
| 10172 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10173 | |
| 10174 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10175 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10176 | if (NULL == pAdapter) |
| 10177 | { |
| 10178 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10179 | "%s: HDD adapter is Null", __func__); |
| 10180 | return -ENODEV; |
| 10181 | } |
| 10182 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10183 | ret = wlan_hdd_validate_context(pHddCtx); |
| 10184 | if (0 != ret) |
| 10185 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10186 | return ret; |
| 10187 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10188 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10189 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 10190 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10191 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10192 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10193 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10194 | |
| 10195 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10196 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10197 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10198 | { |
| 10199 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 10200 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10201 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10202 | { |
| 10203 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10204 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10205 | } |
| 10206 | |
| 10207 | EXIT(); |
| 10208 | return 0; |
| 10209 | } |
| 10210 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 10211 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 10212 | struct net_device *dev, |
| 10213 | struct bss_parameters *params) |
| 10214 | { |
| 10215 | int ret; |
| 10216 | |
| 10217 | vos_ssr_protect(__func__); |
| 10218 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 10219 | vos_ssr_unprotect(__func__); |
| 10220 | |
| 10221 | return ret; |
| 10222 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10223 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 10224 | * to wait for contry code completion |
| 10225 | */ |
| 10226 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 10227 | { |
| 10228 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 10229 | complete(&call_back_pAdapter->change_country_code); |
| 10230 | return NULL; |
| 10231 | } |
| 10232 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10233 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 10234 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10235 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 10236 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 10237 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10238 | struct net_device *ndev, |
| 10239 | enum nl80211_iftype type, |
| 10240 | u32 *flags, |
| 10241 | struct vif_params *params |
| 10242 | ) |
| 10243 | { |
| 10244 | struct wireless_dev *wdev; |
| 10245 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10246 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 10247 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10248 | tCsrRoamProfile *pRoamProfile = NULL; |
| 10249 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10250 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10251 | eMib_dot11DesiredBssType connectedBssType; |
| 10252 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10253 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10254 | |
| 10255 | ENTER(); |
| 10256 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10257 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10258 | { |
| 10259 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10260 | "%s: Adapter context is null", __func__); |
| 10261 | return VOS_STATUS_E_FAILURE; |
| 10262 | } |
| 10263 | |
| 10264 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10265 | if (!pHddCtx) |
| 10266 | { |
| 10267 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10268 | "%s: HDD context is null", __func__); |
| 10269 | return VOS_STATUS_E_FAILURE; |
| 10270 | } |
| 10271 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10272 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10273 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 10274 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10275 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10276 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10277 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10278 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10279 | } |
| 10280 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10281 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10282 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10283 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10284 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10285 | if (vos_max_concurrent_connections_reached()) { |
| 10286 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 10287 | return -EINVAL; |
| 10288 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10289 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10290 | wdev = ndev->ieee80211_ptr; |
| 10291 | |
| 10292 | #ifdef WLAN_BTAMP_FEATURE |
| 10293 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 10294 | (NL80211_IFTYPE_ADHOC == type)|| |
| 10295 | (NL80211_IFTYPE_AP == type)|| |
| 10296 | (NL80211_IFTYPE_P2P_GO == type)) |
| 10297 | { |
| 10298 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 10299 | // stop AMP traffic |
| 10300 | status = WLANBAP_StopAmp(); |
| 10301 | if(VOS_STATUS_SUCCESS != status ) |
| 10302 | { |
| 10303 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 10304 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 10305 | "%s: Failed to stop AMP", __func__); |
| 10306 | return -EINVAL; |
| 10307 | } |
| 10308 | } |
| 10309 | #endif //WLAN_BTAMP_FEATURE |
| 10310 | /* Reset the current device mode bit mask*/ |
| 10311 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 10312 | |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 10313 | if ((pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) && |
| 10314 | ((type == NL80211_IFTYPE_P2P_CLIENT) || |
| 10315 | (type == NL80211_IFTYPE_P2P_GO))) |
| 10316 | { |
| 10317 | /* Notify Mode change in case of concurrency. |
| 10318 | * Below function invokes TDLS teardown Functionality Since TDLS is |
| 10319 | * not Supported in case of concurrency i.e Once P2P session |
| 10320 | * is detected disable offchannel and teardown TDLS links |
| 10321 | */ |
| 10322 | hddLog(LOG1, |
| 10323 | FL("Device mode = %d Interface type = %d"), |
| 10324 | pAdapter->device_mode, type); |
| 10325 | hdd_tdls_notify_mode_change(pAdapter, pHddCtx); |
| 10326 | } |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 10327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10328 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10329 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10330 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10331 | ) |
| 10332 | { |
| 10333 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10334 | if (!pWextState) |
| 10335 | { |
| 10336 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10337 | "%s: pWextState is null", __func__); |
| 10338 | return VOS_STATUS_E_FAILURE; |
| 10339 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10340 | pRoamProfile = &pWextState->roamProfile; |
| 10341 | LastBSSType = pRoamProfile->BSSType; |
| 10342 | |
| 10343 | switch (type) |
| 10344 | { |
| 10345 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10346 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10347 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10348 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 10349 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10350 | #ifdef WLAN_FEATURE_11AC |
| 10351 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 10352 | { |
| 10353 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 10354 | } |
| 10355 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10356 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10357 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10358 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 10359 | //Check for sub-string p2p to confirm its a p2p interface |
| 10360 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10361 | { |
Mahesh A Saptasagar | c48ae8a | 2015-08-09 00:04:35 +0530 | [diff] [blame] | 10362 | #ifdef FEATURE_WLAN_TDLS |
| 10363 | mutex_lock(&pHddCtx->tdls_lock); |
| 10364 | wlan_hdd_tdls_exit(pAdapter, TRUE); |
| 10365 | mutex_unlock(&pHddCtx->tdls_lock); |
| 10366 | #endif |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 10367 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 10368 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 10369 | } |
| 10370 | else |
| 10371 | { |
| 10372 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10373 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 10374 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10375 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 10376 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10377 | case NL80211_IFTYPE_ADHOC: |
| 10378 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10379 | "%s: setting interface Type to ADHOC", __func__); |
| 10380 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 10381 | pRoamProfile->phyMode = |
| 10382 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 10383 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10384 | wdev->iftype = type; |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 10385 | hdd_set_ibss_ops( pAdapter ); |
| 10386 | hdd_ibss_init_tx_rx( pAdapter ); |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 10387 | |
| 10388 | status = hdd_sta_id_hash_attach(pAdapter); |
| 10389 | if (VOS_STATUS_SUCCESS != status) { |
| 10390 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10391 | FL("Failed to initialize hash for IBSS")); |
| 10392 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10393 | break; |
| 10394 | |
| 10395 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10396 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10397 | { |
| 10398 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 10399 | "%s: setting interface Type to %s", __func__, |
| 10400 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 10401 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 10402 | //Cancel any remain on channel for GO mode |
| 10403 | if (NL80211_IFTYPE_P2P_GO == type) |
| 10404 | { |
| 10405 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 10406 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 10407 | if (NL80211_IFTYPE_AP == type) |
| 10408 | { |
| 10409 | /* As Loading WLAN Driver one interface being created for p2p device |
| 10410 | * address. This will take one HW STA and the max number of clients |
| 10411 | * that can connect to softAP will be reduced by one. so while changing |
| 10412 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 10413 | * interface as it is not required in SoftAP mode. |
| 10414 | */ |
| 10415 | |
| 10416 | // Get P2P Adapter |
| 10417 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 10418 | |
| 10419 | if (pP2pAdapter) |
| 10420 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 10421 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 10422 | hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 10423 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 10424 | } |
| 10425 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 10426 | //Disable IMPS & BMPS for SAP/GO |
| 10427 | if(VOS_STATUS_E_FAILURE == |
| 10428 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 10429 | { |
| 10430 | //Fail to Exit BMPS |
| 10431 | VOS_ASSERT(0); |
| 10432 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 10433 | |
| 10434 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 10435 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10436 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 10437 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10438 | /* A Mutex Lock is introduced while changing the mode to |
| 10439 | * protect the concurrent access for the Adapters by TDLS |
| 10440 | * module. |
| 10441 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10442 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10443 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10444 | //De-init the adapter. |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 10445 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10446 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10447 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 10448 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10449 | #ifdef FEATURE_WLAN_TDLS |
| 10450 | mutex_unlock(&pHddCtx->tdls_lock); |
| 10451 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 10452 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 10453 | (pConfig->apRandomBssidEnabled)) |
| 10454 | { |
| 10455 | /* To meet Android requirements create a randomized |
| 10456 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 10457 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 10458 | ndev->dev_addr[0] = 0x02; |
| 10459 | ndev->dev_addr[1] = 0x1A; |
| 10460 | ndev->dev_addr[2] = 0x11; |
| 10461 | ndev->dev_addr[3] |= 0xF0; |
| 10462 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 10463 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10464 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 10465 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 10466 | } |
| 10467 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10468 | hdd_set_ap_ops( pAdapter->dev ); |
| 10469 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10470 | /* This is for only SAP mode where users can |
| 10471 | * control country through ini. |
| 10472 | * P2P GO follows station country code |
| 10473 | * acquired during the STA scanning. */ |
| 10474 | if((NL80211_IFTYPE_AP == type) && |
| 10475 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 10476 | { |
| 10477 | int status = 0; |
| 10478 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 10479 | "%s: setting country code from INI ", __func__); |
| 10480 | init_completion(&pAdapter->change_country_code); |
| 10481 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 10482 | (void *)(tSmeChangeCountryCallback) |
| 10483 | wlan_hdd_change_country_code_cb, |
| 10484 | pConfig->apCntryCode, pAdapter, |
| 10485 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 10486 | eSIR_FALSE, |
| 10487 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10488 | if (eHAL_STATUS_SUCCESS == status) |
| 10489 | { |
| 10490 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10491 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10492 | &pAdapter->change_country_code, |
| 10493 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10494 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10495 | { |
| 10496 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10497 | FL("SME Timed out while setting country code %ld"), |
| 10498 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 10499 | |
| 10500 | if (pHddCtx->isLogpInProgress) |
| 10501 | { |
| 10502 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10503 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 10504 | return -EAGAIN; |
| 10505 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10506 | } |
| 10507 | } |
| 10508 | else |
| 10509 | { |
| 10510 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10511 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10512 | return -EINVAL; |
| 10513 | } |
| 10514 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10515 | status = hdd_init_ap_mode(pAdapter); |
| 10516 | if(status != VOS_STATUS_SUCCESS) |
| 10517 | { |
| 10518 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 10519 | "%s: Error initializing the ap mode", __func__); |
| 10520 | return -EINVAL; |
| 10521 | } |
| 10522 | hdd_set_conparam(1); |
| 10523 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 10524 | status = hdd_sta_id_hash_attach(pAdapter); |
| 10525 | if (VOS_STATUS_SUCCESS != status) |
| 10526 | { |
| 10527 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10528 | FL("Failed to initialize hash for AP")); |
| 10529 | return -EINVAL; |
| 10530 | } |
| 10531 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10532 | /*interface type changed update in wiphy structure*/ |
| 10533 | if(wdev) |
| 10534 | { |
| 10535 | wdev->iftype = type; |
| 10536 | pHddCtx->change_iface = type; |
| 10537 | } |
| 10538 | else |
| 10539 | { |
| 10540 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10541 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 10542 | return -EINVAL; |
| 10543 | } |
| 10544 | goto done; |
| 10545 | } |
| 10546 | |
| 10547 | default: |
| 10548 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 10549 | __func__); |
| 10550 | return -EOPNOTSUPP; |
| 10551 | } |
| 10552 | } |
| 10553 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10554 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10555 | ) |
| 10556 | { |
| 10557 | switch(type) |
| 10558 | { |
| 10559 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10560 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10561 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 10562 | |
| 10563 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10564 | #ifdef FEATURE_WLAN_TDLS |
| 10565 | |
| 10566 | /* A Mutex Lock is introduced while changing the mode to |
| 10567 | * protect the concurrent access for the Adapters by TDLS |
| 10568 | * module. |
| 10569 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10570 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10571 | #endif |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 10572 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10573 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 10574 | //Check for sub-string p2p to confirm its a p2p interface |
| 10575 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 10576 | { |
| 10577 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 10578 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 10579 | } |
| 10580 | else |
| 10581 | { |
| 10582 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10583 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 10584 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10585 | hdd_set_conparam(0); |
| 10586 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10587 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 10588 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10589 | #ifdef FEATURE_WLAN_TDLS |
| 10590 | mutex_unlock(&pHddCtx->tdls_lock); |
| 10591 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 10592 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10593 | if( VOS_STATUS_SUCCESS != status ) |
| 10594 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10595 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 10596 | * This is the right place to enable back bmps_imps() |
| 10597 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 10598 | if (pHddCtx->hdd_wlan_suspended) |
| 10599 | { |
| 10600 | hdd_set_pwrparams(pHddCtx); |
| 10601 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10602 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10603 | goto done; |
| 10604 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10605 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10606 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10607 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 10608 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10609 | goto done; |
| 10610 | default: |
| 10611 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 10612 | __func__); |
| 10613 | return -EOPNOTSUPP; |
| 10614 | |
| 10615 | } |
| 10616 | |
| 10617 | } |
| 10618 | else |
| 10619 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10620 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 10621 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10622 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10623 | return -EOPNOTSUPP; |
| 10624 | } |
| 10625 | |
| 10626 | |
| 10627 | if(pRoamProfile) |
| 10628 | { |
| 10629 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 10630 | { |
| 10631 | /*interface type changed update in wiphy structure*/ |
| 10632 | wdev->iftype = type; |
| 10633 | |
| 10634 | /*the BSS mode changed, We need to issue disconnect |
| 10635 | if connected or in IBSS disconnect state*/ |
| 10636 | if ( hdd_connGetConnectedBssType( |
| 10637 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 10638 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 10639 | { |
| 10640 | /*need to issue a disconnect to CSR.*/ |
| 10641 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 10642 | if( eHAL_STATUS_SUCCESS == |
| 10643 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10644 | pAdapter->sessionId, |
| 10645 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 10646 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10647 | ret = wait_for_completion_interruptible_timeout( |
| 10648 | &pAdapter->disconnect_comp_var, |
| 10649 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 10650 | if (ret <= 0) |
| 10651 | { |
| 10652 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10653 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 10654 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10655 | } |
| 10656 | } |
| 10657 | } |
| 10658 | } |
| 10659 | |
| 10660 | done: |
| 10661 | /*set bitmask based on updated value*/ |
| 10662 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 10663 | |
| 10664 | /* Only STA mode support TM now |
| 10665 | * all other mode, TM feature should be disabled */ |
| 10666 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 10667 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 10668 | { |
| 10669 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 10670 | } |
| 10671 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10672 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10673 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10674 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10675 | { |
| 10676 | //we are ok to do AMP |
| 10677 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 10678 | } |
| 10679 | #endif //WLAN_BTAMP_FEATURE |
| 10680 | EXIT(); |
| 10681 | return 0; |
| 10682 | } |
| 10683 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 10684 | /* |
| 10685 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 10686 | * wrapper function to protect the actual implementation from SSR. |
| 10687 | */ |
| 10688 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 10689 | struct net_device *ndev, |
| 10690 | enum nl80211_iftype type, |
| 10691 | u32 *flags, |
| 10692 | struct vif_params *params |
| 10693 | ) |
| 10694 | { |
| 10695 | int ret; |
| 10696 | |
| 10697 | vos_ssr_protect(__func__); |
| 10698 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 10699 | vos_ssr_unprotect(__func__); |
| 10700 | |
| 10701 | return ret; |
| 10702 | } |
| 10703 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10704 | #ifdef FEATURE_WLAN_TDLS |
| 10705 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 10706 | struct net_device *dev, |
| 10707 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 10708 | const u8 *mac, |
| 10709 | #else |
| 10710 | u8 *mac, |
| 10711 | #endif |
| 10712 | bool update, tCsrStaParams *StaParams) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10713 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10714 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10715 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10716 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10717 | tANI_U16 numCurrTdlsPeers; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10718 | hdd_adapter_t *pAdapter; |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 10719 | VOS_STATUS status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10720 | |
| 10721 | ENTER(); |
| 10722 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10723 | if (!dev) { |
| 10724 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 10725 | return -EINVAL; |
| 10726 | } |
| 10727 | |
| 10728 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10729 | if (!pAdapter) { |
| 10730 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 10731 | return -EINVAL; |
| 10732 | } |
| 10733 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 10734 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10735 | { |
| 10736 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10737 | "Invalid arguments"); |
| 10738 | return -EINVAL; |
| 10739 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 10740 | |
| 10741 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 10742 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 10743 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10744 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 10745 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 10746 | MAC_ADDRESS_STR " Request declined.", |
| 10747 | __func__, MAC_ADDR_ARRAY(mac)); |
| 10748 | return -ENOTSUPP; |
| 10749 | } |
| 10750 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10751 | if (pHddCtx->isLogpInProgress) |
| 10752 | { |
| 10753 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10754 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 10755 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 10756 | mac, |
| 10757 | eTDLS_LINK_IDLE, |
| 10758 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10759 | return -EBUSY; |
| 10760 | } |
| 10761 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 10762 | mutex_lock(&pHddCtx->tdls_lock); |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 10763 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10764 | |
| 10765 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10766 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10767 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 10768 | __func__, MAC_ADDR_ARRAY(mac), update); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 10769 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10770 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 10771 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10772 | |
| 10773 | /* in add station, we accept existing valid staId if there is */ |
| 10774 | if ((0 == update) && |
| 10775 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 10776 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10777 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10778 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10779 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10780 | " link_status %d. staId %d. add station ignored.", |
| 10781 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10782 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10783 | return 0; |
| 10784 | } |
| 10785 | /* in change station, we accept only when staId is valid */ |
| 10786 | if ((1 == update) && |
| 10787 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 10788 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 10789 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10790 | tANI_U16 staId = pTdlsPeer->staId; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10791 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10792 | "%s: " MAC_ADDRESS_STR |
| 10793 | " link status %d. staId %d. change station %s.", |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10794 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, staId, |
| 10795 | (TDLS_STA_INDEX_VALID(staId)) ? "ignored" : "declined"); |
| 10796 | mutex_unlock(&pHddCtx->tdls_lock); |
| 10797 | return (TDLS_STA_INDEX_VALID(staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10798 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10799 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 10800 | |
| 10801 | /* 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] | 10802 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10803 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10804 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10805 | "%s: " MAC_ADDRESS_STR |
| 10806 | " TDLS setup is ongoing. Request declined.", |
| 10807 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10808 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10809 | } |
| 10810 | |
| 10811 | /* first to check if we reached to maximum supported TDLS peer. |
| 10812 | TODO: for now, return -EPERM looks working fine, |
| 10813 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10814 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 10815 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10816 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10817 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10818 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10819 | " TDLS Max peer already connected. Request declined." |
| 10820 | " Num of peers (%d), Max allowed (%d).", |
| 10821 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 10822 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10823 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10824 | } |
| 10825 | else |
| 10826 | { |
| 10827 | hddTdlsPeer_t *pTdlsPeer; |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10828 | mutex_lock(&pHddCtx->tdls_lock); |
| 10829 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10830 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10831 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10832 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10833 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10834 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 10835 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10836 | return -EPERM; |
| 10837 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10838 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10839 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10840 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 10841 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 10842 | mac, |
| 10843 | eTDLS_LINK_CONNECTING, |
| 10844 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10845 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 10846 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 10847 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10848 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10849 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10850 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10851 | if(StaParams->htcap_present) |
| 10852 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10853 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10854 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10855 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10856 | "ht_capa->extended_capabilities: %0x", |
| 10857 | StaParams->HTCap.extendedHtCapInfo); |
| 10858 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10859 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10860 | "params->capability: %0x",StaParams->capability); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10861 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 10862 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10863 | if(StaParams->vhtcap_present) |
| 10864 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10865 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10866 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 10867 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 10868 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 10869 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10870 | { |
| 10871 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10872 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10873 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10874 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10875 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 10876 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 10877 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 10878 | else if ((1 == update) && (NULL == StaParams)) |
| 10879 | { |
| 10880 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10881 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 10882 | return -EPERM; |
| 10883 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10884 | |
| 10885 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 10886 | |
| 10887 | if (!update) |
| 10888 | { |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 10889 | /*Before adding sta make sure that device exited from BMPS*/ |
| 10890 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 10891 | { |
| 10892 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10893 | "%s: Adding tdls peer sta. Disable BMPS", __func__); |
| 10894 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 10895 | if (status != VOS_STATUS_SUCCESS) { |
| 10896 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 10897 | } |
| 10898 | } |
| 10899 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 10900 | ret = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10901 | pAdapter->sessionId, mac); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 10902 | if (ret != eHAL_STATUS_SUCCESS) { |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 10903 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10904 | FL("Failed to add TDLS peer STA. Enable Bmps")); |
| 10905 | wlan_hdd_tdls_check_bmps(pAdapter); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 10906 | return -EPERM; |
| 10907 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10908 | } |
| 10909 | else |
| 10910 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 10911 | ret = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10912 | pAdapter->sessionId, mac, StaParams); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 10913 | if (ret != eHAL_STATUS_SUCCESS) { |
| 10914 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to change TDLS peer STA params")); |
| 10915 | return -EPERM; |
| 10916 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10917 | } |
| 10918 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10919 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10920 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 10921 | |
Masti, Narayanraddi | 255d8c5 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 10922 | mutex_lock(&pHddCtx->tdls_lock); |
| 10923 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
| 10924 | |
Masti, Narayanraddi | 0726246 | 2016-01-19 12:40:06 +0530 | [diff] [blame] | 10925 | if ((pTdlsPeer != NULL) && |
| 10926 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10927 | { |
Masti, Narayanraddi | 0726246 | 2016-01-19 12:40:06 +0530 | [diff] [blame] | 10928 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10929 | FL("peer link status %u"), pTdlsPeer->link_status); |
| 10930 | mutex_unlock(&pHddCtx->tdls_lock); |
| 10931 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10932 | } |
Masti, Narayanraddi | 255d8c5 | 2016-01-07 16:26:06 +0530 | [diff] [blame] | 10933 | mutex_unlock(&pHddCtx->tdls_lock); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10934 | |
Masti, Narayanraddi | 0726246 | 2016-01-19 12:40:06 +0530 | [diff] [blame] | 10935 | if (ret <= 0) |
| 10936 | { |
| 10937 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10938 | "%s: timeout waiting for tdls add station indication %ld", |
| 10939 | __func__, ret); |
| 10940 | goto error; |
| 10941 | } |
| 10942 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10943 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 10944 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10945 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10946 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 10947 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10948 | } |
| 10949 | |
| 10950 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10951 | |
| 10952 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 10953 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 10954 | mac, |
| 10955 | eTDLS_LINK_IDLE, |
| 10956 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10957 | return -EPERM; |
| 10958 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10959 | } |
| 10960 | #endif |
| 10961 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 10962 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10963 | struct net_device *dev, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 10964 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 10965 | const u8 *mac, |
| 10966 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10967 | u8 *mac, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 10968 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10969 | struct station_parameters *params) |
| 10970 | { |
| 10971 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 10972 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10973 | hdd_context_t *pHddCtx; |
| 10974 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10975 | v_MACADDR_t STAMacAddress; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10976 | int ret = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 10977 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10978 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10979 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 10980 | tANI_U8 isOffChannelSupported = 0; |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 10981 | tANI_U8 isQosWmmSta = FALSE; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 10982 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10983 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 10984 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 10985 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 10986 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10987 | if ((NULL == pAdapter)) |
| 10988 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10989 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10990 | "invalid adapter "); |
| 10991 | return -EINVAL; |
| 10992 | } |
| 10993 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10994 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10995 | TRACE_CODE_HDD_CHANGE_STATION, |
| 10996 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10997 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10998 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10999 | ret = wlan_hdd_validate_context(pHddCtx); |
| 11000 | if (0 != ret) |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11001 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11002 | return ret; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11003 | } |
| 11004 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11005 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11006 | |
| 11007 | if (NULL == pHddStaCtx) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11008 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11009 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11010 | "invalid HDD station context"); |
| 11011 | return -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11012 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11013 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 11014 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11015 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 11016 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11017 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11018 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11019 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11020 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11021 | WLANTL_STA_AUTHENTICATED); |
| 11022 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11023 | if (status != VOS_STATUS_SUCCESS) |
| 11024 | { |
| 11025 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11026 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 11027 | return -EINVAL; |
| 11028 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11029 | } |
| 11030 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 11031 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 11032 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11033 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11034 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 11035 | StaParams.capability = params->capability; |
| 11036 | StaParams.uapsd_queues = params->uapsd_queues; |
| 11037 | StaParams.max_sp = params->max_sp; |
| 11038 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 11039 | /* Convert (first channel , number of channels) tuple to |
| 11040 | * the total list of channels. This goes with the assumption |
| 11041 | * that if the first channel is < 14, then the next channels |
| 11042 | * are an incremental of 1 else an incremental of 4 till the number |
| 11043 | * of channels. |
| 11044 | */ |
| 11045 | if (0 != params->supported_channels_len) { |
| 11046 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 11047 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 11048 | { |
| 11049 | int wifi_chan_index; |
| 11050 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 11051 | wifi_chan_index = |
| 11052 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 11053 | no_of_channels = params->supported_channels[i+1]; |
| 11054 | for(k=1; k <= no_of_channels; k++) |
| 11055 | { |
| 11056 | StaParams.supported_channels[j+1] = |
| 11057 | StaParams.supported_channels[j] + wifi_chan_index; |
| 11058 | j+=1; |
| 11059 | } |
| 11060 | } |
| 11061 | StaParams.supported_channels_len = j; |
| 11062 | } |
| 11063 | vos_mem_copy(StaParams.supported_oper_classes, |
| 11064 | params->supported_oper_classes, |
| 11065 | params->supported_oper_classes_len); |
| 11066 | StaParams.supported_oper_classes_len = |
| 11067 | params->supported_oper_classes_len; |
| 11068 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11069 | if (0 != params->ext_capab_len) |
| 11070 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 11071 | sizeof(StaParams.extn_capability)); |
| 11072 | |
| 11073 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11074 | { |
| 11075 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11076 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11077 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11078 | |
| 11079 | StaParams.supported_rates_len = params->supported_rates_len; |
| 11080 | |
| 11081 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 11082 | * The supported_rates array , for all the structures propogating till Add Sta |
| 11083 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 11084 | * modified to send more rates. |
| 11085 | */ |
| 11086 | |
| 11087 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 11088 | */ |
| 11089 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 11090 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 11091 | |
| 11092 | if (0 != StaParams.supported_rates_len) { |
| 11093 | int i = 0; |
| 11094 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 11095 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11096 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11097 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 11098 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11099 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11100 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 11101 | } |
| 11102 | |
| 11103 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11104 | { |
| 11105 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11106 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11107 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11108 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11109 | if (0 != params->ext_capab_len ) { |
| 11110 | /*Define A Macro : TODO Sunil*/ |
| 11111 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 11112 | isBufSta = 1; |
| 11113 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 11114 | /* TDLS Channel Switching Support */ |
| 11115 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 11116 | isOffChannelSupported = 1; |
| 11117 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11118 | } |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 11119 | |
| 11120 | if (pHddCtx->cfg_ini->fEnableTDLSWmmMode && |
Nitesh Shah | 48df4c0 | 2016-08-12 16:27:33 +0530 | [diff] [blame] | 11121 | (params->ht_capa || params->vht_capa || |
| 11122 | (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME)))) |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 11123 | /* TDLS Peer is WME/QoS capable */ |
| 11124 | isQosWmmSta = TRUE; |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 11125 | |
| 11126 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11127 | "%s: TDLS Peer is QOS capable isQosWmmSta= %d HTcapPresent= %d", |
| 11128 | __func__, isQosWmmSta, StaParams.htcap_present); |
| 11129 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 11130 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 11131 | &StaParams, isBufSta, |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 11132 | isOffChannelSupported, |
| 11133 | isQosWmmSta); |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 11134 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 11135 | if (VOS_STATUS_SUCCESS != status) { |
| 11136 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11137 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 11138 | return -EINVAL; |
| 11139 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11140 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 11141 | |
| 11142 | if (VOS_STATUS_SUCCESS != status) { |
| 11143 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11144 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 11145 | return -EINVAL; |
| 11146 | } |
| 11147 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 11148 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 11149 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11150 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11151 | return status; |
| 11152 | } |
| 11153 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11154 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 11155 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 11156 | struct net_device *dev, |
| 11157 | const u8 *mac, |
| 11158 | struct station_parameters *params) |
| 11159 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11160 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 11161 | struct net_device *dev, |
| 11162 | u8 *mac, |
| 11163 | struct station_parameters *params) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11164 | #endif |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11165 | { |
| 11166 | int ret; |
| 11167 | |
| 11168 | vos_ssr_protect(__func__); |
| 11169 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 11170 | vos_ssr_unprotect(__func__); |
| 11171 | |
| 11172 | return ret; |
| 11173 | } |
| 11174 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11175 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11176 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11177 | * This function is used to initialize the key information |
| 11178 | */ |
| 11179 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11180 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11181 | struct net_device *ndev, |
| 11182 | u8 key_index, bool pairwise, |
| 11183 | const u8 *mac_addr, |
| 11184 | struct key_params *params |
| 11185 | ) |
| 11186 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11187 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11188 | struct net_device *ndev, |
| 11189 | u8 key_index, const u8 *mac_addr, |
| 11190 | struct key_params *params |
| 11191 | ) |
| 11192 | #endif |
| 11193 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11194 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11195 | tCsrRoamSetKey setKey; |
| 11196 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11197 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11198 | v_U32_t roamId= 0xFF; |
| 11199 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11200 | hdd_hostapd_state_t *pHostapdState; |
| 11201 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11202 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11203 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11204 | |
| 11205 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11206 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11207 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11208 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 11209 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11210 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11211 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11212 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11213 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11214 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11215 | } |
| 11216 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11217 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 11218 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11219 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11220 | |
| 11221 | if (CSR_MAX_NUM_KEY <= key_index) |
| 11222 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11223 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11224 | key_index); |
| 11225 | |
| 11226 | return -EINVAL; |
| 11227 | } |
| 11228 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11229 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 11230 | { |
| 11231 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 11232 | params->key_len); |
| 11233 | |
| 11234 | return -EINVAL; |
| 11235 | } |
| 11236 | |
| 11237 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11238 | "%s: called with key index = %d & key length %d", |
| 11239 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11240 | |
| 11241 | /*extract key idx, key len and key*/ |
| 11242 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 11243 | setKey.keyId = key_index; |
| 11244 | setKey.keyLength = params->key_len; |
| 11245 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 11246 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11247 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11248 | { |
| 11249 | case WLAN_CIPHER_SUITE_WEP40: |
| 11250 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 11251 | break; |
| 11252 | |
| 11253 | case WLAN_CIPHER_SUITE_WEP104: |
| 11254 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 11255 | break; |
| 11256 | |
| 11257 | case WLAN_CIPHER_SUITE_TKIP: |
| 11258 | { |
| 11259 | u8 *pKey = &setKey.Key[0]; |
| 11260 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 11261 | |
| 11262 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 11263 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11264 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11265 | |
| 11266 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11267 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11268 | |--------------|----------|----------| |
| 11269 | <---16bytes---><--8bytes--><--8bytes--> |
| 11270 | |
| 11271 | */ |
| 11272 | /*Sme expects the 32 bytes key to be in the below order |
| 11273 | |
| 11274 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11275 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11276 | |--------------|----------|----------| |
| 11277 | <---16bytes---><--8bytes--><--8bytes--> |
| 11278 | */ |
| 11279 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11280 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11281 | |
| 11282 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11283 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11284 | |
| 11285 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11286 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11287 | |
| 11288 | |
| 11289 | break; |
| 11290 | } |
| 11291 | |
| 11292 | case WLAN_CIPHER_SUITE_CCMP: |
| 11293 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 11294 | break; |
| 11295 | |
| 11296 | #ifdef FEATURE_WLAN_WAPI |
| 11297 | case WLAN_CIPHER_SUITE_SMS4: |
| 11298 | { |
| 11299 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 11300 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 11301 | params->key, params->key_len); |
| 11302 | return 0; |
| 11303 | } |
| 11304 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11305 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11306 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11307 | case WLAN_CIPHER_SUITE_KRK: |
| 11308 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 11309 | break; |
| 11310 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11311 | |
| 11312 | #ifdef WLAN_FEATURE_11W |
| 11313 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 11314 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 11315 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11316 | #endif |
| 11317 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11318 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11319 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11320 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11321 | status = -EOPNOTSUPP; |
| 11322 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11323 | } |
| 11324 | |
| 11325 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 11326 | __func__, setKey.encType); |
| 11327 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11328 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11329 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11330 | (!pairwise) |
| 11331 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11332 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11333 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11334 | ) |
| 11335 | { |
| 11336 | /* set group key*/ |
| 11337 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11338 | "%s- %d: setting Broadcast key", |
| 11339 | __func__, __LINE__); |
| 11340 | setKey.keyDirection = eSIR_RX_ONLY; |
| 11341 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 11342 | } |
| 11343 | else |
| 11344 | { |
| 11345 | /* set pairwise key*/ |
| 11346 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11347 | "%s- %d: setting pairwise key", |
| 11348 | __func__, __LINE__); |
| 11349 | setKey.keyDirection = eSIR_TX_RX; |
| 11350 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 11351 | } |
| 11352 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 11353 | { |
| 11354 | setKey.keyDirection = eSIR_TX_RX; |
| 11355 | /*Set the group key*/ |
| 11356 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11357 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11358 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11359 | if ( 0 != status ) |
| 11360 | { |
| 11361 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11362 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11363 | status = -EINVAL; |
| 11364 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11365 | } |
| 11366 | /*Save the keys here and call sme_RoamSetKey for setting |
| 11367 | the PTK after peer joins the IBSS network*/ |
| 11368 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 11369 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11370 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11371 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11372 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 11373 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 11374 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11375 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11376 | if( pHostapdState->bssState == BSS_START ) |
| 11377 | { |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 11378 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11379 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 11380 | |
| 11381 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 11382 | { |
| 11383 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11384 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 11385 | __LINE__, vos_status ); |
| 11386 | |
| 11387 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 11388 | |
| 11389 | status = -EINVAL; |
| 11390 | goto end; |
| 11391 | } |
| 11392 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11393 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 11394 | |
| 11395 | if ( status != eHAL_STATUS_SUCCESS ) |
| 11396 | { |
| 11397 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11398 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 11399 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11400 | status = -EINVAL; |
| 11401 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11402 | } |
| 11403 | } |
| 11404 | |
| 11405 | /* Saving WEP keys */ |
| 11406 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 11407 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 11408 | { |
| 11409 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 11410 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 11411 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 11412 | } |
| 11413 | else |
| 11414 | { |
| 11415 | //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] | 11416 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11417 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 11418 | } |
| 11419 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11420 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 11421 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11422 | { |
| 11423 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11424 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11425 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11426 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11427 | if (!pairwise) |
| 11428 | #else |
| 11429 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 11430 | #endif |
| 11431 | { |
| 11432 | /* set group key*/ |
| 11433 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 11434 | { |
| 11435 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11436 | "%s- %d: Perform Set key Complete", |
| 11437 | __func__, __LINE__); |
| 11438 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 11439 | } |
| 11440 | } |
| 11441 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11442 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 11443 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 11444 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 11445 | |
| 11446 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11447 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11448 | params->key, params->key_len); |
| 11449 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11450 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11451 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 11452 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11453 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11454 | "%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] | 11455 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 11456 | setKey.peerMac[2], setKey.peerMac[3], |
| 11457 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11458 | setKey.keyDirection); |
| 11459 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 11460 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 11461 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 11462 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 11463 | { |
| 11464 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11465 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 11466 | __LINE__, vos_status ); |
| 11467 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 11468 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11469 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 11470 | status = -EINVAL; |
| 11471 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11472 | |
| 11473 | } |
| 11474 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11475 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11476 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 11477 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 11478 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11479 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11480 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11481 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11482 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 11483 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11484 | status = 0; |
| 11485 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11486 | } |
| 11487 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 11488 | { |
| 11489 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11490 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11491 | status = -EINVAL; |
| 11492 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11493 | } |
| 11494 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11495 | |
| 11496 | /* issue set key request to SME*/ |
| 11497 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11498 | pAdapter->sessionId, &setKey, &roamId ); |
| 11499 | |
| 11500 | if ( 0 != status ) |
| 11501 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11502 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11503 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 11504 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11505 | status = -EINVAL; |
| 11506 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11507 | } |
| 11508 | |
| 11509 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11510 | /* in case of IBSS as there was no information available about WEP keys during |
| 11511 | * 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] | 11512 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11513 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 11514 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 11515 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11516 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 11517 | ) |
| 11518 | && |
| 11519 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 11520 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 11521 | ) |
| 11522 | ) |
| 11523 | { |
| 11524 | setKey.keyDirection = eSIR_RX_ONLY; |
| 11525 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 11526 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11527 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11528 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11529 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 11530 | setKey.peerMac[2], setKey.peerMac[3], |
| 11531 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11532 | setKey.keyDirection); |
| 11533 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11534 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11535 | pAdapter->sessionId, &setKey, &roamId ); |
| 11536 | |
| 11537 | if ( 0 != status ) |
| 11538 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11539 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11540 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11541 | __func__, status); |
| 11542 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11543 | status = -EINVAL; |
| 11544 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11545 | } |
| 11546 | } |
| 11547 | } |
| 11548 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11549 | end: |
| 11550 | /* Need to clear any trace of key value in the memory. |
| 11551 | * Thus zero out the memory even though it is local |
| 11552 | * variable. |
| 11553 | */ |
| 11554 | vos_mem_zero(&setKey, sizeof(setKey)); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 11555 | EXIT(); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11556 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11557 | } |
| 11558 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11559 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11560 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 11561 | struct net_device *ndev, |
| 11562 | u8 key_index, bool pairwise, |
| 11563 | const u8 *mac_addr, |
| 11564 | struct key_params *params |
| 11565 | ) |
| 11566 | #else |
| 11567 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 11568 | struct net_device *ndev, |
| 11569 | u8 key_index, const u8 *mac_addr, |
| 11570 | struct key_params *params |
| 11571 | ) |
| 11572 | #endif |
| 11573 | { |
| 11574 | int ret; |
| 11575 | vos_ssr_protect(__func__); |
| 11576 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11577 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 11578 | mac_addr, params); |
| 11579 | #else |
| 11580 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 11581 | params); |
| 11582 | #endif |
| 11583 | vos_ssr_unprotect(__func__); |
| 11584 | |
| 11585 | return ret; |
| 11586 | } |
| 11587 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11588 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11589 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11590 | * This function is used to get the key information |
| 11591 | */ |
| 11592 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11593 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11594 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11595 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11596 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11597 | const u8 *mac_addr, void *cookie, |
| 11598 | void (*callback)(void *cookie, struct key_params*) |
| 11599 | ) |
| 11600 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11601 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11602 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11603 | struct net_device *ndev, |
| 11604 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 11605 | void (*callback)(void *cookie, struct key_params*) |
| 11606 | ) |
| 11607 | #endif |
| 11608 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11609 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11610 | hdd_wext_state_t *pWextState = NULL; |
| 11611 | tCsrRoamProfile *pRoamProfile = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11612 | struct key_params params; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11613 | hdd_context_t *pHddCtx; |
| 11614 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11615 | |
| 11616 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11617 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11618 | if (NULL == pAdapter) |
| 11619 | { |
| 11620 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11621 | "%s: HDD adapter is Null", __func__); |
| 11622 | return -ENODEV; |
| 11623 | } |
| 11624 | |
| 11625 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11626 | ret = wlan_hdd_validate_context(pHddCtx); |
| 11627 | if (0 != ret) |
| 11628 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11629 | return ret; |
| 11630 | } |
| 11631 | |
| 11632 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11633 | pRoamProfile = &(pWextState->roamProfile); |
| 11634 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11635 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 11636 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11637 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11638 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11639 | memset(¶ms, 0, sizeof(params)); |
| 11640 | |
| 11641 | if (CSR_MAX_NUM_KEY <= key_index) |
| 11642 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11643 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11644 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11645 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11646 | |
| 11647 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 11648 | { |
| 11649 | case eCSR_ENCRYPT_TYPE_NONE: |
| 11650 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 11651 | break; |
| 11652 | |
| 11653 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 11654 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 11655 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 11656 | break; |
| 11657 | |
| 11658 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 11659 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 11660 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 11661 | break; |
| 11662 | |
| 11663 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 11664 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 11665 | break; |
| 11666 | |
| 11667 | case eCSR_ENCRYPT_TYPE_AES: |
| 11668 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 11669 | break; |
| 11670 | |
| 11671 | default: |
| 11672 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 11673 | break; |
| 11674 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11675 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 11676 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11677 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 11678 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11679 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11680 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 11681 | params.seq_len = 0; |
| 11682 | params.seq = NULL; |
| 11683 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 11684 | callback(cookie, ¶ms); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 11685 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11686 | return 0; |
| 11687 | } |
| 11688 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11689 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11690 | static int wlan_hdd_cfg80211_get_key( |
| 11691 | struct wiphy *wiphy, |
| 11692 | struct net_device *ndev, |
| 11693 | u8 key_index, bool pairwise, |
| 11694 | const u8 *mac_addr, void *cookie, |
| 11695 | void (*callback)(void *cookie, struct key_params*) |
| 11696 | ) |
| 11697 | #else |
| 11698 | static int wlan_hdd_cfg80211_get_key( |
| 11699 | struct wiphy *wiphy, |
| 11700 | struct net_device *ndev, |
| 11701 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 11702 | void (*callback)(void *cookie, struct key_params*) |
| 11703 | ) |
| 11704 | #endif |
| 11705 | { |
| 11706 | int ret; |
| 11707 | |
| 11708 | vos_ssr_protect(__func__); |
| 11709 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11710 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 11711 | mac_addr, cookie, callback); |
| 11712 | #else |
| 11713 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 11714 | callback); |
| 11715 | #endif |
| 11716 | vos_ssr_unprotect(__func__); |
| 11717 | |
| 11718 | return ret; |
| 11719 | } |
| 11720 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11721 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11722 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11723 | * This function is used to delete the key information |
| 11724 | */ |
| 11725 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11726 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11727 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11728 | u8 key_index, |
| 11729 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11730 | const u8 *mac_addr |
| 11731 | ) |
| 11732 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11733 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11734 | struct net_device *ndev, |
| 11735 | u8 key_index, |
| 11736 | const u8 *mac_addr |
| 11737 | ) |
| 11738 | #endif |
| 11739 | { |
| 11740 | int status = 0; |
| 11741 | |
| 11742 | //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] | 11743 | //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] | 11744 | //it is observed that this is invalidating peer |
| 11745 | //key index whenever re-key is done. This is affecting data link. |
| 11746 | //It should be ok to ignore del_key. |
| 11747 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11748 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 11749 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11750 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 11751 | tCsrRoamSetKey setKey; |
| 11752 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11754 | ENTER(); |
| 11755 | |
| 11756 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 11757 | __func__,pAdapter->device_mode); |
| 11758 | |
| 11759 | if (CSR_MAX_NUM_KEY <= key_index) |
| 11760 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11761 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11762 | key_index); |
| 11763 | |
| 11764 | return -EINVAL; |
| 11765 | } |
| 11766 | |
| 11767 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 11768 | setKey.keyId = key_index; |
| 11769 | |
| 11770 | if (mac_addr) |
| 11771 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 11772 | else |
| 11773 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 11774 | |
| 11775 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 11776 | |
| 11777 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11778 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11779 | ) |
| 11780 | { |
| 11781 | |
| 11782 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11783 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 11784 | if( pHostapdState->bssState == BSS_START) |
| 11785 | { |
| 11786 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11787 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11788 | if ( status != eHAL_STATUS_SUCCESS ) |
| 11789 | { |
| 11790 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11791 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 11792 | __LINE__, status ); |
| 11793 | } |
| 11794 | } |
| 11795 | } |
| 11796 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11797 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11798 | ) |
| 11799 | { |
| 11800 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11801 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11802 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 11803 | |
| 11804 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11805 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11806 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 11807 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11808 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11809 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 11810 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11811 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11812 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11813 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11814 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11815 | if ( 0 != status ) |
| 11816 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11817 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11818 | "%s: sme_RoamSetKey failure, returned %d", |
| 11819 | __func__, status); |
| 11820 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 11821 | return -EINVAL; |
| 11822 | } |
| 11823 | } |
| 11824 | } |
| 11825 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11826 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11827 | return status; |
| 11828 | } |
| 11829 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11830 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11831 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 11832 | struct net_device *ndev, |
| 11833 | u8 key_index, |
| 11834 | bool pairwise, |
| 11835 | const u8 *mac_addr |
| 11836 | ) |
| 11837 | #else |
| 11838 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 11839 | struct net_device *ndev, |
| 11840 | u8 key_index, |
| 11841 | const u8 *mac_addr |
| 11842 | ) |
| 11843 | #endif |
| 11844 | { |
| 11845 | int ret; |
| 11846 | |
| 11847 | vos_ssr_protect(__func__); |
| 11848 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11849 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 11850 | mac_addr); |
| 11851 | #else |
| 11852 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 11853 | #endif |
| 11854 | vos_ssr_unprotect(__func__); |
| 11855 | |
| 11856 | return ret; |
| 11857 | } |
| 11858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11859 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11860 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11861 | * This function is used to set the default tx key index |
| 11862 | */ |
| 11863 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11864 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11865 | struct net_device *ndev, |
| 11866 | u8 key_index, |
| 11867 | bool unicast, bool multicast) |
| 11868 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11869 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11870 | struct net_device *ndev, |
| 11871 | u8 key_index) |
| 11872 | #endif |
| 11873 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11874 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11875 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11876 | hdd_wext_state_t *pWextState; |
| 11877 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11878 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11879 | |
| 11880 | ENTER(); |
| 11881 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11882 | if ((NULL == pAdapter)) |
| 11883 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11884 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11885 | "invalid adapter"); |
| 11886 | return -EINVAL; |
| 11887 | } |
| 11888 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11889 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11890 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 11891 | pAdapter->sessionId, key_index)); |
| 11892 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11893 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11894 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11895 | |
| 11896 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 11897 | { |
| 11898 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11899 | "invalid Wext state or HDD context"); |
| 11900 | return -EINVAL; |
| 11901 | } |
| 11902 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11903 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11904 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11905 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11906 | if (CSR_MAX_NUM_KEY <= key_index) |
| 11907 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11908 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11909 | key_index); |
| 11910 | |
| 11911 | return -EINVAL; |
| 11912 | } |
| 11913 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11914 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11915 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11916 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11917 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11918 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11919 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11920 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11921 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11922 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11923 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11924 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11925 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 11926 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11927 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 11928 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11929 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11930 | { |
| 11931 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11932 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11933 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11934 | tCsrRoamSetKey setKey; |
| 11935 | v_U32_t roamId= 0xFF; |
| 11936 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11937 | |
| 11938 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11939 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11940 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11941 | Keys->defaultIndex = (u8)key_index; |
| 11942 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 11943 | setKey.keyId = key_index; |
| 11944 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11945 | |
| 11946 | vos_mem_copy(&setKey.Key[0], |
| 11947 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11948 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11949 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11950 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11951 | |
| 11952 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11953 | &pHddStaCtx->conn_info.bssId[0], |
| 11954 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11955 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11956 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 11957 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 11958 | eCSR_ENCRYPT_TYPE_WEP104) |
| 11959 | { |
| 11960 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 11961 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 11962 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 11963 | type(104) and switching encryption type to 40*/ |
| 11964 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 11965 | eCSR_ENCRYPT_TYPE_WEP40; |
| 11966 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 11967 | eCSR_ENCRYPT_TYPE_WEP40; |
| 11968 | } |
| 11969 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11970 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11971 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11972 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11973 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11974 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11975 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11976 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11977 | if ( 0 != status ) |
| 11978 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11979 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11980 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11981 | status); |
| 11982 | return -EINVAL; |
| 11983 | } |
| 11984 | } |
| 11985 | } |
| 11986 | |
| 11987 | /* In SoftAp mode setting key direction for default mode */ |
| 11988 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 11989 | { |
| 11990 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 11991 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 11992 | (eCSR_ENCRYPT_TYPE_AES != |
| 11993 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 11994 | ) |
| 11995 | { |
| 11996 | /* Saving key direction for default key index to TX default */ |
| 11997 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 11998 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 11999 | } |
| 12000 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12001 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12002 | return status; |
| 12003 | } |
| 12004 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 12005 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12006 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 12007 | struct net_device *ndev, |
| 12008 | u8 key_index, |
| 12009 | bool unicast, bool multicast) |
| 12010 | #else |
| 12011 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 12012 | struct net_device *ndev, |
| 12013 | u8 key_index) |
| 12014 | #endif |
| 12015 | { |
| 12016 | int ret; |
| 12017 | vos_ssr_protect(__func__); |
| 12018 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 12019 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 12020 | multicast); |
| 12021 | #else |
| 12022 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 12023 | #endif |
| 12024 | vos_ssr_unprotect(__func__); |
| 12025 | |
| 12026 | return ret; |
| 12027 | } |
| 12028 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12029 | /* |
| 12030 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 12031 | * This function is used to inform the BSS details to nl80211 interface. |
| 12032 | */ |
| 12033 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 12034 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 12035 | { |
| 12036 | struct net_device *dev = pAdapter->dev; |
| 12037 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 12038 | struct wiphy *wiphy = wdev->wiphy; |
| 12039 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 12040 | int chan_no; |
| 12041 | int ie_length; |
| 12042 | const char *ie; |
| 12043 | unsigned int freq; |
| 12044 | struct ieee80211_channel *chan; |
| 12045 | int rssi = 0; |
| 12046 | struct cfg80211_bss *bss = NULL; |
| 12047 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12048 | if( NULL == pBssDesc ) |
| 12049 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12050 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12051 | return bss; |
| 12052 | } |
| 12053 | |
| 12054 | chan_no = pBssDesc->channelId; |
| 12055 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 12056 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 12057 | |
| 12058 | if( NULL == ie ) |
| 12059 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12060 | 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] | 12061 | return bss; |
| 12062 | } |
| 12063 | |
| 12064 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 12065 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 12066 | { |
| 12067 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 12068 | } |
| 12069 | else |
| 12070 | { |
| 12071 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 12072 | } |
| 12073 | #else |
| 12074 | freq = ieee80211_channel_to_frequency(chan_no); |
| 12075 | #endif |
| 12076 | |
| 12077 | chan = __ieee80211_get_channel(wiphy, freq); |
| 12078 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 12079 | if (!chan) { |
| 12080 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 12081 | return NULL; |
| 12082 | } |
| 12083 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 12084 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12085 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 12086 | return cfg80211_inform_bss(wiphy, chan, |
| 12087 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 12088 | CFG80211_BSS_FTYPE_UNKNOWN, |
| 12089 | #endif |
| 12090 | pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12091 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12092 | pBssDesc->capabilityInfo, |
| 12093 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 12094 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12095 | } |
| 12096 | |
Abhishek Singh | 72c2f4e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 12097 | /* |
| 12098 | * wlan_hdd_cfg80211_update_bss_list :to inform nl80211 |
| 12099 | * interface that BSS might have been lost. |
| 12100 | * @pAdapter: adaptor |
| 12101 | * @bssid: bssid which might have been lost |
| 12102 | * |
| 12103 | * Return: bss which is unlinked from kernel cache |
| 12104 | */ |
| 12105 | struct cfg80211_bss* wlan_hdd_cfg80211_update_bss_list( |
| 12106 | hdd_adapter_t *pAdapter, tSirMacAddr bssid) |
| 12107 | { |
| 12108 | struct net_device *dev = pAdapter->dev; |
| 12109 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 12110 | struct wiphy *wiphy = wdev->wiphy; |
| 12111 | struct cfg80211_bss *bss = NULL; |
| 12112 | |
| 12113 | bss = cfg80211_get_bss(wiphy, NULL, bssid, |
| 12114 | NULL, |
| 12115 | 0, |
| 12116 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0)) && !defined(WITH_BACKPORTS) \ |
| 12117 | && !defined(IEEE80211_PRIVACY) |
| 12118 | WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); |
| 12119 | #else |
| 12120 | IEEE80211_BSS_TYPE_ESS, IEEE80211_PRIVACY_ANY); |
| 12121 | #endif |
| 12122 | if (bss == NULL) { |
| 12123 | hddLog(LOGE, FL("BSS not present")); |
| 12124 | } else { |
| 12125 | hddLog(LOG1, FL("cfg80211_unlink_bss called for BSSID " |
| 12126 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(bssid)); |
| 12127 | cfg80211_unlink_bss(wiphy, bss); |
| 12128 | } |
| 12129 | return bss; |
| 12130 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12131 | |
| 12132 | |
| 12133 | /* |
| 12134 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 12135 | * This function is used to inform the BSS details to nl80211 interface. |
| 12136 | */ |
| 12137 | struct cfg80211_bss* |
| 12138 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 12139 | tSirBssDescription *bss_desc |
| 12140 | ) |
| 12141 | { |
| 12142 | /* |
| 12143 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 12144 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 12145 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 12146 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 12147 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 12148 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 12149 | cfg80211_inform_bss_frame. |
| 12150 | */ |
| 12151 | struct net_device *dev = pAdapter->dev; |
| 12152 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 12153 | struct wiphy *wiphy = wdev->wiphy; |
| 12154 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 12155 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 12156 | qcom_ie_age *qie_age = NULL; |
| 12157 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 12158 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12159 | 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] | 12160 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12161 | const char *ie = |
| 12162 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 12163 | unsigned int freq; |
| 12164 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 12165 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12166 | struct cfg80211_bss *bss_status = NULL; |
| 12167 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 12168 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12169 | hdd_context_t *pHddCtx; |
| 12170 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12171 | #ifdef WLAN_OPEN_SOURCE |
| 12172 | struct timespec ts; |
| 12173 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12174 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12175 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12176 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12177 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12178 | if (0 != status) |
| 12179 | { |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 12180 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12181 | } |
| 12182 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 12183 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12184 | if (!mgmt) |
| 12185 | { |
| 12186 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12187 | "%s: memory allocation failed ", __func__); |
| 12188 | return NULL; |
| 12189 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 12190 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12191 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12192 | |
| 12193 | #ifdef WLAN_OPEN_SOURCE |
| 12194 | /* Android does not want the timestamp from the frame. |
| 12195 | Instead it wants a monotonic increasing value */ |
| 12196 | get_monotonic_boottime(&ts); |
| 12197 | mgmt->u.probe_resp.timestamp = |
| 12198 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 12199 | #else |
| 12200 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12201 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 12202 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12203 | |
| 12204 | #endif |
| 12205 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12206 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 12207 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 12208 | |
| 12209 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 12210 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 12211 | /* Assuming this is the last IE, copy at the end */ |
| 12212 | ie_length -=sizeof(qcom_ie_age); |
| 12213 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 12214 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 12215 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 12216 | qie_age->oui_1 = QCOM_OUI1; |
| 12217 | qie_age->oui_2 = QCOM_OUI2; |
| 12218 | qie_age->oui_3 = QCOM_OUI3; |
| 12219 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
Deepthi Gowri | 4480a3f | 2016-05-18 19:30:17 +0530 | [diff] [blame] | 12220 | qie_age->age = vos_timer_get_system_time() - bss_desc->nReceivedTime; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 12221 | #endif |
| 12222 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12223 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 12224 | if (bss_desc->fProbeRsp) |
| 12225 | { |
| 12226 | mgmt->frame_control |= |
| 12227 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 12228 | } |
| 12229 | else |
| 12230 | { |
| 12231 | mgmt->frame_control |= |
| 12232 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 12233 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12234 | |
| 12235 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12236 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12237 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 12238 | { |
| 12239 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 12240 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12241 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12242 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 12243 | |
| 12244 | { |
| 12245 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 12246 | } |
| 12247 | else |
| 12248 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 12249 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 12250 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12251 | kfree(mgmt); |
| 12252 | return NULL; |
| 12253 | } |
| 12254 | #else |
| 12255 | freq = ieee80211_channel_to_frequency(chan_no); |
| 12256 | #endif |
| 12257 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 12258 | /*when the band is changed on the fly using the GUI, three things are done |
| 12259 | * 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) |
| 12260 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 12261 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 12262 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 12263 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 12264 | * 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 |
| 12265 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 12266 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 12267 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 12268 | * So drop the bss and continue to next bss. |
| 12269 | */ |
| 12270 | if(chan == NULL) |
| 12271 | { |
Deepthi Gowri | 306657b | 2016-04-28 17:10:41 +0530 | [diff] [blame] | 12272 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12273 | FL("chan pointer is NULL, chan_no: %d freq: %d"), |
| 12274 | chan_no, freq); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 12275 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 12276 | return NULL; |
| 12277 | } |
Hanumantha Reddy Pothula | 904bcef | 2015-06-19 11:56:29 +0530 | [diff] [blame] | 12278 | /*To keep the rssi icon of the connected AP in the scan window |
| 12279 | *and the rssi icon of the wireless networks in sync |
| 12280 | * */ |
| 12281 | if (( eConnectionState_Associated == |
| 12282 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 12283 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 12284 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 12285 | WNI_CFG_BSSID_LEN)) && |
| 12286 | (pHddCtx->hdd_wlan_suspended == FALSE)) |
| 12287 | { |
| 12288 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 12289 | rssi = (pAdapter->rssi * 100); |
| 12290 | } |
| 12291 | else |
| 12292 | { |
| 12293 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 12294 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12295 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 12296 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 12297 | " RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 12298 | vos_freq_to_chan(chan->center_freq), (int)(rssi/100)); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 12299 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12300 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 12301 | frame_len, rssi, GFP_KERNEL); |
| 12302 | kfree(mgmt); |
| 12303 | return bss_status; |
| 12304 | } |
| 12305 | |
| 12306 | /* |
| 12307 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 12308 | * This function is used to update the BSS data base of CFG8011 |
| 12309 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12310 | 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] | 12311 | tCsrRoamInfo *pRoamInfo |
| 12312 | ) |
| 12313 | { |
| 12314 | tCsrRoamConnectedProfile roamProfile; |
| 12315 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12316 | struct cfg80211_bss *bss = NULL; |
| 12317 | |
| 12318 | ENTER(); |
| 12319 | |
| 12320 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 12321 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 12322 | |
| 12323 | if (NULL != roamProfile.pBssDesc) |
| 12324 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 12325 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 12326 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12327 | |
| 12328 | if (NULL == bss) |
| 12329 | { |
| 12330 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 12331 | __func__); |
| 12332 | } |
| 12333 | |
| 12334 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 12335 | } |
| 12336 | else |
| 12337 | { |
| 12338 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 12339 | __func__); |
| 12340 | } |
| 12341 | return bss; |
| 12342 | } |
| 12343 | |
| 12344 | /* |
| 12345 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 12346 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12347 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 12348 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12349 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12350 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12351 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12352 | tCsrScanResultInfo *pScanResult; |
| 12353 | eHalStatus status = 0; |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12354 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12355 | tScanResultHandle pResult; |
| 12356 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12357 | hdd_context_t *pHddCtx; |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 12358 | bool is_p2p_scan = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12359 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12360 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12361 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12362 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 12363 | NO_SESSION, pAdapter->sessionId)); |
| 12364 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12365 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12366 | ret = wlan_hdd_validate_context(pHddCtx); |
| 12367 | if (0 != ret) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12368 | { |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12369 | return ret; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12370 | } |
| 12371 | |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 12372 | if (pAdapter->request != NULL) |
| 12373 | { |
| 12374 | if ((pAdapter->request->n_ssids == 1) |
| 12375 | && (pAdapter->request->ssids != NULL) |
| 12376 | && vos_mem_compare(&pAdapter->request->ssids[0], "DIRECT-", 7)) |
| 12377 | is_p2p_scan = true; |
| 12378 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12379 | /* |
| 12380 | * start getting scan results and populate cgf80211 BSS database |
| 12381 | */ |
| 12382 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 12383 | |
| 12384 | /* no scan results */ |
| 12385 | if (NULL == pResult) |
| 12386 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 12387 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 12388 | __func__, status); |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 12389 | wlan_hdd_get_frame_logs(pAdapter, |
| 12390 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12391 | return status; |
| 12392 | } |
| 12393 | |
| 12394 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 12395 | |
| 12396 | while (pScanResult) |
| 12397 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12398 | /* |
| 12399 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 12400 | * entry already exists in bss data base of cfg80211 for that |
| 12401 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 12402 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 12403 | * mgmt packet as input. As of now there is no possibility to get |
| 12404 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12405 | * ieee80211_mgmt(probe response) and passing to c |
| 12406 | * fg80211_inform_bss_frame. |
| 12407 | * */ |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 12408 | if(is_p2p_scan && (pScanResult->ssId.ssId != NULL) && |
| 12409 | !vos_mem_compare( pScanResult->ssId.ssId, "DIRECT-", 7) ) |
| 12410 | { |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 12411 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 12412 | continue; //Skip the non p2p bss entries |
| 12413 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12414 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 12415 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12416 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12417 | |
| 12418 | if (NULL == bss_status) |
| 12419 | { |
| 12420 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12421 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12422 | } |
| 12423 | else |
| 12424 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12425 | cfg80211_put_bss( |
| 12426 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 12427 | wiphy, |
| 12428 | #endif |
| 12429 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12430 | } |
| 12431 | |
| 12432 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 12433 | } |
| 12434 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12435 | sme_ScanResultPurge(hHal, pResult); |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 12436 | is_p2p_scan = false; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12437 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12438 | } |
| 12439 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12440 | void |
| 12441 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 12442 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12443 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 12444 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12445 | } /****** end hddPrintMacAddr() ******/ |
| 12446 | |
| 12447 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 12448 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12449 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12450 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12451 | "%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] | 12452 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 12453 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 12454 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12455 | } /****** end hddPrintPmkId() ******/ |
| 12456 | |
| 12457 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 12458 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 12459 | |
| 12460 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 12461 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 12462 | |
| 12463 | #define dump_bssid(bssid) \ |
| 12464 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12465 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 12466 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12467 | } |
| 12468 | |
| 12469 | #define dump_pmkid(pMac, pmkid) \ |
| 12470 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12471 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 12472 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12473 | } |
| 12474 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 12475 | #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] | 12476 | /* |
| 12477 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 12478 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 12479 | */ |
| 12480 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12481 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12482 | int index, bool preauth ) |
| 12483 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12484 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12485 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 12486 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12487 | |
| 12488 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12489 | 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] | 12490 | |
| 12491 | if( NULL == pRoamInfo ) |
| 12492 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12493 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12494 | return -EINVAL; |
| 12495 | } |
| 12496 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 12497 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 12498 | { |
| 12499 | dump_bssid(pRoamInfo->bssid); |
| 12500 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12501 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 12502 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12503 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12504 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12505 | } |
| 12506 | #endif //FEATURE_WLAN_LFR |
| 12507 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 12508 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 12509 | /* |
| 12510 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 12511 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 12512 | * |
| 12513 | */ |
| 12514 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 12515 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 12516 | tCsrRoamInfo *pRoamInfo) |
| 12517 | { |
| 12518 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 12519 | union iwreq_data wrqu; |
| 12520 | |
| 12521 | ENTER(); |
| 12522 | |
| 12523 | if (NULL == pAdapter) |
| 12524 | { |
| 12525 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 12526 | return VOS_STATUS_E_FAILURE; |
| 12527 | } |
| 12528 | |
| 12529 | /* create the event */ |
| 12530 | memset(&wrqu, 0, sizeof(wrqu)); |
| 12531 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 12532 | |
| 12533 | wrqu.data.pointer = metrics_notification; |
| 12534 | wrqu.data.length = scnprintf(metrics_notification, |
| 12535 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 12536 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 12537 | |
| 12538 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 12539 | |
| 12540 | EXIT(); |
| 12541 | |
| 12542 | return VOS_STATUS_SUCCESS; |
| 12543 | } |
| 12544 | |
| 12545 | /* |
| 12546 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 12547 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 12548 | * or failure |
| 12549 | */ |
| 12550 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 12551 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 12552 | { |
| 12553 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 12554 | union iwreq_data wrqu; |
| 12555 | |
| 12556 | ENTER(); |
| 12557 | |
| 12558 | if (NULL == pAdapter) |
| 12559 | { |
| 12560 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 12561 | return VOS_STATUS_E_FAILURE; |
| 12562 | } |
| 12563 | |
| 12564 | /* create the event */ |
| 12565 | memset(&wrqu, 0, sizeof(wrqu)); |
| 12566 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 12567 | |
| 12568 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 12569 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 12570 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 12571 | |
| 12572 | if (1 == preauth_status) |
| 12573 | strncat(metrics_notification, " TRUE", 5); |
| 12574 | else |
| 12575 | strncat(metrics_notification, " FALSE", 6); |
| 12576 | |
| 12577 | wrqu.data.pointer = metrics_notification; |
| 12578 | wrqu.data.length = strlen(metrics_notification); |
| 12579 | |
| 12580 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 12581 | |
| 12582 | EXIT(); |
| 12583 | |
| 12584 | return VOS_STATUS_SUCCESS; |
| 12585 | } |
| 12586 | |
| 12587 | /* |
| 12588 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 12589 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 12590 | * |
| 12591 | */ |
| 12592 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 12593 | tCsrRoamInfo *pRoamInfo) |
| 12594 | { |
| 12595 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 12596 | union iwreq_data wrqu; |
| 12597 | |
| 12598 | ENTER(); |
| 12599 | |
| 12600 | if (NULL == pAdapter) |
| 12601 | { |
| 12602 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 12603 | return VOS_STATUS_E_FAILURE; |
| 12604 | } |
| 12605 | |
| 12606 | /* create the event */ |
| 12607 | memset(&wrqu, 0, sizeof(wrqu)); |
| 12608 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 12609 | |
| 12610 | wrqu.data.pointer = metrics_notification; |
| 12611 | wrqu.data.length = scnprintf(metrics_notification, |
| 12612 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 12613 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 12614 | |
| 12615 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 12616 | |
| 12617 | EXIT(); |
| 12618 | |
| 12619 | return VOS_STATUS_SUCCESS; |
| 12620 | } |
| 12621 | #endif |
| 12622 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12623 | /* |
| 12624 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 12625 | * scanning callback function, called after finishing scan |
| 12626 | * |
| 12627 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12628 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12629 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 12630 | { |
| 12631 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12632 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12633 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12634 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12635 | struct cfg80211_scan_request *req = NULL; |
| 12636 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12637 | bool aborted = false; |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12638 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 12639 | bool iface_down = false; |
| 12640 | #endif |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12641 | long waitRet = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 12642 | tANI_U8 i; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12643 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12644 | |
| 12645 | ENTER(); |
| 12646 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12647 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Siddharth Bhal | 5c2e02d | 2015-05-05 17:35:29 +0530 | [diff] [blame] | 12648 | if (NULL == pHddCtx) { |
| 12649 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is Null")); |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12650 | return 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12651 | } |
| 12652 | |
Mahesh A Saptasagar | 1129675 | 2016-01-07 17:53:02 +0530 | [diff] [blame] | 12653 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 12654 | if (!(pAdapter->dev->flags & IFF_UP)) |
| 12655 | { |
| 12656 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Interface is down")); |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12657 | iface_down = true; |
Mahesh A Saptasagar | 1129675 | 2016-01-07 17:53:02 +0530 | [diff] [blame] | 12658 | } |
| 12659 | #endif |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12660 | pScanInfo = &pHddCtx->scan_info; |
| 12661 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12662 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12663 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12664 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12665 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 12666 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 12667 | pScanInfo->mScanPendingCounter = 0; |
| 12668 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12669 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12670 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12671 | &pScanInfo->scan_req_completion_event, |
| 12672 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12673 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12674 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12675 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12676 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12677 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12678 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12679 | } |
| 12680 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 12681 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12682 | { |
| 12683 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12684 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12685 | } |
| 12686 | |
| 12687 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12688 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12689 | { |
| 12690 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12691 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12692 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12693 | (int) scanId); |
| 12694 | } |
| 12695 | |
Mahesh A Saptasagar | 9dd7284 | 2016-04-15 19:45:14 +0530 | [diff] [blame] | 12696 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12697 | if (!iface_down) |
Mahesh A Saptasagar | 9dd7284 | 2016-04-15 19:45:14 +0530 | [diff] [blame] | 12698 | #endif |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12699 | { |
| 12700 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 12701 | pAdapter); |
| 12702 | if (0 > ret) |
| 12703 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | 9dd7284 | 2016-04-15 19:45:14 +0530 | [diff] [blame] | 12704 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12705 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12706 | /* If any client wait scan result through WEXT |
| 12707 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 12708 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12709 | { |
| 12710 | /* The other scan request waiting for current scan finish |
| 12711 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 12712 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12713 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 12714 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12715 | } |
| 12716 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 12717 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12718 | { |
| 12719 | struct net_device *dev = pAdapter->dev; |
| 12720 | union iwreq_data wrqu; |
| 12721 | int we_event; |
| 12722 | char *msg; |
| 12723 | |
| 12724 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 12725 | we_event = SIOCGIWSCAN; |
| 12726 | msg = NULL; |
| 12727 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 12728 | } |
| 12729 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 12730 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12731 | |
| 12732 | /* Get the Scan Req */ |
| 12733 | req = pAdapter->request; |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 12734 | pAdapter->request = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12735 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12736 | /* Scan is no longer pending */ |
| 12737 | pScanInfo->mScanPending = VOS_FALSE; |
| 12738 | |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 12739 | if (!req || req->wiphy == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12740 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12741 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 12742 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12743 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12744 | } |
| 12745 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 12746 | /* last_scan_timestamp is used to decide if new scan |
| 12747 | * is needed or not on station interface. If last station |
| 12748 | * scan time and new station scan time is less then |
| 12749 | * last_scan_timestamp ; driver will return cached scan. |
| 12750 | */ |
| 12751 | if (req->no_cck == FALSE && status == eCSR_SCAN_SUCCESS) // no_cck will be set during p2p find |
| 12752 | { |
| 12753 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 12754 | |
| 12755 | if ( req->n_channels ) |
| 12756 | { |
| 12757 | for (i = 0; i < req->n_channels ; i++ ) |
| 12758 | { |
| 12759 | pHddCtx->scan_info.last_scan_channelList[i] = req->channels[i]->hw_value; |
| 12760 | } |
| 12761 | /* store no of channel scanned */ |
| 12762 | pHddCtx->scan_info.last_scan_numChannels= req->n_channels; |
| 12763 | } |
| 12764 | |
| 12765 | } |
| 12766 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 12767 | /* |
| 12768 | * cfg80211_scan_done informing NL80211 about completion |
| 12769 | * of scanning |
| 12770 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12771 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 12772 | { |
| 12773 | aborted = true; |
| 12774 | } |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 12775 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12776 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 12777 | if (!iface_down) |
| 12778 | #endif |
| 12779 | cfg80211_scan_done(req, aborted); |
mukul sharma | e704182 | 2015-12-03 15:09:21 +0530 | [diff] [blame] | 12780 | |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 12781 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12782 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12783 | allow_suspend: |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 12784 | if ((pHddCtx->cfg_ini->enableMacSpoofing == MAC_ADDR_SPOOFING_FW_HOST_ENABLE |
| 12785 | ) && (pHddCtx->spoofMacAddr.isEnabled |
| 12786 | || pHddCtx->spoofMacAddr.isReqDeferred)) { |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 12787 | /* Generate new random mac addr for next scan */ |
| 12788 | 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] | 12789 | |
| 12790 | schedule_delayed_work(&pHddCtx->spoof_mac_addr_work, |
| 12791 | msecs_to_jiffies(MAC_ADDR_SPOOFING_DEFER_INTERVAL)); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 12792 | } |
| 12793 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 12794 | /* release the wake lock at the end of the scan*/ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 12795 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12796 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 12797 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 12798 | * immediatly after the driver gets connect request(i.e after scan) |
| 12799 | * from supplicant, this result in app's is suspending and not able |
| 12800 | * to process the connect request to AP */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 12801 | hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 12802 | |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12803 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 12804 | if (!iface_down) |
| 12805 | #endif |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 12806 | #ifdef FEATURE_WLAN_TDLS |
Mahesh A Saptasagar | 08af5a3 | 2016-06-30 12:29:49 +0530 | [diff] [blame] | 12807 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 12808 | #endif |
| 12809 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12810 | EXIT(); |
| 12811 | return 0; |
| 12812 | } |
| 12813 | |
| 12814 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12815 | * FUNCTION: hdd_isConnectionInProgress |
| 12816 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12817 | * |
| 12818 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 12819 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12820 | { |
| 12821 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 12822 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 12823 | hdd_adapter_t *pAdapter = NULL; |
| 12824 | VOS_STATUS status = 0; |
| 12825 | v_U8_t staId = 0; |
| 12826 | v_U8_t *staMac = NULL; |
| 12827 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 12828 | if (TRUE == pHddCtx->btCoexModeSet) |
| 12829 | { |
| 12830 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12831 | FL("BTCoex Mode operation in progress")); |
| 12832 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 12833 | } |
| 12834 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12835 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 12836 | |
| 12837 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 12838 | { |
| 12839 | pAdapter = pAdapterNode->pAdapter; |
| 12840 | |
| 12841 | if( pAdapter ) |
| 12842 | { |
| 12843 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12844 | "%s: Adapter with device mode %s (%d) exists", |
| 12845 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12846 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 12847 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12848 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 12849 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 12850 | (eConnectionState_Connecting == |
| 12851 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 12852 | { |
| 12853 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12854 | "%s: %p(%d) Connection is in progress", __func__, |
| 12855 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 12856 | return VOS_TRUE; |
| 12857 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 12858 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Padma, Santhosh Kumar | 3b9657d | 2015-02-04 19:37:32 +0530 | [diff] [blame] | 12859 | smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 12860 | { |
| 12861 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12862 | "%s: %p(%d) Reassociation is in progress", __func__, |
| 12863 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 12864 | return VOS_TRUE; |
| 12865 | } |
| 12866 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12867 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 12868 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12869 | { |
| 12870 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12871 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12872 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12873 | { |
| 12874 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 12875 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12876 | "%s: client " MAC_ADDRESS_STR |
| 12877 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 12878 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12879 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12880 | } |
| 12881 | } |
| 12882 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 12883 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 12884 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 12885 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 12886 | ptSapContext pSapCtx = NULL; |
| 12887 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 12888 | if(pSapCtx == NULL){ |
| 12889 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12890 | FL("psapCtx is NULL")); |
| 12891 | return VOS_FALSE; |
| 12892 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12893 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 12894 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 12895 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 12896 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12897 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 12898 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12899 | |
| 12900 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12901 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 12902 | "middle of WPS/EAPOL exchange.", __func__, |
| 12903 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12904 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12905 | } |
| 12906 | } |
| 12907 | } |
| 12908 | } |
| 12909 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 12910 | pAdapterNode = pNext; |
| 12911 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12912 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12913 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12914 | |
Selvaraj, Sridhar | d2b078a | 2016-06-18 10:44:37 +0530 | [diff] [blame] | 12915 | /** |
| 12916 | * csr_scan_request_assign_bssid() - Set the BSSID received from Supplicant |
| 12917 | * to the Scan request |
| 12918 | * @scanRequest: Pointer to the csr scan request |
| 12919 | * @request: Pointer to the scan request from supplicant |
| 12920 | * |
| 12921 | * Return: None |
| 12922 | */ |
| 12923 | #ifdef CFG80211_SCAN_BSSID |
| 12924 | static inline void csr_scan_request_assign_bssid(tCsrScanRequest *scanRequest, |
| 12925 | struct cfg80211_scan_request *request) |
| 12926 | { |
| 12927 | vos_mem_copy(scanRequest->bssid, request->bssid, VOS_MAC_ADDR_SIZE); |
| 12928 | } |
| 12929 | #else |
| 12930 | static inline void csr_scan_request_assign_bssid(tCsrScanRequest *scanRequest, |
| 12931 | struct cfg80211_scan_request *request) |
| 12932 | { |
| 12933 | } |
| 12934 | #endif |
| 12935 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12936 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12937 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12938 | * this scan respond to scan trigger and update cfg80211 scan database |
| 12939 | * later, scan dump command can be used to recieve scan results |
| 12940 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12941 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 12942 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 12943 | struct net_device *dev, |
| 12944 | #endif |
| 12945 | struct cfg80211_scan_request *request) |
| 12946 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 12947 | hdd_adapter_t *pAdapter = NULL; |
| 12948 | hdd_context_t *pHddCtx = NULL; |
| 12949 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12950 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12951 | tCsrScanRequest scanRequest; |
| 12952 | tANI_U8 *channelList = NULL, i; |
| 12953 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12954 | int status; |
| 12955 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12956 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 12957 | int ret = 0; |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 12958 | v_U8_t *pWpsIe=NULL; |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 12959 | bool is_p2p_scan = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12960 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 12961 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 12962 | struct net_device *dev = NULL; |
| 12963 | if (NULL == request) |
| 12964 | { |
| 12965 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12966 | "%s: scan req param null", __func__); |
| 12967 | return -EINVAL; |
| 12968 | } |
| 12969 | dev = request->wdev->netdev; |
| 12970 | #endif |
| 12971 | |
| 12972 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 12973 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 12974 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12975 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12976 | ENTER(); |
| 12977 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12978 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 12979 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12980 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12981 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12982 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12983 | if (0 != status) |
| 12984 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12985 | return status; |
| 12986 | } |
| 12987 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 12988 | if (NULL == pwextBuf) |
| 12989 | { |
| 12990 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 12991 | __func__); |
| 12992 | return -EIO; |
| 12993 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12994 | cfg_param = pHddCtx->cfg_ini; |
| 12995 | pScanInfo = &pHddCtx->scan_info; |
| 12996 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12997 | #ifdef WLAN_BTAMP_FEATURE |
| 12998 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12999 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13000 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 13001 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13002 | "%s: No scanning when AMP is on", __func__); |
| 13003 | return -EOPNOTSUPP; |
| 13004 | } |
| 13005 | #endif |
| 13006 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13007 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13008 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13009 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13010 | "%s: Not scanning on device_mode = %s (%d)", |
| 13011 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 13012 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13013 | return -EOPNOTSUPP; |
| 13014 | } |
| 13015 | |
| 13016 | if (TRUE == pScanInfo->mScanPending) |
| 13017 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 13018 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 13019 | { |
| 13020 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 13021 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13022 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13023 | } |
| 13024 | |
Hanumantha Reddy Pothula | 4b6be06 | 2015-08-18 14:06:24 +0530 | [diff] [blame] | 13025 | // Don't allow scan if PNO scan is going on. |
| 13026 | if (pHddCtx->isPnoEnable) |
| 13027 | { |
| 13028 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 13029 | FL("pno scan in progress")); |
| 13030 | return -EBUSY; |
| 13031 | } |
| 13032 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13033 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13034 | //Channel and action frame is pending |
| 13035 | //Otherwise Cancel Remain On Channel and allow Scan |
| 13036 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 13037 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13038 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 13039 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13040 | return -EBUSY; |
| 13041 | } |
| 13042 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13043 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 13044 | { |
| 13045 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 13046 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13047 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13048 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13049 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 13050 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13051 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13052 | "%s: MAX TM Level Scan not allowed", __func__); |
| 13053 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13054 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13055 | } |
| 13056 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 13057 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13058 | /* Check if scan is allowed at this point of time. |
| 13059 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 13060 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13061 | { |
Agrawal Ashish | c932a8d | 2016-08-17 19:21:02 +0530 | [diff] [blame] | 13062 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Scan not allowed")); |
| 13063 | if (SCAN_ABORT_THRESHOLD < pHddCtx->con_scan_abort_cnt) { |
| 13064 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 13065 | FL("Triggering SSR, SSR status = %d"), status); |
| 13066 | vos_wlanRestart(); |
| 13067 | } |
| 13068 | else |
| 13069 | pHddCtx->con_scan_abort_cnt++; |
| 13070 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 13071 | return -EBUSY; |
| 13072 | } |
Agrawal Ashish | c932a8d | 2016-08-17 19:21:02 +0530 | [diff] [blame] | 13073 | pHddCtx->con_scan_abort_cnt = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13074 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13075 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 13076 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13077 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 13078 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 13079 | * is not aging out the scan results. |
| 13080 | */ |
| 13081 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13082 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13083 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13084 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13085 | |
| 13086 | if ((request->ssids) && (0 < request->n_ssids)) |
| 13087 | { |
| 13088 | tCsrSSIDInfo *SsidInfo; |
| 13089 | int j; |
| 13090 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 13091 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 13092 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 13093 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 13094 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 13095 | |
| 13096 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 13097 | { |
| 13098 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13099 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 13100 | return -ENOMEM; |
| 13101 | } |
| 13102 | |
| 13103 | /* copy all the ssid's and their length */ |
| 13104 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 13105 | { |
| 13106 | /* get the ssid length */ |
| 13107 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 13108 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 13109 | SsidInfo->SSID.length); |
| 13110 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 13111 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 13112 | j, SsidInfo->SSID.ssId); |
| 13113 | } |
| 13114 | /* set the scan type to active */ |
| 13115 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 13116 | } |
| 13117 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13118 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 13119 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 13120 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 13121 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13122 | /* set the scan type to active */ |
| 13123 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13124 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13125 | else |
| 13126 | { |
| 13127 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 13128 | scanRequest.scanType = pScanInfo->scan_mode; |
| 13129 | } |
| 13130 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 13131 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13132 | |
Selvaraj, Sridhar | d2b078a | 2016-06-18 10:44:37 +0530 | [diff] [blame] | 13133 | csr_scan_request_assign_bssid(&scanRequest, request); |
| 13134 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13135 | /* set BSSType to default type */ |
| 13136 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 13137 | |
| 13138 | /*TODO: scan the requested channels only*/ |
| 13139 | |
| 13140 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13141 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13142 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13143 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 13144 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 13145 | request->n_channels = MAX_CHANNEL; |
| 13146 | } |
| 13147 | |
| 13148 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13149 | "No of Scan Channels: %d", request->n_channels); |
| 13150 | |
| 13151 | |
| 13152 | if( request->n_channels ) |
| 13153 | { |
| 13154 | char chList [(request->n_channels*5)+1]; |
| 13155 | int len; |
| 13156 | channelList = vos_mem_malloc( request->n_channels ); |
| 13157 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 13158 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13159 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13160 | "%s: memory alloc failed channelList", __func__); |
| 13161 | status = -ENOMEM; |
| 13162 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 13163 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13164 | |
| 13165 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 13166 | { |
| 13167 | channelList[i] = request->channels[i]->hw_value; |
| 13168 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 13169 | } |
| 13170 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13171 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13172 | "Channel-List: %s ", chList); |
| 13173 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 13174 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13175 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 13176 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 13177 | |
| 13178 | /* set requestType to full scan */ |
| 13179 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 13180 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13181 | /* if there is back to back scan happening in driver with in |
| 13182 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 13183 | * and should provide last cached scan results instead of new channel list. |
| 13184 | * This rule is not applicable if scan is p2p scan. |
| 13185 | * This condition will work only in case when last request no of channels |
| 13186 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13187 | * This should be done only in connected state |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 13188 | * Scan shouldn't be defered for WPS scan case. |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13189 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13190 | |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 13191 | pWpsIe = wlan_hdd_get_wps_ie_ptr((v_U8_t*)request->ie,request->ie_len); |
| 13192 | /* if wps ie is NULL , then only defer scan */ |
| 13193 | if ( pWpsIe == NULL && |
| 13194 | (VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13195 | { |
| 13196 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 13197 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 13198 | { |
| 13199 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 13200 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 13201 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 13202 | channelList, pScanInfo->last_scan_numChannels)) |
| 13203 | { |
| 13204 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 13205 | " New and old station scan time differ is less then %u", |
| 13206 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 13207 | |
| 13208 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13209 | pAdapter); |
| 13210 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13211 | hddLog(VOS_TRACE_LEVEL_WARN, |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 13212 | "Return old cached scan as all channels and no of channels are same"); |
| 13213 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13214 | if (0 > ret) |
| 13215 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13216 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13217 | cfg80211_scan_done(request, eCSR_SCAN_SUCCESS); |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 13218 | |
| 13219 | status = eHAL_STATUS_SUCCESS; |
| 13220 | goto free_mem; |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13221 | } |
| 13222 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13223 | } |
| 13224 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13225 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 13226 | * search (Flush on both full scan and social scan but not on single |
| 13227 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 13228 | */ |
| 13229 | |
| 13230 | /* Supplicant does single channel scan after 8-way handshake |
| 13231 | * and in that case driver shoudnt flush scan results. If |
| 13232 | * driver flushes the scan results here and unfortunately if |
| 13233 | * the AP doesnt respond to our probe req then association |
| 13234 | * fails which is not desired |
| 13235 | */ |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 13236 | if ((request->n_ssids == 1) |
| 13237 | && (request->ssids != NULL) |
| 13238 | && vos_mem_compare(&request->ssids[0], "DIRECT-", 7)) |
| 13239 | is_p2p_scan = true; |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13240 | |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 13241 | if( is_p2p_scan || |
| 13242 | (request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN) ) |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13243 | { |
| 13244 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 13245 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13246 | pAdapter->sessionId ); |
| 13247 | } |
| 13248 | |
| 13249 | if( request->ie_len ) |
| 13250 | { |
| 13251 | /* save this for future association (join requires this) */ |
| 13252 | /*TODO: Array needs to be converted to dynamic allocation, |
| 13253 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 13254 | * CR 597966 |
| 13255 | */ |
| 13256 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 13257 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 13258 | pScanInfo->scanAddIE.length = request->ie_len; |
| 13259 | |
| 13260 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 13261 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 13262 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13263 | { |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 13264 | if (request->ie_len <= SIR_MAC_MAX_ADD_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13265 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13266 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 13267 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 13268 | request->ie, request->ie_len); |
| 13269 | } |
| 13270 | else |
| 13271 | { |
| 13272 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 13273 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13274 | } |
| 13275 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13276 | } |
| 13277 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 13278 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 13279 | |
| 13280 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 13281 | request->ie_len); |
| 13282 | if (pP2pIe != NULL) |
| 13283 | { |
| 13284 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 13285 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 13286 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 13287 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13288 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13289 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 13290 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 13291 | "Go nego completed to Connection is started"); |
| 13292 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 13293 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13294 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13295 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 13296 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13297 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13298 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 13299 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 13300 | "Disconnected state to Connection is started"); |
| 13301 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 13302 | "for 4way Handshake"); |
| 13303 | } |
| 13304 | #endif |
| 13305 | |
| 13306 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 13307 | if(TRUE == request->no_cck) |
| 13308 | { |
| 13309 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13310 | "%s: This is a P2P Search", __func__); |
| 13311 | scanRequest.p2pSearch = 1; |
| 13312 | |
| 13313 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13314 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13315 | /* set requestType to P2P Discovery */ |
| 13316 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 13317 | } |
| 13318 | |
| 13319 | /* |
| 13320 | Skip Dfs Channel in case of P2P Search |
| 13321 | if it is set in ini file |
| 13322 | */ |
| 13323 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 13324 | { |
| 13325 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13326 | } |
| 13327 | else |
| 13328 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13329 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13330 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13331 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13332 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13333 | } |
| 13334 | } |
| 13335 | |
| 13336 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 13337 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 13338 | #ifdef FEATURE_WLAN_TDLS |
| 13339 | /* if tdls disagree scan right now, return immediately. |
| 13340 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 13341 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 13342 | */ |
| 13343 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 13344 | wiphy, |
| 13345 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 13346 | dev, |
| 13347 | #endif |
| 13348 | request); |
Abhishek Singh | e2b6395 | 2016-01-05 18:27:29 +0530 | [diff] [blame] | 13349 | if (status <= 0) |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 13350 | { |
Abhishek Singh | e2b6395 | 2016-01-05 18:27:29 +0530 | [diff] [blame] | 13351 | if (!status) |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 13352 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 13353 | "scan rejected %d", __func__, status); |
| 13354 | else |
| 13355 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 13356 | __func__, status); |
Abhishek Singh | e2b6395 | 2016-01-05 18:27:29 +0530 | [diff] [blame] | 13357 | hdd_wlan_block_scan_by_tdls(); |
Gupta, Kapil | 2ebf3e0 | 2016-03-17 19:45:19 +0530 | [diff] [blame] | 13358 | goto free_mem; |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 13359 | } |
| 13360 | #endif |
| 13361 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 13362 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 13363 | * address the following issues. |
| 13364 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 13365 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 13366 | * for long time, this result in apps running at full power for long time. |
| 13367 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 13368 | * be stuck in full power because of resume BMPS |
| 13369 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 13370 | hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13371 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13372 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 13373 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13374 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 13375 | scanRequest.requestType, scanRequest.scanType, |
| 13376 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13377 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 13378 | |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 13379 | if (pHddCtx->spoofMacAddr.isEnabled && |
| 13380 | pHddCtx->cfg_ini->enableMacSpoofing == 1) |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 13381 | { |
| 13382 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13383 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 13384 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 13385 | * to fill TxBds for probe request during current scan |
| 13386 | */ |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 13387 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 13388 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 13389 | |
| 13390 | if(status != VOS_STATUS_SUCCESS) |
| 13391 | { |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 13392 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 13393 | status = -EFAULT; |
Ganesh Kondabattini | 6d3b490 | 2015-05-12 23:19:22 +0530 | [diff] [blame] | 13394 | #ifdef FEATURE_WLAN_TDLS |
| 13395 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 13396 | #endif |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 13397 | goto free_mem; |
| 13398 | } |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 13399 | } |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 13400 | 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] | 13401 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13402 | pAdapter->sessionId, &scanRequest, &scanId, |
| 13403 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13404 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13405 | if (eHAL_STATUS_SUCCESS != status) |
| 13406 | { |
| 13407 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13408 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 13409 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 13410 | if(eHAL_STATUS_RESOURCES == status) |
| 13411 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13412 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 13413 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 13414 | status = -EBUSY; |
| 13415 | } else { |
| 13416 | status = -EIO; |
| 13417 | } |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 13418 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 13419 | |
| 13420 | #ifdef FEATURE_WLAN_TDLS |
| 13421 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 13422 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13423 | goto free_mem; |
| 13424 | } |
| 13425 | |
| 13426 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 13427 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13428 | pAdapter->request = request; |
| 13429 | pScanInfo->scanId = scanId; |
| 13430 | |
| 13431 | complete(&pScanInfo->scan_req_completion_event); |
| 13432 | |
| 13433 | free_mem: |
| 13434 | if( scanRequest.SSIDs.SSIDList ) |
| 13435 | { |
| 13436 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 13437 | } |
| 13438 | |
| 13439 | if( channelList ) |
| 13440 | vos_mem_free( channelList ); |
| 13441 | |
| 13442 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13443 | return status; |
| 13444 | } |
| 13445 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 13446 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 13447 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 13448 | struct net_device *dev, |
| 13449 | #endif |
| 13450 | struct cfg80211_scan_request *request) |
| 13451 | { |
| 13452 | int ret; |
| 13453 | |
| 13454 | vos_ssr_protect(__func__); |
| 13455 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 13456 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 13457 | dev, |
| 13458 | #endif |
| 13459 | request); |
| 13460 | vos_ssr_unprotect(__func__); |
| 13461 | |
| 13462 | return ret; |
| 13463 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13464 | |
| 13465 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 13466 | { |
| 13467 | v_U8_t iniDot11Mode = |
| 13468 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 13469 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 13470 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 13471 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 13472 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13473 | switch ( iniDot11Mode ) |
| 13474 | { |
| 13475 | case eHDD_DOT11_MODE_AUTO: |
| 13476 | case eHDD_DOT11_MODE_11ac: |
| 13477 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 13478 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 13479 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 13480 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 13481 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 13482 | else |
| 13483 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13484 | #else |
| 13485 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 13486 | #endif |
| 13487 | break; |
| 13488 | case eHDD_DOT11_MODE_11n: |
| 13489 | case eHDD_DOT11_MODE_11n_ONLY: |
| 13490 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 13491 | break; |
| 13492 | default: |
| 13493 | hddDot11Mode = iniDot11Mode; |
| 13494 | break; |
| 13495 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 13496 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 13497 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 13498 | #endif |
| 13499 | { |
| 13500 | /* This call decides required channel bonding mode */ |
| 13501 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13502 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 13503 | operationChannel); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 13504 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13505 | } |
| 13506 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13507 | /* |
| 13508 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13509 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13510 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13511 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 13512 | const u8 *ssid, size_t ssid_len, const u8 *bssid, |
| 13513 | const u8 *bssid_hint, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13514 | { |
| 13515 | int status = 0; |
| 13516 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 13517 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13518 | v_U32_t roamId; |
| 13519 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13520 | eCsrAuthType RSNAuthType; |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 13521 | const u8 *pValidBssid = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13522 | |
| 13523 | ENTER(); |
| 13524 | |
| 13525 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 13526 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13527 | |
| 13528 | status = wlan_hdd_validate_context(pHddCtx); |
| 13529 | if (status) |
| 13530 | { |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 13531 | return status; |
| 13532 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13533 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13534 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 13535 | { |
| 13536 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 13537 | return -EINVAL; |
| 13538 | } |
| 13539 | |
| 13540 | pRoamProfile = &pWextState->roamProfile; |
| 13541 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13542 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13543 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13544 | hdd_station_ctx_t *pHddStaCtx; |
| 13545 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13546 | |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 13547 | wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR); |
| 13548 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13549 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13550 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 13551 | { |
| 13552 | /*QoS not enabled in cfg file*/ |
| 13553 | pRoamProfile->uapsd_mask = 0; |
| 13554 | } |
| 13555 | else |
| 13556 | { |
| 13557 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13558 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13559 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 13560 | } |
| 13561 | |
| 13562 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 13563 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 13564 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13565 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13566 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 13567 | ssid, ssid_len); |
| 13568 | |
| 13569 | if (bssid) |
| 13570 | { |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 13571 | pValidBssid = bssid; |
| 13572 | } |
| 13573 | else if (bssid_hint) |
| 13574 | { |
| 13575 | pValidBssid = bssid_hint; |
| 13576 | } |
| 13577 | if (pValidBssid) |
| 13578 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13579 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 13580 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), pValidBssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13581 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13582 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 13583 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13584 | case of join failure we should send valid BSSID to supplicant |
| 13585 | */ |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 13586 | vos_mem_copy((void *)(pWextState->req_bssId), pValidBssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13587 | WNI_CFG_BSSID_LEN); |
| 13588 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 13589 | else |
| 13590 | { |
| 13591 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 13592 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13593 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 13594 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 13595 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13596 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 13597 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13598 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13599 | /*set gen ie*/ |
| 13600 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 13601 | /*set auth*/ |
| 13602 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 13603 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13604 | #ifdef FEATURE_WLAN_WAPI |
| 13605 | if (pAdapter->wapi_info.nWapiMode) |
| 13606 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13607 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13608 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 13609 | { |
| 13610 | case WAPI_AUTH_MODE_PSK: |
| 13611 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13612 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13613 | pAdapter->wapi_info.wapiAuthMode); |
| 13614 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 13615 | break; |
| 13616 | } |
| 13617 | case WAPI_AUTH_MODE_CERT: |
| 13618 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13619 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13620 | pAdapter->wapi_info.wapiAuthMode); |
| 13621 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 13622 | break; |
| 13623 | } |
| 13624 | } // End of switch |
| 13625 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 13626 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 13627 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13628 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13629 | pRoamProfile->AuthType.numEntries = 1; |
| 13630 | pRoamProfile->EncryptionType.numEntries = 1; |
| 13631 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 13632 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 13633 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 13634 | } |
| 13635 | } |
| 13636 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13637 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13638 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13639 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 13640 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 13641 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13642 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 13643 | sizeof (tSirGtkOffloadParams)); |
| 13644 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13645 | } |
| 13646 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13647 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 13648 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13649 | if( operatingChannel ) |
| 13650 | { |
| 13651 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 13652 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 13653 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 13654 | else |
| 13655 | { |
| 13656 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 13657 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 13658 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13659 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 13660 | { |
| 13661 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 13662 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 13663 | |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 13664 | /* |
| 13665 | * Change conn_state to connecting before sme_RoamConnect(), |
| 13666 | * because sme_RoamConnect() has a direct path to call |
| 13667 | * hdd_smeRoamCallback(), which will change the conn_state |
| 13668 | * If direct path, conn_state will be accordingly changed |
| 13669 | * to NotConnected or Associated by either |
| 13670 | * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() |
| 13671 | * in sme_RoamCallback() |
| 13672 | * if sme_RomConnect is to be queued, |
| 13673 | * Connecting state will remain until it is completed. |
| 13674 | * If connection state is not changed, |
| 13675 | * connection state will remain in eConnectionState_NotConnected state. |
| 13676 | * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true |
| 13677 | * if conn state is eConnectionState_NotConnected. |
| 13678 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 13679 | * informed of connect result indication which is an issue. |
| 13680 | */ |
| 13681 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 13682 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 13683 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 13684 | { |
| 13685 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 13686 | FL("Set HDD connState to eConnectionState_Connecting")); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 13687 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 13688 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 13689 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13690 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13691 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 13692 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 13693 | if ((eHAL_STATUS_SUCCESS != status) && |
| 13694 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 13695 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 13696 | |
| 13697 | { |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 13698 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13699 | FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"), |
| 13700 | pAdapter->sessionId, status); |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 13701 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 13702 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 13703 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 13704 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 13705 | |
| 13706 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 13707 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 13708 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13709 | } |
| 13710 | else |
| 13711 | { |
| 13712 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 13713 | return -EINVAL; |
| 13714 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 13715 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13716 | return status; |
| 13717 | } |
| 13718 | |
| 13719 | /* |
| 13720 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 13721 | * This function is used to set the authentication type (OPEN/SHARED). |
| 13722 | * |
| 13723 | */ |
| 13724 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 13725 | enum nl80211_auth_type auth_type) |
| 13726 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13727 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13728 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13729 | |
| 13730 | ENTER(); |
| 13731 | |
| 13732 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13733 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13734 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13735 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13736 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13737 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 13738 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 13739 | break; |
| 13740 | |
| 13741 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13742 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 13743 | case NL80211_AUTHTYPE_FT: |
| 13744 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13745 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13746 | "%s: set authentication type to OPEN", __func__); |
| 13747 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 13748 | break; |
| 13749 | |
| 13750 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13751 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13752 | "%s: set authentication type to SHARED", __func__); |
| 13753 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 13754 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13755 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13756 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13757 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13758 | "%s: set authentication type to CCKM WPA", __func__); |
| 13759 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 13760 | break; |
| 13761 | #endif |
| 13762 | |
| 13763 | |
| 13764 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13765 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13766 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13767 | auth_type); |
| 13768 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 13769 | return -EINVAL; |
| 13770 | } |
| 13771 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13772 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13773 | pHddStaCtx->conn_info.authType; |
| 13774 | return 0; |
| 13775 | } |
| 13776 | |
| 13777 | /* |
| 13778 | * FUNCTION: wlan_hdd_set_akm_suite |
| 13779 | * This function is used to set the key mgmt type(PSK/8021x). |
| 13780 | * |
| 13781 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13782 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13783 | u32 key_mgmt |
| 13784 | ) |
| 13785 | { |
| 13786 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 13787 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 13788 | /* Should be in ieee802_11_defs.h */ |
| 13789 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 13790 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13791 | /*set key mgmt type*/ |
| 13792 | switch(key_mgmt) |
| 13793 | { |
| 13794 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 13795 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 13796 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 13797 | case WLAN_AKM_SUITE_FT_PSK: |
| 13798 | #endif |
| 13799 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13800 | __func__); |
| 13801 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 13802 | break; |
| 13803 | |
| 13804 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 13805 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 13806 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 13807 | case WLAN_AKM_SUITE_FT_8021X: |
| 13808 | #endif |
| 13809 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13810 | __func__); |
| 13811 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 13812 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13813 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13814 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 13815 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 13816 | case WLAN_AKM_SUITE_CCKM: |
| 13817 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 13818 | __func__); |
| 13819 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 13820 | break; |
| 13821 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 13822 | #ifndef WLAN_AKM_SUITE_OSEN |
| 13823 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 13824 | case WLAN_AKM_SUITE_OSEN: |
| 13825 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 13826 | __func__); |
| 13827 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 13828 | break; |
| 13829 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13830 | |
| 13831 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13832 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13833 | __func__, key_mgmt); |
| 13834 | return -EINVAL; |
| 13835 | |
| 13836 | } |
| 13837 | return 0; |
| 13838 | } |
| 13839 | |
| 13840 | /* |
| 13841 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13842 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13843 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 13844 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13845 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 13846 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13847 | bool ucast |
| 13848 | ) |
| 13849 | { |
| 13850 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13851 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13852 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13853 | |
| 13854 | ENTER(); |
| 13855 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13856 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13857 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 13858 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13859 | __func__, cipher); |
| 13860 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 13861 | } |
| 13862 | else |
| 13863 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13864 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13865 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13866 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13867 | { |
| 13868 | case IW_AUTH_CIPHER_NONE: |
| 13869 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 13870 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13871 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13872 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13873 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13874 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13875 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13876 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13877 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13878 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13879 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13880 | case WLAN_CIPHER_SUITE_TKIP: |
| 13881 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 13882 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13883 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13884 | case WLAN_CIPHER_SUITE_CCMP: |
| 13885 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 13886 | break; |
| 13887 | #ifdef FEATURE_WLAN_WAPI |
| 13888 | case WLAN_CIPHER_SUITE_SMS4: |
| 13889 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 13890 | break; |
| 13891 | #endif |
| 13892 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13893 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13894 | case WLAN_CIPHER_SUITE_KRK: |
| 13895 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 13896 | break; |
| 13897 | #endif |
| 13898 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13899 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13900 | __func__, cipher); |
| 13901 | return -EOPNOTSUPP; |
| 13902 | } |
| 13903 | } |
| 13904 | |
| 13905 | if (ucast) |
| 13906 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13907 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13908 | __func__, encryptionType); |
| 13909 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 13910 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13911 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13912 | encryptionType; |
| 13913 | } |
| 13914 | else |
| 13915 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13916 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13917 | __func__, encryptionType); |
| 13918 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 13919 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 13920 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 13921 | } |
| 13922 | |
| 13923 | return 0; |
| 13924 | } |
| 13925 | |
| 13926 | |
| 13927 | /* |
| 13928 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 13929 | * This function is used to parse WPA/RSN IE's. |
| 13930 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13931 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13932 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 13933 | const u8 *ie, |
| 13934 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13935 | u8 *ie, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13936 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13937 | size_t ie_len |
| 13938 | ) |
| 13939 | { |
| 13940 | 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] | 13941 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 13942 | const u8 *genie = ie; |
| 13943 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13944 | u8 *genie = ie; |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13945 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13946 | v_U16_t remLen = ie_len; |
| 13947 | #ifdef FEATURE_WLAN_WAPI |
| 13948 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 13949 | u16 *tmp; |
| 13950 | v_U16_t akmsuiteCount; |
| 13951 | int *akmlist; |
| 13952 | #endif |
| 13953 | ENTER(); |
| 13954 | |
| 13955 | /* clear previous assocAddIE */ |
| 13956 | pWextState->assocAddIE.length = 0; |
| 13957 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 13958 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13959 | |
| 13960 | while (remLen >= 2) |
| 13961 | { |
| 13962 | v_U16_t eLen = 0; |
| 13963 | v_U8_t elementId; |
| 13964 | elementId = *genie++; |
| 13965 | eLen = *genie++; |
| 13966 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13967 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13968 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13969 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13970 | |
| 13971 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13972 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13973 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 13974 | 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] | 13975 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13976 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13977 | "%s: Invalid WPA IE", __func__); |
| 13978 | return -EINVAL; |
| 13979 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13980 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13981 | { |
| 13982 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13983 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13984 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13985 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 13986 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13987 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 13988 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 13989 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13990 | VOS_ASSERT(0); |
| 13991 | return -ENOMEM; |
| 13992 | } |
| 13993 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 13994 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 13995 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13996 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13997 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 13998 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 13999 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14000 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14001 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 14002 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14003 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 14004 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 14005 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 14006 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 14007 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 14008 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14009 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 14010 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14011 | { |
| 14012 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14013 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14014 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14015 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14016 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14017 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 14018 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 14019 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14020 | VOS_ASSERT(0); |
| 14021 | return -ENOMEM; |
| 14022 | } |
| 14023 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 14024 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 14025 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14026 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14027 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 14028 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14029 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14030 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14031 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 14032 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14033 | /*Consider WFD IE, only for P2P Client */ |
| 14034 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 14035 | { |
| 14036 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14037 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14038 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14039 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14040 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14041 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 14042 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 14043 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14044 | VOS_ASSERT(0); |
| 14045 | return -ENOMEM; |
| 14046 | } |
| 14047 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 14048 | // WPS IE + P2P IE + WFD IE |
| 14049 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 14050 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14051 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14052 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 14053 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14054 | } |
| 14055 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14056 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14057 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 14058 | HS20_OUI_TYPE_SIZE)) ) |
| 14059 | { |
| 14060 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14061 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 14062 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14063 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14064 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 14065 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 14066 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 14067 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 14068 | VOS_ASSERT(0); |
| 14069 | return -ENOMEM; |
| 14070 | } |
| 14071 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 14072 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14073 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 14074 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 14075 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14076 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 14077 | /* Appending OSEN Information Element in Assiciation Request */ |
| 14078 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 14079 | OSEN_OUI_TYPE_SIZE)) ) |
| 14080 | { |
| 14081 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 14082 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 14083 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14084 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14085 | 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] | 14086 | { |
| 14087 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 14088 | "Need bigger buffer space"); |
| 14089 | VOS_ASSERT(0); |
| 14090 | return -ENOMEM; |
| 14091 | } |
| 14092 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 14093 | pWextState->assocAddIE.length += eLen + 2; |
| 14094 | |
| 14095 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 14096 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 14097 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14098 | } |
| 14099 | |
Abhishek Singh | 4322e62 | 2015-06-10 15:42:54 +0530 | [diff] [blame] | 14100 | /* Update only for WPA IE */ |
| 14101 | if (!memcmp(genie, WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) && |
| 14102 | (WLAN_HDD_IBSS == pAdapter->device_mode)) { |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 14103 | |
| 14104 | /* populating as ADDIE in beacon frames */ |
| 14105 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14106 | 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] | 14107 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 14108 | { |
| 14109 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14110 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 14111 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 14112 | { |
| 14113 | hddLog(LOGE, |
| 14114 | "Coldn't pass " |
| 14115 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 14116 | } |
| 14117 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 14118 | else |
| 14119 | hddLog(LOGE, |
| 14120 | "Could not pass on " |
| 14121 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 14122 | |
| 14123 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 14124 | beaconIE's need to be populated in probe response frames */ |
| 14125 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 14126 | { |
| 14127 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 14128 | u8 probe_rsp_ie_len[3] = {0}; |
| 14129 | u8 counter = 0; |
| 14130 | |
| 14131 | /* Check Probe Resp Length if it is greater then 255 then |
| 14132 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 14133 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 14134 | not able Store More then 255 bytes into One Variable */ |
| 14135 | |
| 14136 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 14137 | { |
| 14138 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 14139 | { |
| 14140 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 14141 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 14142 | } |
| 14143 | else |
| 14144 | { |
| 14145 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 14146 | rem_probe_resp_ie_len = 0; |
| 14147 | } |
| 14148 | } |
| 14149 | |
| 14150 | rem_probe_resp_ie_len = 0; |
| 14151 | |
| 14152 | if (probe_rsp_ie_len[0] > 0) |
| 14153 | { |
| 14154 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14155 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 14156 | (tANI_U8*)(genie - 2), |
| 14157 | probe_rsp_ie_len[0], NULL, |
| 14158 | eANI_BOOLEAN_FALSE) |
| 14159 | == eHAL_STATUS_FAILURE) |
| 14160 | { |
| 14161 | hddLog(LOGE, |
| 14162 | "Could not pass" |
| 14163 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 14164 | } |
| 14165 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 14166 | } |
| 14167 | |
| 14168 | if (probe_rsp_ie_len[1] > 0) |
| 14169 | { |
| 14170 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14171 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 14172 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 14173 | probe_rsp_ie_len[1], NULL, |
| 14174 | eANI_BOOLEAN_FALSE) |
| 14175 | == eHAL_STATUS_FAILURE) |
| 14176 | { |
| 14177 | hddLog(LOGE, |
| 14178 | "Could not pass" |
| 14179 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 14180 | } |
| 14181 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 14182 | } |
| 14183 | |
| 14184 | if (probe_rsp_ie_len[2] > 0) |
| 14185 | { |
| 14186 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14187 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 14188 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 14189 | probe_rsp_ie_len[2], NULL, |
| 14190 | eANI_BOOLEAN_FALSE) |
| 14191 | == eHAL_STATUS_FAILURE) |
| 14192 | { |
| 14193 | hddLog(LOGE, |
| 14194 | "Could not pass" |
| 14195 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 14196 | } |
| 14197 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 14198 | } |
| 14199 | |
| 14200 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14201 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 14202 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 14203 | { |
| 14204 | hddLog(LOGE, |
| 14205 | "Could not pass" |
| 14206 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 14207 | } |
| 14208 | } |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 14209 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14210 | break; |
| 14211 | case DOT11F_EID_RSN: |
| 14212 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 14213 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 14214 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 14215 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 14216 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 14217 | break; |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 14218 | |
Abhishek Singh | b16f356 | 2016-01-20 11:08:32 +0530 | [diff] [blame] | 14219 | /* Appending extended capabilities with Interworking or |
| 14220 | * bsstransition bit set in Assoc Req. |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 14221 | * |
| 14222 | * 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] | 14223 | * interworkingService or bsstransition bit is set to 1. |
| 14224 | * Driver is only interested in interworkingService and |
| 14225 | * bsstransition capability from supplicant. |
| 14226 | * If in future any other EXT Cap info is |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 14227 | * required from supplicat, it needs to be handled while |
| 14228 | * sending Assoc Req in LIM. |
| 14229 | */ |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14230 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14231 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14232 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14233 | 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] | 14234 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14235 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14236 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14237 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 14238 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 14239 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14240 | VOS_ASSERT(0); |
| 14241 | return -ENOMEM; |
| 14242 | } |
| 14243 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 14244 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14245 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14246 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 14247 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14248 | break; |
| 14249 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14250 | #ifdef FEATURE_WLAN_WAPI |
| 14251 | case WLAN_EID_WAPI: |
| 14252 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 14253 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14254 | pAdapter->wapi_info.nWapiMode); |
| 14255 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14256 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14257 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 14258 | tmp = tmp + 1; |
| 14259 | akmlist = (int *)(tmp); |
| 14260 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 14261 | { |
| 14262 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 14263 | } |
| 14264 | else |
| 14265 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14266 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14267 | VOS_ASSERT(0); |
| 14268 | return -EINVAL; |
| 14269 | } |
| 14270 | |
| 14271 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 14272 | { |
| 14273 | 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] | 14274 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14275 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14276 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14277 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14278 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14279 | 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] | 14280 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14281 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 14282 | } |
| 14283 | break; |
| 14284 | #endif |
| 14285 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14286 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14287 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14288 | /* when Unknown IE is received we should break and continue |
| 14289 | * to the next IE in the buffer instead we were returning |
| 14290 | * so changing this to break */ |
| 14291 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14292 | } |
| 14293 | genie += eLen; |
| 14294 | remLen -= eLen; |
| 14295 | } |
| 14296 | EXIT(); |
| 14297 | return 0; |
| 14298 | } |
| 14299 | |
| 14300 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 14301 | * FUNCTION: hdd_isWPAIEPresent |
| 14302 | * Parse the received IE to find the WPA IE |
| 14303 | * |
| 14304 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14305 | static bool hdd_isWPAIEPresent( |
| 14306 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 14307 | const u8 *ie, |
| 14308 | #else |
| 14309 | u8 *ie, |
| 14310 | #endif |
| 14311 | u8 ie_len) |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 14312 | { |
| 14313 | v_U8_t eLen = 0; |
| 14314 | v_U16_t remLen = ie_len; |
| 14315 | v_U8_t elementId = 0; |
| 14316 | |
| 14317 | while (remLen >= 2) |
| 14318 | { |
| 14319 | elementId = *ie++; |
| 14320 | eLen = *ie++; |
| 14321 | remLen -= 2; |
| 14322 | if (eLen > remLen) |
| 14323 | { |
| 14324 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14325 | "%s: IE length is wrong %d", __func__, eLen); |
| 14326 | return FALSE; |
| 14327 | } |
| 14328 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 14329 | { |
| 14330 | /* OUI - 0x00 0X50 0XF2 |
| 14331 | WPA Information Element - 0x01 |
| 14332 | WPA version - 0x01*/ |
| 14333 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 14334 | return TRUE; |
| 14335 | } |
| 14336 | ie += eLen; |
| 14337 | remLen -= eLen; |
| 14338 | } |
| 14339 | return FALSE; |
| 14340 | } |
| 14341 | |
| 14342 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14343 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14344 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14345 | * parameters during connect operation. |
| 14346 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14347 | int wlan_hdd_cfg80211_set_privacy(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14348 | struct cfg80211_connect_params *req |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14349 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14350 | { |
| 14351 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14352 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14353 | ENTER(); |
| 14354 | |
| 14355 | /*set wpa version*/ |
| 14356 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 14357 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14358 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14359 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 14360 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14361 | { |
| 14362 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 14363 | } |
| 14364 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 14365 | { |
| 14366 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 14367 | } |
| 14368 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14369 | |
| 14370 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14371 | pWextState->wpaVersion); |
| 14372 | |
| 14373 | /*set authentication type*/ |
| 14374 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 14375 | |
| 14376 | if (0 > status) |
| 14377 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14378 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14379 | "%s: failed to set authentication type ", __func__); |
| 14380 | return status; |
| 14381 | } |
| 14382 | |
| 14383 | /*set key mgmt type*/ |
| 14384 | if (req->crypto.n_akm_suites) |
| 14385 | { |
| 14386 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 14387 | if (0 > status) |
| 14388 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14389 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14390 | __func__); |
| 14391 | return status; |
| 14392 | } |
| 14393 | } |
| 14394 | |
| 14395 | /*set pairwise cipher type*/ |
| 14396 | if (req->crypto.n_ciphers_pairwise) |
| 14397 | { |
| 14398 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 14399 | req->crypto.ciphers_pairwise[0], true); |
| 14400 | if (0 > status) |
| 14401 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14402 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14403 | "%s: failed to set unicast cipher type", __func__); |
| 14404 | return status; |
| 14405 | } |
| 14406 | } |
| 14407 | else |
| 14408 | { |
| 14409 | /*Reset previous cipher suite to none*/ |
| 14410 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 14411 | if (0 > status) |
| 14412 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14413 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14414 | "%s: failed to set unicast cipher type", __func__); |
| 14415 | return status; |
| 14416 | } |
| 14417 | } |
| 14418 | |
| 14419 | /*set group cipher type*/ |
| 14420 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 14421 | false); |
| 14422 | |
| 14423 | if (0 > status) |
| 14424 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14425 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14426 | __func__); |
| 14427 | return status; |
| 14428 | } |
| 14429 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 14430 | #ifdef WLAN_FEATURE_11W |
| 14431 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 14432 | #endif |
| 14433 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14434 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 14435 | if (req->ie_len) |
| 14436 | { |
| 14437 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 14438 | if ( 0 > status) |
| 14439 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14440 | 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] | 14441 | __func__); |
| 14442 | return status; |
| 14443 | } |
| 14444 | } |
| 14445 | |
| 14446 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14447 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14448 | { |
| 14449 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 14450 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 14451 | ) |
| 14452 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14453 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14454 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 14455 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14456 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14457 | __func__); |
| 14458 | return -EOPNOTSUPP; |
| 14459 | } |
| 14460 | else |
| 14461 | { |
| 14462 | u8 key_len = req->key_len; |
| 14463 | u8 key_idx = req->key_idx; |
| 14464 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14465 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14466 | && (CSR_MAX_NUM_KEY > key_idx) |
| 14467 | ) |
| 14468 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14469 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14470 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14471 | __func__, key_idx, key_len); |
| 14472 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14473 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14474 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14475 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14476 | (u8)key_len; |
| 14477 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 14478 | } |
| 14479 | } |
| 14480 | } |
| 14481 | } |
| 14482 | |
| 14483 | return status; |
| 14484 | } |
| 14485 | |
| 14486 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14487 | * FUNCTION: wlan_hdd_try_disconnect |
| 14488 | * This function is used to disconnect from previous |
| 14489 | * connection |
| 14490 | */ |
| 14491 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 14492 | { |
| 14493 | long ret = 0; |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14494 | int status, result = 0; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14495 | hdd_station_ctx_t *pHddStaCtx; |
| 14496 | eMib_dot11DesiredBssType connectedBssType; |
Abhishek Singh | 19a7dd9 | 2015-12-30 16:31:51 +0530 | [diff] [blame] | 14497 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14498 | |
Abhishek Singh | 19a7dd9 | 2015-12-30 16:31:51 +0530 | [diff] [blame] | 14499 | ret = wlan_hdd_validate_context(pHddCtx); |
| 14500 | if (0 != ret) |
| 14501 | { |
| 14502 | return ret; |
| 14503 | } |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14504 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14505 | |
| 14506 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 14507 | |
| 14508 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 14509 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
Abhishek Singh | 630ff59 | 2016-01-07 18:15:53 +0530 | [diff] [blame] | 14510 | (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) || |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14511 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 14512 | { |
Abhishek Singh | 19a7dd9 | 2015-12-30 16:31:51 +0530 | [diff] [blame] | 14513 | spin_lock_bh(&pAdapter->lock_for_active_session); |
| 14514 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 14515 | { |
| 14516 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 14517 | } |
| 14518 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Abhishek Singh | f796258 | 2015-10-23 10:54:06 +0530 | [diff] [blame] | 14519 | hdd_connSetConnectionState(pHddStaCtx, |
| 14520 | eConnectionState_Disconnecting); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14521 | /* Issue disconnect to CSR */ |
| 14522 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14523 | status = sme_RoamDisconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14524 | pAdapter->sessionId, |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14525 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 14526 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) { |
| 14527 | hddLog(LOG1, |
| 14528 | FL("Already disconnected or connect was in sme/roam pending list and removed by disconnect")); |
| 14529 | } else if ( 0 != status ) { |
| 14530 | hddLog(LOGE, |
| 14531 | FL("csrRoamDisconnect failure, returned %d"), |
| 14532 | (int)status ); |
| 14533 | result = -EINVAL; |
| 14534 | goto disconnected; |
| 14535 | } |
| 14536 | ret = wait_for_completion_timeout( |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14537 | &pAdapter->disconnect_comp_var, |
| 14538 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14539 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status)) { |
| 14540 | hddLog(LOGE, |
| 14541 | "%s: Failed to disconnect, timed out", __func__); |
| 14542 | result = -ETIMEDOUT; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14543 | } |
| 14544 | } |
| 14545 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 14546 | { |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14547 | ret = wait_for_completion_timeout( |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14548 | &pAdapter->disconnect_comp_var, |
| 14549 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14550 | if (!ret) |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14551 | { |
| 14552 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14553 | result = -ETIMEDOUT; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14554 | } |
| 14555 | } |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14556 | disconnected: |
| 14557 | hddLog(LOG1, |
| 14558 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 14559 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 14560 | return result; |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14561 | } |
| 14562 | |
Selvaraj, Sridhar | 95e226f | 2016-06-18 12:27:25 +0530 | [diff] [blame] | 14563 | /** |
| 14564 | * wlan_hdd_reassoc_bssid_hint() - Start reassociation if bssid is present |
| 14565 | * @adapter: Pointer to the HDD adapter |
| 14566 | * @req: Pointer to the structure cfg_connect_params receieved from user space |
| 14567 | * |
| 14568 | * This function will start reassociation if bssid hint, channel hint and |
| 14569 | * previous bssid parameters are present in the connect request |
| 14570 | * |
| 14571 | * Return: success if reassociation is happening |
| 14572 | * Error code if reassociation is not permitted or not happening |
| 14573 | */ |
| 14574 | #ifdef CFG80211_CONNECT_PREV_BSSID |
| 14575 | static int wlan_hdd_reassoc_bssid_hint(hdd_adapter_t *adapter, |
| 14576 | struct cfg80211_connect_params *req) |
| 14577 | { |
| 14578 | int status = -EPERM; |
| 14579 | if (req->bssid_hint && req->channel_hint && req->prev_bssid) { |
| 14580 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14581 | FL("REASSOC Attempt on channel %d to "MAC_ADDRESS_STR), |
| 14582 | req->channel_hint->hw_value, |
| 14583 | MAC_ADDR_ARRAY(req->bssid_hint)); |
| 14584 | status = hdd_reassoc(adapter, req->bssid_hint, |
| 14585 | req->channel_hint->hw_value, |
| 14586 | CONNECT_CMD_USERSPACE); |
| 14587 | } |
| 14588 | return status; |
| 14589 | } |
| 14590 | #else |
| 14591 | static int wlan_hdd_reassoc_bssid_hint(hdd_adapter_t *adapter, |
| 14592 | struct cfg80211_connect_params *req) |
| 14593 | { |
| 14594 | return -EPERM; |
| 14595 | } |
| 14596 | #endif |
| 14597 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14598 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 14599 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 14600 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14601 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 14602 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14603 | struct net_device *ndev, |
| 14604 | struct cfg80211_connect_params *req |
| 14605 | ) |
| 14606 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14607 | int status; |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 14608 | u16 channel; |
Edhar, Mahesh Kumar | 496c7f7 | 2016-03-18 12:47:44 +0530 | [diff] [blame] | 14609 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) || \ |
| 14610 | defined(CFG80211_BSSID_HINT_BACKPORT) |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 14611 | const u8 *bssid_hint = req->bssid_hint; |
| 14612 | #else |
| 14613 | const u8 *bssid_hint = NULL; |
| 14614 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14615 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14616 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 14617 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14618 | |
| 14619 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14620 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14621 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14622 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 14623 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14624 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 14625 | "%s: device_mode = %s (%d)", __func__, |
| 14626 | hdd_device_modetoString(pAdapter->device_mode), |
| 14627 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14628 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14629 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 14630 | if (!pHddCtx) |
| 14631 | { |
| 14632 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14633 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 14634 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 14635 | } |
| 14636 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14637 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14638 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14639 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14640 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14641 | } |
| 14642 | |
Selvaraj, Sridhar | 95e226f | 2016-06-18 12:27:25 +0530 | [diff] [blame] | 14643 | status = wlan_hdd_reassoc_bssid_hint(pAdapter, req); |
| 14644 | if (0 == status) |
| 14645 | return status; |
| 14646 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 14647 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14648 | #ifdef WLAN_BTAMP_FEATURE |
| 14649 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14650 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14651 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14652 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14653 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 14654 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14655 | } |
| 14656 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14657 | |
| 14658 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 14659 | //P2P Mode will be taken care in Open/close adapter |
| 14660 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 14661 | (vos_concurrent_open_sessions_running())) { |
| 14662 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 14663 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14664 | } |
| 14665 | |
| 14666 | /*Try disconnecting if already in connected state*/ |
| 14667 | status = wlan_hdd_try_disconnect(pAdapter); |
| 14668 | if ( 0 > status) |
| 14669 | { |
| 14670 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 14671 | " connection")); |
| 14672 | return -EALREADY; |
| 14673 | } |
Agrawal Ashish | 559530c | 2015-12-01 18:04:20 +0530 | [diff] [blame] | 14674 | /* Check for max concurrent connections after doing disconnect if any*/ |
| 14675 | if (vos_max_concurrent_connections_reached()) { |
| 14676 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 14677 | return -ECONNREFUSED; |
| 14678 | } |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14679 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14680 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14681 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14682 | |
| 14683 | if ( 0 > status) |
| 14684 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14685 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14686 | __func__); |
| 14687 | return status; |
| 14688 | } |
Sravan Kumar Kairam | 589c572 | 2016-01-27 20:28:53 +0530 | [diff] [blame] | 14689 | |
| 14690 | if (pHddCtx->spoofMacAddr.isEnabled) |
| 14691 | { |
| 14692 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14693 | "%s: MAC Spoofing enabled ", __func__); |
| 14694 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 14695 | * to fill TxBds for probe request during SSID scan which may happen |
| 14696 | * as part of connect command |
| 14697 | */ |
| 14698 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
| 14699 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
| 14700 | if (status != VOS_STATUS_SUCCESS) |
| 14701 | return -ECONNREFUSED; |
| 14702 | } |
| 14703 | |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 14704 | if (req->channel) |
| 14705 | channel = req->channel->hw_value; |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 14706 | else |
Sreelakshmi Konamki | e652174 | 2016-03-18 12:44:27 +0530 | [diff] [blame] | 14707 | channel = 0; |
| 14708 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 14709 | req->ssid_len, req->bssid, |
| 14710 | bssid_hint, channel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14711 | |
Sushant Kaushik | d708398 | 2015-03-18 14:33:24 +0530 | [diff] [blame] | 14712 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14713 | { |
| 14714 | //ReEnable BMPS if disabled |
| 14715 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 14716 | (NULL != pHddCtx)) |
| 14717 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 14718 | if (pHddCtx->hdd_wlan_suspended) |
| 14719 | { |
| 14720 | hdd_set_pwrparams(pHddCtx); |
| 14721 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14722 | //ReEnable Bmps and Imps back |
| 14723 | hdd_enable_bmps_imps(pHddCtx); |
| 14724 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 14725 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14726 | return status; |
| 14727 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14728 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14729 | EXIT(); |
| 14730 | return status; |
| 14731 | } |
| 14732 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 14733 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 14734 | struct net_device *ndev, |
| 14735 | struct cfg80211_connect_params *req) |
| 14736 | { |
| 14737 | int ret; |
| 14738 | vos_ssr_protect(__func__); |
| 14739 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 14740 | vos_ssr_unprotect(__func__); |
| 14741 | |
| 14742 | return ret; |
| 14743 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14744 | |
| 14745 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14746 | * FUNCTION: wlan_hdd_disconnect |
| 14747 | * This function is used to issue a disconnect request to SME |
| 14748 | */ |
| 14749 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 14750 | { |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 14751 | int status, result = 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14752 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14753 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 14754 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14755 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14756 | ENTER(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14757 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14758 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14759 | if (0 != status) |
| 14760 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14761 | return status; |
| 14762 | } |
Abhishek Singh | 07e4a89 | 2015-11-23 11:29:57 +0530 | [diff] [blame] | 14763 | /* Indicate sme of disconnect so that in progress connection or preauth |
| 14764 | * can be aborted |
| 14765 | */ |
| 14766 | sme_abortConnection(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Sushant Kaushik | b4834d2 | 2015-07-15 15:29:05 +0530 | [diff] [blame] | 14767 | pAdapter->sessionId); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14768 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 14769 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 14770 | /* Need to apply spin lock before decreasing active sessions |
| 14771 | * as there can be chance for double decrement if context switch |
| 14772 | * Calls hdd_DisConnectHandler. |
| 14773 | */ |
| 14774 | |
| 14775 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 14776 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 14777 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 14778 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 14779 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 14780 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 14781 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 14782 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 14783 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 14784 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 14785 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14786 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14787 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 14788 | /* |
| 14789 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 14790 | * tx has to be disabled because the firmware can get busy dropping |
| 14791 | * the tx frames after BSS/STA has been deleted and will not send |
| 14792 | * back a response resulting in WDI timeout |
| 14793 | */ |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 14794 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 14795 | netif_tx_disable(pAdapter->dev); |
| 14796 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 14797 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 14798 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14799 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14800 | pAdapter->sessionId, reason); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14801 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 14802 | { |
| 14803 | hddLog(LOG1, |
| 14804 | FL("Already disconnected or connect was in sme/roam pending list and removed by disconnect")); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 14805 | } |
| 14806 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14807 | { |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14808 | hddLog(LOGE, |
| 14809 | FL("csrRoamDisconnect failure, returned %d"), |
| 14810 | (int)status); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 14811 | result = -EINVAL; |
| 14812 | goto disconnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14813 | } |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14814 | ret = wait_for_completion_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14815 | &pAdapter->disconnect_comp_var, |
| 14816 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14817 | if (!ret && (eHAL_STATUS_CMD_NOT_QUEUED != status)) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14818 | { |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14819 | hddLog(LOGE, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 14820 | "%s: Failed to disconnect, timed out", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 14821 | result = -ETIMEDOUT; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 14822 | } |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 14823 | disconnected: |
Abhishek Singh | f1b048a | 2016-01-13 13:57:27 +0530 | [diff] [blame] | 14824 | hddLog(LOG1, |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 14825 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 14826 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
Mahesh A Saptasagar | 936ffc3 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 14827 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0) |
| 14828 | /* Sending disconnect event to userspace for kernel version < 3.11 |
| 14829 | * is handled by __cfg80211_disconnect call to __cfg80211_disconnected |
| 14830 | */ |
| 14831 | hddLog(LOG1, FL("Send disconnected event to userspace")); |
| 14832 | |
Mahesh A Saptasagar | f5859b1 | 2016-06-01 17:17:50 +0530 | [diff] [blame] | 14833 | wlan_hdd_cfg80211_indicate_disconnect(pAdapter->dev, true, |
Mahesh A Saptasagar | 936ffc3 | 2016-05-25 11:27:43 +0530 | [diff] [blame] | 14834 | WLAN_REASON_UNSPECIFIED); |
| 14835 | #endif |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 14836 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14837 | EXIT(); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 14838 | return result; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14839 | } |
| 14840 | |
| 14841 | |
| 14842 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 14843 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14844 | * This function is used to issue a disconnect request to SME |
| 14845 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 14846 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14847 | struct net_device *dev, |
| 14848 | u16 reason |
| 14849 | ) |
| 14850 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14851 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14852 | int status; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 14853 | tCsrRoamProfile *pRoamProfile; |
| 14854 | hdd_station_ctx_t *pHddStaCtx; |
| 14855 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 14856 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 14857 | tANI_U8 staIdx; |
| 14858 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14859 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14860 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14861 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 14862 | if (!pAdapter) { |
| 14863 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 14864 | return -EINVAL; |
| 14865 | } |
| 14866 | |
| 14867 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14868 | if (!pHddStaCtx) { |
| 14869 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is NULL")); |
| 14870 | return -EINVAL; |
| 14871 | } |
| 14872 | |
| 14873 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14874 | status = wlan_hdd_validate_context(pHddCtx); |
| 14875 | if (0 != status) |
| 14876 | { |
| 14877 | return status; |
| 14878 | } |
| 14879 | |
| 14880 | pRoamProfile = &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
| 14881 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14882 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14883 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 14884 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 14885 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 14886 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 14887 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14888 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14889 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 14890 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14891 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14892 | if (NULL != pRoamProfile) |
| 14893 | { |
| 14894 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 14895 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 14896 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14897 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14898 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14899 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 14900 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14901 | switch(reason) |
| 14902 | { |
| 14903 | case WLAN_REASON_MIC_FAILURE: |
| 14904 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 14905 | break; |
| 14906 | |
| 14907 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 14908 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 14909 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 14910 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 14911 | break; |
| 14912 | |
| 14913 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 14914 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 14915 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14916 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 14917 | break; |
| 14918 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14919 | default: |
| 14920 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 14921 | break; |
| 14922 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 14923 | pScanInfo = &pHddCtx->scan_info; |
| 14924 | if (pScanInfo->mScanPending) |
| 14925 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 14926 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 14927 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 14928 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 14929 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 14930 | } |
Agarwal Ashish | c089cec | 2015-08-10 13:10:04 +0530 | [diff] [blame] | 14931 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 14932 | #ifdef FEATURE_WLAN_TDLS |
| 14933 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14934 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 14935 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14936 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 14937 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 14938 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14939 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14940 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14941 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14942 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14943 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14944 | MAC_ADDR_ARRAY(mac)); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14945 | status = sme_DeleteTdlsPeerSta( |
| 14946 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14947 | pAdapter->sessionId, |
| 14948 | mac); |
| 14949 | if (status != eHAL_STATUS_SUCCESS) { |
| 14950 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 14951 | return -EPERM; |
| 14952 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 14953 | } |
| 14954 | } |
| 14955 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 14956 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14957 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 14958 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14959 | { |
| 14960 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14961 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14962 | __func__, (int)status ); |
| 14963 | return -EINVAL; |
| 14964 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14965 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 14966 | else |
| 14967 | { |
| 14968 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 14969 | "called while in %d state", __func__, |
| 14970 | pHddStaCtx->conn_info.connState); |
| 14971 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14972 | } |
| 14973 | else |
| 14974 | { |
| 14975 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 14976 | } |
| 14977 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14978 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14979 | return status; |
| 14980 | } |
| 14981 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 14982 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 14983 | struct net_device *dev, |
| 14984 | u16 reason |
| 14985 | ) |
| 14986 | { |
| 14987 | int ret; |
| 14988 | vos_ssr_protect(__func__); |
| 14989 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 14990 | vos_ssr_unprotect(__func__); |
| 14991 | |
| 14992 | return ret; |
| 14993 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14994 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14995 | /* |
| 14996 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14997 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14998 | * settings in IBSS mode. |
| 14999 | */ |
| 15000 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15001 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15002 | struct cfg80211_ibss_params *params |
| 15003 | ) |
| 15004 | { |
| 15005 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15006 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15007 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 15008 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15009 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15010 | ENTER(); |
| 15011 | |
| 15012 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 15013 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15014 | |
| 15015 | if (params->ie_len && ( NULL != params->ie) ) |
| 15016 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 15017 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 15018 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15019 | { |
| 15020 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 15021 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 15022 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 15023 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15024 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 15025 | tDot11fIEWPA dot11WPAIE; |
| 15026 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 15027 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 15028 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 15029 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 15030 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 15031 | params->ie_len, DOT11F_EID_WPA); |
| 15032 | if ( NULL != ie ) |
| 15033 | { |
| 15034 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 15035 | // Unpack the WPA IE |
| 15036 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 15037 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 15038 | &ie[2+4], |
| 15039 | ie[1] - 4, |
| 15040 | &dot11WPAIE); |
| 15041 | /*Extract the multicast cipher, the encType for unicast |
| 15042 | cipher for wpa-none is none*/ |
| 15043 | encryptionType = |
| 15044 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 15045 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15046 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 15047 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15048 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 15049 | |
| 15050 | if (0 > status) |
| 15051 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15052 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15053 | __func__); |
| 15054 | return status; |
| 15055 | } |
| 15056 | } |
| 15057 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15058 | pWextState->roamProfile.AuthType.authType[0] = |
| 15059 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15060 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 15061 | |
| 15062 | if (params->privacy) |
| 15063 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15064 | /* Security enabled IBSS, At this time there is no information available |
| 15065 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15066 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15067 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15068 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15069 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15070 | *enable privacy bit in beacons */ |
| 15071 | |
| 15072 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 15073 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 15074 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 15075 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15076 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 15077 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 15078 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15079 | return status; |
| 15080 | } |
| 15081 | |
| 15082 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15083 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15084 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15085 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15086 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15087 | struct net_device *dev, |
| 15088 | struct cfg80211_ibss_params *params |
| 15089 | ) |
| 15090 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15091 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15092 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 15093 | tCsrRoamProfile *pRoamProfile; |
| 15094 | int status; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15095 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15096 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 15097 | tSirMacAddr bssid; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15098 | |
| 15099 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15100 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15101 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15102 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 15103 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15104 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15105 | "%s: device_mode = %s (%d)", __func__, |
| 15106 | hdd_device_modetoString(pAdapter->device_mode), |
| 15107 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15108 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15109 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15110 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15111 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15112 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15113 | } |
| 15114 | |
| 15115 | if (NULL == pWextState) |
| 15116 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 15117 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15118 | __func__); |
| 15119 | return -EIO; |
| 15120 | } |
| 15121 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 15122 | if (vos_max_concurrent_connections_reached()) { |
| 15123 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 15124 | return -ECONNREFUSED; |
| 15125 | } |
| 15126 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 15127 | /*Try disconnecting if already in connected state*/ |
| 15128 | status = wlan_hdd_try_disconnect(pAdapter); |
| 15129 | if ( 0 > status) |
| 15130 | { |
| 15131 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 15132 | " IBSS connection")); |
| 15133 | return -EALREADY; |
| 15134 | } |
| 15135 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15136 | pRoamProfile = &pWextState->roamProfile; |
| 15137 | |
| 15138 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 15139 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15140 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 15141 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15142 | return -EINVAL; |
| 15143 | } |
| 15144 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 15145 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 15146 | if (NULL != params->bssid) { |
| 15147 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 15148 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 15149 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 15150 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 15151 | return -EIO; |
| 15152 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 15153 | 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] | 15154 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 15155 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 15156 | { |
| 15157 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 15158 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 15159 | { |
| 15160 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 15161 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 15162 | return -EIO; |
| 15163 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 15164 | |
| 15165 | vos_mem_copy((v_U8_t *)bssid, |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 15166 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 15167 | sizeof(bssid)); |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 15168 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 15169 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15170 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 15171 | if (NULL != |
| 15172 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 15173 | params->chandef.chan) |
| 15174 | #else |
| 15175 | params->channel) |
| 15176 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15177 | { |
| 15178 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15179 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 15180 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 15181 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 15182 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15183 | |
| 15184 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15185 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 15186 | ieee80211_frequency_to_channel( |
| 15187 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 15188 | params->chandef.chan->center_freq); |
| 15189 | #else |
| 15190 | params->channel->center_freq); |
| 15191 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15192 | |
| 15193 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 15194 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15195 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15196 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 15197 | __func__); |
| 15198 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15199 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15200 | |
| 15201 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15202 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15203 | if (channelNum == validChan[indx]) |
| 15204 | { |
| 15205 | break; |
| 15206 | } |
| 15207 | } |
| 15208 | if (indx >= numChans) |
| 15209 | { |
| 15210 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15211 | __func__, channelNum); |
| 15212 | return -EINVAL; |
| 15213 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15214 | /* Set the Operational Channel */ |
| 15215 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 15216 | channelNum); |
| 15217 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 15218 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 15219 | pRoamProfile->ChannelInfo.ChannelList = |
| 15220 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15221 | } |
| 15222 | |
| 15223 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15224 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15225 | if (status < 0) |
| 15226 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15227 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15228 | __func__); |
| 15229 | return status; |
| 15230 | } |
| 15231 | |
| 15232 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15233 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Abhishek Singh | 4d92468 | 2015-11-17 15:23:06 +0530 | [diff] [blame] | 15234 | params->ssid_len, (const u8 *)&bssid, NULL, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 15235 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15236 | |
| 15237 | if (0 > status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15238 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15239 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15240 | EXIT(); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 15241 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15242 | } |
| 15243 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15244 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 15245 | struct net_device *dev, |
| 15246 | struct cfg80211_ibss_params *params |
| 15247 | ) |
| 15248 | { |
| 15249 | int ret = 0; |
| 15250 | |
| 15251 | vos_ssr_protect(__func__); |
| 15252 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 15253 | vos_ssr_unprotect(__func__); |
| 15254 | |
| 15255 | return ret; |
| 15256 | } |
| 15257 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15258 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15259 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15260 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15261 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15262 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15263 | struct net_device *dev |
| 15264 | ) |
| 15265 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15266 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15267 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 15268 | tCsrRoamProfile *pRoamProfile; |
| 15269 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15270 | int status; |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 15271 | #ifdef WLAN_FEATURE_RMC |
| 15272 | tANI_U8 addIE[WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN] = {0}; |
| 15273 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15274 | |
| 15275 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15276 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15277 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15278 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 15279 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15280 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15281 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15282 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15283 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15284 | } |
| 15285 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15286 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 15287 | hdd_device_modetoString(pAdapter->device_mode), |
| 15288 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15289 | if (NULL == pWextState) |
| 15290 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 15291 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15292 | __func__); |
| 15293 | return -EIO; |
| 15294 | } |
| 15295 | |
| 15296 | pRoamProfile = &pWextState->roamProfile; |
| 15297 | |
| 15298 | /* Issue disconnect only if interface type is set to IBSS */ |
| 15299 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 15300 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15301 | 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] | 15302 | __func__); |
| 15303 | return -EINVAL; |
| 15304 | } |
| 15305 | |
Abhishek Singh | 7cd040e | 2016-01-07 10:51:04 +0530 | [diff] [blame] | 15306 | #ifdef WLAN_FEATURE_RMC |
| 15307 | /* Clearing add IE of beacon */ |
| 15308 | if (ccmCfgSetStr(pHddCtx->hHal, |
| 15309 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &addIE[0], |
| 15310 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN, |
| 15311 | NULL, eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS) |
| 15312 | { |
| 15313 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 15314 | "%s: unable to clear PROBE_RSP_BCN_ADDNIE_DATA", __func__); |
| 15315 | return -EINVAL; |
| 15316 | } |
| 15317 | if (ccmCfgSetInt(pHddCtx->hHal, |
| 15318 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0, NULL, |
| 15319 | eANI_BOOLEAN_FALSE) != eHAL_STATUS_SUCCESS) |
| 15320 | { |
| 15321 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 15322 | "%s: unable to clear WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG", |
| 15323 | __func__); |
| 15324 | return -EINVAL; |
| 15325 | } |
| 15326 | |
| 15327 | // Reset WNI_CFG_PROBE_RSP Flags |
| 15328 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 15329 | |
| 15330 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 15331 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 0,NULL, |
| 15332 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 15333 | { |
| 15334 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 15335 | "%s: unable to clear WNI_CFG_PROBE_RSP_ADDNIE_FLAG", |
| 15336 | __func__); |
| 15337 | return -EINVAL; |
| 15338 | } |
| 15339 | #endif |
| 15340 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15341 | /* Issue Disconnect request */ |
| 15342 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 15343 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 15344 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 15345 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15346 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15347 | return 0; |
| 15348 | } |
| 15349 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15350 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 15351 | struct net_device *dev |
| 15352 | ) |
| 15353 | { |
| 15354 | int ret = 0; |
| 15355 | |
| 15356 | vos_ssr_protect(__func__); |
| 15357 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 15358 | vos_ssr_unprotect(__func__); |
| 15359 | |
| 15360 | return ret; |
| 15361 | } |
| 15362 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15363 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15364 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15365 | * This function is used to set the phy parameters |
| 15366 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 15367 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15368 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15369 | u32 changed) |
| 15370 | { |
| 15371 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15372 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15373 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15374 | |
| 15375 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15376 | |
| 15377 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15378 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 15379 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15380 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15381 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15382 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15383 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15384 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15385 | } |
| 15386 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15387 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 15388 | { |
| 15389 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 15390 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 15391 | wiphy->rts_threshold; |
| 15392 | |
| 15393 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15394 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15395 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15396 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15397 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15398 | __func__, rts_threshold); |
| 15399 | return -EINVAL; |
| 15400 | } |
| 15401 | |
| 15402 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 15403 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15404 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15405 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15406 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15407 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15408 | __func__, rts_threshold); |
| 15409 | return -EIO; |
| 15410 | } |
| 15411 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15412 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15413 | rts_threshold); |
| 15414 | } |
| 15415 | |
| 15416 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 15417 | { |
| 15418 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 15419 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 15420 | wiphy->frag_threshold; |
| 15421 | |
| 15422 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15423 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15424 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15425 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15426 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15427 | frag_threshold); |
| 15428 | return -EINVAL; |
| 15429 | } |
| 15430 | |
| 15431 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 15432 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15433 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15434 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15435 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15436 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15437 | __func__, frag_threshold); |
| 15438 | return -EIO; |
| 15439 | } |
| 15440 | |
| 15441 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 15442 | frag_threshold); |
| 15443 | } |
| 15444 | |
| 15445 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 15446 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 15447 | { |
| 15448 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 15449 | wiphy->retry_short : |
| 15450 | wiphy->retry_long; |
| 15451 | |
| 15452 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 15453 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 15454 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15455 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15456 | __func__, retry_value); |
| 15457 | return -EINVAL; |
| 15458 | } |
| 15459 | |
| 15460 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 15461 | { |
| 15462 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 15463 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15464 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15465 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15466 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15467 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15468 | __func__, retry_value); |
| 15469 | return -EIO; |
| 15470 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15471 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15472 | __func__, retry_value); |
| 15473 | } |
| 15474 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 15475 | { |
| 15476 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 15477 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15478 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15479 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15480 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15481 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15482 | __func__, retry_value); |
| 15483 | return -EIO; |
| 15484 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15485 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15486 | __func__, retry_value); |
| 15487 | } |
| 15488 | } |
| 15489 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15490 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15491 | return 0; |
| 15492 | } |
| 15493 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15494 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 15495 | u32 changed) |
| 15496 | { |
| 15497 | int ret; |
| 15498 | |
| 15499 | vos_ssr_protect(__func__); |
| 15500 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 15501 | vos_ssr_unprotect(__func__); |
| 15502 | |
| 15503 | return ret; |
| 15504 | } |
| 15505 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15506 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15507 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15508 | * This function is used to set the txpower |
| 15509 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15510 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 15511 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15512 | struct wireless_dev *wdev, |
| 15513 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15514 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15515 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15516 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15517 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15518 | #endif |
| 15519 | int dbm) |
| 15520 | { |
| 15521 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15522 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15523 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 15524 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15525 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15526 | |
| 15527 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15528 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15529 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15530 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 15531 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15532 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15533 | if (0 != status) |
| 15534 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15535 | return status; |
| 15536 | } |
| 15537 | |
| 15538 | hHal = pHddCtx->hHal; |
| 15539 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15540 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 15541 | dbm, ccmCfgSetCallback, |
| 15542 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15543 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15544 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15545 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 15546 | return -EIO; |
| 15547 | } |
| 15548 | |
| 15549 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 15550 | dbm); |
| 15551 | |
| 15552 | switch(type) |
| 15553 | { |
| 15554 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 15555 | /* Fall through */ |
| 15556 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 15557 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 15558 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15559 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 15560 | __func__); |
| 15561 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15562 | } |
| 15563 | break; |
| 15564 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15565 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15566 | __func__); |
| 15567 | return -EOPNOTSUPP; |
| 15568 | break; |
| 15569 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15570 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 15571 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15572 | return -EIO; |
| 15573 | } |
| 15574 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15575 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15576 | return 0; |
| 15577 | } |
| 15578 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15579 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 15580 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15581 | struct wireless_dev *wdev, |
| 15582 | #endif |
| 15583 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 15584 | enum tx_power_setting type, |
| 15585 | #else |
| 15586 | enum nl80211_tx_power_setting type, |
| 15587 | #endif |
| 15588 | int dbm) |
| 15589 | { |
| 15590 | int ret; |
| 15591 | vos_ssr_protect(__func__); |
| 15592 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 15593 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15594 | wdev, |
| 15595 | #endif |
| 15596 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 15597 | type, |
| 15598 | #else |
| 15599 | type, |
| 15600 | #endif |
| 15601 | dbm); |
| 15602 | vos_ssr_unprotect(__func__); |
| 15603 | |
| 15604 | return ret; |
| 15605 | } |
| 15606 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15607 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15608 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15609 | * This function is used to read the txpower |
| 15610 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15611 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 15612 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15613 | struct wireless_dev *wdev, |
| 15614 | #endif |
| 15615 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15616 | { |
| 15617 | |
| 15618 | hdd_adapter_t *pAdapter; |
| 15619 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15620 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15621 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15622 | ENTER(); |
| 15623 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15624 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15625 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15626 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15627 | *dbm = 0; |
| 15628 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15629 | } |
| 15630 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15631 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 15632 | if (NULL == pAdapter) |
| 15633 | { |
| 15634 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 15635 | return -ENOENT; |
| 15636 | } |
| 15637 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 15638 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15639 | TRACE_CODE_HDD_CFG80211_GET_TXPOWER, |
| 15640 | pAdapter->sessionId, pAdapter->device_mode)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15641 | wlan_hdd_get_classAstats(pAdapter); |
| 15642 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 15643 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15644 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15645 | return 0; |
| 15646 | } |
| 15647 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15648 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 15649 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15650 | struct wireless_dev *wdev, |
| 15651 | #endif |
| 15652 | int *dbm) |
| 15653 | { |
| 15654 | int ret; |
| 15655 | |
| 15656 | vos_ssr_protect(__func__); |
| 15657 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 15658 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15659 | wdev, |
| 15660 | #endif |
| 15661 | dbm); |
| 15662 | vos_ssr_unprotect(__func__); |
| 15663 | |
| 15664 | return ret; |
| 15665 | } |
| 15666 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15667 | 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] | 15668 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 15669 | const u8* mac, |
| 15670 | #else |
| 15671 | u8* mac, |
| 15672 | #endif |
| 15673 | struct station_info *sinfo) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15674 | { |
| 15675 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 15676 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15677 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 15678 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15679 | |
| 15680 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 15681 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15682 | |
| 15683 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 15684 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 15685 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 15686 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 15687 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 15688 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 15689 | tANI_U16 maxRate = 0; |
| 15690 | tANI_U16 myRate; |
| 15691 | tANI_U16 currentRate = 0; |
| 15692 | tANI_U8 maxSpeedMCS = 0; |
| 15693 | tANI_U8 maxMCSIdx = 0; |
| 15694 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15695 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 15696 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15697 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15698 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15699 | #ifdef WLAN_FEATURE_11AC |
| 15700 | tANI_U32 vht_mcs_map; |
| 15701 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 15702 | #endif /* WLAN_FEATURE_11AC */ |
| 15703 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15704 | ENTER(); |
| 15705 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15706 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 15707 | (0 == ssidlen)) |
| 15708 | { |
| 15709 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 15710 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 15711 | /*To keep GUI happy*/ |
| 15712 | return 0; |
| 15713 | } |
| 15714 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 15715 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 15716 | { |
| 15717 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15718 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
Sachin Ahuja | 81ab181 | 2016-08-19 21:35:58 +0530 | [diff] [blame] | 15719 | /* return a cached value */ |
| 15720 | sinfo->signal = pAdapter->rssi; |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 15721 | return 0; |
| 15722 | } |
| 15723 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15724 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15725 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15726 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15727 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15728 | } |
| 15729 | |
Hanumantha Reddy Pothula | dce6674 | 2015-08-25 18:08:44 +0530 | [diff] [blame] | 15730 | wlan_hdd_get_station_stats(pAdapter); |
| 15731 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15732 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 15733 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 15734 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 15735 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 15736 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 15737 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 15738 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15739 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 15740 | { |
| 15741 | rate_flags = pAdapter->maxRateFlags; |
| 15742 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 15743 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15744 | //convert to the UI units of 100kbps |
| 15745 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 15746 | |
| 15747 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15748 | 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] | 15749 | sinfo->signal, |
| 15750 | pCfg->reportMaxLinkSpeed, |
| 15751 | myRate, |
| 15752 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 15753 | (int) pCfg->linkSpeedRssiMid, |
| 15754 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15755 | (int) rate_flags, |
| 15756 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15757 | #endif //LINKSPEED_DEBUG_ENABLED |
| 15758 | |
| 15759 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 15760 | { |
| 15761 | // we do not want to necessarily report the current speed |
| 15762 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 15763 | { |
| 15764 | // report the max possible speed |
| 15765 | rssidx = 0; |
| 15766 | } |
| 15767 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 15768 | { |
| 15769 | // report the max possible speed with RSSI scaling |
| 15770 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 15771 | { |
| 15772 | // report the max possible speed |
| 15773 | rssidx = 0; |
| 15774 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 15775 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15776 | { |
| 15777 | // report middle speed |
| 15778 | rssidx = 1; |
| 15779 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 15780 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 15781 | { |
| 15782 | // report middle speed |
| 15783 | rssidx = 2; |
| 15784 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15785 | else |
| 15786 | { |
| 15787 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 15788 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15789 | } |
| 15790 | } |
| 15791 | else |
| 15792 | { |
| 15793 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 15794 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15795 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 15796 | __func__, pCfg->reportMaxLinkSpeed); |
| 15797 | rssidx = 0; |
| 15798 | } |
| 15799 | |
| 15800 | maxRate = 0; |
| 15801 | |
| 15802 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 15803 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 15804 | OperationalRates, &ORLeng)) |
| 15805 | { |
| 15806 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 15807 | /*To keep GUI happy*/ |
| 15808 | return 0; |
| 15809 | } |
| 15810 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15811 | for (i = 0; i < ORLeng; i++) |
| 15812 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15813 | 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] | 15814 | { |
| 15815 | /* Validate Rate Set */ |
| 15816 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 15817 | { |
| 15818 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 15819 | break; |
| 15820 | } |
| 15821 | } |
| 15822 | /* Update MAX rate */ |
| 15823 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 15824 | } |
| 15825 | |
| 15826 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 15827 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 15828 | ExtendedRates, &ERLeng)) |
| 15829 | { |
| 15830 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 15831 | /*To keep GUI happy*/ |
| 15832 | return 0; |
| 15833 | } |
| 15834 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15835 | for (i = 0; i < ERLeng; i++) |
| 15836 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15837 | 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] | 15838 | { |
| 15839 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 15840 | { |
| 15841 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 15842 | break; |
| 15843 | } |
| 15844 | } |
| 15845 | /* Update MAX rate */ |
| 15846 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 15847 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15848 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 15849 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 15850 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 15851 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15852 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15853 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15854 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 15855 | mode = 2; |
| 15856 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 15857 | mode = 1; |
| 15858 | else |
| 15859 | mode = 0; |
| 15860 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 15861 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 15862 | MCSRates, &MCSLeng)) |
| 15863 | { |
| 15864 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 15865 | /*To keep GUI happy*/ |
| 15866 | return 0; |
| 15867 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15868 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15869 | #ifdef WLAN_FEATURE_11AC |
| 15870 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15871 | 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] | 15872 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15873 | 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] | 15874 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15875 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15876 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15877 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15878 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15879 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15880 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15881 | maxMCSIdx = 7; |
| 15882 | } |
| 15883 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 15884 | { |
| 15885 | maxMCSIdx = 8; |
| 15886 | } |
| 15887 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 15888 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15889 | //VHT20 is supporting 0~8 |
| 15890 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 15891 | maxMCSIdx = 8; |
| 15892 | else |
| 15893 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15894 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15895 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15896 | if (0 != rssidx)/*check for scaled */ |
| 15897 | { |
| 15898 | //get middle rate MCS index if rssi=1/2 |
| 15899 | for (i=0; i <= maxMCSIdx; i++) |
| 15900 | { |
| 15901 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 15902 | { |
| 15903 | maxMCSIdx = i; |
| 15904 | break; |
| 15905 | } |
| 15906 | } |
| 15907 | } |
| 15908 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15909 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 15910 | { |
| 15911 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 15912 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 15913 | } |
| 15914 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 15915 | { |
| 15916 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 15917 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 15918 | } |
| 15919 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 15920 | { |
| 15921 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 15922 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 15923 | } |
| 15924 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15925 | maxSpeedMCS = 1; |
| 15926 | if (currentRate > maxRate) |
| 15927 | { |
| 15928 | maxRate = currentRate; |
| 15929 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15930 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15931 | } |
| 15932 | else |
| 15933 | #endif /* WLAN_FEATURE_11AC */ |
| 15934 | { |
| 15935 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 15936 | { |
| 15937 | rateFlag |= 1; |
| 15938 | } |
| 15939 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 15940 | { |
| 15941 | rateFlag |= 2; |
| 15942 | } |
| 15943 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 15944 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15945 | if (rssidx == 1 || rssidx == 2) |
| 15946 | { |
| 15947 | //get middle rate MCS index if rssi=1/2 |
| 15948 | for (i=0; i <= 7; i++) |
| 15949 | { |
| 15950 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 15951 | { |
| 15952 | temp = i+1; |
| 15953 | break; |
| 15954 | } |
| 15955 | } |
| 15956 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15957 | |
| 15958 | for (i = 0; i < MCSLeng; i++) |
| 15959 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15960 | for (j = 0; j < temp; j++) |
| 15961 | { |
| 15962 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 15963 | { |
| 15964 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 15965 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15966 | break; |
| 15967 | } |
| 15968 | } |
| 15969 | if ((j < temp) && (currentRate > maxRate)) |
| 15970 | { |
| 15971 | maxRate = currentRate; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15972 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15973 | } |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 15974 | maxSpeedMCS = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15975 | } |
| 15976 | } |
| 15977 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15978 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 15979 | { |
| 15980 | maxRate = myRate; |
| 15981 | maxSpeedMCS = 1; |
| 15982 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 15983 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15984 | // 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] | 15985 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15986 | { |
| 15987 | maxRate = myRate; |
| 15988 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 15989 | { |
| 15990 | maxSpeedMCS = 0; |
| 15991 | } |
| 15992 | else |
| 15993 | { |
| 15994 | maxSpeedMCS = 1; |
| 15995 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 15996 | } |
| 15997 | } |
| 15998 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15999 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16000 | { |
| 16001 | sinfo->txrate.legacy = maxRate; |
| 16002 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 16003 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 16004 | #endif //LINKSPEED_DEBUG_ENABLED |
| 16005 | } |
| 16006 | else |
| 16007 | { |
| 16008 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16009 | #ifdef WLAN_FEATURE_11AC |
| 16010 | sinfo->txrate.nss = 1; |
| 16011 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 16012 | { |
| 16013 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16014 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16015 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16016 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16017 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16018 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 16019 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 16020 | } |
| 16021 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 16022 | { |
| 16023 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 16024 | } |
| 16025 | #endif /* WLAN_FEATURE_11AC */ |
| 16026 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 16027 | { |
| 16028 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 16029 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 16030 | { |
| 16031 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 16032 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16033 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16034 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 16035 | { |
| 16036 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 16037 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 16038 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16039 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 16040 | pr_info("Reporting MCS rate %d flags %x\n", |
| 16041 | sinfo->txrate.mcs, |
| 16042 | sinfo->txrate.flags ); |
| 16043 | #endif //LINKSPEED_DEBUG_ENABLED |
| 16044 | } |
| 16045 | } |
| 16046 | else |
| 16047 | { |
| 16048 | // report current rate instead of max rate |
| 16049 | |
| 16050 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 16051 | { |
| 16052 | //provide to the UI in units of 100kbps |
| 16053 | sinfo->txrate.legacy = myRate; |
| 16054 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 16055 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 16056 | #endif //LINKSPEED_DEBUG_ENABLED |
| 16057 | } |
| 16058 | else |
| 16059 | { |
| 16060 | //must be MCS |
| 16061 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16062 | #ifdef WLAN_FEATURE_11AC |
| 16063 | sinfo->txrate.nss = 1; |
| 16064 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 16065 | { |
| 16066 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 16067 | } |
| 16068 | else |
| 16069 | #endif /* WLAN_FEATURE_11AC */ |
| 16070 | { |
| 16071 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 16072 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16073 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 16074 | { |
| 16075 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 16076 | } |
| 16077 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 16078 | { |
| 16079 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 16080 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 16081 | #ifdef WLAN_FEATURE_11AC |
| 16082 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 16083 | { |
| 16084 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 16085 | } |
| 16086 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16087 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 16088 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 16089 | sinfo->txrate.mcs, |
| 16090 | sinfo->txrate.flags ); |
| 16091 | #endif //LINKSPEED_DEBUG_ENABLED |
| 16092 | } |
| 16093 | } |
| 16094 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 16095 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 16096 | sinfo->tx_packets = |
| 16097 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 16098 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 16099 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 16100 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 16101 | |
| 16102 | sinfo->tx_retries = |
| 16103 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 16104 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 16105 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 16106 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 16107 | |
| 16108 | sinfo->tx_failed = |
| 16109 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 16110 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 16111 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 16112 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 16113 | |
| 16114 | sinfo->filled |= |
| 16115 | STATION_INFO_TX_PACKETS | |
| 16116 | STATION_INFO_TX_RETRIES | |
| 16117 | STATION_INFO_TX_FAILED; |
| 16118 | |
Edhar, Mahesh Kumar | 3cc9f23 | 2015-12-29 14:41:01 +0530 | [diff] [blame] | 16119 | sinfo->rx_packets = pAdapter->hdd_stats.summary_stat.rx_frm_cnt; |
| 16120 | sinfo->filled |= STATION_INFO_RX_PACKETS; |
| 16121 | |
| 16122 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 16123 | hddLog(LOG1, FL("Reporting RSSI:%d legacy rate %d pkt cnt tx %d rx %d"), |
| 16124 | sinfo->signal, sinfo->txrate.legacy, sinfo->tx_packets, |
| 16125 | sinfo->rx_packets); |
| 16126 | else |
| 16127 | hddLog(LOG1, |
| 16128 | FL("Reporting RSSI:%d MCS rate %d flags 0x%x pkt cnt tx %d rx %d"), |
| 16129 | sinfo->signal, sinfo->txrate.mcs, sinfo->txrate.flags, |
| 16130 | sinfo->tx_packets, sinfo->rx_packets); |
| 16131 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16132 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16133 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 16134 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 16135 | EXIT(); |
| 16136 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16137 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16138 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 16139 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 16140 | const u8* mac, struct station_info *sinfo) |
| 16141 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16142 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 16143 | u8* mac, struct station_info *sinfo) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16144 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16145 | { |
| 16146 | int ret; |
| 16147 | |
| 16148 | vos_ssr_protect(__func__); |
| 16149 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 16150 | vos_ssr_unprotect(__func__); |
| 16151 | |
| 16152 | return ret; |
| 16153 | } |
| 16154 | |
| 16155 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 16156 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16157 | { |
| 16158 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 16159 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16160 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16161 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16162 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16163 | ENTER(); |
| 16164 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16165 | if (NULL == pAdapter) |
| 16166 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16167 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16168 | return -ENODEV; |
| 16169 | } |
| 16170 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16171 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16172 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 16173 | pAdapter->sessionId, timeout)); |
| 16174 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 16175 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16176 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16177 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16178 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16179 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16180 | } |
| 16181 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 16182 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 16183 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 16184 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 16185 | (eConnectionState_Associated == |
| 16186 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 16187 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 16188 | |
| 16189 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 16190 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 16191 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 16192 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 16193 | { |
| 16194 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16195 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 16196 | __func__, vos_status); |
| 16197 | } |
| 16198 | } |
| 16199 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16200 | /**The get power cmd from the supplicant gets updated by the nl only |
| 16201 | *on successful execution of the function call |
| 16202 | *we are oppositely mapped w.r.t mode in the driver |
| 16203 | **/ |
| 16204 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 16205 | |
| 16206 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 16207 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 16208 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16209 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16210 | return -EINVAL; |
| 16211 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16212 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16213 | return 0; |
| 16214 | } |
| 16215 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16216 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 16217 | struct net_device *dev, bool mode, int timeout) |
| 16218 | { |
| 16219 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16220 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16221 | vos_ssr_protect(__func__); |
| 16222 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 16223 | vos_ssr_unprotect(__func__); |
| 16224 | |
| 16225 | return ret; |
| 16226 | } |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 16227 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16228 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16229 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 16230 | struct net_device *netdev, |
| 16231 | u8 key_index) |
| 16232 | { |
| 16233 | ENTER(); |
| 16234 | return 0; |
| 16235 | } |
| 16236 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16237 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16238 | struct net_device *netdev, |
| 16239 | u8 key_index) |
| 16240 | { |
| 16241 | int ret; |
| 16242 | vos_ssr_protect(__func__); |
| 16243 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 16244 | vos_ssr_unprotect(__func__); |
| 16245 | return ret; |
| 16246 | } |
| 16247 | #endif //LINUX_VERSION_CODE |
| 16248 | |
| 16249 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 16250 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 16251 | struct net_device *dev, |
| 16252 | struct ieee80211_txq_params *params) |
| 16253 | { |
| 16254 | ENTER(); |
| 16255 | return 0; |
| 16256 | } |
| 16257 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 16258 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 16259 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16260 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16261 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16262 | return 0; |
| 16263 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16264 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16265 | |
| 16266 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 16267 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16268 | struct net_device *dev, |
| 16269 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16270 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16271 | int ret; |
| 16272 | |
| 16273 | vos_ssr_protect(__func__); |
| 16274 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 16275 | vos_ssr_unprotect(__func__); |
| 16276 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16277 | } |
| 16278 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 16279 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 16280 | struct ieee80211_txq_params *params) |
| 16281 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16282 | int ret; |
| 16283 | |
| 16284 | vos_ssr_protect(__func__); |
| 16285 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 16286 | vos_ssr_unprotect(__func__); |
| 16287 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16288 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16289 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16290 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 16291 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16292 | struct net_device *dev, |
| 16293 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16294 | { |
| 16295 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16296 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16297 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16298 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16299 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16300 | v_CONTEXT_t pVosContext = NULL; |
| 16301 | ptSapContext pSapCtx = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16302 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16303 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16304 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16305 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16306 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16307 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16308 | return -EINVAL; |
| 16309 | } |
| 16310 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16311 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16312 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 16313 | pAdapter->sessionId, pAdapter->device_mode)); |
| 16314 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16315 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16316 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16317 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16318 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16319 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16320 | } |
| 16321 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16322 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16323 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16324 | ) |
| 16325 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16326 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 16327 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 16328 | if(pSapCtx == NULL){ |
| 16329 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16330 | FL("psapCtx is NULL")); |
| 16331 | return -ENOENT; |
| 16332 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16333 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16334 | { |
| 16335 | v_U16_t i; |
| 16336 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 16337 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16338 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 16339 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16340 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16341 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16342 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16343 | ETHER_ADDR_LEN); |
| 16344 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16345 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 16346 | "%s: Delete STA with MAC::" |
| 16347 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16348 | __func__, |
| 16349 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 16350 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 16351 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16352 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16353 | } |
| 16354 | } |
| 16355 | } |
| 16356 | else |
| 16357 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16358 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16359 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 16360 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16361 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 16362 | { |
| 16363 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 16364 | "%s: Skip this DEL STA as this is not used::" |
| 16365 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16366 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16367 | return -ENOENT; |
| 16368 | } |
| 16369 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16370 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16371 | { |
| 16372 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 16373 | "%s: Skip this DEL STA as deauth is in progress::" |
| 16374 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16375 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16376 | return -ENOENT; |
| 16377 | } |
| 16378 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16379 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16380 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16381 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 16382 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 16383 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16384 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16385 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16386 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16387 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16388 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 16389 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16390 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16391 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 16392 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 16393 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16394 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16395 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16396 | return -ENOENT; |
| 16397 | } |
| 16398 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16399 | } |
| 16400 | } |
| 16401 | |
| 16402 | EXIT(); |
| 16403 | |
| 16404 | return 0; |
| 16405 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 16406 | |
| 16407 | #ifdef CFG80211_DEL_STA_V2 |
| 16408 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 16409 | struct net_device *dev, |
| 16410 | struct station_del_parameters *param) |
| 16411 | #else |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16412 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 16413 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 16414 | struct net_device *dev, const u8 *mac) |
| 16415 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16416 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 16417 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 16418 | #endif |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16419 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16420 | { |
| 16421 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16422 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16423 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16424 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16425 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 16426 | #ifdef CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16427 | if (NULL == param) { |
| 16428 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16429 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16430 | return -EINVAL; |
| 16431 | } |
| 16432 | |
| 16433 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 16434 | param->subtype, &delStaParams); |
| 16435 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 16436 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 16437 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16438 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 16439 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16440 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 16441 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16442 | vos_ssr_unprotect(__func__); |
| 16443 | |
| 16444 | return ret; |
| 16445 | } |
| 16446 | |
| 16447 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16448 | struct net_device *dev, |
| 16449 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 16450 | const u8 *mac, |
| 16451 | #else |
| 16452 | u8 *mac, |
| 16453 | #endif |
| 16454 | struct station_parameters *params) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 16455 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16456 | hdd_adapter_t *pAdapter; |
| 16457 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 16458 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 16459 | #ifdef FEATURE_WLAN_TDLS |
| 16460 | u32 mask, set; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16461 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 16462 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16463 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16464 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16465 | if (NULL == pAdapter) |
| 16466 | { |
| 16467 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16468 | "%s: Adapter is NULL",__func__); |
| 16469 | return -EINVAL; |
| 16470 | } |
| 16471 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16472 | status = wlan_hdd_validate_context(pHddCtx); |
| 16473 | if (0 != status) |
| 16474 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16475 | return status; |
| 16476 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 16477 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16478 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16479 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 16480 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16481 | mask = params->sta_flags_mask; |
| 16482 | |
| 16483 | set = params->sta_flags_set; |
| 16484 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 16485 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 16486 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 16487 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16488 | |
| 16489 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 16490 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 16491 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16492 | } |
| 16493 | } |
| 16494 | #endif |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16495 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 16496 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16497 | } |
| 16498 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16499 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 16500 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 16501 | struct net_device *dev, const u8 *mac, |
| 16502 | struct station_parameters *params) |
| 16503 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16504 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 16505 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16506 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16507 | { |
| 16508 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16509 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16510 | vos_ssr_protect(__func__); |
| 16511 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 16512 | vos_ssr_unprotect(__func__); |
| 16513 | |
| 16514 | return ret; |
| 16515 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16516 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16517 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16518 | 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] | 16519 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16520 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16521 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16522 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16523 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16524 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16525 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16526 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16527 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16528 | ENTER(); |
| 16529 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16530 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16531 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16532 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16533 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16534 | return -EINVAL; |
| 16535 | } |
| 16536 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16537 | if (!pmksa) { |
| 16538 | hddLog(LOGE, FL("pmksa is NULL")); |
| 16539 | return -EINVAL; |
| 16540 | } |
| 16541 | |
| 16542 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 16543 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 16544 | pmksa->bssid, pmksa->pmkid); |
| 16545 | return -EINVAL; |
| 16546 | } |
| 16547 | |
| 16548 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 16549 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 16550 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16551 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16552 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16553 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16554 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16555 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16556 | } |
| 16557 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16558 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16559 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16560 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16561 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 16562 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16563 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16564 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16565 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16566 | &pmk_id, 1, FALSE); |
| 16567 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16568 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16569 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 16570 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16571 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16572 | EXIT(); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16573 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16574 | } |
| 16575 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16576 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 16577 | struct cfg80211_pmksa *pmksa) |
| 16578 | { |
| 16579 | int ret; |
| 16580 | |
| 16581 | vos_ssr_protect(__func__); |
| 16582 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 16583 | vos_ssr_unprotect(__func__); |
| 16584 | |
| 16585 | return ret; |
| 16586 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16587 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16588 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16589 | 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] | 16590 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16591 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16592 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16593 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16594 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 16595 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16596 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16597 | ENTER(); |
| 16598 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16599 | /* Validate pAdapter */ |
| 16600 | if (NULL == pAdapter) |
| 16601 | { |
| 16602 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 16603 | return -EINVAL; |
| 16604 | } |
| 16605 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16606 | if (!pmksa) { |
| 16607 | hddLog(LOGE, FL("pmksa is NULL")); |
| 16608 | return -EINVAL; |
| 16609 | } |
| 16610 | |
| 16611 | if (!pmksa->bssid) { |
| 16612 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 16613 | return -EINVAL; |
| 16614 | } |
| 16615 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 16616 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 16617 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 16618 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16619 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16620 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16621 | if (0 != status) |
| 16622 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16623 | return status; |
| 16624 | } |
| 16625 | |
| 16626 | /*Retrieve halHandle*/ |
| 16627 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16628 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16629 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16630 | TRACE_CODE_HDD_CFG80211_DEL_PMKSA, |
| 16631 | pAdapter->sessionId, 0)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16632 | /* Delete the PMKID CSR cache */ |
| 16633 | if (eHAL_STATUS_SUCCESS != |
| 16634 | sme_RoamDelPMKIDfromCache(halHandle, |
| 16635 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 16636 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 16637 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 16638 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16639 | } |
| 16640 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16641 | EXIT(); |
| 16642 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16643 | } |
| 16644 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16645 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16646 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 16647 | struct cfg80211_pmksa *pmksa) |
| 16648 | { |
| 16649 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16650 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16651 | vos_ssr_protect(__func__); |
| 16652 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 16653 | vos_ssr_unprotect(__func__); |
| 16654 | |
| 16655 | return ret; |
| 16656 | |
| 16657 | } |
| 16658 | |
| 16659 | 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] | 16660 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16661 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16662 | tHalHandle halHandle; |
| 16663 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 16664 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16665 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16666 | ENTER(); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16667 | |
| 16668 | /* Validate pAdapter */ |
| 16669 | if (NULL == pAdapter) |
| 16670 | { |
| 16671 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16672 | "%s: Invalid Adapter" ,__func__); |
| 16673 | return -EINVAL; |
| 16674 | } |
| 16675 | |
| 16676 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16677 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16678 | if (0 != status) |
| 16679 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16680 | return status; |
| 16681 | } |
| 16682 | |
| 16683 | /*Retrieve halHandle*/ |
| 16684 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16685 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16686 | /* Flush the PMKID cache in CSR */ |
| 16687 | if (eHAL_STATUS_SUCCESS != |
| 16688 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 16689 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 16690 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16691 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16692 | EXIT(); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 16693 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16694 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16695 | |
| 16696 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 16697 | { |
| 16698 | int ret; |
| 16699 | |
| 16700 | vos_ssr_protect(__func__); |
| 16701 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 16702 | vos_ssr_unprotect(__func__); |
| 16703 | |
| 16704 | return ret; |
| 16705 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16706 | #endif |
| 16707 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16708 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16709 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 16710 | struct net_device *dev, |
| 16711 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16712 | { |
| 16713 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16714 | hdd_station_ctx_t *pHddStaCtx; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16715 | hdd_context_t *pHddCtx; |
| 16716 | int ret = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16717 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16718 | ENTER(); |
| 16719 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16720 | if (NULL == pAdapter) |
| 16721 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16722 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16723 | return -ENODEV; |
| 16724 | } |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16725 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16726 | ret = wlan_hdd_validate_context(pHddCtx); |
| 16727 | if (0 != ret) |
| 16728 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16729 | return ret; |
| 16730 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16731 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16732 | if (NULL == pHddStaCtx) |
| 16733 | { |
| 16734 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__); |
| 16735 | return -EINVAL; |
| 16736 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16737 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16738 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16739 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 16740 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16741 | // Added for debug on reception of Re-assoc Req. |
| 16742 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 16743 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16744 | 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] | 16745 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16746 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16747 | } |
| 16748 | |
| 16749 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16750 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16751 | ftie->ie_len); |
| 16752 | #endif |
| 16753 | |
| 16754 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 16755 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 16756 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16757 | ftie->ie_len); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16758 | |
| 16759 | EXIT(); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16760 | return 0; |
| 16761 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16762 | |
| 16763 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 16764 | struct net_device *dev, |
| 16765 | struct cfg80211_update_ft_ies_params *ftie) |
| 16766 | { |
| 16767 | int ret; |
| 16768 | |
| 16769 | vos_ssr_protect(__func__); |
| 16770 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 16771 | vos_ssr_unprotect(__func__); |
| 16772 | |
| 16773 | return ret; |
| 16774 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16775 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16776 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16777 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 16778 | |
| 16779 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 16780 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 16781 | { |
| 16782 | int ret; |
| 16783 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 16784 | hdd_context_t *pHddCtx; |
| 16785 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16786 | ENTER(); |
| 16787 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16788 | if (NULL == pAdapter) |
| 16789 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 16790 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16791 | "%s: HDD adapter is Null", __func__); |
| 16792 | return ; |
| 16793 | } |
| 16794 | |
| 16795 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16796 | if (NULL == pHddCtx) |
| 16797 | { |
| 16798 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16799 | "%s: HDD context is Null!!!", __func__); |
| 16800 | return ; |
| 16801 | } |
| 16802 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16803 | spin_lock(&pHddCtx->schedScan_lock); |
| 16804 | if (TRUE == pHddCtx->isWiphySuspended) |
| 16805 | { |
| 16806 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 16807 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16808 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 16809 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 16810 | return ; |
| 16811 | } |
| 16812 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16813 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16814 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 16815 | |
| 16816 | if (0 > ret) |
| 16817 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | fb49cdd | 2015-10-16 18:41:59 +0530 | [diff] [blame] | 16818 | else |
| 16819 | { |
| 16820 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 16821 | * immediatly after the driver gets connect request(i.e after pno) |
| 16822 | * from supplicant, this result in app's is suspending and not able |
| 16823 | * to process the connect request to AP */ |
| 16824 | hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN); |
| 16825 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16826 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16827 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16828 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16829 | } |
| 16830 | |
| 16831 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16832 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 16833 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16834 | */ |
| 16835 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 16836 | { |
| 16837 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 16838 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16839 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16840 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16841 | int status = 0; |
| 16842 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 16843 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 16844 | /* The current firmware design does not allow PNO during any |
| 16845 | * active sessions. Hence, determine the active sessions |
| 16846 | * and return a failure. |
| 16847 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16848 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 16849 | { |
| 16850 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16851 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16852 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16853 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 16854 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 16855 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 16856 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 16857 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 16858 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16859 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16860 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16861 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16862 | } |
| 16863 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 16864 | pAdapterNode = pNext; |
| 16865 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16866 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16867 | } |
| 16868 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16869 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 16870 | { |
| 16871 | hdd_adapter_t *pAdapter = callbackContext; |
| 16872 | hdd_context_t *pHddCtx; |
| 16873 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16874 | ENTER(); |
| 16875 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16876 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 16877 | { |
| 16878 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16879 | FL("Invalid adapter or adapter has invalid magic")); |
| 16880 | return; |
| 16881 | } |
| 16882 | |
| 16883 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16884 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 16885 | { |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16886 | return; |
| 16887 | } |
| 16888 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 16889 | if (VOS_STATUS_SUCCESS != status) |
| 16890 | { |
| 16891 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16892 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 16893 | pHddCtx->isPnoEnable = FALSE; |
| 16894 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16895 | |
| 16896 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 16897 | complete(&pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16898 | EXIT(); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16899 | } |
| 16900 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16901 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 16902 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 16903 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16904 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 16905 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16906 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 16907 | { |
| 16908 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16909 | tSirPNOScanReq pnoRequest = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16910 | hdd_context_t *pHddCtx; |
| 16911 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 16912 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 16913 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 16914 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16915 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 16916 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16917 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 16918 | hdd_config_t *pConfig = NULL; |
| 16919 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16920 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16921 | ENTER(); |
| 16922 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16923 | if (NULL == pAdapter) |
| 16924 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 16925 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16926 | "%s: HDD adapter is Null", __func__); |
| 16927 | return -ENODEV; |
| 16928 | } |
| 16929 | |
| 16930 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16931 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16932 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16933 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16934 | { |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16935 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16936 | } |
| 16937 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 16938 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16939 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16940 | if (NULL == hHal) |
| 16941 | { |
| 16942 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16943 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16944 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16945 | } |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16946 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16947 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START, |
| 16948 | pAdapter->sessionId, pAdapter->device_mode)); |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 16949 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 16950 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 16951 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 16952 | { |
| 16953 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16954 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 16955 | return -EBUSY; |
| 16956 | } |
| 16957 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16958 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16959 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 16960 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16961 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16962 | return -EBUSY; |
| 16963 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16964 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 16965 | if (TRUE == pHddCtx->isPnoEnable) |
| 16966 | { |
| 16967 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 16968 | FL("already PNO is enabled")); |
| 16969 | return -EBUSY; |
| 16970 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 16971 | |
| 16972 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 16973 | { |
| 16974 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16975 | "%s: abort ROC failed ", __func__); |
| 16976 | return -EBUSY; |
| 16977 | } |
| 16978 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 16979 | pHddCtx->isPnoEnable = TRUE; |
| 16980 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16981 | pnoRequest.enable = 1; /*Enable PNO */ |
| 16982 | pnoRequest.ucNetworksCount = request->n_match_sets; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16983 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16984 | if (( !pnoRequest.ucNetworksCount ) || |
| 16985 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16986 | { |
| 16987 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 16988 | "%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] | 16989 | __func__, pnoRequest.ucNetworksCount, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 16990 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16991 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16992 | goto error; |
| 16993 | } |
| 16994 | |
| 16995 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 16996 | { |
| 16997 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16998 | "%s: Incorrect number of channels %d", |
| 16999 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17000 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17001 | goto error; |
| 17002 | } |
| 17003 | |
| 17004 | /* Framework provides one set of channels(all) |
| 17005 | * common for all saved profile */ |
| 17006 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 17007 | channels_allowed, &num_channels_allowed)) |
| 17008 | { |
| 17009 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17010 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17011 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17012 | goto error; |
| 17013 | } |
| 17014 | /* Checking each channel against allowed channel list */ |
| 17015 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 17016 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17017 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 17018 | char chList [(request->n_channels*5)+1]; |
| 17019 | int len; |
| 17020 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17021 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 17022 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17023 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 17024 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 17025 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 17026 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 17027 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 17028 | { |
| 17029 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17030 | "%s : Dropping DFS channel : %d", |
| 17031 | __func__,channels_allowed[indx]); |
| 17032 | num_ignore_dfs_ch++; |
| 17033 | break; |
| 17034 | } |
| 17035 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 17036 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 17037 | len += snprintf(chList+len, 5, "%d ", |
| 17038 | request->channels[i]->hw_value); |
| 17039 | break ; |
| 17040 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17041 | } |
| 17042 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 17043 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17044 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 17045 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 17046 | if (num_ignore_dfs_ch == request->n_channels) |
| 17047 | { |
| 17048 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17049 | "%s : All requested channels are DFS channels", __func__); |
| 17050 | ret = -EINVAL; |
| 17051 | goto error; |
| 17052 | } |
| 17053 | } |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17054 | |
| 17055 | pnoRequest.aNetworks = |
| 17056 | vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 17057 | if (pnoRequest.aNetworks == NULL) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17058 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17059 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 17060 | FL("failed to allocate memory aNetworks %u"), |
| 17061 | (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 17062 | goto error; |
| 17063 | } |
| 17064 | vos_mem_zero(pnoRequest.aNetworks, |
| 17065 | sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 17066 | |
| 17067 | /* Filling per profile params */ |
| 17068 | for (i = 0; i < pnoRequest.ucNetworksCount; i++) |
| 17069 | { |
| 17070 | pnoRequest.aNetworks[i].ssId.length = |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17071 | request->match_sets[i].ssid.ssid_len; |
| 17072 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17073 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 17074 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17075 | { |
| 17076 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 17077 | "%s: SSID Len %d is not correct for network %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17078 | __func__, pnoRequest.aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17079 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17080 | goto error; |
| 17081 | } |
| 17082 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17083 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17084 | request->match_sets[i].ssid.ssid, |
| 17085 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 17086 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17087 | "%s: SSID of network %d is %s ", __func__, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17088 | i, pnoRequest.aNetworks[i].ssId.ssId); |
| 17089 | pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 17090 | pnoRequest.aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 17091 | pnoRequest.aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17092 | |
| 17093 | /*Copying list of valid channel into request */ |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17094 | memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch); |
| 17095 | pnoRequest.aNetworks[i].ucChannelCount = num_ch; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17096 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17097 | pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17098 | } |
| 17099 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 17100 | for (i = 0; i < request->n_ssids; i++) |
| 17101 | { |
| 17102 | j = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17103 | while (j < pnoRequest.ucNetworksCount) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 17104 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17105 | if ((pnoRequest.aNetworks[j].ssId.length == |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 17106 | request->ssids[i].ssid_len) && |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17107 | (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId, |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 17108 | request->ssids[i].ssid, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17109 | pnoRequest.aNetworks[j].ssId.length))) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 17110 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17111 | pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 17112 | break; |
| 17113 | } |
| 17114 | j++; |
| 17115 | } |
| 17116 | } |
| 17117 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17118 | "Number of hidden networks being Configured = %d", |
| 17119 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 17120 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 17121 | "request->ie_len = %zu", request->ie_len); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17122 | |
| 17123 | pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 17124 | if (pnoRequest.p24GProbeTemplate == NULL) |
| 17125 | { |
| 17126 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 17127 | FL("failed to allocate memory p24GProbeTemplate %u"), |
| 17128 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 17129 | goto error; |
| 17130 | } |
| 17131 | |
| 17132 | pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 17133 | if (pnoRequest.p5GProbeTemplate == NULL) |
| 17134 | { |
| 17135 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 17136 | FL("failed to allocate memory p5GProbeTemplate %u"), |
| 17137 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 17138 | goto error; |
| 17139 | } |
| 17140 | |
| 17141 | vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 17142 | vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 17143 | |
Hanumantha Reddy Pothula | 06e87b2 | 2015-03-02 18:02:23 +0530 | [diff] [blame] | 17144 | if ((0 < request->ie_len) && (request->ie_len <= SIR_PNO_MAX_PB_REQ_SIZE) && |
| 17145 | (NULL != request->ie)) |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 17146 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17147 | pnoRequest.us24GProbeTemplateLen = request->ie_len; |
| 17148 | memcpy(pnoRequest.p24GProbeTemplate, request->ie, |
| 17149 | pnoRequest.us24GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 17150 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17151 | pnoRequest.us5GProbeTemplateLen = request->ie_len; |
| 17152 | memcpy(pnoRequest.p5GProbeTemplate, request->ie, |
| 17153 | pnoRequest.us5GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 17154 | } |
| 17155 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 17156 | /* Driver gets only one time interval which is hardcoded in |
| 17157 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 17158 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 17159 | * 80,160,320 secs. And number of scan cycle for each timer |
| 17160 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 17161 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 17162 | * will be repeated after each interval specified by supplicant |
| 17163 | * till PNO is disabled. |
| 17164 | */ |
| 17165 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17166 | pnoRequest.scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 17167 | else |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17168 | pnoRequest.scanTimers.ucScanTimersCount = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 17169 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 17170 | |
| 17171 | tempInterval = (request->interval)/1000; |
| 17172 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17173 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 17174 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17175 | for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++) |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 17176 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17177 | pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 17178 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17179 | pnoRequest.scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 17180 | tempInterval *= 2; |
| 17181 | } |
| 17182 | //Repeat last timer until pno disabled. |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17183 | pnoRequest.scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 17184 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17185 | pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17186 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17187 | INIT_COMPLETION(pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17188 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 17189 | pnoRequest.callbackContext = pAdapter; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17190 | pAdapter->pno_req_status = 0; |
| 17191 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 17192 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17193 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17194 | pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO, |
| 17195 | pnoRequest.scanTimers.ucScanTimersCount); |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 17196 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17197 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17198 | &pnoRequest, pAdapter->sessionId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17199 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 17200 | if (eHAL_STATUS_SUCCESS != status) |
| 17201 | { |
| 17202 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 17203 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17204 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17205 | goto error; |
| 17206 | } |
| 17207 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17208 | ret = wait_for_completion_timeout( |
| 17209 | &pAdapter->pno_comp_var, |
| 17210 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 17211 | if (0 >= ret) |
| 17212 | { |
| 17213 | // Did not receive the response for PNO enable in time. |
| 17214 | // Assuming the PNO enable was success. |
| 17215 | // Returning error from here, because we timeout, results |
| 17216 | // in side effect of Wifi (Wifi Setting) not to work. |
| 17217 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17218 | FL("Timed out waiting for PNO to be Enabled")); |
| 17219 | ret = 0; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17220 | } |
| 17221 | |
| 17222 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 17223 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 17224 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17225 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17226 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17227 | FL("PNO scanRequest offloaded ret = %d"), ret); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 17228 | pHddCtx->isPnoEnable = FALSE; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17229 | if (pnoRequest.aNetworks) |
| 17230 | vos_mem_free(pnoRequest.aNetworks); |
| 17231 | if (pnoRequest.p24GProbeTemplate) |
| 17232 | vos_mem_free(pnoRequest.p24GProbeTemplate); |
| 17233 | if (pnoRequest.p5GProbeTemplate) |
| 17234 | vos_mem_free(pnoRequest.p5GProbeTemplate); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17235 | |
| 17236 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17237 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17238 | } |
| 17239 | |
| 17240 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 17241 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 17242 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17243 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 17244 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 17245 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 17246 | { |
| 17247 | int ret; |
| 17248 | |
| 17249 | vos_ssr_protect(__func__); |
| 17250 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 17251 | vos_ssr_unprotect(__func__); |
| 17252 | |
| 17253 | return ret; |
| 17254 | } |
| 17255 | |
| 17256 | /* |
| 17257 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 17258 | * Function to disable PNO |
| 17259 | */ |
| 17260 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17261 | struct net_device *dev) |
| 17262 | { |
| 17263 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 17264 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 17265 | hdd_context_t *pHddCtx; |
| 17266 | tHalHandle hHal; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17267 | tSirPNOScanReq pnoRequest = {0}; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17268 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17269 | |
| 17270 | ENTER(); |
| 17271 | |
| 17272 | if (NULL == pAdapter) |
| 17273 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17274 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17275 | "%s: HDD adapter is Null", __func__); |
| 17276 | return -ENODEV; |
| 17277 | } |
| 17278 | |
| 17279 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17280 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17281 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17282 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 17283 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17284 | "%s: HDD context is Null", __func__); |
| 17285 | return -ENODEV; |
| 17286 | } |
| 17287 | |
| 17288 | /* The return 0 is intentional when isLogpInProgress and |
| 17289 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 17290 | * failure in sched_scan_stop , especially for a case where the unload |
| 17291 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 17292 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 17293 | * success. If it returns a failure , then its next invocation due to the |
| 17294 | * clean up of the second interface will have the dev pointer corresponding |
| 17295 | * to the first one leading to a crash. |
| 17296 | */ |
| 17297 | if (pHddCtx->isLogpInProgress) |
| 17298 | { |
| 17299 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17300 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Mahesh A Saptasagar | 0c11d82 | 2015-10-08 19:54:08 +0530 | [diff] [blame] | 17301 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17302 | return ret; |
| 17303 | } |
| 17304 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 17305 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17306 | { |
| 17307 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17308 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 17309 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17310 | } |
| 17311 | |
| 17312 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 17313 | if (NULL == hHal) |
| 17314 | { |
| 17315 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17316 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 17317 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17318 | } |
| 17319 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17320 | pnoRequest.enable = 0; /* Disable PNO */ |
| 17321 | pnoRequest.ucNetworksCount = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17322 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 17323 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17324 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP, |
| 17325 | pAdapter->sessionId, pAdapter->device_mode)); |
Hanumantha Reddy Pothula | 0e408dc | 2015-11-23 12:04:53 +0530 | [diff] [blame] | 17326 | |
| 17327 | INIT_COMPLETION(pAdapter->pno_comp_var); |
| 17328 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 17329 | pnoRequest.callbackContext = pAdapter; |
| 17330 | pAdapter->pno_req_status = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17331 | status = sme_SetPreferredNetworkList(hHal, &pnoRequest, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17332 | pAdapter->sessionId, |
| 17333 | NULL, pAdapter); |
| 17334 | if (eHAL_STATUS_SUCCESS != status) |
| 17335 | { |
| 17336 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17337 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17338 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17339 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17340 | } |
Hanumantha Reddy Pothula | 0e408dc | 2015-11-23 12:04:53 +0530 | [diff] [blame] | 17341 | ret = wait_for_completion_timeout( |
| 17342 | &pAdapter->pno_comp_var, |
| 17343 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 17344 | if (0 >= ret) |
| 17345 | { |
| 17346 | // Did not receive the response for PNO disable in time. |
| 17347 | // Assuming the PNO disable was success. |
| 17348 | // Returning error from here, because we timeout, results |
| 17349 | // in side effect of Wifi (Wifi Setting) not to work. |
| 17350 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17351 | FL("Timed out waiting for PNO to be disabled")); |
| 17352 | ret = 0; |
| 17353 | } |
| 17354 | |
| 17355 | ret = pAdapter->pno_req_status; |
| 17356 | pHddCtx->isPnoEnable = (ret == 0) ? FALSE : TRUE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17357 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17358 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 17359 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17360 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17361 | |
| 17362 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17363 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17364 | } |
| 17365 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 17366 | /* |
| 17367 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 17368 | * NL interface to disable PNO |
| 17369 | */ |
| 17370 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 17371 | struct net_device *dev) |
| 17372 | { |
| 17373 | int ret; |
| 17374 | |
| 17375 | vos_ssr_protect(__func__); |
| 17376 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 17377 | vos_ssr_unprotect(__func__); |
| 17378 | |
| 17379 | return ret; |
| 17380 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17381 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 17382 | |
| 17383 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17384 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 17385 | #if TDLS_MGMT_VERSION2 |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17386 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17387 | struct net_device *dev, |
| 17388 | u8 *peer, u8 action_code, |
| 17389 | u8 dialog_token, |
| 17390 | u16 status_code, u32 peer_capability, |
| 17391 | const u8 *buf, size_t len) |
| 17392 | #else /* TDLS_MGMT_VERSION2 */ |
| 17393 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS) |
| 17394 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17395 | struct net_device *dev, |
| 17396 | const u8 *peer, u8 action_code, |
| 17397 | u8 dialog_token, u16 status_code, |
| 17398 | u32 peer_capability, bool initiator, |
| 17399 | const u8 *buf, size_t len) |
| 17400 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) |
| 17401 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17402 | struct net_device *dev, |
| 17403 | const u8 *peer, u8 action_code, |
| 17404 | u8 dialog_token, u16 status_code, |
| 17405 | u32 peer_capability, const u8 *buf, |
| 17406 | size_t len) |
| 17407 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 17408 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17409 | struct net_device *dev, |
| 17410 | u8 *peer, u8 action_code, |
| 17411 | u8 dialog_token, |
| 17412 | u16 status_code, u32 peer_capability, |
| 17413 | const u8 *buf, size_t len) |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 17414 | #else |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17415 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17416 | struct net_device *dev, |
| 17417 | u8 *peer, u8 action_code, |
| 17418 | u8 dialog_token, |
| 17419 | u16 status_code, const u8 *buf, |
| 17420 | size_t len) |
| 17421 | #endif |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 17422 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17423 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17424 | hdd_adapter_t *pAdapter; |
| 17425 | hdd_context_t *pHddCtx; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17426 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 17427 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17428 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 17429 | long rc; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17430 | int ret; |
Masti, Narayanraddi | 3b68193 | 2015-10-08 19:22:25 +0530 | [diff] [blame] | 17431 | hddTdlsPeer_t *pTdlsPeer; |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17432 | #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] | 17433 | u32 peer_capability = 0; |
| 17434 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 17435 | tANI_U16 numCurrTdlsPeers; |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17436 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17437 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17438 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 17439 | if (NULL == pAdapter) |
| 17440 | { |
| 17441 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17442 | "%s: Adapter is NULL",__func__); |
| 17443 | return -EINVAL; |
| 17444 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17445 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17446 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 17447 | pAdapter->sessionId, action_code)); |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17448 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17449 | pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17450 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17451 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17452 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17453 | "Invalid arguments"); |
| 17454 | return -EINVAL; |
| 17455 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17456 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 17457 | if (pHddCtx->isLogpInProgress) |
| 17458 | { |
| 17459 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17460 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17461 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 17462 | peer, |
| 17463 | eTDLS_LINK_IDLE, |
| 17464 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 17465 | return -EBUSY; |
| 17466 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17467 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17468 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
| 17469 | { |
| 17470 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17471 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 17472 | return -EAGAIN; |
| 17473 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17474 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17475 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17476 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 17477 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17478 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 17479 | MAC_ADDRESS_STR " action %d declined.", |
| 17480 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17481 | return -ENOTSUPP; |
| 17482 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17483 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17484 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 17485 | |
| 17486 | if( NULL == pHddStaCtx ) |
| 17487 | { |
| 17488 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17489 | "%s: HDD station context NULL ",__func__); |
| 17490 | return -EINVAL; |
| 17491 | } |
| 17492 | |
| 17493 | /* STA should be connected and authenticated |
| 17494 | * before sending any TDLS frames |
| 17495 | */ |
| 17496 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 17497 | (FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 17498 | { |
| 17499 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17500 | "STA is not connected or unauthenticated. " |
| 17501 | "connState %u, uIsAuthenticated %u", |
| 17502 | pHddStaCtx->conn_info.connState, |
| 17503 | pHddStaCtx->conn_info.uIsAuthenticated); |
| 17504 | return -EAGAIN; |
| 17505 | } |
| 17506 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17507 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 17508 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 17509 | { |
| 17510 | /* if tdls_mode is disabled to respond to peer's request */ |
| 17511 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 17512 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 17513 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17514 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 17515 | " TDLS mode is disabled. action %d declined.", |
| 17516 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17517 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17518 | return -ENOTSUPP; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17519 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 17520 | |
| 17521 | if (vos_max_concurrent_connections_reached()) |
| 17522 | { |
| 17523 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 17524 | return -EINVAL; |
| 17525 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17526 | } |
| 17527 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17528 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 17529 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 17530 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17531 | { |
| 17532 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17533 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 17534 | " TDLS setup is ongoing. action %d declined.", |
| 17535 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 17536 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17537 | } |
| 17538 | } |
| 17539 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17540 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 17541 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17542 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 17543 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 17544 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17545 | { |
| 17546 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 17547 | we return error code at 'add_station()'. Hence we have this |
| 17548 | check again in addtion to add_station(). |
| 17549 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17550 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17551 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17552 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17553 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 17554 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 17555 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 17556 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 17557 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17558 | } |
| 17559 | else |
| 17560 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17561 | /* maximum reached. tweak to send error code to peer and return |
| 17562 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17563 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17564 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17565 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 17566 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 17567 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 17568 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 17569 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17570 | /* fall through to send setup resp with failure status |
| 17571 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17572 | } |
| 17573 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17574 | else |
| 17575 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17576 | mutex_lock(&pHddCtx->tdls_lock); |
| 17577 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 17578 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17579 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17580 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17581 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 17582 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 17583 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17584 | return -EPERM; |
| 17585 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17586 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17587 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17588 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17589 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 17590 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 17591 | "%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] | 17592 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 17593 | action_code, dialog_token, status_code, len); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17594 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17595 | /*Except teardown responder will not be used so just make 0*/ |
| 17596 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17597 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17598 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 17599 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17600 | mutex_lock(&pHddCtx->tdls_lock); |
| 17601 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 17602 | |
| 17603 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 17604 | responder = pTdlsPeer->is_responder; |
| 17605 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17606 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 17607 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 17608 | "%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] | 17609 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 17610 | dialog_token, status_code, len); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17611 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 17612 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17613 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17614 | mutex_unlock(&pHddCtx->tdls_lock); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17615 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17616 | |
Masti, Narayanraddi | 3b68193 | 2015-10-08 19:22:25 +0530 | [diff] [blame] | 17617 | /* Discard TDLS setup if peer is removed by user app */ |
| 17618 | if ((pHddCtx->cfg_ini->fTDLSExternalControl) && |
| 17619 | ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 17620 | (SIR_MAC_TDLS_SETUP_CNF == action_code) || |
| 17621 | (SIR_MAC_TDLS_DIS_REQ == action_code))) { |
| 17622 | |
| 17623 | mutex_lock(&pHddCtx->tdls_lock); |
| 17624 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 17625 | if (pTdlsPeer && (FALSE == pTdlsPeer->isForcedPeer)) { |
| 17626 | mutex_unlock(&pHddCtx->tdls_lock); |
| 17627 | hddLog(LOGE, FL("TDLS External Control enabled, but peer " |
| 17628 | MAC_ADDRESS_STR " is not forced, so reject the action code %d"), |
| 17629 | MAC_ADDR_ARRAY(peer), action_code); |
| 17630 | return -EINVAL; |
| 17631 | } |
| 17632 | mutex_unlock(&pHddCtx->tdls_lock); |
| 17633 | } |
| 17634 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 17635 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 17636 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17637 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Deepthi Gowri | f78f1f7 | 2016-03-21 13:13:28 +0530 | [diff] [blame] | 17638 | (SIR_MAC_TDLS_SETUP_CNF== action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 17639 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 17640 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17641 | { |
| 17642 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 17643 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 17644 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 17645 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17646 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 17647 | if (status != VOS_STATUS_SUCCESS) { |
| 17648 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 17649 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17650 | } |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17651 | if (SIR_MAC_TDLS_DIS_REQ != action_code) { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17652 | if (0 != wlan_hdd_tdls_set_cap(pAdapter, peer, eTDLS_CAP_SUPPORTED)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17653 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS capabilities")); |
| 17654 | } |
| 17655 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17656 | } |
| 17657 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 17658 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 17659 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 17660 | { |
| 17661 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17662 | "%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] | 17663 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17664 | ret = -EBUSY; |
| 17665 | goto tx_failed; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 17666 | } |
| 17667 | |
| 17668 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17669 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 17670 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17671 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 17672 | pAdapter->sessionId, peer, action_code, dialog_token, |
| 17673 | status_code, peer_capability, (tANI_U8 *)buf, len, |
| 17674 | responder); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17675 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17676 | if (VOS_STATUS_SUCCESS != status) |
| 17677 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17678 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17679 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 17680 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17681 | ret = -EINVAL; |
| 17682 | goto tx_failed; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17683 | } |
| 17684 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17685 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17686 | "%s: Wait for tdls_mgmt_comp. Timeout %u ms", __func__, |
| 17687 | WAIT_TIME_TDLS_MGMT); |
| 17688 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 17689 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 17690 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 17691 | |
| 17692 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17693 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 17694 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 17695 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 17696 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 17697 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 17698 | |
| 17699 | if (pHddCtx->isLogpInProgress) |
| 17700 | { |
| 17701 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17702 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 17703 | return -EAGAIN; |
| 17704 | } |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 17705 | if (rc <= 0) |
| 17706 | vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL, |
| 17707 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 17708 | WLAN_LOG_REASON_HDD_TIME_OUT, |
| 17709 | TRUE, TRUE); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 17710 | |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17711 | ret = -EINVAL; |
| 17712 | goto tx_failed; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17713 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17714 | else |
| 17715 | { |
| 17716 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17717 | "%s: Mgmt Tx Completion status %ld TxCompletion %u", |
| 17718 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
| 17719 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17720 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 17721 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17722 | { |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17723 | ret = max_sta_failed; |
| 17724 | goto tx_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17725 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17726 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17727 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 17728 | { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17729 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, TRUE)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17730 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 17731 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17732 | } |
| 17733 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 17734 | { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17735 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, FALSE)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17736 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 17737 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17738 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17739 | |
| 17740 | return 0; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17741 | |
| 17742 | tx_failed: |
| 17743 | /* add_station will be called before sending TDLS_SETUP_REQ and |
| 17744 | * TDLS_SETUP_RSP and as part of add_station driver will enable |
| 17745 | * BMPS. NL80211_TDLS_DISABLE_LINK will be called if the tx of |
| 17746 | * TDLS_SETUP_REQ or TDLS_SETUP_RSP fails. BMPS will be enabled |
| 17747 | * as part of processing NL80211_TDLS_DISABLE_LINK. So need to |
| 17748 | * enable BMPS for TDLS_SETUP_REQ and TDLS_SETUP_RSP if tx fails. |
| 17749 | */ |
| 17750 | |
| 17751 | if ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 17752 | (SIR_MAC_TDLS_SETUP_RSP == action_code)) |
| 17753 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 17754 | return ret; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17755 | } |
| 17756 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17757 | #if TDLS_MGMT_VERSION2 |
| 17758 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 17759 | u8 *peer, u8 action_code, u8 dialog_token, |
| 17760 | u16 status_code, u32 peer_capability, |
| 17761 | const u8 *buf, size_t len) |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17762 | #else /* TDLS_MGMT_VERSION2 */ |
| 17763 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) |
| 17764 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17765 | struct net_device *dev, |
| 17766 | const u8 *peer, u8 action_code, |
| 17767 | u8 dialog_token, u16 status_code, |
| 17768 | u32 peer_capability, bool initiator, |
| 17769 | const u8 *buf, size_t len) |
| 17770 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 17771 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17772 | struct net_device *dev, |
| 17773 | const u8 *peer, u8 action_code, |
| 17774 | u8 dialog_token, u16 status_code, |
| 17775 | u32 peer_capability, const u8 *buf, |
| 17776 | size_t len) |
| 17777 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 17778 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17779 | struct net_device *dev, |
| 17780 | u8 *peer, u8 action_code, |
| 17781 | u8 dialog_token, |
| 17782 | u16 status_code, u32 peer_capability, |
| 17783 | const u8 *buf, size_t len) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17784 | #else |
| 17785 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 17786 | u8 *peer, u8 action_code, u8 dialog_token, |
| 17787 | u16 status_code, const u8 *buf, size_t len) |
| 17788 | #endif |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17789 | #endif |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17790 | { |
| 17791 | int ret; |
| 17792 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17793 | vos_ssr_protect(__func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17794 | #if TDLS_MGMT_VERSION2 |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17795 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 17796 | dialog_token, status_code, |
| 17797 | peer_capability, buf, len); |
| 17798 | #else /* TDLS_MGMT_VERSION2 */ |
| 17799 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS) |
| 17800 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 17801 | dialog_token, status_code, |
| 17802 | peer_capability, initiator, |
| 17803 | buf, len); |
| 17804 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) |
| 17805 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 17806 | dialog_token, status_code, |
| 17807 | peer_capability, buf, len); |
| 17808 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 17809 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 17810 | dialog_token, status_code, |
| 17811 | peer_capability, buf, len); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17812 | #else |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17813 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 17814 | dialog_token, status_code, buf, len); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17815 | #endif |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17816 | #endif |
| 17817 | vos_ssr_unprotect(__func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17818 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17819 | return ret; |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17820 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17821 | |
| 17822 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17823 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 17824 | const u8 *peer, |
| 17825 | #else |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17826 | u8 *peer, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17827 | #endif |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17828 | tdls_req_params_t *tdls_peer_params, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17829 | cfg80211_exttdls_callback callback) |
| 17830 | { |
| 17831 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17832 | hddTdlsPeer_t *pTdlsPeer = NULL; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17833 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 17834 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17835 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17836 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 17837 | __func__, MAC_ADDR_ARRAY(peer)); |
| 17838 | |
| 17839 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 17840 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 17841 | |
| 17842 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17843 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 17844 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 17845 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17846 | return -ENOTSUPP; |
| 17847 | } |
| 17848 | |
| 17849 | /* To cater the requirement of establishing the TDLS link |
| 17850 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 17851 | */ |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 17852 | mutex_lock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17853 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 17854 | if (pTdlsPeer == NULL) { |
| 17855 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17856 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 17857 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 17858 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17859 | return -EINVAL; |
| 17860 | } |
| 17861 | |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 17862 | /* check FW TDLS Off Channel capability */ |
| 17863 | if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) && |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 17864 | (TRUE == pHddCtx->cfg_ini->fEnableTDLSOffChannel) && |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 17865 | (NULL != tdls_peer_params)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17866 | { |
| 17867 | pTdlsPeer->peerParams.channel = tdls_peer_params->channel; |
| 17868 | pTdlsPeer->peerParams.global_operating_class = |
| 17869 | tdls_peer_params->global_operating_class; |
| 17870 | pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms; |
| 17871 | pTdlsPeer->peerParams.min_bandwidth_kbps = |
| 17872 | tdls_peer_params->min_bandwidth_kbps; |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 17873 | /* check configured channel is valid, non dfs and |
| 17874 | * not current operating channel */ |
| 17875 | if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 17876 | tdls_peer_params->channel)) && |
| 17877 | (pHddStaCtx) && |
| 17878 | (tdls_peer_params->channel != |
| 17879 | pHddStaCtx->conn_info.operationChannel)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17880 | { |
| 17881 | pTdlsPeer->isOffChannelConfigured = TRUE; |
| 17882 | } |
| 17883 | else |
| 17884 | { |
| 17885 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 17886 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17887 | "%s: Configured Tdls Off Channel is not valid", __func__); |
| 17888 | |
| 17889 | } |
| 17890 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 17891 | "%s: tdls_off_channel %d isOffChannelConfigured %d " |
| 17892 | "current operating channel %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17893 | __func__, pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 17894 | pTdlsPeer->isOffChannelConfigured, |
| 17895 | (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17896 | } |
| 17897 | else |
| 17898 | { |
| 17899 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 17900 | "%s: TDLS off channel FW capability %d, " |
| 17901 | "host capab %d or Invalid TDLS Peer Params", __func__, |
| 17902 | sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL), |
| 17903 | pHddCtx->cfg_ini->fEnableTDLSOffChannel); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17904 | } |
| 17905 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17906 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 17907 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17908 | mutex_unlock(&pHddCtx->tdls_lock); |
| 17909 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17910 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17911 | " %s TDLS Add Force Peer Failed", |
| 17912 | __func__); |
| 17913 | return -EINVAL; |
| 17914 | } |
| 17915 | /*EXT TDLS*/ |
| 17916 | |
| 17917 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17918 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17919 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17920 | " %s TDLS set callback Failed", |
| 17921 | __func__); |
| 17922 | return -EINVAL; |
| 17923 | } |
| 17924 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17925 | mutex_unlock(&pHddCtx->tdls_lock); |
| 17926 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17927 | return(0); |
| 17928 | |
| 17929 | } |
| 17930 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17931 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, |
| 17932 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 17933 | const u8 *peer |
| 17934 | #else |
| 17935 | u8 *peer |
| 17936 | #endif |
| 17937 | ) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17938 | { |
| 17939 | |
| 17940 | hddTdlsPeer_t *pTdlsPeer; |
| 17941 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | ff7c2f9 | 2016-01-05 15:28:12 +0530 | [diff] [blame] | 17942 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17943 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17944 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 17945 | __func__, MAC_ADDR_ARRAY(peer)); |
| 17946 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 17947 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 17948 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is NULL")); |
| 17949 | return -EINVAL; |
| 17950 | } |
| 17951 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17952 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 17953 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 17954 | |
| 17955 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17956 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 17957 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 17958 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17959 | return -ENOTSUPP; |
| 17960 | } |
| 17961 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17962 | mutex_lock(&pHddCtx->tdls_lock); |
| 17963 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17964 | |
| 17965 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17966 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17967 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 17968 | " peer not existing", |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17969 | __func__, MAC_ADDR_ARRAY(peer)); |
| 17970 | return -EINVAL; |
| 17971 | } |
| 17972 | else { |
| 17973 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 17974 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Abhishek Singh | ff7c2f9 | 2016-01-05 15:28:12 +0530 | [diff] [blame] | 17975 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_EXT_CTRL, |
| 17976 | pTdlsPeer->peerMac); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17977 | /* if channel switch is configured, reset |
| 17978 | the channel for this peer */ |
| 17979 | if (TRUE == pTdlsPeer->isOffChannelConfigured) |
| 17980 | { |
| 17981 | pTdlsPeer->peerParams.channel = 0; |
| 17982 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 17983 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17984 | } |
| 17985 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17986 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17987 | mutex_unlock(&pHddCtx->tdls_lock); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17988 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set force peer")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17989 | return -EINVAL; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17990 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17991 | |
| 17992 | /*EXT TDLS*/ |
| 17993 | |
| 17994 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17995 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17996 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17997 | " %s TDLS set callback Failed", |
| 17998 | __func__); |
| 17999 | return -EINVAL; |
| 18000 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18001 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18002 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18003 | |
| 18004 | return(0); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18005 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18006 | 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] | 18007 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 18008 | const u8 *peer, |
| 18009 | #else |
| 18010 | u8 *peer, |
| 18011 | #endif |
| 18012 | enum nl80211_tdls_operation oper) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18013 | { |
| 18014 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 18015 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18016 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 18017 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 18018 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18019 | ENTER(); |
| 18020 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 18021 | if (!pAdapter) { |
| 18022 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 18023 | return -EINVAL; |
| 18024 | } |
| 18025 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 18026 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18027 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 18028 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18029 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18030 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 18031 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 18032 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18033 | return -EINVAL; |
| 18034 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 18035 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18036 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18037 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 18038 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18039 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 18040 | } |
| 18041 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18042 | |
| 18043 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 18044 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18045 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 18046 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18047 | "TDLS Disabled in INI (%d) OR not enabled in FW (%d) " |
| 18048 | "Cannot process TDLS commands", |
| 18049 | pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 18050 | sme_IsFeatureSupportedByFW(TDLS)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18051 | return -ENOTSUPP; |
| 18052 | } |
| 18053 | |
| 18054 | switch (oper) { |
| 18055 | case NL80211_TDLS_ENABLE_LINK: |
| 18056 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18057 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 18058 | long ret; |
Hanumantha Reddy Pothula | da38949 | 2016-02-11 17:29:27 +0530 | [diff] [blame] | 18059 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams = { {0}, 0, |
| 18060 | 0, 0, 0, 0, 0, 0, {0}, 0, {0} }; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 18061 | WLAN_STADescType staDesc; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18062 | tANI_U16 numCurrTdlsPeers = 0; |
| 18063 | hddTdlsPeer_t *connPeer = NULL; |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 18064 | tANI_U8 suppChannelLen = 0; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18065 | tSirMacAddr peerMac; |
| 18066 | int channel; |
| 18067 | tTDLSLinkStatus peer_status = eTDLS_LINK_IDLE; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18068 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18069 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18070 | " %s : NL80211_TDLS_ENABLE_LINK for " MAC_ADDRESS_STR, |
| 18071 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18072 | |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18073 | mutex_lock(&pHddCtx->tdls_lock); |
| 18074 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 18075 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18076 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18077 | mutex_unlock(&pHddCtx->tdls_lock); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18078 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 18079 | " (oper %d) not exsting. ignored", |
| 18080 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 18081 | return -EINVAL; |
| 18082 | } |
| 18083 | |
| 18084 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18085 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 18086 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 18087 | "NL80211_TDLS_ENABLE_LINK"); |
| 18088 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 18089 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 18090 | { |
| 18091 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 18092 | MAC_ADDRESS_STR " failed", |
| 18093 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18094 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 18095 | return -EINVAL; |
| 18096 | } |
| 18097 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 18098 | /* before starting tdls connection, set tdls |
| 18099 | * off channel established status to default value */ |
| 18100 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18101 | |
| 18102 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18103 | |
Deepthi Gowri | 2d85bbf | 2016-07-25 15:43:31 +0530 | [diff] [blame] | 18104 | wlan_hdd_tdls_set_cap(pAdapter, peer, eTDLS_CAP_SUPPORTED); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18105 | /* TDLS Off Channel, Disable tdls channel switch, |
| 18106 | when there are more than one tdls link */ |
| 18107 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 18108 | if (numCurrTdlsPeers == 2) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18109 | { |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18110 | mutex_lock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18111 | /* get connected peer and send disable tdls off chan */ |
| 18112 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 18113 | if ((connPeer) && |
| 18114 | (connPeer->isOffChannelSupported == TRUE) && |
| 18115 | (connPeer->isOffChannelConfigured == TRUE)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18116 | { |
| 18117 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18118 | "%s: More then one peer connected, Disable " |
| 18119 | "TDLS channel switch", __func__); |
| 18120 | |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 18121 | connPeer->isOffChannelEstablished = FALSE; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18122 | vos_mem_copy(peerMac, connPeer->peerMac, sizeof (tSirMacAddr)); |
| 18123 | channel = connPeer->peerParams.channel; |
| 18124 | |
| 18125 | mutex_unlock(&pHddCtx->tdls_lock); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18126 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18127 | ret = sme_SendTdlsChanSwitchReq( |
| 18128 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18129 | pAdapter->sessionId, |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18130 | peerMac, |
| 18131 | channel, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18132 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 18133 | TDLS_CHANNEL_SWITCH_DISABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18134 | if (ret != VOS_STATUS_SUCCESS) { |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18135 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 18136 | FL("Failed to send TDLS switch channel request")); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18137 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18138 | } |
| 18139 | else |
| 18140 | { |
| 18141 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18142 | "%s: No TDLS Connected Peer or " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 18143 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18144 | "isOffChannelConfigured %d", |
| 18145 | __func__, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 18146 | (connPeer ? (connPeer->isOffChannelSupported) |
| 18147 | : -1), |
| 18148 | (connPeer ? (connPeer->isOffChannelConfigured) |
| 18149 | : -1)); |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18150 | mutex_unlock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18151 | } |
| 18152 | } |
| 18153 | |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18154 | mutex_lock(&pHddCtx->tdls_lock); |
| 18155 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 18156 | if ( NULL == pTdlsPeer ) { |
| 18157 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18158 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18159 | "%s: " MAC_ADDRESS_STR |
| 18160 | " (oper %d) peer got freed in other context. ignored", |
| 18161 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 18162 | return -EINVAL; |
| 18163 | } |
| 18164 | peer_status = pTdlsPeer->link_status; |
| 18165 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18166 | |
| 18167 | if (eTDLS_LINK_CONNECTED != peer_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18168 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 18169 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 18170 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 18171 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 18172 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18173 | 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] | 18174 | return -EINVAL; |
| 18175 | } |
| 18176 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 18177 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18178 | ret = sme_SendTdlsLinkEstablishParams( |
| 18179 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 18180 | pAdapter->sessionId, peer, |
| 18181 | &tdlsLinkEstablishParams); |
| 18182 | if (ret != VOS_STATUS_SUCCESS) { |
| 18183 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send link establishment params")); |
| 18184 | } |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 18185 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 18186 | * register with the TL on after the response for this operation |
| 18187 | * is received . |
| 18188 | */ |
| 18189 | ret = wait_for_completion_interruptible_timeout( |
| 18190 | &pAdapter->tdls_link_establish_req_comp, |
| 18191 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
Masti, Narayanraddi | e1892a5 | 2015-12-15 15:01:01 +0530 | [diff] [blame] | 18192 | |
| 18193 | mutex_lock(&pHddCtx->tdls_lock); |
| 18194 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 18195 | if ( NULL == pTdlsPeer ) { |
| 18196 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18197 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18198 | "%s %d: " MAC_ADDRESS_STR |
| 18199 | " (oper %d) peer got freed in other context. ignored", |
| 18200 | __func__, __LINE__, MAC_ADDR_ARRAY(peer), |
| 18201 | (int)oper); |
| 18202 | return -EINVAL; |
| 18203 | } |
| 18204 | peer_status = pTdlsPeer->link_status; |
| 18205 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18206 | |
| 18207 | if (ret <= 0 || (peer_status == eTDLS_LINK_TEARING)) |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 18208 | { |
| 18209 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18210 | FL("Link Establish Request Failed Status %ld"), |
| 18211 | ret); |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 18212 | return -EINVAL; |
| 18213 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 18214 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 18215 | |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18216 | mutex_lock(&pHddCtx->tdls_lock); |
| 18217 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 18218 | if ( NULL == pTdlsPeer ) { |
| 18219 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18220 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18221 | "%s: " MAC_ADDRESS_STR |
| 18222 | " (oper %d) peer got freed in other context. ignored", |
| 18223 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 18224 | return -EINVAL; |
| 18225 | } |
| 18226 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18227 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 18228 | eTDLS_LINK_CONNECTED, |
| 18229 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 18230 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 18231 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
Masti, Narayanraddi | 3d79902 | 2015-12-24 18:22:36 +0530 | [diff] [blame] | 18232 | |
| 18233 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18234 | "%s: tdlsLinkEstablishParams of peer " |
| 18235 | MAC_ADDRESS_STR "uapsdQueues: %d" |
| 18236 | "qos: %d maxSp: %d isBufSta: %d isOffChannelSupported: %d" |
| 18237 | "isResponder: %d peerstaId: %d", |
| 18238 | __func__, |
| 18239 | MAC_ADDR_ARRAY(tdlsLinkEstablishParams.peerMac), |
| 18240 | tdlsLinkEstablishParams.uapsdQueues, |
| 18241 | tdlsLinkEstablishParams.qos, |
| 18242 | tdlsLinkEstablishParams.maxSp, |
| 18243 | tdlsLinkEstablishParams.isBufSta, |
| 18244 | tdlsLinkEstablishParams.isOffChannelSupported, |
| 18245 | tdlsLinkEstablishParams.isResponder, |
| 18246 | pTdlsPeer->staId); |
| 18247 | |
| 18248 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18249 | "%s: StaDesc ucSTAId: %d ucQosEnabled: %d", |
| 18250 | __func__, |
| 18251 | staDesc.ucSTAId, |
| 18252 | staDesc.ucQosEnabled); |
| 18253 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18254 | ret = WLANTL_UpdateTdlsSTAClient( |
| 18255 | pHddCtx->pvosContext, |
| 18256 | &staDesc); |
| 18257 | if (ret != VOS_STATUS_SUCCESS) { |
| 18258 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to update TDLS STA params")); |
| 18259 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 18260 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 18261 | /* Mark TDLS client Authenticated .*/ |
| 18262 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 18263 | pTdlsPeer->staId, |
| 18264 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 18265 | if (VOS_STATUS_SUCCESS == status) |
| 18266 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 18267 | if (pTdlsPeer->is_responder == 0) |
| 18268 | { |
| 18269 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
Ganesh Kondabattini | cbfdc39 | 2015-09-11 19:12:59 +0530 | [diff] [blame] | 18270 | tdlsConnInfo_t *tdlsInfo; |
| 18271 | |
| 18272 | tdlsInfo = wlan_hdd_get_conn_info(pHddCtx, staId); |
| 18273 | |
Hanumantha Reddy Pothula | c823840 | 2016-03-24 18:02:23 +0530 | [diff] [blame] | 18274 | if (!vos_timer_is_initialized( |
| 18275 | &pTdlsPeer->initiatorWaitTimeoutTimer)) |
| 18276 | { |
| 18277 | /* Initialize initiator wait callback */ |
| 18278 | vos_timer_init( |
Ganesh Kondabattini | cbfdc39 | 2015-09-11 19:12:59 +0530 | [diff] [blame] | 18279 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 18280 | VOS_TIMER_TYPE_SW, |
| 18281 | wlan_hdd_tdls_initiator_wait_cb, |
| 18282 | tdlsInfo); |
Hanumantha Reddy Pothula | c823840 | 2016-03-24 18:02:23 +0530 | [diff] [blame] | 18283 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 18284 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 18285 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 18286 | WAIT_TIME_TDLS_INITIATOR); |
| 18287 | /* suspend initiator TX until it receives direct packet from the |
| 18288 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18289 | ret = WLANTL_SuspendDataTx( |
| 18290 | (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 18291 | &staId, NULL); |
| 18292 | if (ret != VOS_STATUS_SUCCESS) { |
| 18293 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx")); |
| 18294 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 18295 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18296 | |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 18297 | if ((TRUE == pTdlsPeer->isOffChannelSupported) && |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 18298 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 18299 | { |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 18300 | suppChannelLen = |
| 18301 | tdlsLinkEstablishParams.supportedChannelsLen; |
| 18302 | |
| 18303 | if ((suppChannelLen > 0) && |
| 18304 | (suppChannelLen <= SIR_MAC_MAX_SUPP_CHANNELS)) |
| 18305 | { |
| 18306 | tANI_U8 suppPeerChannel = 0; |
| 18307 | int i = 0; |
| 18308 | for (i = 0U; i < suppChannelLen; i++) |
| 18309 | { |
| 18310 | suppPeerChannel = |
| 18311 | tdlsLinkEstablishParams.supportedChannels[i]; |
| 18312 | |
| 18313 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 18314 | if (suppPeerChannel == |
| 18315 | pTdlsPeer->peerParams.channel) |
| 18316 | { |
| 18317 | pTdlsPeer->isOffChannelSupported = TRUE; |
| 18318 | break; |
| 18319 | } |
| 18320 | } |
| 18321 | } |
| 18322 | else |
| 18323 | { |
| 18324 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 18325 | } |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 18326 | } |
| 18327 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18328 | "%s: TDLS channel switch request for channel " |
| 18329 | "%d isOffChannelConfigured %d suppChannelLen " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 18330 | "%d isOffChannelSupported %d", __func__, |
| 18331 | pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 18332 | pTdlsPeer->isOffChannelConfigured, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 18333 | suppChannelLen, |
| 18334 | pTdlsPeer->isOffChannelSupported); |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 18335 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18336 | /* TDLS Off Channel, Enable tdls channel switch, |
| 18337 | when their is only one tdls link and it supports */ |
| 18338 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 18339 | if ((numCurrTdlsPeers == 1) && |
| 18340 | (TRUE == pTdlsPeer->isOffChannelSupported) && |
| 18341 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
| 18342 | { |
| 18343 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18344 | "%s: Send TDLS channel switch request for channel %d", |
| 18345 | __func__, pTdlsPeer->peerParams.channel); |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 18346 | |
| 18347 | pTdlsPeer->isOffChannelEstablished = TRUE; |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18348 | vos_mem_copy(peerMac, pTdlsPeer->peerMac, sizeof (tSirMacAddr)); |
| 18349 | channel = pTdlsPeer->peerParams.channel; |
| 18350 | |
| 18351 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18352 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18353 | ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 18354 | pAdapter->sessionId, |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18355 | peerMac, |
| 18356 | channel, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18357 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 18358 | TDLS_CHANNEL_SWITCH_ENABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18359 | if (ret != VOS_STATUS_SUCCESS) { |
| 18360 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS offchannel: Failed to send TDLS switch channel req")); |
| 18361 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18362 | } |
| 18363 | else |
| 18364 | { |
| 18365 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18366 | "%s: TDLS channel switch request not sent" |
| 18367 | " numCurrTdlsPeers %d " |
| 18368 | "isOffChannelSupported %d " |
| 18369 | "isOffChannelConfigured %d", |
| 18370 | __func__, numCurrTdlsPeers, |
| 18371 | pTdlsPeer->isOffChannelSupported, |
| 18372 | pTdlsPeer->isOffChannelConfigured); |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18373 | mutex_unlock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18374 | } |
| 18375 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 18376 | } |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18377 | else |
| 18378 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18379 | |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18380 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 18381 | |
| 18382 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 18383 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 18384 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 18385 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 18386 | int ac; |
| 18387 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 18388 | WLANTL_AC_VI, |
| 18389 | WLANTL_AC_BK, |
| 18390 | WLANTL_AC_BE }; |
| 18391 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 18392 | for(ac=0; ac < 4; ac++) |
| 18393 | { |
| 18394 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 18395 | pTdlsPeer->staId, ucAc[ac], |
| 18396 | tlTid[ac], tlTid[ac], 0, 0, |
| 18397 | WLANTL_BI_DIR ); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18398 | if (status != VOS_STATUS_SUCCESS) { |
| 18399 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to enable UAPSD for AC")); |
| 18400 | } |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 18401 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 18402 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18403 | } |
Masti, Narayanraddi | 09c52d5 | 2015-12-19 14:19:18 +0530 | [diff] [blame] | 18404 | |
Bhargav Shah | 6689679 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 18405 | /* stop TCP delack timer if TDLS is enable */ |
| 18406 | set_bit(WLAN_TDLS_MODE, &pHddCtx->mode); |
| 18407 | hdd_manage_delack_timer(pHddCtx); |
Abhishek Singh | 67fa6bc | 2016-01-05 15:57:19 +0530 | [diff] [blame] | 18408 | hdd_wlan_tdls_enable_link_event(peer, |
| 18409 | pTdlsPeer->isOffChannelSupported, |
| 18410 | pTdlsPeer->isOffChannelConfigured, |
| 18411 | pTdlsPeer->isOffChannelEstablished); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18412 | } |
| 18413 | break; |
| 18414 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18415 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18416 | tANI_U16 numCurrTdlsPeers = 0; |
| 18417 | hddTdlsPeer_t *connPeer = NULL; |
| 18418 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18419 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18420 | " %s : NL80211_TDLS_DISABLE_LINK for " MAC_ADDRESS_STR, |
| 18421 | __func__, MAC_ADDR_ARRAY(peer)); |
| 18422 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18423 | mutex_lock(&pHddCtx->tdls_lock); |
| 18424 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18425 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18426 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18427 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18428 | mutex_unlock(&pHddCtx->tdls_lock); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18429 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 18430 | " (oper %d) not exsting. ignored", |
| 18431 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 18432 | return -EINVAL; |
| 18433 | } |
| 18434 | |
| 18435 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18436 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 18437 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 18438 | "NL80211_TDLS_DISABLE_LINK"); |
| 18439 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 18440 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18441 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 18442 | long status; |
| 18443 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 18444 | /* set tdls off channel status to false for this peer */ |
| 18445 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 18446 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 18447 | eTDLS_LINK_TEARING, |
| 18448 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 18449 | eTDLS_LINK_UNSPECIFIED: |
| 18450 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18451 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18452 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 18453 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 18454 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18455 | status = sme_DeleteTdlsPeerSta( |
| 18456 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 18457 | pAdapter->sessionId, peer ); |
| 18458 | if (status != VOS_STATUS_SUCCESS) { |
| 18459 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 18460 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 18461 | |
| 18462 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 18463 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18464 | |
| 18465 | mutex_lock(&pHddCtx->tdls_lock); |
| 18466 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 18467 | if ( NULL == pTdlsPeer ) { |
| 18468 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18469 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 18470 | " peer was freed in other context", |
| 18471 | __func__, MAC_ADDR_ARRAY(peer)); |
| 18472 | return -EINVAL; |
| 18473 | } |
| 18474 | |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 18475 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 18476 | eTDLS_LINK_IDLE, |
| 18477 | eTDLS_LINK_UNSPECIFIED); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18478 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18479 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 18480 | if (status <= 0) |
| 18481 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 18482 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18483 | "%s: Del station failed status %ld", |
| 18484 | __func__, status); |
| 18485 | return -EPERM; |
| 18486 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18487 | |
| 18488 | /* TDLS Off Channel, Enable tdls channel switch, |
| 18489 | when their is only one tdls link and it supports */ |
| 18490 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 18491 | if (numCurrTdlsPeers == 1) |
| 18492 | { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18493 | tSirMacAddr peerMac; |
| 18494 | int channel; |
Masti, Narayanraddi | 3818aea | 2015-10-17 15:20:28 +0530 | [diff] [blame] | 18495 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18496 | mutex_lock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18497 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Masti, Narayanraddi | 3818aea | 2015-10-17 15:20:28 +0530 | [diff] [blame] | 18498 | |
| 18499 | if (connPeer == NULL) { |
| 18500 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18501 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 18502 | "%s connPeer is NULL", __func__); |
| 18503 | return -EINVAL; |
| 18504 | } |
| 18505 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18506 | vos_mem_copy(peerMac, connPeer->peerMac, sizeof(tSirMacAddr)); |
| 18507 | channel = connPeer->peerParams.channel; |
| 18508 | |
| 18509 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18510 | "%s: TDLS channel switch " |
| 18511 | "isOffChannelSupported %d " |
| 18512 | "isOffChannelConfigured %d " |
| 18513 | "isOffChannelEstablished %d", |
| 18514 | __func__, |
| 18515 | (connPeer ? connPeer->isOffChannelSupported : -1), |
| 18516 | (connPeer ? connPeer->isOffChannelConfigured : -1), |
| 18517 | (connPeer ? connPeer->isOffChannelEstablished : -1)); |
| 18518 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18519 | if ((connPeer) && |
| 18520 | (connPeer->isOffChannelSupported == TRUE) && |
| 18521 | (connPeer->isOffChannelConfigured == TRUE)) |
| 18522 | { |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 18523 | connPeer->isOffChannelEstablished = TRUE; |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18524 | mutex_unlock(&pHddCtx->tdls_lock); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18525 | status = sme_SendTdlsChanSwitchReq( |
| 18526 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 18527 | pAdapter->sessionId, |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18528 | peerMac, |
| 18529 | channel, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18530 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 18531 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 18532 | if (status != VOS_STATUS_SUCCESS) { |
| 18533 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel req")); |
| 18534 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18535 | } |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18536 | else |
| 18537 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18538 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18539 | else |
| 18540 | { |
| 18541 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18542 | "%s: TDLS channel switch request not sent " |
| 18543 | "numCurrTdlsPeers %d ", |
| 18544 | __func__, numCurrTdlsPeers); |
| 18545 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18546 | } |
| 18547 | else |
| 18548 | { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18549 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18550 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18551 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18552 | } |
Bhargav Shah | 6689679 | 2015-10-01 18:17:37 +0530 | [diff] [blame] | 18553 | if (numCurrTdlsPeers == 0) { |
| 18554 | /* start TCP delack timer if TDLS is disable */ |
| 18555 | clear_bit(WLAN_TDLS_MODE, &pHddCtx->mode); |
| 18556 | hdd_manage_delack_timer(pHddCtx); |
| 18557 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18558 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18559 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18560 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18561 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18562 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18563 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18564 | if (0 != status) |
| 18565 | { |
| 18566 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18567 | FL("Error in TDLS Teardown")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18568 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18569 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18570 | break; |
| 18571 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18572 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18573 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18574 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 18575 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18576 | NULL, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18577 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18578 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18579 | if (0 != status) |
| 18580 | { |
| 18581 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18582 | FL("Error in TDLS Setup")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18583 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 18584 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 18585 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18586 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18587 | case NL80211_TDLS_DISCOVERY_REQ: |
| 18588 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 18589 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18590 | "%s: Driver doesn't support in-driver setup/teardown/discovery " |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 18591 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18592 | return -ENOTSUPP; |
| 18593 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 18594 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18595 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18596 | return -ENOTSUPP; |
| 18597 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18598 | |
| 18599 | EXIT(); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18600 | return 0; |
| 18601 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 18602 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18603 | 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] | 18604 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 18605 | const u8 *peer, |
| 18606 | #else |
| 18607 | u8 *peer, |
| 18608 | #endif |
| 18609 | enum nl80211_tdls_operation oper) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18610 | { |
| 18611 | int ret; |
| 18612 | |
| 18613 | vos_ssr_protect(__func__); |
| 18614 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 18615 | vos_ssr_unprotect(__func__); |
| 18616 | |
| 18617 | return ret; |
| 18618 | } |
| 18619 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 18620 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 18621 | struct net_device *dev, u8 *peer) |
| 18622 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 18623 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 18624 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 18625 | MAC_ADDR_ARRAY(peer)); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 18626 | #if TDLS_MGMT_VERSION2 |
| 18627 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 18628 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 18629 | #else |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18630 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) |
| 18631 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 18632 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, 0, NULL, 0); |
| 18633 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 18634 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 18635 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 18636 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 18637 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 18638 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 18639 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 18640 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 18641 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 18642 | #endif |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18643 | #endif /* KERNEL_VERSION */ |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 18644 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18645 | #endif |
| 18646 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18647 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 18648 | /* |
| 18649 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 18650 | * Callback rountine called upon receiving response for |
| 18651 | * get offload info |
| 18652 | */ |
| 18653 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 18654 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 18655 | { |
| 18656 | |
| 18657 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18658 | tANI_U8 tempReplayCounter[8]; |
| 18659 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18660 | |
| 18661 | ENTER(); |
| 18662 | |
| 18663 | if (NULL == pAdapter) |
| 18664 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 18665 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18666 | "%s: HDD adapter is Null", __func__); |
| 18667 | return ; |
| 18668 | } |
| 18669 | |
| 18670 | if (NULL == pGtkOffloadGetInfoRsp) |
| 18671 | { |
| 18672 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18673 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 18674 | return ; |
| 18675 | } |
| 18676 | |
| 18677 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 18678 | { |
| 18679 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18680 | "%s: wlan Failed to get replay counter value", |
| 18681 | __func__); |
| 18682 | return ; |
| 18683 | } |
| 18684 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18685 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 18686 | /* Update replay counter */ |
| 18687 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 18688 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 18689 | |
| 18690 | { |
| 18691 | /* changing from little to big endian since supplicant |
| 18692 | * works on big endian format |
| 18693 | */ |
| 18694 | int i; |
| 18695 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 18696 | |
| 18697 | for (i = 0; i < 8; i++) |
| 18698 | { |
| 18699 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 18700 | } |
| 18701 | } |
| 18702 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18703 | /* Update replay counter to NL */ |
| 18704 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18705 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18706 | } |
| 18707 | |
| 18708 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18709 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18710 | * This function is used to offload GTK rekeying job to the firmware. |
| 18711 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18712 | 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] | 18713 | struct cfg80211_gtk_rekey_data *data) |
| 18714 | { |
| 18715 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 18716 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 18717 | hdd_station_ctx_t *pHddStaCtx; |
| 18718 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18719 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18720 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18721 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 18722 | |
| 18723 | ENTER(); |
| 18724 | |
| 18725 | if (NULL == pAdapter) |
| 18726 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 18727 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18728 | "%s: HDD adapter is Null", __func__); |
| 18729 | return -ENODEV; |
| 18730 | } |
| 18731 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 18732 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18733 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 18734 | pAdapter->sessionId, pAdapter->device_mode)); |
| 18735 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18736 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18737 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18738 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18739 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18740 | } |
| 18741 | |
| 18742 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 18743 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 18744 | if (NULL == hHal) |
| 18745 | { |
| 18746 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18747 | "%s: HAL context is Null!!!", __func__); |
| 18748 | return -EAGAIN; |
| 18749 | } |
| 18750 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18751 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 18752 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 18753 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 18754 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18755 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18756 | { |
| 18757 | /* changing from big to little endian since driver |
| 18758 | * works on little endian format |
| 18759 | */ |
| 18760 | tANI_U8 *p = |
| 18761 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 18762 | int i; |
| 18763 | |
| 18764 | for (i = 0; i < 8; i++) |
| 18765 | { |
| 18766 | p[7-i] = data->replay_ctr[i]; |
| 18767 | } |
| 18768 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18769 | |
| 18770 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 18771 | { |
| 18772 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18773 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 18774 | sizeof (tSirGtkOffloadParams)); |
| 18775 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18776 | pAdapter->sessionId); |
| 18777 | |
| 18778 | if (eHAL_STATUS_SUCCESS != status) |
| 18779 | { |
| 18780 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18781 | "%s: sme_SetGTKOffload failed, returned %d", |
| 18782 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 18783 | |
| 18784 | /* Need to clear any trace of key value in the memory. |
| 18785 | * Thus zero out the memory even though it is local |
| 18786 | * variable. |
| 18787 | */ |
| 18788 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 18789 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18790 | return status; |
| 18791 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18792 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18793 | "%s: sme_SetGTKOffload successfull", __func__); |
| 18794 | } |
| 18795 | else |
| 18796 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18797 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18798 | "%s: wlan not suspended GTKOffload request is stored", |
| 18799 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18800 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18801 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 18802 | /* Need to clear any trace of key value in the memory. |
| 18803 | * Thus zero out the memory even though it is local |
| 18804 | * variable. |
| 18805 | */ |
| 18806 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 18807 | sizeof(hddGtkOffloadReqParams)); |
| 18808 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18809 | EXIT(); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18810 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18811 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18812 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18813 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 18814 | struct cfg80211_gtk_rekey_data *data) |
| 18815 | { |
| 18816 | int ret; |
| 18817 | |
| 18818 | vos_ssr_protect(__func__); |
| 18819 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 18820 | vos_ssr_unprotect(__func__); |
| 18821 | |
| 18822 | return ret; |
| 18823 | } |
| 18824 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18825 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18826 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18827 | * This function is used to set access control policy |
| 18828 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18829 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 18830 | struct net_device *dev, |
| 18831 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18832 | { |
| 18833 | int i; |
| 18834 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 18835 | hdd_hostapd_state_t *pHostapdState; |
| 18836 | tsap_Config_t *pConfig; |
| 18837 | v_CONTEXT_t pVosContext = NULL; |
| 18838 | hdd_context_t *pHddCtx; |
| 18839 | int status; |
| 18840 | |
| 18841 | ENTER(); |
| 18842 | |
| 18843 | if (NULL == pAdapter) |
| 18844 | { |
| 18845 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 18846 | "%s: HDD adapter is Null", __func__); |
| 18847 | return -ENODEV; |
| 18848 | } |
| 18849 | |
| 18850 | if (NULL == params) |
| 18851 | { |
| 18852 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 18853 | "%s: params is Null", __func__); |
| 18854 | return -EINVAL; |
| 18855 | } |
| 18856 | |
| 18857 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 18858 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18859 | if (0 != status) |
| 18860 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18861 | return status; |
| 18862 | } |
| 18863 | |
| 18864 | pVosContext = pHddCtx->pvosContext; |
| 18865 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 18866 | |
| 18867 | if (NULL == pHostapdState) |
| 18868 | { |
| 18869 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 18870 | "%s: pHostapdState is Null", __func__); |
| 18871 | return -EINVAL; |
| 18872 | } |
| 18873 | |
| 18874 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 18875 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 18876 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18877 | TRACE_CODE_HDD_CFG80211_SET_MAC_ACL, |
| 18878 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18879 | |
| 18880 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 18881 | { |
| 18882 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 18883 | |
| 18884 | /* default value */ |
| 18885 | pConfig->num_accept_mac = 0; |
| 18886 | pConfig->num_deny_mac = 0; |
| 18887 | |
| 18888 | /** |
| 18889 | * access control policy |
| 18890 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 18891 | * listed in hostapd.deny file. |
| 18892 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 18893 | * listed in hostapd.accept file. |
| 18894 | */ |
| 18895 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 18896 | { |
| 18897 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 18898 | } |
| 18899 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 18900 | { |
| 18901 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 18902 | } |
| 18903 | else |
| 18904 | { |
| 18905 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18906 | "%s:Acl Policy : %d is not supported", |
| 18907 | __func__, params->acl_policy); |
| 18908 | return -ENOTSUPP; |
| 18909 | } |
| 18910 | |
| 18911 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 18912 | { |
| 18913 | pConfig->num_accept_mac = params->n_acl_entries; |
| 18914 | for (i = 0; i < params->n_acl_entries; i++) |
| 18915 | { |
| 18916 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18917 | "** Add ACL MAC entry %i in WhiletList :" |
| 18918 | MAC_ADDRESS_STR, i, |
| 18919 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 18920 | |
| 18921 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 18922 | sizeof(qcmacaddr)); |
| 18923 | } |
| 18924 | } |
| 18925 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 18926 | { |
| 18927 | pConfig->num_deny_mac = params->n_acl_entries; |
| 18928 | for (i = 0; i < params->n_acl_entries; i++) |
| 18929 | { |
| 18930 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18931 | "** Add ACL MAC entry %i in BlackList :" |
| 18932 | MAC_ADDRESS_STR, i, |
| 18933 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 18934 | |
| 18935 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 18936 | sizeof(qcmacaddr)); |
| 18937 | } |
| 18938 | } |
| 18939 | |
| 18940 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 18941 | { |
| 18942 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18943 | "%s: SAP Set Mac Acl fail", __func__); |
| 18944 | return -EINVAL; |
| 18945 | } |
| 18946 | } |
| 18947 | else |
| 18948 | { |
| 18949 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 18950 | "%s: Invalid device_mode = %s (%d)", |
| 18951 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 18952 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18953 | return -EINVAL; |
| 18954 | } |
| 18955 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18956 | EXIT(); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18957 | return 0; |
| 18958 | } |
| 18959 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18960 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 18961 | struct net_device *dev, |
| 18962 | const struct cfg80211_acl_data *params) |
| 18963 | { |
| 18964 | int ret; |
| 18965 | vos_ssr_protect(__func__); |
| 18966 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 18967 | vos_ssr_unprotect(__func__); |
| 18968 | |
| 18969 | return ret; |
| 18970 | } |
| 18971 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18972 | #ifdef WLAN_NL80211_TESTMODE |
| 18973 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18974 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18975 | ( |
| 18976 | void *pAdapter, |
| 18977 | void *indCont |
| 18978 | ) |
| 18979 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18980 | tSirLPHBInd *lphbInd; |
| 18981 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 18982 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18983 | |
| 18984 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18985 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18986 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 18987 | if (pAdapter == NULL) |
| 18988 | { |
| 18989 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18990 | "%s: pAdapter is NULL\n",__func__); |
| 18991 | return; |
| 18992 | } |
| 18993 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18994 | if (NULL == indCont) |
| 18995 | { |
| 18996 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18997 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18998 | return; |
| 18999 | } |
| 19000 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 19001 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19002 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19003 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 19004 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19005 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19006 | GFP_ATOMIC); |
| 19007 | if (!skb) |
| 19008 | { |
| 19009 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19010 | "LPHB timeout, NL buffer alloc fail"); |
| 19011 | return; |
| 19012 | } |
| 19013 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 19014 | 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] | 19015 | { |
| 19016 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19017 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 19018 | goto nla_put_failure; |
| 19019 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 19020 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19021 | { |
| 19022 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19023 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 19024 | goto nla_put_failure; |
| 19025 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 19026 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19027 | sizeof(tSirLPHBInd), lphbInd)) |
| 19028 | { |
| 19029 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19030 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 19031 | goto nla_put_failure; |
| 19032 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19033 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 19034 | return; |
| 19035 | |
| 19036 | nla_put_failure: |
| 19037 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19038 | "NLA Put fail"); |
| 19039 | kfree_skb(skb); |
| 19040 | |
| 19041 | return; |
| 19042 | } |
| 19043 | #endif /* FEATURE_WLAN_LPHB */ |
| 19044 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19045 | 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] | 19046 | { |
| 19047 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 19048 | int err = 0; |
| 19049 | #ifdef FEATURE_WLAN_LPHB |
| 19050 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19051 | eHalStatus smeStatus; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19052 | |
| 19053 | ENTER(); |
| 19054 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 19055 | err = wlan_hdd_validate_context(pHddCtx); |
| 19056 | if (0 != err) |
| 19057 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 19058 | return err; |
| 19059 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19060 | #endif /* FEATURE_WLAN_LPHB */ |
| 19061 | |
| 19062 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 19063 | if (err) |
| 19064 | { |
| 19065 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19066 | "%s Testmode INV ATTR", __func__); |
| 19067 | return err; |
| 19068 | } |
| 19069 | |
| 19070 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 19071 | { |
| 19072 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19073 | "%s Testmode INV CMD", __func__); |
| 19074 | return -EINVAL; |
| 19075 | } |
| 19076 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 19077 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19078 | TRACE_CODE_HDD_CFG80211_TESTMODE, |
| 19079 | NO_SESSION, nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD]))); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19080 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 19081 | { |
| 19082 | #ifdef FEATURE_WLAN_LPHB |
| 19083 | /* Low Power Heartbeat configuration request */ |
| 19084 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 19085 | { |
| 19086 | int buf_len; |
| 19087 | void *buf; |
| 19088 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 19089 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19090 | |
| 19091 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 19092 | { |
| 19093 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19094 | "%s Testmode INV DATA", __func__); |
| 19095 | return -EINVAL; |
| 19096 | } |
| 19097 | |
| 19098 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 19099 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 19100 | |
| 19101 | hb_params_temp =(tSirLPHBReq *)buf; |
| 19102 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 19103 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 19104 | return -EINVAL; |
| 19105 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19106 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 19107 | if (NULL == hb_params) |
| 19108 | { |
| 19109 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19110 | "%s Request Buffer Alloc Fail", __func__); |
| 19111 | return -EINVAL; |
| 19112 | } |
| 19113 | |
| 19114 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19115 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 19116 | hb_params, |
| 19117 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 19118 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19119 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 19120 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19121 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19122 | vos_mem_free(hb_params); |
| 19123 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19124 | return 0; |
| 19125 | } |
| 19126 | #endif /* FEATURE_WLAN_LPHB */ |
| 19127 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 19128 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 19129 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19130 | return -EOPNOTSUPP; |
| 19131 | } |
| 19132 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19133 | EXIT(); |
| 19134 | return err; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19135 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19136 | |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 19137 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, |
| 19138 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) |
| 19139 | struct wireless_dev *wdev, |
| 19140 | #endif |
| 19141 | void *data, int len) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19142 | { |
| 19143 | int ret; |
| 19144 | |
| 19145 | vos_ssr_protect(__func__); |
| 19146 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 19147 | vos_ssr_unprotect(__func__); |
| 19148 | |
| 19149 | return ret; |
| 19150 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19151 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 19152 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19153 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19154 | struct net_device *dev, |
| 19155 | int idx, struct survey_info *survey) |
| 19156 | { |
| 19157 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 19158 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 19159 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19160 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 19161 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19162 | v_S7_t snr,rssi; |
| 19163 | int status, i, j, filled = 0; |
| 19164 | |
| 19165 | ENTER(); |
| 19166 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19167 | if (NULL == pAdapter) |
| 19168 | { |
| 19169 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 19170 | "%s: HDD adapter is Null", __func__); |
| 19171 | return -ENODEV; |
| 19172 | } |
| 19173 | |
| 19174 | if (NULL == wiphy) |
| 19175 | { |
| 19176 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 19177 | "%s: wiphy is Null", __func__); |
| 19178 | return -ENODEV; |
| 19179 | } |
| 19180 | |
| 19181 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 19182 | status = wlan_hdd_validate_context(pHddCtx); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19183 | if (0 != status) |
| 19184 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19185 | return status; |
| 19186 | } |
| 19187 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 19188 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 19189 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19190 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 19191 | 0 != pAdapter->survey_idx || |
| 19192 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19193 | { |
| 19194 | /* The survey dump ops when implemented completely is expected to |
| 19195 | * return a survey of all channels and the ops is called by the |
| 19196 | * kernel with incremental values of the argument 'idx' till it |
| 19197 | * returns -ENONET. But we can only support the survey for the |
| 19198 | * operating channel for now. survey_idx is used to track |
| 19199 | * that the ops is called only once and then return -ENONET for |
| 19200 | * the next iteration |
| 19201 | */ |
| 19202 | pAdapter->survey_idx = 0; |
| 19203 | return -ENONET; |
| 19204 | } |
| 19205 | |
Mukul Sharma | 9d5233b | 2015-06-11 20:28:20 +0530 | [diff] [blame] | 19206 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 19207 | { |
| 19208 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19209 | "%s: Roaming in progress, hence return ", __func__); |
| 19210 | return -ENONET; |
| 19211 | } |
| 19212 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19213 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 19214 | |
| 19215 | wlan_hdd_get_snr(pAdapter, &snr); |
| 19216 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 19217 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 19218 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19219 | TRACE_CODE_HDD_CFG80211_DUMP_SURVEY, |
| 19220 | pAdapter->sessionId, pAdapter->device_mode)); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19221 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 19222 | hdd_wlan_get_freq(channel, &freq); |
| 19223 | |
| 19224 | |
| 19225 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 19226 | { |
| 19227 | if (NULL == wiphy->bands[i]) |
| 19228 | { |
| 19229 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 19230 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 19231 | continue; |
| 19232 | } |
| 19233 | |
| 19234 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 19235 | { |
| 19236 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 19237 | |
| 19238 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 19239 | { |
| 19240 | survey->channel = &band->channels[j]; |
| 19241 | /* The Rx BDs contain SNR values in dB for the received frames |
| 19242 | * while the supplicant expects noise. So we calculate and |
| 19243 | * return the value of noise (dBm) |
| 19244 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 19245 | */ |
| 19246 | survey->noise = rssi - snr; |
| 19247 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 19248 | filled = 1; |
| 19249 | } |
| 19250 | } |
| 19251 | } |
| 19252 | |
| 19253 | if (filled) |
| 19254 | pAdapter->survey_idx = 1; |
| 19255 | else |
| 19256 | { |
| 19257 | pAdapter->survey_idx = 0; |
| 19258 | return -ENONET; |
| 19259 | } |
| 19260 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19261 | EXIT(); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19262 | return 0; |
| 19263 | } |
| 19264 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 19265 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 19266 | struct net_device *dev, |
| 19267 | int idx, struct survey_info *survey) |
| 19268 | { |
| 19269 | int ret; |
| 19270 | |
| 19271 | vos_ssr_protect(__func__); |
| 19272 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 19273 | vos_ssr_unprotect(__func__); |
| 19274 | |
| 19275 | return ret; |
| 19276 | } |
| 19277 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19278 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 19279 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19280 | * this is called when cfg80211 driver resume |
| 19281 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 19282 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 19283 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19284 | { |
| 19285 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 19286 | hdd_adapter_t *pAdapter; |
| 19287 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 19288 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 19289 | |
| 19290 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19291 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 19292 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19293 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19294 | return 0; |
| 19295 | } |
| 19296 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 19297 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_RESUME_WLAN, |
| 19298 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19299 | spin_lock(&pHddCtx->schedScan_lock); |
| 19300 | pHddCtx->isWiphySuspended = FALSE; |
| 19301 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 19302 | { |
| 19303 | spin_unlock(&pHddCtx->schedScan_lock); |
| 19304 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19305 | "%s: Return resume is not due to PNO indication", __func__); |
| 19306 | return 0; |
| 19307 | } |
| 19308 | // Reset flag to avoid updatating cfg80211 data old results again |
| 19309 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 19310 | spin_unlock(&pHddCtx->schedScan_lock); |
| 19311 | |
| 19312 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 19313 | |
| 19314 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 19315 | { |
| 19316 | pAdapter = pAdapterNode->pAdapter; |
| 19317 | if ( (NULL != pAdapter) && |
| 19318 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 19319 | { |
| 19320 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 19321 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19322 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 19323 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 19324 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19325 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 19326 | { |
| 19327 | /* Acquire wakelock to handle the case where APP's tries to |
| 19328 | * suspend immediately after updating the scan results. Whis |
| 19329 | * results in app's is in suspended state and not able to |
| 19330 | * process the connect request to AP |
| 19331 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 19332 | hdd_prevent_suspend_timeout(2000, |
| 19333 | WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19334 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 19335 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19336 | |
| 19337 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19338 | "%s : cfg80211 scan result database updated", __func__); |
| 19339 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19340 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19341 | return 0; |
| 19342 | |
| 19343 | } |
| 19344 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 19345 | pAdapterNode = pNext; |
| 19346 | } |
| 19347 | |
| 19348 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 19349 | "%s: Failed to find Adapter", __func__); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19350 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19351 | return 0; |
| 19352 | } |
| 19353 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 19354 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 19355 | { |
| 19356 | int ret; |
| 19357 | |
| 19358 | vos_ssr_protect(__func__); |
| 19359 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 19360 | vos_ssr_unprotect(__func__); |
| 19361 | |
| 19362 | return ret; |
| 19363 | } |
| 19364 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19365 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 19366 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19367 | * this is called when cfg80211 driver suspends |
| 19368 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 19369 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19370 | struct cfg80211_wowlan *wow) |
| 19371 | { |
| 19372 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 19373 | int ret = 0; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19374 | |
| 19375 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 19376 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 19377 | ret = wlan_hdd_validate_context(pHddCtx); |
| 19378 | if (0 != ret) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19379 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 19380 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19381 | } |
| 19382 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 19383 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 19384 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 19385 | TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN, |
| 19386 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19387 | pHddCtx->isWiphySuspended = TRUE; |
| 19388 | |
| 19389 | EXIT(); |
| 19390 | |
| 19391 | return 0; |
| 19392 | } |
| 19393 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 19394 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 19395 | struct cfg80211_wowlan *wow) |
| 19396 | { |
| 19397 | int ret; |
| 19398 | |
| 19399 | vos_ssr_protect(__func__); |
| 19400 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 19401 | vos_ssr_unprotect(__func__); |
| 19402 | |
| 19403 | return ret; |
| 19404 | } |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 19405 | |
| 19406 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 19407 | 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] | 19408 | void *pMsg, tANI_U32 evLen) |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 19409 | { |
| 19410 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 19411 | |
| 19412 | ENTER(); |
| 19413 | |
| 19414 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 19415 | return; |
| 19416 | } |
| 19417 | if (!pMsg) |
| 19418 | { |
| 19419 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 19420 | return; |
| 19421 | } |
| 19422 | |
Padma, Santhosh Kumar | f75c37b | 2016-01-25 10:36:08 +0530 | [diff] [blame] | 19423 | send_oem_data_rsp_msg(evLen, pMsg); |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 19424 | |
| 19425 | EXIT(); |
| 19426 | return; |
| 19427 | |
| 19428 | } |
| 19429 | |
| 19430 | 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] | 19431 | void *pMsg, tANI_U32 evLen) |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 19432 | { |
| 19433 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 19434 | |
| 19435 | ENTER(); |
| 19436 | |
| 19437 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 19438 | return; |
| 19439 | } |
| 19440 | |
Padma, Santhosh Kumar | f75c37b | 2016-01-25 10:36:08 +0530 | [diff] [blame] | 19441 | 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] | 19442 | |
| 19443 | switch(evType) { |
| 19444 | case SIR_HAL_START_OEM_DATA_RSP_IND_NEW: |
Padma, Santhosh Kumar | f75c37b | 2016-01-25 10:36:08 +0530 | [diff] [blame] | 19445 | wlan_hdd_cfg80211_oem_data_rsp_ind_new(ctx, pMsg, evLen); |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 19446 | break; |
| 19447 | default: |
| 19448 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 19449 | break; |
| 19450 | } |
| 19451 | EXIT(); |
| 19452 | } |
| 19453 | #endif |
| 19454 | |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 19455 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) || \ |
| 19456 | defined(CFG80211_ABORT_SCAN) |
Kanchanapally, Vidyullatha | c473516 | 2016-02-09 17:49:39 +0530 | [diff] [blame] | 19457 | /** |
| 19458 | * __wlan_hdd_cfg80211_abort_scan() - cfg80211 abort scan api |
| 19459 | * @wiphy: Pointer to wiphy |
| 19460 | * @wdev: Pointer to wireless device structure |
| 19461 | * |
| 19462 | * This function is used to abort an ongoing scan |
| 19463 | * |
| 19464 | * Return: None |
| 19465 | */ |
| 19466 | static void __wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy, |
| 19467 | struct wireless_dev *wdev) |
| 19468 | { |
| 19469 | struct net_device *dev = wdev->netdev; |
| 19470 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 19471 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 19472 | int ret; |
| 19473 | |
| 19474 | ENTER(); |
| 19475 | |
| 19476 | if (NULL == adapter) { |
| 19477 | hddLog(VOS_TRACE_LEVEL_FATAL, FL("HDD adapter is NULL")); |
| 19478 | return; |
| 19479 | } |
| 19480 | |
| 19481 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 19482 | if (0 != ret) |
| 19483 | return; |
| 19484 | |
| 19485 | wlan_hdd_scan_abort(adapter); |
| 19486 | |
| 19487 | return; |
| 19488 | } |
| 19489 | |
| 19490 | /** |
| 19491 | * wlan_hdd_cfg80211_abort_scan - cfg80211 abort scan api |
| 19492 | * @wiphy: Pointer to wiphy |
| 19493 | * @wdev: Pointer to wireless device structure |
| 19494 | * |
| 19495 | * Return: None |
| 19496 | */ |
| 19497 | void wlan_hdd_cfg80211_abort_scan(struct wiphy *wiphy, |
| 19498 | struct wireless_dev *wdev) |
| 19499 | { |
| 19500 | vos_ssr_protect(__func__); |
| 19501 | __wlan_hdd_cfg80211_abort_scan(wiphy, wdev); |
| 19502 | vos_ssr_unprotect(__func__); |
| 19503 | |
| 19504 | return; |
| 19505 | } |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 19506 | #endif |
Kanchanapally, Vidyullatha | c473516 | 2016-02-09 17:49:39 +0530 | [diff] [blame] | 19507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19508 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 19509 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19510 | { |
| 19511 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 19512 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 19513 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 19514 | .change_station = wlan_hdd_change_station, |
| 19515 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 19516 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 19517 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 19518 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19519 | #else |
| 19520 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 19521 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 19522 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19523 | #endif |
| 19524 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 19525 | .add_key = wlan_hdd_cfg80211_add_key, |
| 19526 | .get_key = wlan_hdd_cfg80211_get_key, |
| 19527 | .del_key = wlan_hdd_cfg80211_del_key, |
| 19528 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 19529 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19530 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 19531 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19532 | .scan = wlan_hdd_cfg80211_scan, |
| 19533 | .connect = wlan_hdd_cfg80211_connect, |
| 19534 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 19535 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 19536 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 19537 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 19538 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 19539 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19540 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 19541 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 19542 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19543 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 19544 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 19545 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 19546 | .set_txq_params = wlan_hdd_set_txq_params, |
| 19547 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19548 | .get_station = wlan_hdd_cfg80211_get_station, |
| 19549 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 19550 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19551 | .add_station = wlan_hdd_cfg80211_add_station, |
| 19552 | #ifdef FEATURE_WLAN_LFR |
| 19553 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 19554 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 19555 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 19556 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19557 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 19558 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 19559 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19560 | #ifdef FEATURE_WLAN_TDLS |
| 19561 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 19562 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 19563 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19564 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 19565 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 19566 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19567 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 19568 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 19569 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 19570 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19571 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 19572 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 19573 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19574 | #ifdef WLAN_NL80211_TESTMODE |
| 19575 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 19576 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19577 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 19578 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0)) || \ |
| 19579 | defined(CFG80211_ABORT_SCAN) |
Kanchanapally, Vidyullatha | c473516 | 2016-02-09 17:49:39 +0530 | [diff] [blame] | 19580 | .abort_scan = wlan_hdd_cfg80211_abort_scan, |
Kanchanapally, Vidyullatha | 740d64e | 2016-05-03 15:25:54 +0530 | [diff] [blame] | 19581 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19582 | }; |
| 19583 | |