Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 26 | * |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 27 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 28 | |
| 29 | |
Kiet Lam | a7f454d | 2014-07-24 12:04:06 -0700 | [diff] [blame] | 30 | |
| 31 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 32 | /**======================================================================== |
| 33 | |
| 34 | \file wlan_hdd_cfg80211.c |
| 35 | |
| 36 | \brief WLAN Host Device Driver implementation |
| 37 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 38 | ========================================================================*/ |
| 39 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 40 | /**========================================================================= |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 41 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 42 | EDIT HISTORY FOR FILE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 43 | |
| 44 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 45 | This section contains comments describing changes made to the module. |
| 46 | Notice that changes are listed in reverse chronological order. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 47 | |
| 48 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 49 | $Header:$ $DateTime: $ $Author: $ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 50 | |
| 51 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 52 | when who what, where, why |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 53 | -------- --- -------------------------------------------------------- |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 54 | 21/12/09 Ashwani Created module. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | |
| 56 | 07/06/10 Kumar Deepak Implemented cfg80211 callbacks for ANDROID |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 57 | Ganesh K |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 58 | ==========================================================================*/ |
| 59 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 60 | |
| 61 | #include <linux/version.h> |
| 62 | #include <linux/module.h> |
| 63 | #include <linux/kernel.h> |
| 64 | #include <linux/init.h> |
| 65 | #include <linux/wireless.h> |
| 66 | #include <wlan_hdd_includes.h> |
| 67 | #include <net/arp.h> |
| 68 | #include <net/cfg80211.h> |
| 69 | #include <linux/wireless.h> |
| 70 | #include <wlan_hdd_wowl.h> |
| 71 | #include <aniGlobal.h> |
| 72 | #include "ccmApi.h" |
| 73 | #include "sirParams.h" |
| 74 | #include "dot11f.h" |
| 75 | #include "wlan_hdd_assoc.h" |
| 76 | #include "wlan_hdd_wext.h" |
| 77 | #include "sme_Api.h" |
| 78 | #include "wlan_hdd_p2p.h" |
| 79 | #include "wlan_hdd_cfg80211.h" |
| 80 | #include "wlan_hdd_hostapd.h" |
| 81 | #include "sapInternal.h" |
| 82 | #include "wlan_hdd_softap_tx_rx.h" |
| 83 | #include "wlan_hdd_main.h" |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 84 | #include "wlan_hdd_assoc.h" |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 85 | #include "wlan_hdd_power.h" |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 86 | #include "wlan_hdd_trace.h" |
| 87 | #include "vos_types.h" |
| 88 | #include "vos_trace.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 89 | #ifdef WLAN_BTAMP_FEATURE |
| 90 | #include "bap_hdd_misc.h" |
| 91 | #endif |
| 92 | #include <qc_sap_ioctl.h> |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 93 | #include "wlan_hdd_tdls.h" |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 94 | #include "wlan_hdd_wmm.h" |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 95 | #include "wlan_qct_wda.h" |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 96 | #include "wlan_nv.h" |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 97 | #include "wlan_hdd_dev_pwr.h" |
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 |
| 183 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 184 | static const u32 hdd_cipher_suites[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 185 | { |
| 186 | WLAN_CIPHER_SUITE_WEP40, |
| 187 | WLAN_CIPHER_SUITE_WEP104, |
| 188 | WLAN_CIPHER_SUITE_TKIP, |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 189 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 190 | #define WLAN_CIPHER_SUITE_KRK 0x004096ff /* use for KRK */ |
| 191 | WLAN_CIPHER_SUITE_KRK, |
| 192 | WLAN_CIPHER_SUITE_CCMP, |
| 193 | #else |
| 194 | WLAN_CIPHER_SUITE_CCMP, |
| 195 | #endif |
| 196 | #ifdef FEATURE_WLAN_WAPI |
| 197 | WLAN_CIPHER_SUITE_SMS4, |
| 198 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 199 | #ifdef WLAN_FEATURE_11W |
| 200 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 201 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 202 | }; |
| 203 | |
| 204 | static inline int is_broadcast_ether_addr(const u8 *addr) |
| 205 | { |
| 206 | return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && |
| 207 | (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff)); |
| 208 | } |
| 209 | |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 210 | const static struct ieee80211_channel hdd_channels_2_4_GHZ[] = |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 211 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 212 | HDD2GHZCHAN(2412, 1, 0) , |
| 213 | HDD2GHZCHAN(2417, 2, 0) , |
| 214 | HDD2GHZCHAN(2422, 3, 0) , |
| 215 | HDD2GHZCHAN(2427, 4, 0) , |
| 216 | HDD2GHZCHAN(2432, 5, 0) , |
| 217 | HDD2GHZCHAN(2437, 6, 0) , |
| 218 | HDD2GHZCHAN(2442, 7, 0) , |
| 219 | HDD2GHZCHAN(2447, 8, 0) , |
| 220 | HDD2GHZCHAN(2452, 9, 0) , |
| 221 | HDD2GHZCHAN(2457, 10, 0) , |
| 222 | HDD2GHZCHAN(2462, 11, 0) , |
| 223 | HDD2GHZCHAN(2467, 12, 0) , |
| 224 | HDD2GHZCHAN(2472, 13, 0) , |
| 225 | HDD2GHZCHAN(2484, 14, 0) , |
| 226 | }; |
| 227 | |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 228 | const static struct ieee80211_channel hdd_channels_5_GHZ[] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 229 | { |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 230 | HDD5GHZCHAN(4920, 240, 0) , |
| 231 | HDD5GHZCHAN(4940, 244, 0) , |
| 232 | HDD5GHZCHAN(4960, 248, 0) , |
| 233 | HDD5GHZCHAN(4980, 252, 0) , |
| 234 | HDD5GHZCHAN(5040, 208, 0) , |
| 235 | HDD5GHZCHAN(5060, 212, 0) , |
| 236 | HDD5GHZCHAN(5080, 216, 0) , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 237 | HDD5GHZCHAN(5180, 36, 0) , |
| 238 | HDD5GHZCHAN(5200, 40, 0) , |
| 239 | HDD5GHZCHAN(5220, 44, 0) , |
| 240 | HDD5GHZCHAN(5240, 48, 0) , |
| 241 | HDD5GHZCHAN(5260, 52, 0) , |
| 242 | HDD5GHZCHAN(5280, 56, 0) , |
| 243 | HDD5GHZCHAN(5300, 60, 0) , |
| 244 | HDD5GHZCHAN(5320, 64, 0) , |
| 245 | HDD5GHZCHAN(5500,100, 0) , |
| 246 | HDD5GHZCHAN(5520,104, 0) , |
| 247 | HDD5GHZCHAN(5540,108, 0) , |
| 248 | HDD5GHZCHAN(5560,112, 0) , |
| 249 | HDD5GHZCHAN(5580,116, 0) , |
| 250 | HDD5GHZCHAN(5600,120, 0) , |
| 251 | HDD5GHZCHAN(5620,124, 0) , |
| 252 | HDD5GHZCHAN(5640,128, 0) , |
| 253 | HDD5GHZCHAN(5660,132, 0) , |
| 254 | HDD5GHZCHAN(5680,136, 0) , |
| 255 | HDD5GHZCHAN(5700,140, 0) , |
Leo Chang | 80de3c2 | 2013-11-26 10:52:12 -0800 | [diff] [blame] | 256 | #ifdef FEATURE_WLAN_CH144 |
| 257 | HDD5GHZCHAN(5720,144, 0) , |
| 258 | #endif /* FEATURE_WLAN_CH144 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 259 | HDD5GHZCHAN(5745,149, 0) , |
| 260 | HDD5GHZCHAN(5765,153, 0) , |
| 261 | HDD5GHZCHAN(5785,157, 0) , |
| 262 | HDD5GHZCHAN(5805,161, 0) , |
| 263 | HDD5GHZCHAN(5825,165, 0) , |
| 264 | }; |
| 265 | |
| 266 | static struct ieee80211_rate g_mode_rates[] = |
| 267 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 268 | HDD_G_MODE_RATETAB(10, 0x1, 0), |
| 269 | HDD_G_MODE_RATETAB(20, 0x2, 0), |
| 270 | HDD_G_MODE_RATETAB(55, 0x4, 0), |
| 271 | HDD_G_MODE_RATETAB(110, 0x8, 0), |
| 272 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 273 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 274 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 275 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 276 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 277 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 278 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 279 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 280 | }; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 281 | |
| 282 | static struct ieee80211_rate a_mode_rates[] = |
| 283 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 284 | HDD_G_MODE_RATETAB(60, 0x10, 0), |
| 285 | HDD_G_MODE_RATETAB(90, 0x20, 0), |
| 286 | HDD_G_MODE_RATETAB(120, 0x40, 0), |
| 287 | HDD_G_MODE_RATETAB(180, 0x80, 0), |
| 288 | HDD_G_MODE_RATETAB(240, 0x100, 0), |
| 289 | HDD_G_MODE_RATETAB(360, 0x200, 0), |
| 290 | HDD_G_MODE_RATETAB(480, 0x400, 0), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 291 | HDD_G_MODE_RATETAB(540, 0x800, 0), |
| 292 | }; |
| 293 | |
| 294 | static struct ieee80211_supported_band wlan_hdd_band_2_4_GHZ = |
| 295 | { |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 296 | .channels = NULL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 297 | .n_channels = ARRAY_SIZE(hdd_channels_2_4_GHZ), |
| 298 | .band = IEEE80211_BAND_2GHZ, |
| 299 | .bitrates = g_mode_rates, |
| 300 | .n_bitrates = g_mode_rates_size, |
| 301 | .ht_cap.ht_supported = 1, |
| 302 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 303 | | IEEE80211_HT_CAP_GRN_FLD |
| 304 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 305 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT, |
| 306 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 307 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 308 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 309 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 310 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 311 | }; |
| 312 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 313 | static struct ieee80211_supported_band wlan_hdd_band_5_GHZ = |
| 314 | { |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 315 | .channels = NULL, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 316 | .n_channels = ARRAY_SIZE(hdd_channels_5_GHZ), |
| 317 | .band = IEEE80211_BAND_5GHZ, |
| 318 | .bitrates = a_mode_rates, |
| 319 | .n_bitrates = a_mode_rates_size, |
| 320 | .ht_cap.ht_supported = 1, |
| 321 | .ht_cap.cap = IEEE80211_HT_CAP_SGI_20 |
| 322 | | IEEE80211_HT_CAP_GRN_FLD |
| 323 | | IEEE80211_HT_CAP_DSSSCCK40 |
| 324 | | IEEE80211_HT_CAP_LSIG_TXOP_PROT |
| 325 | | IEEE80211_HT_CAP_SGI_40 |
| 326 | | IEEE80211_HT_CAP_SUP_WIDTH_20_40, |
| 327 | .ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K, |
| 328 | .ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16, |
| 329 | .ht_cap.mcs.rx_mask = { 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, |
| 330 | .ht_cap.mcs.rx_highest = cpu_to_le16( 72 ), |
| 331 | .ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED, |
| 332 | }; |
| 333 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 334 | /* This structure contain information what kind of frame are expected in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 335 | TX/RX direction for each kind of interface */ |
| 336 | static const struct ieee80211_txrx_stypes |
| 337 | wlan_hdd_txrx_stypes[NUM_NL80211_IFTYPES] = { |
| 338 | [NL80211_IFTYPE_STATION] = { |
| 339 | .tx = 0xffff, |
| 340 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 341 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 342 | }, |
| 343 | [NL80211_IFTYPE_AP] = { |
| 344 | .tx = 0xffff, |
| 345 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 346 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 347 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 348 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 349 | BIT(SIR_MAC_MGMT_AUTH) | |
| 350 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 351 | BIT(SIR_MAC_MGMT_ACTION), |
| 352 | }, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 353 | [NL80211_IFTYPE_ADHOC] = { |
| 354 | .tx = 0xffff, |
| 355 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 356 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 357 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 358 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 359 | BIT(SIR_MAC_MGMT_AUTH) | |
| 360 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 361 | BIT(SIR_MAC_MGMT_ACTION), |
| 362 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 363 | [NL80211_IFTYPE_P2P_CLIENT] = { |
| 364 | .tx = 0xffff, |
| 365 | .rx = BIT(SIR_MAC_MGMT_ACTION) | |
| 366 | BIT(SIR_MAC_MGMT_PROBE_REQ), |
| 367 | }, |
| 368 | [NL80211_IFTYPE_P2P_GO] = { |
| 369 | /* This is also same as for SoftAP */ |
| 370 | .tx = 0xffff, |
| 371 | .rx = BIT(SIR_MAC_MGMT_ASSOC_REQ) | |
| 372 | BIT(SIR_MAC_MGMT_REASSOC_REQ) | |
| 373 | BIT(SIR_MAC_MGMT_PROBE_REQ) | |
| 374 | BIT(SIR_MAC_MGMT_DISASSOC) | |
| 375 | BIT(SIR_MAC_MGMT_AUTH) | |
| 376 | BIT(SIR_MAC_MGMT_DEAUTH) | |
| 377 | BIT(SIR_MAC_MGMT_ACTION), |
| 378 | }, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 379 | }; |
| 380 | |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 381 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 382 | static const struct ieee80211_iface_limit |
| 383 | wlan_hdd_iface_limit[] = { |
| 384 | { |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 385 | /* max = 3 ; Our driver create two interfaces during driver init |
| 386 | * wlan0 and p2p0 interfaces. p2p0 is considered as station |
| 387 | * interface until a group is formed. In JB architecture, once the |
| 388 | * group is formed, interface type of p2p0 is changed to P2P GO or |
| 389 | * Client. |
| 390 | * When supplicant remove the group, it first issue a set interface |
| 391 | * cmd to change the mode back to Station. In JB this works fine as |
| 392 | * we advertize two station type interface during driver init. |
| 393 | * Some vendors create separate interface for P2P GO/Client, |
| 394 | * after group formation(Third one). But while group remove |
| 395 | * supplicant first tries to change the mode(3rd interface) to STATION |
| 396 | * But as we advertized only two sta type interfaces nl80211 was |
| 397 | * returning error for the third one which was leading to failure in |
| 398 | * delete interface. Ideally while removing the group, supplicant |
| 399 | * should not try to change the 3rd interface mode to Station type. |
| 400 | * Till we get a fix in wpa_supplicant, we advertize max STA |
| 401 | * interface type to 3 |
| 402 | */ |
| 403 | .max = 3, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 404 | .types = BIT(NL80211_IFTYPE_STATION), |
| 405 | }, |
| 406 | { |
| 407 | .max = 1, |
Jeff Johnson | bc00620 | 2013-04-29 14:05:30 -0700 | [diff] [blame] | 408 | .types = BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP), |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 409 | }, |
| 410 | { |
| 411 | .max = 1, |
| 412 | .types = BIT(NL80211_IFTYPE_P2P_GO) | |
| 413 | BIT(NL80211_IFTYPE_P2P_CLIENT), |
| 414 | }, |
| 415 | }; |
| 416 | |
| 417 | /* By default, only single channel concurrency is allowed */ |
| 418 | static struct ieee80211_iface_combination |
| 419 | wlan_hdd_iface_combination = { |
| 420 | .limits = wlan_hdd_iface_limit, |
| 421 | .num_different_channels = 1, |
Sunil Ravi | a72c399 | 2013-01-31 06:12:22 -0800 | [diff] [blame] | 422 | /* |
| 423 | * max = WLAN_MAX_INTERFACES ; JellyBean architecture creates wlan0 |
| 424 | * and p2p0 interfaces during driver init |
| 425 | * Some vendors create separate interface for P2P operations. |
| 426 | * wlan0: STA interface |
| 427 | * p2p0: P2P Device interface, action frames goes |
| 428 | * through this interface. |
| 429 | * p2p-xx: P2P interface, After GO negotiation this interface is |
| 430 | * created for p2p operations(GO/CLIENT interface). |
| 431 | */ |
| 432 | .max_interfaces = WLAN_MAX_INTERFACES, |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 433 | .n_limits = ARRAY_SIZE(wlan_hdd_iface_limit), |
| 434 | .beacon_int_infra_match = false, |
| 435 | }; |
| 436 | #endif |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 437 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 438 | static struct cfg80211_ops wlan_hdd_cfg80211_ops; |
| 439 | |
| 440 | /* Data rate 100KBPS based on IE Index */ |
| 441 | struct index_data_rate_type |
| 442 | { |
| 443 | v_U8_t beacon_rate_index; |
| 444 | v_U16_t supported_rate[4]; |
| 445 | }; |
| 446 | |
| 447 | /* 11B, 11G Rate table include Basic rate and Extended rate |
| 448 | The IDX field is the rate index |
| 449 | The HI field is the rate when RSSI is strong or being ignored |
| 450 | (in this case we report actual rate) |
| 451 | The MID field is the rate when RSSI is moderate |
| 452 | (in this case we cap 11b rates at 5.5 and 11g rates at 24) |
| 453 | The LO field is the rate when RSSI is low |
| 454 | (in this case we don't report rates, actual current rate used) |
| 455 | */ |
| 456 | static const struct |
| 457 | { |
| 458 | v_U8_t beacon_rate_index; |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 459 | v_U16_t supported_rate[4]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 460 | } supported_data_rate[] = |
| 461 | { |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 462 | /* IDX HI HM LM LO (RSSI-based index */ |
| 463 | {2, { 10, 10, 10, 0}}, |
| 464 | {4, { 20, 20, 10, 0}}, |
| 465 | {11, { 55, 20, 10, 0}}, |
| 466 | {12, { 60, 55, 20, 0}}, |
| 467 | {18, { 90, 55, 20, 0}}, |
| 468 | {22, {110, 55, 20, 0}}, |
| 469 | {24, {120, 90, 60, 0}}, |
| 470 | {36, {180, 120, 60, 0}}, |
| 471 | {44, {220, 180, 60, 0}}, |
| 472 | {48, {240, 180, 90, 0}}, |
| 473 | {66, {330, 180, 90, 0}}, |
| 474 | {72, {360, 240, 90, 0}}, |
| 475 | {96, {480, 240, 120, 0}}, |
| 476 | {108, {540, 240, 120, 0}} |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 477 | }; |
| 478 | |
| 479 | /* MCS Based rate table */ |
| 480 | static struct index_data_rate_type supported_mcs_rate[] = |
| 481 | { |
| 482 | /* MCS L20 L40 S20 S40 */ |
| 483 | {0, {65, 135, 72, 150}}, |
| 484 | {1, {130, 270, 144, 300}}, |
| 485 | {2, {195, 405, 217, 450}}, |
| 486 | {3, {260, 540, 289, 600}}, |
| 487 | {4, {390, 810, 433, 900}}, |
| 488 | {5, {520, 1080, 578, 1200}}, |
| 489 | {6, {585, 1215, 650, 1350}}, |
| 490 | {7, {650, 1350, 722, 1500}} |
| 491 | }; |
| 492 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 493 | #ifdef WLAN_FEATURE_11AC |
| 494 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 495 | #define DATA_RATE_11AC_MCS_MASK 0x03 |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 496 | |
| 497 | struct index_vht_data_rate_type |
| 498 | { |
| 499 | v_U8_t beacon_rate_index; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 500 | v_U16_t supported_VHT80_rate[2]; |
| 501 | v_U16_t supported_VHT40_rate[2]; |
| 502 | v_U16_t supported_VHT20_rate[2]; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 503 | }; |
| 504 | |
| 505 | typedef enum |
| 506 | { |
| 507 | DATA_RATE_11AC_MAX_MCS_7, |
| 508 | DATA_RATE_11AC_MAX_MCS_8, |
| 509 | DATA_RATE_11AC_MAX_MCS_9, |
| 510 | DATA_RATE_11AC_MAX_MCS_NA |
| 511 | } eDataRate11ACMaxMcs; |
| 512 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 513 | /* SSID broadcast type */ |
| 514 | typedef enum eSSIDBcastType |
| 515 | { |
| 516 | eBCAST_UNKNOWN = 0, |
| 517 | eBCAST_NORMAL = 1, |
| 518 | eBCAST_HIDDEN = 2, |
| 519 | } tSSIDBcastType; |
| 520 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 521 | /* MCS Based VHT rate table */ |
| 522 | static struct index_vht_data_rate_type supported_vht_mcs_rate[] = |
| 523 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 524 | /* MCS L80 S80 L40 S40 L20 S40*/ |
| 525 | {0, {293, 325}, {135, 150}, {65, 72}}, |
| 526 | {1, {585, 650}, {270, 300}, {130, 144}}, |
| 527 | {2, {878, 975}, {405, 450}, {195, 217}}, |
| 528 | {3, {1170, 1300}, {540, 600}, {260, 289}}, |
| 529 | {4, {1755, 1950}, {810, 900}, {390, 433}}, |
| 530 | {5, {2340, 2600}, {1080, 1200}, {520, 578}}, |
| 531 | {6, {2633, 2925}, {1215, 1350}, {585, 650}}, |
| 532 | {7, {2925, 3250}, {1350, 1500}, {650, 722}}, |
| 533 | {8, {3510, 3900}, {1620, 1800}, {780, 867}}, |
| 534 | {9, {3900, 4333}, {1800, 2000}, {780, 867}} |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 535 | }; |
| 536 | #endif /* WLAN_FEATURE_11AC */ |
| 537 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 538 | /*array index points to MCS and array value points respective rssi*/ |
| 539 | static int rssiMcsTbl[][10] = |
| 540 | { |
| 541 | /*MCS 0 1 2 3 4 5 6 7 8 9*/ |
| 542 | {-82, -79, -77, -74, -70, -66, -65, -64, -59, -57}, //20 |
| 543 | {-79, -76, -74, -71, -67, -63, -62, -61, -56, -54}, //40 |
| 544 | {-76, -73, -71, -68, -64, -60, -59, -58, -53, -51} //80 |
| 545 | }; |
| 546 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 547 | extern struct net_device_ops net_ops_struct; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 548 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 549 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter); |
| 550 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 551 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 552 | #ifdef WLAN_NL80211_TESTMODE |
| 553 | enum wlan_hdd_tm_attr |
| 554 | { |
| 555 | WLAN_HDD_TM_ATTR_INVALID = 0, |
| 556 | WLAN_HDD_TM_ATTR_CMD = 1, |
| 557 | WLAN_HDD_TM_ATTR_DATA = 2, |
| 558 | WLAN_HDD_TM_ATTR_TYPE = 3, |
| 559 | /* keep last */ |
| 560 | WLAN_HDD_TM_ATTR_AFTER_LAST, |
| 561 | WLAN_HDD_TM_ATTR_MAX = WLAN_HDD_TM_ATTR_AFTER_LAST - 1, |
| 562 | }; |
| 563 | |
| 564 | enum wlan_hdd_tm_cmd |
| 565 | { |
| 566 | WLAN_HDD_TM_CMD_WLAN_HB = 1, |
| 567 | }; |
| 568 | |
| 569 | #define WLAN_HDD_TM_DATA_MAX_LEN 5000 |
| 570 | |
| 571 | static const struct nla_policy wlan_hdd_tm_policy[WLAN_HDD_TM_ATTR_MAX + 1] = |
| 572 | { |
| 573 | [WLAN_HDD_TM_ATTR_CMD] = { .type = NLA_U32 }, |
| 574 | [WLAN_HDD_TM_ATTR_DATA] = { .type = NLA_BINARY, |
| 575 | .len = WLAN_HDD_TM_DATA_MAX_LEN }, |
| 576 | }; |
| 577 | #endif /* WLAN_NL80211_TESTMODE */ |
| 578 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 579 | #ifdef FEATURE_WLAN_CH_AVOID |
| 580 | /* |
| 581 | * FUNCTION: wlan_hdd_send_avoid_freq_event |
| 582 | * This is called when wlan driver needs to send vendor specific |
| 583 | * avoid frequency range event to userspace |
| 584 | */ |
| 585 | int wlan_hdd_send_avoid_freq_event(hdd_context_t *pHddCtx, |
| 586 | tHddAvoidFreqList *pAvoidFreqList) |
| 587 | { |
| 588 | struct sk_buff *vendor_event; |
| 589 | |
| 590 | ENTER(); |
| 591 | |
| 592 | if (!pHddCtx) |
| 593 | { |
| 594 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 595 | "%s: HDD context is null", __func__); |
| 596 | return -1; |
| 597 | } |
| 598 | |
| 599 | if (!pAvoidFreqList) |
| 600 | { |
| 601 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 602 | "%s: pAvoidFreqList is null", __func__); |
| 603 | return -1; |
| 604 | } |
| 605 | |
| 606 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 607 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 608 | NULL, |
| 609 | #endif |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 610 | sizeof(tHddAvoidFreqList), |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 611 | QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_INDEX, |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 612 | GFP_KERNEL); |
| 613 | if (!vendor_event) |
| 614 | { |
| 615 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 616 | "%s: cfg80211_vendor_event_alloc failed", __func__); |
| 617 | return -1; |
| 618 | } |
| 619 | |
| 620 | memcpy(skb_put(vendor_event, sizeof(tHddAvoidFreqList)), |
| 621 | (void *)pAvoidFreqList, sizeof(tHddAvoidFreqList)); |
| 622 | |
| 623 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 624 | |
| 625 | EXIT(); |
| 626 | return 0; |
| 627 | } |
| 628 | #endif /* FEATURE_WLAN_CH_AVOID */ |
| 629 | |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 630 | /* |
| 631 | * FUNCTION: __wlan_hdd_cfg80211_nan_request |
| 632 | * This is called when wlan driver needs to send vendor specific |
| 633 | * nan request event. |
| 634 | */ |
| 635 | static int __wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 636 | struct wireless_dev *wdev, |
| 637 | const void *data, int data_len) |
| 638 | { |
| 639 | tNanRequestReq nan_req; |
| 640 | VOS_STATUS status; |
| 641 | int ret_val = -1; |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 642 | struct net_device *dev = wdev->netdev; |
| 643 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 644 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 645 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 646 | |
| 647 | if (0 == data_len) |
| 648 | { |
| 649 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 650 | FL("NAN - Invalid Request, length = 0")); |
| 651 | return ret_val; |
| 652 | } |
| 653 | |
| 654 | if (NULL == data) |
| 655 | { |
| 656 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 657 | FL("NAN - Invalid Request, data is NULL")); |
| 658 | return ret_val; |
| 659 | } |
| 660 | |
| 661 | status = wlan_hdd_validate_context(pHddCtx); |
| 662 | if (0 != status) |
| 663 | { |
| 664 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 665 | FL("HDD context is not valid")); |
| 666 | return -EINVAL; |
| 667 | } |
| 668 | |
| 669 | hddLog(LOG1, FL("Received NAN command")); |
| 670 | vos_trace_hex_dump( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 671 | (tANI_U8 *)data, data_len); |
| 672 | |
| 673 | /* check the NAN Capability */ |
| 674 | if (TRUE != sme_IsFeatureSupportedByFW(NAN)) |
| 675 | { |
| 676 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 677 | FL("NAN is not supported by Firmware")); |
| 678 | return -EINVAL; |
| 679 | } |
| 680 | |
| 681 | nan_req.request_data_len = data_len; |
| 682 | nan_req.request_data = data; |
| 683 | |
Srinivas Dasari | a3f11c0 | 2015-03-20 13:15:20 +0530 | [diff] [blame] | 684 | status = sme_NanRequest(hHal, &nan_req, pAdapter->sessionId); |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 685 | if (VOS_STATUS_SUCCESS == status) |
| 686 | { |
| 687 | ret_val = 0; |
| 688 | } |
| 689 | return ret_val; |
| 690 | } |
| 691 | |
| 692 | /* |
| 693 | * FUNCTION: wlan_hdd_cfg80211_nan_request |
| 694 | * Wrapper to protect the nan vendor command from ssr |
| 695 | */ |
| 696 | static int wlan_hdd_cfg80211_nan_request(struct wiphy *wiphy, |
| 697 | struct wireless_dev *wdev, |
| 698 | const void *data, int data_len) |
| 699 | { |
| 700 | int ret; |
| 701 | |
| 702 | vos_ssr_protect(__func__); |
| 703 | ret = __wlan_hdd_cfg80211_nan_request(wiphy, wdev, data, data_len); |
| 704 | vos_ssr_unprotect(__func__); |
| 705 | |
| 706 | return ret; |
| 707 | } |
| 708 | |
| 709 | /* |
| 710 | * FUNCTION: wlan_hdd_cfg80211_nan_callback |
| 711 | * This is a callback function and it gets called |
| 712 | * when we need to report nan response event to |
| 713 | * upper layers. |
| 714 | */ |
| 715 | static void wlan_hdd_cfg80211_nan_callback(void* ctx, tSirNanEvent* msg) |
| 716 | { |
| 717 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 718 | struct sk_buff *vendor_event; |
| 719 | int status; |
| 720 | tSirNanEvent *data; |
| 721 | |
| 722 | ENTER(); |
| 723 | if (NULL == msg) |
| 724 | { |
| 725 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 726 | FL(" msg received here is null")); |
| 727 | return; |
| 728 | } |
| 729 | data = msg; |
| 730 | |
| 731 | status = wlan_hdd_validate_context(pHddCtx); |
| 732 | |
| 733 | if (0 != status) |
| 734 | { |
| 735 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 736 | FL("HDD context is not valid")); |
| 737 | return; |
| 738 | } |
| 739 | |
| 740 | vendor_event = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 741 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 742 | NULL, |
| 743 | #endif |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 744 | data->event_data_len + |
| 745 | NLMSG_HDRLEN, |
| 746 | QCA_NL80211_VENDOR_SUBCMD_NAN_INDEX, |
| 747 | GFP_KERNEL); |
| 748 | |
| 749 | if (!vendor_event) |
| 750 | { |
| 751 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 752 | FL("cfg80211_vendor_event_alloc failed")); |
| 753 | return; |
| 754 | } |
| 755 | if (nla_put(vendor_event, QCA_WLAN_VENDOR_ATTR_NAN, |
| 756 | data->event_data_len, data->event_data)) |
| 757 | { |
| 758 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 759 | FL("QCA_WLAN_VENDOR_ATTR_NAN put fail")); |
| 760 | kfree_skb(vendor_event); |
| 761 | return; |
| 762 | } |
| 763 | cfg80211_vendor_event(vendor_event, GFP_KERNEL); |
| 764 | EXIT(); |
| 765 | } |
| 766 | |
| 767 | /* |
| 768 | * FUNCTION: wlan_hdd_cfg80211_nan_init |
| 769 | * This function is called to register the callback to sme layer |
| 770 | */ |
| 771 | inline void wlan_hdd_cfg80211_nan_init(hdd_context_t *pHddCtx) |
| 772 | { |
| 773 | sme_NanRegisterCallback(pHddCtx->hHal, wlan_hdd_cfg80211_nan_callback); |
| 774 | } |
| 775 | |
| 776 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 777 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 778 | |
| 779 | static v_BOOL_t put_wifi_rate_stat( tpSirWifiRateStat stats, |
| 780 | struct sk_buff *vendor_event) |
| 781 | { |
| 782 | if (nla_put_u8(vendor_event, |
| 783 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_PREAMBLE, |
| 784 | stats->rate.preamble) || |
| 785 | nla_put_u8(vendor_event, |
| 786 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_NSS, |
| 787 | stats->rate.nss) || |
| 788 | nla_put_u8(vendor_event, |
| 789 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BW, |
| 790 | stats->rate.bw) || |
| 791 | nla_put_u8(vendor_event, |
| 792 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MCS_INDEX, |
| 793 | stats->rate.rateMcsIdx) || |
| 794 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_BIT_RATE, |
| 795 | stats->rate.bitrate ) || |
| 796 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_TX_MPDU, |
| 797 | stats->txMpdu ) || |
| 798 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RX_MPDU, |
| 799 | stats->rxMpdu ) || |
| 800 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_MPDU_LOST, |
| 801 | stats->mpduLost ) || |
| 802 | nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES, |
| 803 | stats->retries) || |
| 804 | nla_put_u32(vendor_event, |
| 805 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_SHORT, |
| 806 | stats->retriesShort ) || |
| 807 | nla_put_u32(vendor_event, |
| 808 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RATE_RETRIES_LONG, |
| 809 | stats->retriesLong)) |
| 810 | { |
| 811 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 812 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 813 | return FALSE; |
| 814 | } |
| 815 | return TRUE; |
| 816 | } |
| 817 | |
| 818 | static v_BOOL_t put_wifi_peer_info( tpSirWifiPeerInfo stats, |
| 819 | struct sk_buff *vendor_event) |
| 820 | { |
| 821 | u32 i = 0; |
| 822 | struct nlattr *rateInfo; |
| 823 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_TYPE, |
| 824 | stats->type) || |
| 825 | nla_put(vendor_event, |
| 826 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_MAC_ADDRESS, |
| 827 | VOS_MAC_ADDR_SIZE, &stats->peerMacAddress[0]) || |
| 828 | nla_put_u32(vendor_event, |
| 829 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_CAPABILITIES, |
| 830 | stats->capabilities) || |
| 831 | nla_put_u32(vendor_event, |
| 832 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_NUM_RATES, |
| 833 | stats->numRate)) |
| 834 | { |
| 835 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 836 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 837 | goto error; |
| 838 | } |
| 839 | |
| 840 | rateInfo = nla_nest_start(vendor_event, |
| 841 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO_RATE_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 842 | if(!rateInfo) |
| 843 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 844 | for (i = 0; i < stats->numRate; i++) |
| 845 | { |
| 846 | struct nlattr *rates; |
| 847 | tpSirWifiRateStat pRateStats = (tpSirWifiRateStat )((uint8 *) |
| 848 | stats->rateStats + |
| 849 | (i * sizeof(tSirWifiRateStat))); |
| 850 | rates = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 851 | if(!rates) |
| 852 | return FALSE; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 853 | |
| 854 | if (FALSE == put_wifi_rate_stat(pRateStats, vendor_event)) |
| 855 | { |
| 856 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 857 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 858 | return FALSE; |
| 859 | } |
| 860 | nla_nest_end(vendor_event, rates); |
| 861 | } |
| 862 | nla_nest_end(vendor_event, rateInfo); |
| 863 | |
| 864 | return TRUE; |
| 865 | error: |
| 866 | return FALSE; |
| 867 | } |
| 868 | |
| 869 | static v_BOOL_t put_wifi_wmm_ac_stat( tpSirWifiWmmAcStat stats, |
| 870 | struct sk_buff *vendor_event) |
| 871 | { |
| 872 | if (nla_put_u32(vendor_event, QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_AC, |
| 873 | stats->ac ) || |
| 874 | nla_put_u32(vendor_event, |
| 875 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MPDU, |
| 876 | stats->txMpdu ) || |
| 877 | nla_put_u32(vendor_event, |
| 878 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MPDU, |
| 879 | stats->rxMpdu ) || |
| 880 | nla_put_u32(vendor_event, |
| 881 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_MCAST, |
| 882 | stats->txMcast ) || |
| 883 | nla_put_u32(vendor_event, |
| 884 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_MCAST, |
| 885 | stats->rxMcast ) || |
| 886 | nla_put_u32(vendor_event, |
| 887 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RX_AMPDU, |
| 888 | stats->rxAmpdu ) || |
| 889 | nla_put_u32(vendor_event, |
| 890 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_TX_AMPDU, |
| 891 | stats->txAmpdu ) || |
| 892 | nla_put_u32(vendor_event, |
| 893 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_MPDU_LOST, |
| 894 | stats->mpduLost )|| |
| 895 | nla_put_u32(vendor_event, |
| 896 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES, |
| 897 | stats->retries ) || |
| 898 | nla_put_u32(vendor_event, |
| 899 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_SHORT, |
| 900 | stats->retriesShort ) || |
| 901 | nla_put_u32(vendor_event, |
| 902 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_RETRIES_LONG, |
| 903 | stats->retriesLong ) || |
| 904 | nla_put_u32(vendor_event, |
| 905 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MIN, |
| 906 | stats->contentionTimeMin ) || |
| 907 | nla_put_u32(vendor_event, |
| 908 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_MAX, |
| 909 | stats->contentionTimeMax ) || |
| 910 | nla_put_u32(vendor_event, |
| 911 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_TIME_AVG, |
| 912 | stats->contentionTimeAvg ) || |
| 913 | nla_put_u32(vendor_event, |
| 914 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_AC_CONTENTION_NUM_SAMPLES, |
| 915 | stats->contentionNumSamples )) |
| 916 | { |
| 917 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 918 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 919 | return FALSE; |
| 920 | } |
| 921 | return TRUE; |
| 922 | } |
| 923 | |
| 924 | static v_BOOL_t put_wifi_interface_info(tpSirWifiInterfaceInfo stats, |
| 925 | struct sk_buff *vendor_event) |
| 926 | { |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 927 | if (nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 928 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MODE, stats->mode ) || |
| 929 | nla_put(vendor_event, |
| 930 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_MAC_ADDR, |
| 931 | VOS_MAC_ADDR_SIZE, stats->macAddr) || |
| 932 | nla_put_u32(vendor_event, |
| 933 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_STATE, |
| 934 | stats->state ) || |
| 935 | nla_put_u32(vendor_event, |
| 936 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_ROAMING, |
| 937 | stats->roaming ) || |
| 938 | nla_put_u32(vendor_event, |
| 939 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_CAPABILITIES, |
| 940 | stats->capabilities ) || |
| 941 | nla_put(vendor_event, |
| 942 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_SSID, |
| 943 | strlen(stats->ssid), stats->ssid) || |
| 944 | nla_put(vendor_event, |
| 945 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_BSSID, |
| 946 | WNI_CFG_BSSID_LEN, stats->bssid) || |
| 947 | nla_put(vendor_event, |
| 948 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_AP_COUNTRY_STR, |
| 949 | WNI_CFG_COUNTRY_CODE_LEN, stats->apCountryStr) || |
| 950 | nla_put(vendor_event, |
| 951 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_INFO_COUNTRY_STR, |
| 952 | WNI_CFG_COUNTRY_CODE_LEN, stats->countryStr) |
| 953 | ) |
| 954 | { |
| 955 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 956 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 957 | return FALSE; |
| 958 | } |
| 959 | return TRUE; |
| 960 | } |
| 961 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 962 | static v_BOOL_t put_wifi_iface_stats(hdd_adapter_t *pAdapter, |
| 963 | tpSirWifiIfaceStat pWifiIfaceStat, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 964 | struct sk_buff *vendor_event) |
| 965 | { |
| 966 | int i = 0; |
| 967 | struct nlattr *wmmInfo; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 968 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 969 | WLANTL_InterfaceStatsType *pWifiIfaceStatTL = NULL; |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 970 | tSirWifiWmmAcStat accessclassStats; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 971 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 972 | if (FALSE == put_wifi_interface_info( |
| 973 | &pWifiIfaceStat->info, |
| 974 | vendor_event)) |
| 975 | { |
| 976 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 977 | FL("QCA_WLAN_VENDOR_ATTR put fail") ); |
| 978 | return FALSE; |
| 979 | |
| 980 | } |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 981 | pWifiIfaceStatTL = (WLANTL_InterfaceStatsType *) |
| 982 | vos_mem_malloc(sizeof(WLANTL_InterfaceStatsType)); |
| 983 | if (NULL == pWifiIfaceStatTL) |
| 984 | { |
| 985 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 986 | return FALSE; |
| 987 | } |
| 988 | |
Srinivas Dasari | a8a304f | 2014-11-15 16:13:37 +0530 | [diff] [blame] | 989 | accessclassStats = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK]; |
| 990 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK] = |
| 991 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE]; |
| 992 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE] = accessclassStats; |
| 993 | |
| 994 | accessclassStats.ac = pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac; |
| 995 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].ac = |
| 996 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac; |
| 997 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].ac = accessclassStats.ac; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 998 | |
| 999 | if ( pWifiIfaceStat->info.state == WIFI_ASSOCIATED) |
| 1000 | { |
| 1001 | if (VOS_STATUS_SUCCESS == |
| 1002 | WLANTL_CollectInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 1003 | pHddStaCtx->conn_info.staId[0], pWifiIfaceStatTL)) |
| 1004 | { |
| 1005 | /* mgmtRx, MgmtActionRx, rxMcast, rxMpdu, rxAmpdu, rssiData are |
| 1006 | * obtained from TL structure |
| 1007 | */ |
| 1008 | |
| 1009 | pWifiIfaceStat->mgmtRx = pWifiIfaceStat->beaconRx + |
| 1010 | pWifiIfaceStatTL->mgmtRx; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1011 | pWifiIfaceStat->rssiData = pWifiIfaceStatTL->rssiData; |
| 1012 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1013 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMcast |
| 1014 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMcast; |
| 1015 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMcast |
| 1016 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMcast; |
| 1017 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMcast |
| 1018 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMcast; |
| 1019 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMcast |
| 1020 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMcast; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1021 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1022 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxMpdu |
| 1023 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxMpdu; |
| 1024 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxMpdu |
| 1025 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxMpdu; |
| 1026 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxMpdu |
| 1027 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxMpdu; |
| 1028 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxMpdu |
| 1029 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxMpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1030 | |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1031 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].rxAmpdu |
| 1032 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VO].rxAmpdu; |
| 1033 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].rxAmpdu |
| 1034 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_VI].rxAmpdu; |
| 1035 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].rxAmpdu |
| 1036 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BE].rxAmpdu; |
| 1037 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].rxAmpdu |
| 1038 | = pWifiIfaceStatTL->accessCategoryStats[WLANTL_AC_BK].rxAmpdu; |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1039 | } |
| 1040 | else |
| 1041 | { |
| 1042 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in getting stats from TL")); |
| 1043 | } |
| 1044 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1045 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VO].txMcast = |
| 1046 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO]; |
| 1047 | pWifiIfaceStat->AccessclassStats[WIFI_AC_VI].txMcast = |
| 1048 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI]; |
| 1049 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BE].txMcast = |
| 1050 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE]; |
| 1051 | pWifiIfaceStat->AccessclassStats[WIFI_AC_BK].txMcast = |
| 1052 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK]; |
| 1053 | } |
| 1054 | else |
| 1055 | { |
| 1056 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Interface not Associated")); |
| 1057 | } |
| 1058 | |
| 1059 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1060 | |
| 1061 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1062 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1063 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_IFACE) || |
| 1064 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1065 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_BEACON_RX, |
| 1066 | pWifiIfaceStat->beaconRx) || |
| 1067 | nla_put_u32(vendor_event, |
| 1068 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_RX, |
| 1069 | pWifiIfaceStat->mgmtRx) || |
| 1070 | nla_put_u32(vendor_event, |
| 1071 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_RX, |
| 1072 | pWifiIfaceStat->mgmtActionRx) || |
| 1073 | nla_put_u32(vendor_event, |
| 1074 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_MGMT_ACTION_TX, |
| 1075 | pWifiIfaceStat->mgmtActionTx) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1076 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1077 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_MGMT, |
| 1078 | pWifiIfaceStat->rssiMgmt) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1079 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1080 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_DATA, |
| 1081 | pWifiIfaceStat->rssiData) || |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1082 | nla_put_s32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1083 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_RSSI_ACK, |
| 1084 | pWifiIfaceStat->rssiAck)) |
| 1085 | { |
| 1086 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mukul Sharma | f1bd932 | 2015-10-20 16:03:42 +0530 | [diff] [blame] | 1087 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1088 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1089 | return FALSE; |
| 1090 | } |
| 1091 | |
Mukul Sharma | f1bd932 | 2015-10-20 16:03:42 +0530 | [diff] [blame] | 1092 | #ifdef FEATURE_EXT_LL_STAT |
| 1093 | /* |
| 1094 | * Ensure when EXT_LL_STAT is supported by both host and fwr, |
| 1095 | * then host should send Leaky AP stats to upper layer, |
| 1096 | * otherwise no need to send these stats. |
| 1097 | */ |
| 1098 | if(sme_IsFeatureSupportedByFW(EXT_LL_STAT) && |
| 1099 | sme_IsFeatureSupportedByDriver(EXT_LL_STAT) |
| 1100 | ) |
| 1101 | { |
| 1102 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1103 | FL("EXT_LL_STAT is supported by fwr and host %u %u %u %llu"), |
| 1104 | pWifiIfaceStat->leakyApStat.is_leaky_ap, |
| 1105 | pWifiIfaceStat->leakyApStat.avg_rx_frms_leaked, |
| 1106 | pWifiIfaceStat->leakyApStat.rx_leak_window, |
| 1107 | pWifiIfaceStat->leakyApStat.avg_bcn_spread); |
| 1108 | if (nla_put_u32(vendor_event, |
| 1109 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_DETECTED, |
| 1110 | pWifiIfaceStat->leakyApStat.is_leaky_ap) || |
| 1111 | nla_put_u32(vendor_event, |
| 1112 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_AVG_NUM_FRAMES_LEAKED, |
| 1113 | pWifiIfaceStat->leakyApStat.avg_rx_frms_leaked) || |
| 1114 | nla_put_u32(vendor_event, |
| 1115 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_LEAKY_AP_GUARD_TIME, |
| 1116 | pWifiIfaceStat->leakyApStat.rx_leak_window) || |
| 1117 | nla_put_u64(vendor_event, |
| 1118 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_AVERAGE_TSF_OFFSET, |
| 1119 | pWifiIfaceStat->leakyApStat.avg_bcn_spread)) |
| 1120 | { |
| 1121 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1122 | FL("EXT_LL_STAT put fail")); |
| 1123 | vos_mem_free(pWifiIfaceStatTL); |
| 1124 | return FALSE; |
| 1125 | } |
| 1126 | } |
| 1127 | #endif |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1128 | wmmInfo = nla_nest_start(vendor_event, |
| 1129 | QCA_WLAN_VENDOR_ATTR_LL_STATS_WMM_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1130 | if(!wmmInfo) |
| 1131 | { |
| 1132 | vos_mem_free(pWifiIfaceStatTL); |
| 1133 | return FALSE; |
| 1134 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1135 | for (i = 0; i < WIFI_AC_MAX; i++) |
| 1136 | { |
| 1137 | struct nlattr *wmmStats; |
| 1138 | wmmStats = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1139 | if(!wmmStats) |
| 1140 | { |
| 1141 | vos_mem_free(pWifiIfaceStatTL); |
| 1142 | return FALSE; |
| 1143 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1144 | if (FALSE == put_wifi_wmm_ac_stat( |
| 1145 | &pWifiIfaceStat->AccessclassStats[i], |
| 1146 | vendor_event)) |
| 1147 | { |
| 1148 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1149 | FL("QCA_WLAN_VENDOR_ATTR put Fail")); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1150 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1151 | return FALSE; |
| 1152 | } |
| 1153 | |
| 1154 | nla_nest_end(vendor_event, wmmStats); |
| 1155 | } |
| 1156 | nla_nest_end(vendor_event, wmmInfo); |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1157 | vos_mem_free(pWifiIfaceStatTL); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1158 | return TRUE; |
| 1159 | } |
| 1160 | |
| 1161 | static tSirWifiInterfaceMode |
| 1162 | hdd_map_device_to_ll_iface_mode ( int deviceMode ) |
| 1163 | { |
| 1164 | switch (deviceMode) |
| 1165 | { |
| 1166 | case WLAN_HDD_INFRA_STATION: |
| 1167 | return WIFI_INTERFACE_STA; |
| 1168 | case WLAN_HDD_SOFTAP: |
| 1169 | return WIFI_INTERFACE_SOFTAP; |
| 1170 | case WLAN_HDD_P2P_CLIENT: |
| 1171 | return WIFI_INTERFACE_P2P_CLIENT; |
| 1172 | case WLAN_HDD_P2P_GO: |
| 1173 | return WIFI_INTERFACE_P2P_GO; |
| 1174 | case WLAN_HDD_IBSS: |
| 1175 | return WIFI_INTERFACE_IBSS; |
| 1176 | default: |
Dino Mycle | c8f3f33 | 2014-07-21 16:48:27 +0530 | [diff] [blame] | 1177 | return WIFI_INTERFACE_UNKNOWN; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1178 | } |
| 1179 | } |
| 1180 | |
| 1181 | static v_BOOL_t hdd_get_interface_info(hdd_adapter_t *pAdapter, |
| 1182 | tpSirWifiInterfaceInfo pInfo) |
| 1183 | { |
| 1184 | v_U8_t *staMac = NULL; |
| 1185 | hdd_station_ctx_t *pHddStaCtx; |
| 1186 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 1187 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1188 | |
| 1189 | pInfo->mode = hdd_map_device_to_ll_iface_mode(pAdapter->device_mode); |
| 1190 | |
| 1191 | vos_mem_copy(pInfo->macAddr, |
| 1192 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
| 1193 | |
| 1194 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 1195 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 1196 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode))) |
| 1197 | { |
| 1198 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1199 | if (eConnectionState_NotConnected == pHddStaCtx->conn_info.connState) |
| 1200 | { |
| 1201 | pInfo->state = WIFI_DISCONNECTED; |
| 1202 | } |
| 1203 | if (eConnectionState_Connecting == pHddStaCtx->conn_info.connState) |
| 1204 | { |
| 1205 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1206 | "%s: Session ID %d, Connection is in progress", __func__, |
| 1207 | pAdapter->sessionId); |
| 1208 | pInfo->state = WIFI_ASSOCIATING; |
| 1209 | } |
| 1210 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
| 1211 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 1212 | { |
| 1213 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 1214 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1215 | "%s: client " MAC_ADDRESS_STR |
| 1216 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 1217 | MAC_ADDR_ARRAY(staMac)); |
| 1218 | pInfo->state = WIFI_AUTHENTICATING; |
| 1219 | } |
| 1220 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 1221 | { |
| 1222 | pInfo->state = WIFI_ASSOCIATED; |
| 1223 | vos_mem_copy(pInfo->bssid, |
| 1224 | &pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 1225 | vos_mem_copy(pInfo->ssid, |
| 1226 | pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 1227 | pHddStaCtx->conn_info.SSID.SSID.length); |
| 1228 | //NULL Terminate the string. |
| 1229 | pInfo->ssid[pHddStaCtx->conn_info.SSID.SSID.length] = 0; |
| 1230 | } |
| 1231 | } |
| 1232 | vos_mem_copy(pInfo->countryStr, |
| 1233 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1234 | |
| 1235 | vos_mem_copy(pInfo->apCountryStr, |
| 1236 | pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN); |
| 1237 | |
| 1238 | return TRUE; |
| 1239 | } |
| 1240 | |
| 1241 | /* |
| 1242 | * hdd_link_layer_process_peer_stats () - This function is called after |
| 1243 | * receiving Link Layer Peer statistics from FW.This function converts |
| 1244 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1245 | * layers. |
| 1246 | */ |
| 1247 | static v_VOID_t hdd_link_layer_process_peer_stats(hdd_adapter_t *pAdapter, |
| 1248 | v_VOID_t *pData) |
| 1249 | { |
| 1250 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1251 | tpSirWifiPeerStat pWifiPeerStat; |
| 1252 | tpSirWifiPeerInfo pWifiPeerInfo; |
| 1253 | struct nlattr *peerInfo; |
| 1254 | struct sk_buff *vendor_event; |
| 1255 | int status, i; |
| 1256 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1257 | ENTER(); |
| 1258 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1259 | status = wlan_hdd_validate_context(pHddCtx); |
| 1260 | if (0 != status) |
| 1261 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1262 | return; |
| 1263 | } |
| 1264 | |
| 1265 | pWifiPeerStat = (tpSirWifiPeerStat) pData; |
| 1266 | |
| 1267 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1268 | "LL_STATS_PEER_ALL : numPeers %u", |
| 1269 | pWifiPeerStat->numPeers); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1270 | /* |
| 1271 | * Allocate a size of 4096 for the peer stats comprising |
| 1272 | * each of size = sizeof (tSirWifiPeerInfo) + numRate * |
| 1273 | * sizeof (tSirWifiRateStat).Each field is put with an |
| 1274 | * NL attribute.The size of 4096 is considered assuming |
| 1275 | * that number of rates shall not exceed beyond 50 with |
| 1276 | * the sizeof (tSirWifiRateStat) being 32. |
| 1277 | */ |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1278 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1279 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1280 | if (!vendor_event) |
| 1281 | { |
| 1282 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1283 | "%s: cfg80211_vendor_cmd_alloc_reply_skb failed", |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1284 | __func__); |
| 1285 | return; |
| 1286 | } |
| 1287 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1288 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1289 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_PEER) || |
| 1290 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1291 | QCA_WLAN_VENDOR_ATTR_LL_STATS_IFACE_NUM_PEERS, |
| 1292 | pWifiPeerStat->numPeers)) |
| 1293 | { |
| 1294 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1295 | "%s: QCA_WLAN_VENDOR_ATTR put fail", __func__); |
| 1296 | kfree_skb(vendor_event); |
| 1297 | return; |
| 1298 | } |
| 1299 | |
| 1300 | peerInfo = nla_nest_start(vendor_event, |
| 1301 | QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1302 | if(!peerInfo) |
| 1303 | { |
| 1304 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1305 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_PEER_INFO put fail", |
| 1306 | __func__); |
| 1307 | kfree_skb(vendor_event); |
| 1308 | return; |
| 1309 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1310 | |
| 1311 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1312 | pWifiPeerStat->peerInfo); |
| 1313 | |
| 1314 | for (i = 1; i <= pWifiPeerStat->numPeers; i++) |
| 1315 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1316 | int numRate = pWifiPeerInfo->numRate; |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1317 | struct nlattr *peers = nla_nest_start(vendor_event, i); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1318 | |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1319 | if(!peers) |
| 1320 | { |
| 1321 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1322 | "%s: peer stats put fail", |
| 1323 | __func__); |
| 1324 | kfree_skb(vendor_event); |
| 1325 | return; |
| 1326 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1327 | if (FALSE == put_wifi_peer_info( |
| 1328 | pWifiPeerInfo, vendor_event)) |
| 1329 | { |
| 1330 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1331 | "%s: put_wifi_peer_info put fail", __func__); |
| 1332 | kfree_skb(vendor_event); |
| 1333 | return; |
| 1334 | } |
| 1335 | |
| 1336 | pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *) |
| 1337 | pWifiPeerStat->peerInfo + |
| 1338 | (i * sizeof(tSirWifiPeerInfo)) + |
| 1339 | (numRate * sizeof (tSirWifiRateStat))); |
| 1340 | nla_nest_end(vendor_event, peers); |
| 1341 | } |
| 1342 | nla_nest_end(vendor_event, peerInfo); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1343 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1344 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1345 | } |
| 1346 | |
| 1347 | /* |
| 1348 | * hdd_link_layer_process_iface_stats () - This function is called after |
| 1349 | * receiving Link Layer Interface statistics from FW.This function converts |
| 1350 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1351 | * layers. |
| 1352 | */ |
| 1353 | static v_VOID_t hdd_link_layer_process_iface_stats(hdd_adapter_t *pAdapter, |
| 1354 | v_VOID_t *pData) |
| 1355 | { |
| 1356 | tpSirWifiIfaceStat pWifiIfaceStat; |
| 1357 | struct sk_buff *vendor_event; |
| 1358 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1359 | int status; |
| 1360 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1361 | ENTER(); |
| 1362 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1363 | status = wlan_hdd_validate_context(pHddCtx); |
| 1364 | if (0 != status) |
| 1365 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1366 | return; |
| 1367 | } |
| 1368 | /* |
| 1369 | * Allocate a size of 4096 for the interface stats comprising |
| 1370 | * sizeof (tpSirWifiIfaceStat).The size of 4096 is considered |
| 1371 | * assuming that all these fit with in the limit.Please take |
| 1372 | * a call on the limit based on the data requirements on |
| 1373 | * interface statistics. |
| 1374 | */ |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1375 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1376 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1377 | if (!vendor_event) |
| 1378 | { |
| 1379 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1380 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed") ); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1381 | return; |
| 1382 | } |
| 1383 | |
| 1384 | pWifiIfaceStat = (tpSirWifiIfaceStat) pData; |
| 1385 | |
Dino Mycle | 3b9536d | 2014-07-09 22:05:24 +0530 | [diff] [blame] | 1386 | |
| 1387 | if (FALSE == hdd_get_interface_info( pAdapter, |
| 1388 | &pWifiIfaceStat->info)) |
| 1389 | { |
| 1390 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1391 | FL("hdd_get_interface_info get fail") ); |
| 1392 | kfree_skb(vendor_event); |
| 1393 | return; |
| 1394 | } |
| 1395 | |
| 1396 | if (FALSE == put_wifi_iface_stats( pAdapter, pWifiIfaceStat, |
| 1397 | vendor_event)) |
| 1398 | { |
| 1399 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1400 | FL("put_wifi_iface_stats fail") ); |
| 1401 | kfree_skb(vendor_event); |
| 1402 | return; |
| 1403 | } |
| 1404 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1405 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1406 | "WMI_LINK_STATS_IFACE Data"); |
| 1407 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1408 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1409 | |
| 1410 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1411 | } |
| 1412 | |
| 1413 | /* |
| 1414 | * hdd_link_layer_process_radio_stats () - This function is called after |
| 1415 | * receiving Link Layer Radio statistics from FW.This function converts |
| 1416 | * the firmware data to the NL data and sends the same to the kernel/upper |
| 1417 | * layers. |
| 1418 | */ |
| 1419 | static v_VOID_t hdd_link_layer_process_radio_stats(hdd_adapter_t *pAdapter, |
| 1420 | v_VOID_t *pData) |
| 1421 | { |
| 1422 | int status, i; |
| 1423 | tpSirWifiRadioStat pWifiRadioStat; |
| 1424 | tpSirWifiChannelStats pWifiChannelStats; |
| 1425 | struct sk_buff *vendor_event; |
| 1426 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1427 | struct nlattr *chList; |
| 1428 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1429 | ENTER(); |
| 1430 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1431 | status = wlan_hdd_validate_context(pHddCtx); |
| 1432 | if (0 != status) |
| 1433 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1434 | return; |
| 1435 | } |
| 1436 | pWifiRadioStat = (tpSirWifiRadioStat) pData; |
| 1437 | |
| 1438 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 1439 | "LL_STATS_RADIO" |
| 1440 | " radio is %d onTime is %u " |
| 1441 | " txTime is %u rxTime is %u " |
| 1442 | " onTimeScan is %u onTimeNbd is %u " |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1443 | " onTimeEXTScan is %u onTimeRoamScan is %u " |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1444 | " onTimePnoScan is %u onTimeHs20 is %u " |
| 1445 | " numChannels is %u", |
| 1446 | pWifiRadioStat->radio, pWifiRadioStat->onTime, |
| 1447 | pWifiRadioStat->txTime, pWifiRadioStat->rxTime, |
| 1448 | pWifiRadioStat->onTimeScan, pWifiRadioStat->onTimeNbd, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1449 | pWifiRadioStat->onTimeEXTScan, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1450 | pWifiRadioStat->onTimeRoamScan, |
| 1451 | pWifiRadioStat->onTimePnoScan, |
| 1452 | pWifiRadioStat->onTimeHs20, |
| 1453 | pWifiRadioStat->numChannels); |
| 1454 | /* |
| 1455 | * Allocate a size of 4096 for the Radio stats comprising |
| 1456 | * sizeof (tSirWifiRadioStat) + numChannels * sizeof |
| 1457 | * (tSirWifiChannelStats).Each channel data is put with an |
| 1458 | * NL attribute.The size of 4096 is considered assuming that |
| 1459 | * number of channels shall not exceed beyond 60 with the |
| 1460 | * sizeof (tSirWifiChannelStats) being 24 bytes. |
| 1461 | */ |
| 1462 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1463 | vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 1464 | LL_STATS_EVENT_BUF_SIZE); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1465 | if (!vendor_event) |
| 1466 | { |
| 1467 | hddLog(VOS_TRACE_LEVEL_ERROR, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1468 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed") ); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1469 | return; |
| 1470 | } |
| 1471 | |
| 1472 | if (nla_put_u32(vendor_event, |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1473 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE, |
| 1474 | QCA_WLAN_VENDOR_ATTR_LL_STATS_TYPE_RADIO) || |
| 1475 | nla_put_u32(vendor_event, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1476 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ID, |
| 1477 | pWifiRadioStat->radio) || |
| 1478 | nla_put_u32(vendor_event, |
| 1479 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME, |
| 1480 | pWifiRadioStat->onTime) || |
| 1481 | nla_put_u32(vendor_event, |
| 1482 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_TX_TIME, |
| 1483 | pWifiRadioStat->txTime) || |
| 1484 | nla_put_u32(vendor_event, |
| 1485 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_RX_TIME, |
| 1486 | pWifiRadioStat->rxTime) || |
| 1487 | nla_put_u32(vendor_event, |
| 1488 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_SCAN, |
| 1489 | pWifiRadioStat->onTimeScan) || |
| 1490 | nla_put_u32(vendor_event, |
| 1491 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_NBD, |
| 1492 | pWifiRadioStat->onTimeNbd) || |
| 1493 | nla_put_u32(vendor_event, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 1494 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_EXTSCAN, |
| 1495 | pWifiRadioStat->onTimeEXTScan)|| |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1496 | nla_put_u32(vendor_event, |
| 1497 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_ROAM_SCAN, |
| 1498 | pWifiRadioStat->onTimeRoamScan) || |
| 1499 | nla_put_u32(vendor_event, |
| 1500 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_PNO_SCAN, |
| 1501 | pWifiRadioStat->onTimePnoScan) || |
| 1502 | nla_put_u32(vendor_event, |
| 1503 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_ON_TIME_HS20, |
| 1504 | pWifiRadioStat->onTimeHs20) || |
| 1505 | nla_put_u32(vendor_event, |
| 1506 | QCA_WLAN_VENDOR_ATTR_LL_STATS_RADIO_NUM_CHANNELS, |
| 1507 | pWifiRadioStat->numChannels)) |
| 1508 | { |
| 1509 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1510 | FL("QCA_WLAN_VENDOR_ATTR put fail")); |
| 1511 | kfree_skb(vendor_event); |
| 1512 | return ; |
| 1513 | } |
| 1514 | |
| 1515 | chList = nla_nest_start(vendor_event, |
| 1516 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1517 | if(!chList) |
| 1518 | { |
| 1519 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1520 | "%s: QCA_WLAN_VENDOR_ATTR_LL_STATS_CH_INFO put fail", |
| 1521 | __func__); |
| 1522 | kfree_skb(vendor_event); |
| 1523 | return; |
| 1524 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1525 | for (i = 0; i < pWifiRadioStat->numChannels; i++) |
| 1526 | { |
| 1527 | struct nlattr *chInfo; |
| 1528 | |
| 1529 | pWifiChannelStats = (tpSirWifiChannelStats) ((uint8*) |
| 1530 | pWifiRadioStat->channels + |
| 1531 | (i * sizeof(tSirWifiChannelStats))); |
| 1532 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1533 | chInfo = nla_nest_start(vendor_event, i); |
Sushant Kaushik | ee1f55e | 2015-01-22 11:27:01 +0530 | [diff] [blame] | 1534 | if(!chInfo) |
| 1535 | { |
| 1536 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1537 | "%s: failed to put chInfo", |
| 1538 | __func__); |
| 1539 | kfree_skb(vendor_event); |
| 1540 | return; |
| 1541 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1542 | |
| 1543 | if (nla_put_u32(vendor_event, |
| 1544 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_WIDTH, |
| 1545 | pWifiChannelStats->channel.width) || |
| 1546 | nla_put_u32(vendor_event, |
| 1547 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ, |
| 1548 | pWifiChannelStats->channel.centerFreq) || |
| 1549 | nla_put_u32(vendor_event, |
| 1550 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ0, |
| 1551 | pWifiChannelStats->channel.centerFreq0) || |
| 1552 | nla_put_u32(vendor_event, |
| 1553 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_INFO_CENTER_FREQ1, |
| 1554 | pWifiChannelStats->channel.centerFreq1) || |
| 1555 | nla_put_u32(vendor_event, |
| 1556 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME, |
| 1557 | pWifiChannelStats->onTime) || |
| 1558 | nla_put_u32(vendor_event, |
| 1559 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME, |
| 1560 | pWifiChannelStats->ccaBusyTime)) |
| 1561 | { |
| 1562 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1563 | FL("cfg80211_vendor_event_alloc failed") ); |
| 1564 | kfree_skb(vendor_event); |
| 1565 | return ; |
| 1566 | } |
| 1567 | nla_nest_end(vendor_event, chInfo); |
| 1568 | } |
| 1569 | nla_nest_end(vendor_event, chList); |
| 1570 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1571 | cfg80211_vendor_cmd_reply(vendor_event); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1572 | |
| 1573 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1574 | return; |
| 1575 | } |
| 1576 | |
| 1577 | /* |
| 1578 | * hdd_link_layer_stats_ind_callback () - This function is called after |
| 1579 | * receiving Link Layer indications from FW.This callback converts the firmware |
| 1580 | * data to the NL data and send the same to the kernel/upper layers. |
| 1581 | */ |
| 1582 | static void hdd_link_layer_stats_ind_callback ( void *pCtx, |
| 1583 | int indType, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1584 | void *pRsp, u8 *macAddr) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1585 | { |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1586 | hdd_context_t *pHddCtx = (hdd_context_t *)pCtx; |
| 1587 | hdd_adapter_t *pAdapter = NULL; |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1588 | struct hdd_ll_stats_context *context; |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1589 | tpSirLLStatsResults linkLayerStatsResults = (tpSirLLStatsResults)pRsp; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1590 | int status; |
| 1591 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1592 | ENTER(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1593 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1594 | status = wlan_hdd_validate_context(pHddCtx); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1595 | if (0 != status) |
| 1596 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1597 | return; |
| 1598 | } |
| 1599 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1600 | pAdapter = hdd_get_adapter_by_macaddr(pHddCtx, macAddr); |
| 1601 | if (NULL == pAdapter) |
| 1602 | { |
| 1603 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1604 | FL(" MAC address %pM does not exist with host"), |
| 1605 | macAddr); |
| 1606 | return; |
| 1607 | } |
| 1608 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1609 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1610 | "%s: Interface: %s LLStats indType: %d", __func__, |
| 1611 | pAdapter->dev->name, indType); |
| 1612 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1613 | switch (indType) |
| 1614 | { |
| 1615 | case SIR_HAL_LL_STATS_RESULTS_RSP: |
| 1616 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1617 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 1618 | "LL_STATS RESP paramID = 0x%x, ifaceId = %u MAC: %pM " |
| 1619 | "respId = %u, moreResultToFollow = %u", |
| 1620 | linkLayerStatsResults->paramId, linkLayerStatsResults->ifaceId, |
| 1621 | macAddr, linkLayerStatsResults->respId, |
| 1622 | linkLayerStatsResults->moreResultToFollow); |
| 1623 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1624 | spin_lock(&hdd_context_lock); |
| 1625 | context = &pHddCtx->ll_stats_context; |
| 1626 | /* validate response received from target */ |
| 1627 | if ((context->request_id != linkLayerStatsResults->respId) || |
| 1628 | !(context->request_bitmap & linkLayerStatsResults->paramId)) |
| 1629 | { |
| 1630 | spin_unlock(&hdd_context_lock); |
| 1631 | hddLog(LOGE, |
| 1632 | FL("Error : Request id %d response id %d request bitmap 0x%x" |
| 1633 | "response bitmap 0x%x"), |
| 1634 | context->request_id, linkLayerStatsResults->respId, |
| 1635 | context->request_bitmap, linkLayerStatsResults->paramId); |
| 1636 | return; |
| 1637 | } |
| 1638 | spin_unlock(&hdd_context_lock); |
| 1639 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1640 | if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_RADIO ) |
| 1641 | { |
| 1642 | hdd_link_layer_process_radio_stats(pAdapter, |
| 1643 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1644 | spin_lock(&hdd_context_lock); |
| 1645 | context->request_bitmap &= ~(WMI_LINK_STATS_RADIO); |
| 1646 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1647 | } |
| 1648 | else if ( linkLayerStatsResults->paramId & WMI_LINK_STATS_IFACE ) |
| 1649 | { |
| 1650 | hdd_link_layer_process_iface_stats(pAdapter, |
| 1651 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1652 | spin_lock(&hdd_context_lock); |
| 1653 | context->request_bitmap &= ~(WMI_LINK_STATS_IFACE); |
| 1654 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1655 | } |
| 1656 | else if ( linkLayerStatsResults->paramId & |
| 1657 | WMI_LINK_STATS_ALL_PEER ) |
| 1658 | { |
| 1659 | hdd_link_layer_process_peer_stats(pAdapter, |
| 1660 | (v_VOID_t *)linkLayerStatsResults->result); |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1661 | spin_lock(&hdd_context_lock); |
| 1662 | context->request_bitmap &= ~(WMI_LINK_STATS_ALL_PEER); |
| 1663 | spin_unlock(&hdd_context_lock); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1664 | } /* WMI_LINK_STATS_ALL_PEER */ |
| 1665 | else |
| 1666 | { |
| 1667 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1668 | FL("INVALID LL_STATS_NOTIFY RESPONSE ***********")); |
| 1669 | } |
| 1670 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1671 | spin_lock(&hdd_context_lock); |
| 1672 | /* complete response event if all requests are completed */ |
| 1673 | if (0 == context->request_bitmap) |
| 1674 | complete(&context->response_event); |
| 1675 | spin_unlock(&hdd_context_lock); |
| 1676 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1677 | break; |
| 1678 | } |
| 1679 | default: |
| 1680 | hddLog(VOS_TRACE_LEVEL_ERROR, "invalid event type %d", indType); |
| 1681 | break; |
| 1682 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1683 | |
| 1684 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1685 | return; |
| 1686 | } |
| 1687 | |
| 1688 | const struct |
| 1689 | nla_policy |
| 1690 | qca_wlan_vendor_ll_set_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX +1] = |
| 1691 | { |
| 1692 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD] = |
| 1693 | { .type = NLA_U32 }, |
| 1694 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING] = |
| 1695 | { .type = NLA_U32 }, |
| 1696 | }; |
| 1697 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1698 | static int __wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1699 | struct wireless_dev *wdev, |
| 1700 | const void *data, |
| 1701 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1702 | { |
| 1703 | int status; |
| 1704 | 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] | 1705 | tSirLLStatsSetReq linkLayerStatsSetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1706 | struct net_device *dev = wdev->netdev; |
| 1707 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1708 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1709 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1710 | ENTER(); |
| 1711 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1712 | status = wlan_hdd_validate_context(pHddCtx); |
| 1713 | if (0 != status) |
| 1714 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1715 | return -EINVAL; |
| 1716 | } |
| 1717 | |
| 1718 | if (NULL == pAdapter) |
| 1719 | { |
| 1720 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1721 | FL("HDD adapter is Null")); |
| 1722 | return -ENODEV; |
| 1723 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1724 | /* check the LLStats Capability */ |
| 1725 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1726 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1727 | { |
| 1728 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1729 | FL("Link Layer Statistics not supported by Firmware")); |
| 1730 | return -EINVAL; |
| 1731 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1732 | |
| 1733 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX, |
| 1734 | (struct nlattr *)data, |
| 1735 | data_len, qca_wlan_vendor_ll_set_policy)) |
| 1736 | { |
| 1737 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1738 | return -EINVAL; |
| 1739 | } |
| 1740 | if (!tb_vendor |
| 1741 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]) |
| 1742 | { |
| 1743 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("MPDU size Not present")); |
| 1744 | return -EINVAL; |
| 1745 | } |
| 1746 | if (!tb_vendor[ |
| 1747 | QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]) |
| 1748 | { |
| 1749 | hddLog(VOS_TRACE_LEVEL_ERROR, FL(" Stats Gathering Not Present")); |
| 1750 | return -EINVAL; |
| 1751 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1752 | // 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] | 1753 | linkLayerStatsSetReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1754 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1755 | linkLayerStatsSetReq.mpduSizeThreshold = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1756 | nla_get_u32( |
| 1757 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_MPDU_SIZE_THRESHOLD]); |
| 1758 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1759 | linkLayerStatsSetReq.aggressiveStatisticsGathering = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1760 | nla_get_u32( |
| 1761 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_CONFIG_AGGRESSIVE_STATS_GATHERING]); |
| 1762 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1763 | vos_mem_copy(linkLayerStatsSetReq.macAddr, |
| 1764 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1765 | |
| 1766 | |
| 1767 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 1768 | "LL_STATS_SET reqId = %d, MAC = %pM, mpduSizeThreshold = %d " |
| 1769 | "Statistics Gathering = %d ", |
| 1770 | linkLayerStatsSetReq.reqId, linkLayerStatsSetReq.macAddr, |
| 1771 | linkLayerStatsSetReq.mpduSizeThreshold, |
| 1772 | linkLayerStatsSetReq.aggressiveStatisticsGathering); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1773 | |
| 1774 | if (eHAL_STATUS_SUCCESS != sme_SetLinkLayerStatsIndCB( |
| 1775 | pHddCtx->hHal, |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1776 | hdd_link_layer_stats_ind_callback)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1777 | { |
| 1778 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1779 | "sme_SetLinkLayerStatsIndCB Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1780 | return -EINVAL; |
| 1781 | |
| 1782 | } |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 1783 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1784 | if (eHAL_STATUS_SUCCESS != sme_LLStatsSetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1785 | &linkLayerStatsSetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1786 | { |
| 1787 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1788 | "sme_LLStatsSetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1789 | return -EINVAL; |
| 1790 | } |
| 1791 | |
| 1792 | pAdapter->isLinkLayerStatsSet = 1; |
| 1793 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1794 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1795 | return 0; |
| 1796 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1797 | static int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy, |
| 1798 | struct wireless_dev *wdev, |
| 1799 | const void *data, |
| 1800 | int data_len) |
| 1801 | { |
| 1802 | int ret = 0; |
| 1803 | |
| 1804 | vos_ssr_protect(__func__); |
| 1805 | ret = __wlan_hdd_cfg80211_ll_stats_set(wiphy, wdev, data, data_len); |
| 1806 | vos_ssr_unprotect(__func__); |
| 1807 | |
| 1808 | return ret; |
| 1809 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1810 | |
| 1811 | const struct |
| 1812 | nla_policy |
| 1813 | qca_wlan_vendor_ll_get_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX +1] = |
| 1814 | { |
| 1815 | /* Unsigned 32bit value provided by the caller issuing the GET stats |
| 1816 | * command. When reporting |
| 1817 | * the stats results, the driver uses the same value to indicate |
| 1818 | * which GET request the results |
| 1819 | * correspond to. |
| 1820 | */ |
| 1821 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID] = { .type = NLA_U32 }, |
| 1822 | |
| 1823 | /* Unsigned 32bit value . bit mask to identify what statistics are |
| 1824 | requested for retrieval */ |
| 1825 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK] = { .type = NLA_U32 }, |
| 1826 | }; |
| 1827 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1828 | static int __wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1829 | struct wireless_dev *wdev, |
| 1830 | const void *data, |
| 1831 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1832 | { |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1833 | unsigned long rc; |
| 1834 | struct hdd_ll_stats_context *context; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1835 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1836 | 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] | 1837 | tSirLLStatsGetReq linkLayerStatsGetReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1838 | struct net_device *dev = wdev->netdev; |
| 1839 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 1840 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1841 | int status; |
| 1842 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1843 | ENTER(); |
| 1844 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1845 | status = wlan_hdd_validate_context(pHddCtx); |
| 1846 | if (0 != status) |
| 1847 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1848 | return -EINVAL ; |
| 1849 | } |
| 1850 | |
| 1851 | if (NULL == pAdapter) |
| 1852 | { |
| 1853 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1854 | "%s: HDD adapter is Null", __func__); |
| 1855 | return -ENODEV; |
| 1856 | } |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 1857 | |
| 1858 | if (pHddStaCtx == NULL) |
| 1859 | { |
| 1860 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 1861 | "%s: HddStaCtx is Null", __func__); |
| 1862 | return -ENODEV; |
| 1863 | } |
| 1864 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1865 | /* check the LLStats Capability */ |
| 1866 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 1867 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 1868 | { |
| 1869 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 1870 | FL("Link Layer Statistics not supported by Firmware")); |
| 1871 | return -EINVAL; |
| 1872 | } |
| 1873 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1874 | |
| 1875 | if (!pAdapter->isLinkLayerStatsSet) |
| 1876 | { |
Sushant Kaushik | dc3184b | 2015-10-09 12:00:21 +0530 | [diff] [blame] | 1877 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1878 | "%s: isLinkLayerStatsSet : %d", |
| 1879 | __func__, pAdapter->isLinkLayerStatsSet); |
| 1880 | return -EINVAL; |
| 1881 | } |
| 1882 | |
Mukul Sharma | 10313ba | 2015-07-29 19:14:39 +0530 | [diff] [blame] | 1883 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 1884 | { |
| 1885 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 1886 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 1887 | return -EBUSY; |
| 1888 | } |
| 1889 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1890 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX, |
| 1891 | (struct nlattr *)data, |
| 1892 | data_len, qca_wlan_vendor_ll_get_policy)) |
| 1893 | { |
| 1894 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 1895 | return -EINVAL; |
| 1896 | } |
| 1897 | |
| 1898 | if (!tb_vendor |
| 1899 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]) |
| 1900 | { |
| 1901 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Request Id Not present")); |
| 1902 | return -EINVAL; |
| 1903 | } |
| 1904 | |
| 1905 | if (!tb_vendor |
| 1906 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]) |
| 1907 | { |
| 1908 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Req Mask Not present")); |
| 1909 | return -EINVAL; |
| 1910 | } |
| 1911 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1912 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1913 | linkLayerStatsGetReq.reqId = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1914 | nla_get_u32( tb_vendor[ |
| 1915 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_ID]); |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1916 | linkLayerStatsGetReq.paramIdMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1917 | nla_get_u32( tb_vendor[ |
| 1918 | QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_CONFIG_REQ_MASK]); |
| 1919 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 1920 | vos_mem_copy(linkLayerStatsGetReq.macAddr, |
| 1921 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1922 | |
| 1923 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 1924 | "LL_STATS_GET reqId = %d, MAC = %pM, paramIdMask = %d", |
| 1925 | linkLayerStatsGetReq.reqId, linkLayerStatsGetReq.macAddr, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1926 | linkLayerStatsGetReq.paramIdMask); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1927 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1928 | spin_lock(&hdd_context_lock); |
| 1929 | context = &pHddCtx->ll_stats_context; |
| 1930 | context->request_id = linkLayerStatsGetReq.reqId; |
| 1931 | context->request_bitmap = linkLayerStatsGetReq.paramIdMask; |
| 1932 | INIT_COMPLETION(context->response_event); |
| 1933 | spin_unlock(&hdd_context_lock); |
| 1934 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1935 | if (eHAL_STATUS_SUCCESS != sme_LLStatsGetReq( pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 1936 | &linkLayerStatsGetReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1937 | { |
| 1938 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 1939 | "sme_LLStatsGetReq Failed", __func__); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1940 | return -EINVAL; |
| 1941 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1942 | |
mukul sharma | 4bd8d2e | 2015-08-13 20:33:25 +0530 | [diff] [blame] | 1943 | rc = wait_for_completion_timeout(&context->response_event, |
| 1944 | msecs_to_jiffies(WLAN_WAIT_TIME_LL_STATS)); |
| 1945 | if (!rc) |
| 1946 | { |
| 1947 | hddLog(LOGE, |
| 1948 | FL("Target response timed out request id %d request bitmap 0x%x"), |
| 1949 | context->request_id, context->request_bitmap); |
| 1950 | return -ETIMEDOUT; |
| 1951 | } |
| 1952 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1953 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1954 | return 0; |
| 1955 | } |
| 1956 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1957 | static int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy, |
| 1958 | struct wireless_dev *wdev, |
| 1959 | const void *data, |
| 1960 | int data_len) |
| 1961 | { |
| 1962 | int ret = 0; |
| 1963 | |
| 1964 | vos_ssr_protect(__func__); |
| 1965 | ret = __wlan_hdd_cfg80211_ll_stats_get(wiphy, wdev, data, data_len); |
| 1966 | vos_ssr_unprotect(__func__); |
| 1967 | |
| 1968 | return ret; |
| 1969 | } |
| 1970 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1971 | const struct |
| 1972 | nla_policy |
| 1973 | qca_wlan_vendor_ll_clr_policy[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX +1] = |
| 1974 | { |
| 1975 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] = {.type = NLA_U32 }, |
| 1976 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ] = {.type = NLA_U8 }, |
| 1977 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK] = {.type = NLA_U32 }, |
| 1978 | [QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP] = {.type = NLA_U8 }, |
| 1979 | }; |
| 1980 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 1981 | static int __wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 1982 | struct wireless_dev *wdev, |
| 1983 | const void *data, |
| 1984 | int data_len) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1985 | { |
| 1986 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 1987 | 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] | 1988 | tSirLLStatsClearReq linkLayerStatsClearReq; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1989 | struct net_device *dev = wdev->netdev; |
| 1990 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1991 | u32 statsClearReqMask; |
| 1992 | u8 stopReq; |
| 1993 | int status; |
| 1994 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 1995 | ENTER(); |
| 1996 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 1997 | status = wlan_hdd_validate_context(pHddCtx); |
| 1998 | if (0 != status) |
| 1999 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2000 | return -EINVAL; |
| 2001 | } |
| 2002 | |
| 2003 | if (NULL == pAdapter) |
| 2004 | { |
| 2005 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2006 | "%s: HDD adapter is Null", __func__); |
| 2007 | return -ENODEV; |
| 2008 | } |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2009 | /* check the LLStats Capability */ |
| 2010 | if ( (TRUE != pHddCtx->cfg_ini->fEnableLLStats) || |
| 2011 | (TRUE != sme_IsFeatureSupportedByFW(LINK_LAYER_STATS_MEAS))) |
| 2012 | { |
| 2013 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2014 | FL("Enable LLStats Capability")); |
| 2015 | return -EINVAL; |
| 2016 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2017 | |
| 2018 | if (!pAdapter->isLinkLayerStatsSet) |
| 2019 | { |
| 2020 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 2021 | "%s: isLinkLayerStatsSet : %d", |
| 2022 | __func__, pAdapter->isLinkLayerStatsSet); |
| 2023 | return -EINVAL; |
| 2024 | } |
| 2025 | |
| 2026 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX, |
| 2027 | (struct nlattr *)data, |
| 2028 | data_len, qca_wlan_vendor_ll_clr_policy)) |
| 2029 | { |
| 2030 | hddLog(VOS_TRACE_LEVEL_ERROR, FL() ); |
| 2031 | return -EINVAL; |
| 2032 | } |
| 2033 | |
| 2034 | if (!tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK] || |
| 2035 | |
| 2036 | !tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]) |
| 2037 | { |
| 2038 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Error in LL_STATS CLR CONFIG PARA") ); |
| 2039 | return -EINVAL; |
| 2040 | |
| 2041 | } |
| 2042 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2043 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2044 | statsClearReqMask = linkLayerStatsClearReq.statsClearReqMask = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2045 | nla_get_u32( |
| 2046 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_REQ_MASK]); |
| 2047 | |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2048 | stopReq = linkLayerStatsClearReq.stopReq = |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2049 | nla_get_u8( |
| 2050 | tb_vendor[QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_REQ]); |
| 2051 | |
| 2052 | // 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] | 2053 | linkLayerStatsClearReq.reqId = 1; |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2054 | |
Dino Mycle | d3d5002 | 2014-07-07 12:58:25 +0530 | [diff] [blame] | 2055 | vos_mem_copy(linkLayerStatsClearReq.macAddr, |
| 2056 | pAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2057 | |
| 2058 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 81a730c | 2015-09-14 14:49:52 +0530 | [diff] [blame] | 2059 | "LL_STATS_CLEAR reqId = %d, MAC = %pM," |
| 2060 | "statsClearReqMask = 0x%X, stopReq = %d", |
| 2061 | linkLayerStatsClearReq.reqId, |
| 2062 | linkLayerStatsClearReq.macAddr, |
| 2063 | linkLayerStatsClearReq.statsClearReqMask, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2064 | linkLayerStatsClearReq.stopReq); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2065 | |
| 2066 | if (eHAL_STATUS_SUCCESS == sme_LLStatsClearReq(pHddCtx->hHal, |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2067 | &linkLayerStatsClearReq)) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2068 | { |
| 2069 | struct sk_buff *temp_skbuff; |
Srinivas Dasari | 9894743 | 2014-11-07 19:41:24 +0530 | [diff] [blame] | 2070 | hdd_station_ctx_t *pHddStaCtx; |
| 2071 | |
| 2072 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2073 | if (VOS_STATUS_SUCCESS != |
| 2074 | WLANTL_ClearInterfaceStats((WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 2075 | pHddStaCtx->conn_info.staId[0], statsClearReqMask)) |
| 2076 | { |
| 2077 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s:" |
| 2078 | "WLANTL_ClearInterfaceStats Failed", __func__); |
| 2079 | return -EINVAL; |
| 2080 | } |
| 2081 | if ((statsClearReqMask & WIFI_STATS_IFACE_AC) || |
| 2082 | (statsClearReqMask & WIFI_STATS_IFACE)) { |
| 2083 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VO] = 0; |
| 2084 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_VI] = 0; |
| 2085 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BE] = 0; |
| 2086 | pAdapter->hdd_stats.hddTxRxStats.txMcast[WLANTL_AC_BK] = 0; |
| 2087 | } |
| 2088 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2089 | temp_skbuff = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 2090 | 2 * sizeof(u32) + |
| 2091 | NLMSG_HDRLEN); |
| 2092 | |
| 2093 | if (temp_skbuff != NULL) |
| 2094 | { |
| 2095 | |
| 2096 | if (nla_put_u32(temp_skbuff, |
| 2097 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_RSP_MASK, |
| 2098 | statsClearReqMask) || |
| 2099 | nla_put_u32(temp_skbuff, |
| 2100 | QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_CONFIG_STOP_RSP, |
| 2101 | stopReq)) |
| 2102 | { |
| 2103 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("LL_STATS_CLR put fail")); |
| 2104 | kfree_skb(temp_skbuff); |
| 2105 | return -EINVAL; |
| 2106 | } |
| 2107 | /* If the ask is to stop the stats collection as part of clear |
| 2108 | * (stopReq = 1) , ensure that no further requests of get |
| 2109 | * go to the firmware by having isLinkLayerStatsSet set to 0. |
| 2110 | * However it the stopReq as part of the clear request is 0 , |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2111 | * the request to get the statistics are honoured as in this |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2112 | * case the firmware is just asked to clear the statistics. |
| 2113 | */ |
Dino Mycle | df0a5d9 | 2014-07-04 09:41:55 +0530 | [diff] [blame] | 2114 | if (linkLayerStatsClearReq.stopReq == 1) |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2115 | pAdapter->isLinkLayerStatsSet = 0; |
| 2116 | return cfg80211_vendor_cmd_reply(temp_skbuff); |
| 2117 | } |
| 2118 | return -ENOMEM; |
| 2119 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2120 | |
| 2121 | EXIT(); |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2122 | return -EINVAL; |
| 2123 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 2124 | static int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy, |
| 2125 | struct wireless_dev *wdev, |
| 2126 | const void *data, |
| 2127 | int data_len) |
| 2128 | { |
| 2129 | int ret = 0; |
| 2130 | |
| 2131 | vos_ssr_protect(__func__); |
| 2132 | ret = __wlan_hdd_cfg80211_ll_stats_clear(wiphy, wdev, data, data_len); |
| 2133 | vos_ssr_unprotect(__func__); |
| 2134 | |
| 2135 | return ret; |
| 2136 | |
| 2137 | |
| 2138 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 2139 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
| 2140 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2141 | #ifdef WLAN_FEATURE_EXTSCAN |
| 2142 | static const struct nla_policy |
| 2143 | wlan_hdd_extscan_config_policy |
| 2144 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1] = |
| 2145 | { |
| 2146 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID] = |
| 2147 | { .type = NLA_U32 }, |
| 2148 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND] = |
| 2149 | { .type = NLA_U32 }, |
| 2150 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL] = { .type = NLA_U32 }, |
| 2151 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME] = |
| 2152 | { .type = NLA_U32 }, |
| 2153 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE] = { .type = NLA_U8 }, |
| 2154 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CLASS] = { .type = NLA_U8 }, |
| 2155 | |
| 2156 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX] = { .type = NLA_U8 }, |
| 2157 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND] = { .type = NLA_U8 }, |
| 2158 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD] = { .type = NLA_U32 }, |
| 2159 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS] = |
| 2160 | { .type = NLA_U8 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2161 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD] = |
| 2162 | { .type = NLA_U32 }, |
| 2163 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT] = |
| 2164 | { .type = NLA_U32 }, |
| 2165 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT] = |
| 2166 | { .type = NLA_U32 }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2167 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS] = |
| 2168 | { .type = NLA_U32 }, |
| 2169 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD] = |
| 2170 | { .type = NLA_U32 }, |
| 2171 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN] = |
| 2172 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2173 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT] = |
| 2174 | { .type = NLA_U8 }, |
| 2175 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS] = |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2176 | { .type = NLA_U8 }, |
| 2177 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS] = |
| 2178 | { .type = NLA_U8 }, |
| 2179 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH] = |
| 2180 | { .type = NLA_U8 }, |
| 2181 | |
| 2182 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_MAX] = |
| 2183 | { .type = NLA_U32 }, |
| 2184 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID] = |
| 2185 | { .type = NLA_UNSPEC }, |
| 2186 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW] = |
| 2187 | { .type = NLA_S32 }, |
| 2188 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2189 | { .type = NLA_S32 }, |
| 2190 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_CHANNEL] = |
| 2191 | { .type = NLA_U32 }, |
| 2192 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP] = |
| 2193 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2194 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE] = |
| 2195 | { .type = NLA_U32 }, |
| 2196 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID] = |
| 2197 | { .type = NLA_BINARY, |
| 2198 | .len = IEEE80211_MAX_SSID_LEN + 1 }, |
| 2199 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE] = |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2200 | { .type = NLA_U32 }, |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2201 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID] = |
| 2202 | { .type = NLA_U32 }, |
| 2203 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND] = |
| 2204 | { .type = NLA_U8 }, |
| 2205 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW] = |
| 2206 | { .type = NLA_S32 }, |
| 2207 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH] = |
| 2208 | { .type = NLA_S32 }, |
| 2209 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_CONFIGURATION_FLAGS] = |
| 2210 | { .type = NLA_U32 }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2211 | }; |
| 2212 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2213 | /** |
| 2214 | * wlan_hdd_cfg80211_extscan_get_capabilities_rsp() - response from target |
| 2215 | * @ctx: hdd global context |
| 2216 | * @data: capabilities data |
| 2217 | * |
| 2218 | * Return: none |
| 2219 | */ |
| 2220 | static void |
| 2221 | wlan_hdd_cfg80211_extscan_get_capabilities_rsp(void *ctx, void *pMsg) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2222 | { |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2223 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2224 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2225 | tSirEXTScanCapabilitiesEvent *data = |
| 2226 | (tSirEXTScanCapabilitiesEvent *) pMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2227 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2228 | ENTER(); |
| 2229 | |
| 2230 | if (wlan_hdd_validate_context(pHddCtx)) |
| 2231 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2232 | return; |
| 2233 | } |
| 2234 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2235 | if (!pMsg) |
| 2236 | { |
| 2237 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2238 | return; |
| 2239 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2240 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2241 | vos_spin_lock_acquire(&hdd_context_lock); |
| 2242 | |
| 2243 | context = &pHddCtx->ext_scan_context; |
| 2244 | /* validate response received from target*/ |
| 2245 | if (context->request_id != data->requestId) |
| 2246 | { |
| 2247 | vos_spin_lock_release(&hdd_context_lock); |
| 2248 | hddLog(LOGE, |
| 2249 | FL("Target response id did not match: request_id %d resposne_id %d"), |
| 2250 | context->request_id, data->requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2251 | return; |
| 2252 | } |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2253 | else |
| 2254 | { |
| 2255 | context->capability_response = *data; |
| 2256 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2257 | } |
| 2258 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2259 | vos_spin_lock_release(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2260 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2261 | return; |
| 2262 | } |
| 2263 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2264 | /* |
| 2265 | * define short names for the global vendor params |
| 2266 | * used by wlan_hdd_send_ext_scan_capability() |
| 2267 | */ |
| 2268 | #define PARAM_REQUEST_ID \ |
| 2269 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID |
| 2270 | #define PARAM_STATUS \ |
| 2271 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_STATUS |
| 2272 | #define MAX_SCAN_CACHE_SIZE \ |
| 2273 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_CACHE_SIZE |
| 2274 | #define MAX_SCAN_BUCKETS \ |
| 2275 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_BUCKETS |
| 2276 | #define MAX_AP_CACHE_PER_SCAN \ |
| 2277 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_AP_CACHE_PER_SCAN |
| 2278 | #define MAX_RSSI_SAMPLE_SIZE \ |
| 2279 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_RSSI_SAMPLE_SIZE |
| 2280 | #define MAX_SCAN_RPT_THRHOLD \ |
| 2281 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_SCAN_REPORTING_THRESHOLD |
| 2282 | #define MAX_HOTLIST_BSSIDS \ |
| 2283 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_BSSIDS |
| 2284 | #define MAX_BSSID_HISTORY_ENTRIES \ |
| 2285 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_BSSID_HISTORY_ENTRIES |
| 2286 | #define MAX_HOTLIST_SSIDS \ |
| 2287 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CAPABILITIES_MAX_HOTLIST_SSIDS |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2288 | #define MAX_SIGNIFICANT_WIFI_CHANGE_APS \ |
| 2289 | 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] | 2290 | |
| 2291 | static int wlan_hdd_send_ext_scan_capability(void *ctx) |
| 2292 | { |
| 2293 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2294 | struct sk_buff *skb = NULL; |
| 2295 | int ret; |
| 2296 | tSirEXTScanCapabilitiesEvent *data; |
| 2297 | tANI_U32 nl_buf_len; |
| 2298 | |
| 2299 | ret = wlan_hdd_validate_context(pHddCtx); |
| 2300 | if (0 != ret) |
| 2301 | { |
| 2302 | return ret; |
| 2303 | } |
| 2304 | |
| 2305 | data = &(pHddCtx->ext_scan_context.capability_response); |
| 2306 | |
| 2307 | nl_buf_len = NLMSG_HDRLEN; |
| 2308 | nl_buf_len += (sizeof(data->requestId) + NLA_HDRLEN) + |
| 2309 | (sizeof(data->status) + NLA_HDRLEN) + |
| 2310 | (sizeof(data->scanCacheSize) + NLA_HDRLEN) + |
| 2311 | (sizeof(data->scanBuckets) + NLA_HDRLEN) + |
| 2312 | (sizeof(data->maxApPerScan) + NLA_HDRLEN) + |
| 2313 | (sizeof(data->maxRssiSampleSize) + NLA_HDRLEN) + |
| 2314 | (sizeof(data->maxScanReportingThreshold) + NLA_HDRLEN) + |
| 2315 | (sizeof(data->maxHotlistAPs) + NLA_HDRLEN) + |
| 2316 | (sizeof(data->maxBsidHistoryEntries) + NLA_HDRLEN) + |
| 2317 | (sizeof(data->maxHotlistSSIDs) + NLA_HDRLEN); |
| 2318 | |
| 2319 | skb = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, nl_buf_len); |
| 2320 | |
| 2321 | if (!skb) |
| 2322 | { |
| 2323 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 2324 | return -ENOMEM; |
| 2325 | } |
| 2326 | |
| 2327 | hddLog(LOG1, "Req Id (%u) Status (%u)", data->requestId, data->status); |
| 2328 | hddLog(LOG1, "Scan cache size (%u) Scan buckets (%u) Max AP per scan (%u)", |
| 2329 | data->scanCacheSize, data->scanBuckets, data->maxApPerScan); |
| 2330 | hddLog(LOG1, "max_rssi_sample_size (%u) max_scan_reporting_threshold (%u)", |
| 2331 | data->maxRssiSampleSize, data->maxScanReportingThreshold); |
| 2332 | hddLog(LOG1, "max_hotlist_bssids (%u) max_bssid_history_entries (%u)" |
| 2333 | "max_hotlist_ssids (%u)", data->maxHotlistAPs, |
| 2334 | data->maxBsidHistoryEntries, data->maxHotlistSSIDs); |
| 2335 | |
| 2336 | if (nla_put_u32(skb, PARAM_REQUEST_ID, data->requestId) || |
| 2337 | nla_put_u32(skb, PARAM_STATUS, data->status) || |
| 2338 | nla_put_u32(skb, MAX_SCAN_CACHE_SIZE, data->scanCacheSize) || |
| 2339 | nla_put_u32(skb, MAX_SCAN_BUCKETS, data->scanBuckets) || |
| 2340 | nla_put_u32(skb, MAX_AP_CACHE_PER_SCAN, |
| 2341 | data->maxApPerScan) || |
| 2342 | nla_put_u32(skb, MAX_RSSI_SAMPLE_SIZE, |
| 2343 | data->maxRssiSampleSize) || |
| 2344 | nla_put_u32(skb, MAX_SCAN_RPT_THRHOLD, |
| 2345 | data->maxScanReportingThreshold) || |
| 2346 | nla_put_u32(skb, MAX_HOTLIST_BSSIDS, data->maxHotlistAPs) || |
| 2347 | nla_put_u32(skb, MAX_BSSID_HISTORY_ENTRIES, |
| 2348 | data->maxBsidHistoryEntries) || |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2349 | nla_put_u32(skb, MAX_HOTLIST_SSIDS, data->maxHotlistSSIDs) || |
| 2350 | nla_put_u32(skb, MAX_SIGNIFICANT_WIFI_CHANGE_APS, 0)) |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2351 | { |
| 2352 | hddLog(LOGE, FL("nla put fail")); |
| 2353 | goto nla_put_failure; |
| 2354 | } |
| 2355 | |
| 2356 | cfg80211_vendor_cmd_reply(skb); |
| 2357 | return 0; |
| 2358 | |
| 2359 | nla_put_failure: |
| 2360 | kfree_skb(skb); |
| 2361 | return -EINVAL;; |
| 2362 | } |
| 2363 | |
| 2364 | /* |
| 2365 | * done with short names for the global vendor params |
| 2366 | * used by wlan_hdd_send_ext_scan_capability() |
| 2367 | */ |
| 2368 | #undef PARAM_REQUEST_ID |
| 2369 | #undef PARAM_STATUS |
| 2370 | #undef MAX_SCAN_CACHE_SIZE |
| 2371 | #undef MAX_SCAN_BUCKETS |
| 2372 | #undef MAX_AP_CACHE_PER_SCAN |
| 2373 | #undef MAX_RSSI_SAMPLE_SIZE |
| 2374 | #undef MAX_SCAN_RPT_THRHOLD |
| 2375 | #undef MAX_HOTLIST_BSSIDS |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 2376 | #undef MAX_BSSID_HISTORY_ENTRIES |
| 2377 | #undef MAX_HOTLIST_SSIDS |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2378 | |
| 2379 | static void wlan_hdd_cfg80211_extscan_start_rsp(void *ctx, void *pMsg) |
| 2380 | { |
| 2381 | tpSirEXTScanStartRspParams pData = (tpSirEXTScanStartRspParams) pMsg; |
| 2382 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2383 | tpAniSirGlobal pMac = PMAC_STRUCT( pHddCtx->hHal ); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2384 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2385 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2386 | ENTER(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2387 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2388 | if (wlan_hdd_validate_context(pHddCtx)) |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2389 | return; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2390 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2391 | if (!pMsg) |
| 2392 | { |
| 2393 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2394 | return; |
| 2395 | } |
| 2396 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2397 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2398 | hddLog(VOS_TRACE_LEVEL_INFO, "Status (%u)", pData->status); |
| 2399 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2400 | context = &pHddCtx->ext_scan_context; |
| 2401 | spin_lock(&hdd_context_lock); |
| 2402 | if (context->request_id == pData->requestId) { |
| 2403 | context->response_status = pData->status ? -EINVAL : 0; |
| 2404 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2405 | } |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 2406 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2407 | |
| 2408 | /* |
| 2409 | * Store the Request ID for comparing with the requestID obtained |
| 2410 | * in other requests.HDD shall return a failure is the extscan_stop |
| 2411 | * request is issued with a different requestId as that of the |
| 2412 | * extscan_start request. Also, This requestId shall be used while |
| 2413 | * indicating the full scan results to the upper layers. |
| 2414 | * The requestId is stored with the assumption that the firmware |
| 2415 | * shall return the ext scan start request's requestId in ext scan |
| 2416 | * start response. |
| 2417 | */ |
| 2418 | if (pData->status == 0) |
| 2419 | pMac->sme.extScanStartReqId = pData->requestId; |
| 2420 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2421 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2422 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2423 | } |
| 2424 | |
| 2425 | |
| 2426 | static void wlan_hdd_cfg80211_extscan_stop_rsp(void *ctx, void *pMsg) |
| 2427 | { |
| 2428 | tpSirEXTScanStopRspParams pData = (tpSirEXTScanStopRspParams) pMsg; |
| 2429 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2430 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2431 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2432 | ENTER(); |
| 2433 | |
| 2434 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2435 | return; |
| 2436 | } |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2437 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2438 | if (!pMsg) |
| 2439 | { |
| 2440 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2441 | return; |
| 2442 | } |
| 2443 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2444 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2445 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2446 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2447 | context = &pHddCtx->ext_scan_context; |
| 2448 | spin_lock(&hdd_context_lock); |
| 2449 | if (context->request_id == pData->requestId) { |
| 2450 | context->response_status = pData->status ? -EINVAL : 0; |
| 2451 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2452 | } |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 2453 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2454 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2455 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2456 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2457 | } |
| 2458 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2459 | static void wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(void *ctx, |
| 2460 | void *pMsg) |
| 2461 | { |
| 2462 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2463 | tpSirEXTScanSetBssidHotListRspParams pData = |
| 2464 | (tpSirEXTScanSetBssidHotListRspParams) pMsg; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2465 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2466 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2467 | ENTER(); |
| 2468 | |
| 2469 | if (wlan_hdd_validate_context(pHddCtx)){ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2470 | return; |
| 2471 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2472 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2473 | if (!pMsg) |
| 2474 | { |
| 2475 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2476 | return; |
| 2477 | } |
| 2478 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2479 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2480 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2481 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2482 | context = &pHddCtx->ext_scan_context; |
| 2483 | spin_lock(&hdd_context_lock); |
| 2484 | if (context->request_id == pData->requestId) { |
| 2485 | context->response_status = pData->status ? -EINVAL : 0; |
| 2486 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2487 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2488 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2489 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2490 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2491 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2492 | } |
| 2493 | |
| 2494 | static void wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(void *ctx, |
| 2495 | void *pMsg) |
| 2496 | { |
| 2497 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2498 | tpSirEXTScanResetBssidHotlistRspParams pData = |
| 2499 | (tpSirEXTScanResetBssidHotlistRspParams) pMsg; |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2500 | struct hdd_ext_scan_context *context; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2501 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2502 | ENTER(); |
| 2503 | |
| 2504 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2505 | return; |
| 2506 | } |
| 2507 | if (!pMsg) |
| 2508 | { |
| 2509 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2510 | return; |
| 2511 | } |
| 2512 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2513 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2514 | pData->status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2515 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2516 | context = &pHddCtx->ext_scan_context; |
| 2517 | spin_lock(&hdd_context_lock); |
| 2518 | if (context->request_id == pData->requestId) { |
| 2519 | context->response_status = pData->status ? -EINVAL : 0; |
| 2520 | complete(&context->response_event); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2521 | } |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 2522 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2523 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2524 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2525 | return; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2526 | } |
| 2527 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 2528 | static void wlan_hdd_cfg80211_extscan_set_ssid_hotlist_rsp(void *ctx, |
| 2529 | void *pMsg) |
| 2530 | { |
| 2531 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2532 | tpSirEXTScanSetSsidHotListRspParams pData = |
| 2533 | (tpSirEXTScanSetSsidHotListRspParams) pMsg; |
| 2534 | struct hdd_ext_scan_context *context; |
| 2535 | |
| 2536 | if (wlan_hdd_validate_context(pHddCtx)){ |
| 2537 | return; |
| 2538 | } |
| 2539 | |
| 2540 | if (!pMsg) |
| 2541 | { |
| 2542 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2543 | return; |
| 2544 | } |
| 2545 | |
| 2546 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2547 | pData->status); |
| 2548 | |
| 2549 | context = &pHddCtx->ext_scan_context; |
| 2550 | spin_lock(&hdd_context_lock); |
| 2551 | if (context->request_id == pData->requestId) { |
| 2552 | context->response_status = pData->status ? -EINVAL : 0; |
| 2553 | complete(&context->response_event); |
| 2554 | } |
| 2555 | spin_unlock(&hdd_context_lock); |
| 2556 | |
| 2557 | return; |
| 2558 | } |
| 2559 | |
| 2560 | static void wlan_hdd_cfg80211_extscan_reset_ssid_hotlist_rsp(void *ctx, |
| 2561 | void *pMsg) |
| 2562 | { |
| 2563 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2564 | tpSirEXTScanResetSsidHotlistRspParams pData = |
| 2565 | (tpSirEXTScanResetSsidHotlistRspParams) pMsg; |
| 2566 | struct hdd_ext_scan_context *context; |
| 2567 | |
| 2568 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 2569 | return; |
| 2570 | } |
| 2571 | if (!pMsg) |
| 2572 | { |
| 2573 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2574 | return; |
| 2575 | } |
| 2576 | |
| 2577 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u Status %u", pData->requestId, |
| 2578 | pData->status); |
| 2579 | |
| 2580 | context = &pHddCtx->ext_scan_context; |
| 2581 | spin_lock(&hdd_context_lock); |
| 2582 | if (context->request_id == pData->requestId) { |
| 2583 | context->response_status = pData->status ? -EINVAL : 0; |
| 2584 | complete(&context->response_event); |
| 2585 | } |
| 2586 | spin_unlock(&hdd_context_lock); |
| 2587 | |
| 2588 | return; |
| 2589 | } |
| 2590 | |
| 2591 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2592 | static void wlan_hdd_cfg80211_extscan_cached_results_ind(void *ctx, |
| 2593 | void *pMsg) |
| 2594 | { |
| 2595 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2596 | struct sk_buff *skb = NULL; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2597 | tANI_U32 i = 0, j, resultsPerEvent, scan_id_index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2598 | tANI_S32 totalResults; |
| 2599 | tpSirWifiScanResultEvent pData = (tpSirWifiScanResultEvent) pMsg; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2600 | tpSirWifiScanResult pSirWifiScanResult, head_ptr; |
| 2601 | struct hdd_ext_scan_context *context; |
| 2602 | bool ignore_cached_results = false; |
| 2603 | tExtscanCachedScanResult *result; |
| 2604 | struct nlattr *nla_results; |
| 2605 | tANI_U16 ieLength= 0; |
| 2606 | tANI_U8 *ie = NULL; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2607 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2608 | ENTER(); |
| 2609 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2610 | if (wlan_hdd_validate_context(pHddCtx)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2611 | return; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2612 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2613 | if (!pMsg) |
| 2614 | { |
| 2615 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 2616 | return; |
| 2617 | } |
| 2618 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2619 | spin_lock(&hdd_context_lock); |
| 2620 | context = &pHddCtx->ext_scan_context; |
| 2621 | ignore_cached_results = context->ignore_cached_results; |
| 2622 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2623 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2624 | if (ignore_cached_results) { |
| 2625 | hddLog(LOGE, |
| 2626 | FL("Ignore the cached results received after timeout")); |
| 2627 | return; |
| 2628 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2629 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2630 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id %u More Data %u No of scan ids %u", |
| 2631 | pData->requestId, pData->moreData, pData->scanResultSize); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2632 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2633 | result = (tExtscanCachedScanResult *)&(pData->result); |
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 | for (scan_id_index = 0; scan_id_index < pData->scanResultSize; |
| 2636 | scan_id_index++) { |
| 2637 | result+= scan_id_index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2638 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2639 | totalResults = result->num_results; |
| 2640 | hddLog(VOS_TRACE_LEVEL_INFO, "scan_id %u flags %u Num results %u", |
| 2641 | result->scan_id, result->flags, totalResults); |
| 2642 | i = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2643 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2644 | do{ |
| 2645 | resultsPerEvent = ((totalResults >= EXTSCAN_MAX_CACHED_RESULTS_PER_IND) ? |
| 2646 | EXTSCAN_MAX_CACHED_RESULTS_PER_IND : totalResults); |
| 2647 | totalResults -= EXTSCAN_MAX_CACHED_RESULTS_PER_IND; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2648 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2649 | skb = cfg80211_vendor_cmd_alloc_reply_skb(pHddCtx->wiphy, |
| 2650 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN); |
| 2651 | |
| 2652 | if (!skb) { |
| 2653 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2654 | FL("cfg80211_vendor_event_alloc failed")); |
| 2655 | return; |
| 2656 | } |
| 2657 | |
| 2658 | hddLog(VOS_TRACE_LEVEL_INFO, "resultsPerEvent (%u)", resultsPerEvent); |
| 2659 | |
| 2660 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2661 | pData->requestId) || |
| 2662 | nla_put_u32(skb, |
| 2663 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2664 | resultsPerEvent)) { |
| 2665 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2666 | goto fail; |
| 2667 | } |
| 2668 | if (nla_put_u8(skb, |
| 2669 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2670 | pData->moreData ? 1 : (totalResults > 0 ? 1 : 0 ))) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2671 | { |
| 2672 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2673 | goto fail; |
| 2674 | } |
| 2675 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2676 | if (nla_put_u32(skb, |
| 2677 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_SCAN_ID, |
| 2678 | result->scan_id)) { |
| 2679 | hddLog(LOGE, FL("put fail")); |
| 2680 | goto fail; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2681 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2682 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 2683 | nla_results = nla_nest_start(skb, |
| 2684 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_LIST); |
| 2685 | if (!nla_results) |
| 2686 | goto fail; |
| 2687 | |
| 2688 | if (resultsPerEvent) { |
| 2689 | struct nlattr *aps; |
| 2690 | struct nlattr *nla_result; |
| 2691 | |
| 2692 | nla_result = nla_nest_start(skb, scan_id_index); |
| 2693 | if(!nla_result) |
| 2694 | goto fail; |
| 2695 | |
| 2696 | if (nla_put_u32(skb, |
| 2697 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_SCAN_ID, |
| 2698 | result->scan_id) || |
| 2699 | nla_put_u32(skb, |
| 2700 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CACHED_RESULTS_FLAGS, |
| 2701 | result->flags) || |
| 2702 | nla_put_u32(skb, |
| 2703 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 2704 | totalResults)) { |
| 2705 | hddLog(LOGE, FL("put fail")); |
| 2706 | goto fail; |
| 2707 | } |
| 2708 | |
| 2709 | aps = nla_nest_start(skb, |
| 2710 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2711 | if (!aps) |
| 2712 | { |
| 2713 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2714 | goto fail; |
| 2715 | } |
| 2716 | |
| 2717 | head_ptr = (tpSirWifiScanResult) &(result->ap); |
| 2718 | |
| 2719 | for (j = 0; j < resultsPerEvent; j++, i++) { |
| 2720 | struct nlattr *ap; |
| 2721 | pSirWifiScanResult = head_ptr + i; |
| 2722 | |
| 2723 | /* |
| 2724 | * Firmware returns timestamp from WiFi turn ON till |
| 2725 | * BSSID was cached (in seconds). Add this with |
| 2726 | * time gap between system boot up to WiFi turn ON |
| 2727 | * to derive the time since boot when the |
| 2728 | * BSSID was cached. |
| 2729 | */ |
| 2730 | pSirWifiScanResult->ts += pHddCtx->wifi_turn_on_time_since_boot; |
| 2731 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(%llu) " |
| 2732 | "Ssid (%s)" |
| 2733 | "Bssid: %pM " |
| 2734 | "Channel (%u)" |
| 2735 | "Rssi (%d)" |
| 2736 | "RTT (%u)" |
| 2737 | "RTT_SD (%u)" |
| 2738 | "Beacon Period %u" |
| 2739 | "Capability 0x%x " |
| 2740 | "Ie length %d", |
| 2741 | i, |
| 2742 | pSirWifiScanResult->ts, |
| 2743 | pSirWifiScanResult->ssid, |
| 2744 | pSirWifiScanResult->bssid, |
| 2745 | pSirWifiScanResult->channel, |
| 2746 | pSirWifiScanResult->rssi, |
| 2747 | pSirWifiScanResult->rtt, |
| 2748 | pSirWifiScanResult->rtt_sd, |
| 2749 | pSirWifiScanResult->beaconPeriod, |
| 2750 | pSirWifiScanResult->capability, |
| 2751 | ieLength); |
| 2752 | |
| 2753 | ap = nla_nest_start(skb, j + 1); |
| 2754 | if (!ap) |
| 2755 | { |
| 2756 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2757 | goto fail; |
| 2758 | } |
| 2759 | |
| 2760 | if (nla_put_u64(skb, |
| 2761 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 2762 | pSirWifiScanResult->ts) ) |
| 2763 | { |
| 2764 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2765 | goto fail; |
| 2766 | } |
| 2767 | if (nla_put(skb, |
| 2768 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 2769 | sizeof(pSirWifiScanResult->ssid), |
| 2770 | pSirWifiScanResult->ssid) ) |
| 2771 | { |
| 2772 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2773 | goto fail; |
| 2774 | } |
| 2775 | if (nla_put(skb, |
| 2776 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 2777 | sizeof(pSirWifiScanResult->bssid), |
| 2778 | pSirWifiScanResult->bssid) ) |
| 2779 | { |
| 2780 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2781 | goto fail; |
| 2782 | } |
| 2783 | if (nla_put_u32(skb, |
| 2784 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 2785 | pSirWifiScanResult->channel) ) |
| 2786 | { |
| 2787 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2788 | goto fail; |
| 2789 | } |
| 2790 | if (nla_put_s32(skb, |
| 2791 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 2792 | pSirWifiScanResult->rssi) ) |
| 2793 | { |
| 2794 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2795 | goto fail; |
| 2796 | } |
| 2797 | if (nla_put_u32(skb, |
| 2798 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 2799 | pSirWifiScanResult->rtt) ) |
| 2800 | { |
| 2801 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2802 | goto fail; |
| 2803 | } |
| 2804 | if (nla_put_u32(skb, |
| 2805 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 2806 | pSirWifiScanResult->rtt_sd)) |
| 2807 | { |
| 2808 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2809 | goto fail; |
| 2810 | } |
| 2811 | if (nla_put_u32(skb, |
| 2812 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 2813 | pSirWifiScanResult->beaconPeriod)) |
| 2814 | { |
| 2815 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2816 | goto fail; |
| 2817 | } |
| 2818 | if (nla_put_u32(skb, |
| 2819 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 2820 | pSirWifiScanResult->capability)) |
| 2821 | { |
| 2822 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2823 | goto fail; |
| 2824 | } |
| 2825 | if (nla_put_u32(skb, |
| 2826 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
| 2827 | ieLength)) |
| 2828 | { |
| 2829 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2830 | goto fail; |
| 2831 | } |
| 2832 | |
| 2833 | if (ieLength) |
| 2834 | if (nla_put(skb, |
| 2835 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 2836 | ieLength, ie)) { |
| 2837 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2838 | goto fail; |
| 2839 | } |
| 2840 | |
| 2841 | nla_nest_end(skb, ap); |
| 2842 | } |
| 2843 | nla_nest_end(skb, aps); |
| 2844 | nla_nest_end(skb, nla_result); |
| 2845 | } |
| 2846 | |
| 2847 | nla_nest_end(skb, nla_results); |
| 2848 | |
| 2849 | cfg80211_vendor_cmd_reply(skb); |
| 2850 | |
| 2851 | } while (totalResults > 0); |
| 2852 | } |
| 2853 | |
| 2854 | if (!pData->moreData) { |
| 2855 | spin_lock(&hdd_context_lock); |
| 2856 | context->response_status = 0; |
| 2857 | complete(&context->response_event); |
| 2858 | spin_unlock(&hdd_context_lock); |
| 2859 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2860 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2861 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2862 | return; |
| 2863 | fail: |
| 2864 | kfree_skb(skb); |
| 2865 | return; |
| 2866 | } |
| 2867 | |
| 2868 | static void wlan_hdd_cfg80211_extscan_hotlist_match_ind(void *ctx, |
| 2869 | void *pMsg) |
| 2870 | { |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2871 | tpSirEXTScanHotlistMatch pData = (tpSirEXTScanHotlistMatch) pMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2872 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 2873 | struct sk_buff *skb = NULL; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2874 | tANI_U32 i, index; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2875 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2876 | ENTER(); |
| 2877 | |
| 2878 | if (wlan_hdd_validate_context(pHddCtx)) { |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2879 | hddLog(LOGE, |
| 2880 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2881 | return; |
| 2882 | } |
| 2883 | if (!pMsg) |
| 2884 | { |
| 2885 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2886 | return; |
| 2887 | } |
| 2888 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2889 | if (pData->bss_found) |
| 2890 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND_INDEX; |
| 2891 | else |
| 2892 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_LOST_INDEX; |
| 2893 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2894 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 2895 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 2896 | NULL, |
| 2897 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2898 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2899 | index, GFP_KERNEL); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2900 | |
| 2901 | if (!skb) { |
| 2902 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 2903 | FL("cfg80211_vendor_event_alloc failed")); |
| 2904 | return; |
| 2905 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2906 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2907 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 2908 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", pData->numHotlistBss); |
| 2909 | hddLog(VOS_TRACE_LEVEL_INFO, "More Data (%u)", pData->moreData); |
| 2910 | hddLog(VOS_TRACE_LEVEL_INFO, "ap_found %u", pData->bss_found); |
| 2911 | |
| 2912 | for (i = 0; i < pData->numHotlistBss; i++) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2913 | hddLog(VOS_TRACE_LEVEL_INFO, "[index=%u] Timestamp(0x%lld) " |
| 2914 | "Ssid (%s) " |
| 2915 | "Bssid (" MAC_ADDRESS_STR ") " |
| 2916 | "Channel (%u) " |
| 2917 | "Rssi (%d) " |
| 2918 | "RTT (%u) " |
| 2919 | "RTT_SD (%u) ", |
| 2920 | i, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2921 | pData->bssHotlist[i].ts, |
| 2922 | pData->bssHotlist[i].ssid, |
| 2923 | MAC_ADDR_ARRAY(pData->bssHotlist[i].bssid), |
| 2924 | pData->bssHotlist[i].channel, |
| 2925 | pData->bssHotlist[i].rssi, |
| 2926 | pData->bssHotlist[i].rtt, |
| 2927 | pData->bssHotlist[i].rtt_sd); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2928 | } |
| 2929 | |
| 2930 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 2931 | pData->requestId) || |
| 2932 | nla_put_u32(skb, |
| 2933 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2934 | pData->numHotlistBss)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2935 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("put fail")); |
| 2936 | goto fail; |
| 2937 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2938 | if (pData->numHotlistBss) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2939 | struct nlattr *aps; |
| 2940 | |
| 2941 | aps = nla_nest_start(skb, |
| 2942 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 2943 | if (!aps) |
| 2944 | goto fail; |
| 2945 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2946 | for (i = 0; i < pData->numHotlistBss; i++) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2947 | struct nlattr *ap; |
| 2948 | |
| 2949 | ap = nla_nest_start(skb, i + 1); |
| 2950 | if (!ap) |
| 2951 | goto fail; |
| 2952 | |
| 2953 | if (nla_put_u64(skb, |
| 2954 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2955 | pData->bssHotlist[i].ts) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2956 | nla_put(skb, |
| 2957 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2958 | sizeof(pData->bssHotlist[i].ssid), |
| 2959 | pData->bssHotlist[i].ssid) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2960 | nla_put(skb, |
| 2961 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2962 | sizeof(pData->bssHotlist[i].bssid), |
| 2963 | pData->bssHotlist[i].bssid) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2964 | nla_put_u32(skb, |
| 2965 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2966 | pData->bssHotlist[i].channel) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2967 | nla_put_s32(skb, |
| 2968 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2969 | pData->bssHotlist[i].rssi) || |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2970 | nla_put_u32(skb, |
| 2971 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2972 | pData->bssHotlist[i].rtt) || |
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_SD, |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 2975 | pData->bssHotlist[i].rtt_sd)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2976 | goto fail; |
| 2977 | |
| 2978 | nla_nest_end(skb, ap); |
| 2979 | } |
| 2980 | nla_nest_end(skb, aps); |
| 2981 | |
| 2982 | if (nla_put_u8(skb, |
| 2983 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 2984 | pData->moreData)) |
| 2985 | goto fail; |
| 2986 | } |
| 2987 | |
| 2988 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 2989 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2990 | return; |
| 2991 | |
| 2992 | fail: |
| 2993 | kfree_skb(skb); |
| 2994 | return; |
| 2995 | |
| 2996 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 2997 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 2998 | /** |
| 2999 | * wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind() - |
| 3000 | * Handle an SSID hotlist match event |
| 3001 | * @ctx: HDD context registered with SME |
| 3002 | * @event: The SSID hotlist match event |
| 3003 | * |
| 3004 | * This function will take an SSID match event that was generated by |
| 3005 | * firmware and will convert it into a cfg80211 vendor event which is |
| 3006 | * sent to userspace. |
| 3007 | * |
| 3008 | * Return: none |
| 3009 | */ |
| 3010 | static void |
| 3011 | wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind(void *ctx, |
| 3012 | void *pMsg) |
| 3013 | { |
| 3014 | hdd_context_t *hdd_ctx = ctx; |
| 3015 | struct sk_buff *skb; |
| 3016 | tANI_U32 i, index; |
| 3017 | tpSirEXTScanSsidHotlistMatch pData = (tpSirEXTScanSsidHotlistMatch) pMsg; |
| 3018 | |
| 3019 | ENTER(); |
| 3020 | |
| 3021 | if (wlan_hdd_validate_context(hdd_ctx)) { |
| 3022 | hddLog(LOGE, |
| 3023 | FL("HDD context is not valid or response")); |
| 3024 | return; |
| 3025 | } |
| 3026 | if (!pMsg) |
| 3027 | { |
| 3028 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 3029 | return; |
| 3030 | } |
| 3031 | |
| 3032 | if (pData->ssid_found) { |
| 3033 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND_INDEX; |
| 3034 | hddLog(LOG1, "SSID hotlist found"); |
| 3035 | } else { |
| 3036 | index = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST_INDEX; |
| 3037 | hddLog(LOG1, "SSID hotlist lost"); |
| 3038 | } |
| 3039 | |
| 3040 | skb = cfg80211_vendor_event_alloc(hdd_ctx->wiphy, |
| 3041 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3042 | NULL, |
| 3043 | #endif |
| 3044 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3045 | index, GFP_KERNEL); |
| 3046 | |
| 3047 | if (!skb) { |
| 3048 | hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed")); |
| 3049 | return; |
| 3050 | } |
| 3051 | hddLog(LOG1, "Req Id %u, Num of SSIDs %u, More Data (%u)", |
| 3052 | pData->requestId, pData->numHotlistSsid, pData->moreData); |
| 3053 | |
| 3054 | for (i = 0; i < pData->numHotlistSsid; i++) { |
| 3055 | hddLog(LOG1, "[i=%d] Timestamp %llu " |
| 3056 | "Ssid: %s " |
| 3057 | "Bssid (" MAC_ADDRESS_STR ") " |
| 3058 | "Channel %u " |
| 3059 | "Rssi %d " |
| 3060 | "RTT %u " |
| 3061 | "RTT_SD %u", |
| 3062 | i, |
| 3063 | pData->ssidHotlist[i].ts, |
| 3064 | pData->ssidHotlist[i].ssid, |
| 3065 | MAC_ADDR_ARRAY(pData->ssidHotlist[i].bssid), |
| 3066 | pData->ssidHotlist[i].channel, |
| 3067 | pData->ssidHotlist[i].rssi, |
| 3068 | pData->ssidHotlist[i].rtt, |
| 3069 | pData->ssidHotlist[i].rtt_sd); |
| 3070 | } |
| 3071 | |
| 3072 | if (nla_put_u32(skb, |
| 3073 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3074 | pData->requestId) || |
| 3075 | nla_put_u32(skb, |
| 3076 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3077 | pData->numHotlistSsid)) { |
| 3078 | hddLog(LOGE, FL("put fail")); |
| 3079 | goto fail; |
| 3080 | } |
| 3081 | |
| 3082 | if (pData->numHotlistSsid) { |
| 3083 | struct nlattr *aps; |
| 3084 | aps = nla_nest_start(skb, |
| 3085 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_LIST); |
| 3086 | if (!aps) { |
| 3087 | hddLog(LOGE, FL("nest fail")); |
| 3088 | goto fail; |
| 3089 | } |
| 3090 | |
| 3091 | for (i = 0; i < pData->numHotlistSsid; i++) { |
| 3092 | struct nlattr *ap; |
| 3093 | |
| 3094 | ap = nla_nest_start(skb, i); |
| 3095 | if (!ap) { |
| 3096 | hddLog(LOGE, FL("nest fail")); |
| 3097 | goto fail; |
| 3098 | } |
| 3099 | |
| 3100 | if (nla_put_u64(skb, |
| 3101 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3102 | pData->ssidHotlist[i].ts) || |
| 3103 | nla_put(skb, |
| 3104 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3105 | sizeof(pData->ssidHotlist[i].ssid), |
| 3106 | pData->ssidHotlist[i].ssid) || |
| 3107 | nla_put(skb, |
| 3108 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3109 | sizeof(pData->ssidHotlist[i].bssid), |
| 3110 | pData->ssidHotlist[i].bssid) || |
| 3111 | nla_put_u32(skb, |
| 3112 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3113 | pData->ssidHotlist[i].channel) || |
| 3114 | nla_put_s32(skb, |
| 3115 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RSSI, |
| 3116 | pData->ssidHotlist[i].rssi) || |
| 3117 | nla_put_u32(skb, |
| 3118 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3119 | pData->ssidHotlist[i].rtt) || |
| 3120 | nla_put_u32(skb, |
| 3121 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3122 | pData->ssidHotlist[i].rtt_sd)) { |
| 3123 | hddLog(LOGE, FL("put fail")); |
| 3124 | goto fail; |
| 3125 | } |
| 3126 | nla_nest_end(skb, ap); |
| 3127 | } |
| 3128 | nla_nest_end(skb, aps); |
| 3129 | |
| 3130 | if (nla_put_u8(skb, |
| 3131 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3132 | pData->moreData)) { |
| 3133 | hddLog(LOGE, FL("put fail")); |
| 3134 | goto fail; |
| 3135 | } |
| 3136 | } |
| 3137 | |
| 3138 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 3139 | return; |
| 3140 | |
| 3141 | fail: |
| 3142 | kfree_skb(skb); |
| 3143 | return; |
| 3144 | |
| 3145 | } |
| 3146 | |
| 3147 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3148 | static void wlan_hdd_cfg80211_extscan_full_scan_result_event(void *ctx, |
| 3149 | void *pMsg) |
| 3150 | { |
| 3151 | struct sk_buff *skb; |
| 3152 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3153 | tpSirWifiFullScanResultEvent pData = |
| 3154 | (tpSirWifiFullScanResultEvent) (pMsg); |
| 3155 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3156 | ENTER(); |
| 3157 | |
| 3158 | if (wlan_hdd_validate_context(pHddCtx)) { |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3159 | hddLog(LOGE, |
| 3160 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3161 | return; |
| 3162 | } |
| 3163 | if (!pMsg) |
| 3164 | { |
| 3165 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3166 | return; |
| 3167 | } |
| 3168 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3169 | /* |
| 3170 | * If the full scan result including IE data exceeds NL 4K size |
| 3171 | * limitation, drop that beacon/probe rsp frame. |
| 3172 | */ |
| 3173 | if ((sizeof(*pData) + pData->ieLength) >= EXTSCAN_EVENT_BUF_SIZE) { |
| 3174 | hddLog(LOGE, FL("Frame exceeded NL size limilation, drop it!")); |
| 3175 | return; |
| 3176 | } |
| 3177 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3178 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3179 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3180 | NULL, |
| 3181 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3182 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3183 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT_INDEX, |
| 3184 | GFP_KERNEL); |
| 3185 | |
| 3186 | if (!skb) { |
| 3187 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3188 | FL("cfg80211_vendor_event_alloc failed")); |
| 3189 | return; |
| 3190 | } |
| 3191 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3192 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%u)"), pData->requestId); |
| 3193 | hddLog(VOS_TRACE_LEVEL_INFO, FL("More Data (%u)"), pData->moreData); |
| 3194 | hddLog(VOS_TRACE_LEVEL_INFO, FL("AP Info: Timestamp(0x%llX) " |
| 3195 | "Ssid (%s)" |
| 3196 | "Bssid (" MAC_ADDRESS_STR ")" |
| 3197 | "Channel (%u)" |
| 3198 | "Rssi (%d)" |
| 3199 | "RTT (%u)" |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3200 | "RTT_SD (%u)" |
| 3201 | "Bcn Period %d" |
| 3202 | "Capability 0x%X "), |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3203 | pData->ap.ts, |
| 3204 | pData->ap.ssid, |
| 3205 | MAC_ADDR_ARRAY(pData->ap.bssid), |
| 3206 | pData->ap.channel, |
| 3207 | pData->ap.rssi, |
| 3208 | pData->ap.rtt, |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3209 | pData->ap.rtt_sd, |
| 3210 | pData->ap.beaconPeriod, |
| 3211 | pData->ap.capability); |
| 3212 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3213 | hddLog(VOS_TRACE_LEVEL_INFO, "IE Length (%u)", pData->ieLength); |
| 3214 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3215 | pData->requestId) || |
| 3216 | nla_put_u64(skb, |
| 3217 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_TIME_STAMP, |
| 3218 | pData->ap.ts) || |
| 3219 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_SSID, |
| 3220 | sizeof(pData->ap.ssid), |
| 3221 | pData->ap.ssid) || |
| 3222 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BSSID, |
| 3223 | WNI_CFG_BSSID_LEN, |
| 3224 | pData->ap.bssid) || |
| 3225 | nla_put_u32(skb, |
| 3226 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CHANNEL, |
| 3227 | pData->ap.channel) || |
Dasari Srinivas | 90747d7 | 2014-10-08 12:16:15 +0530 | [diff] [blame] | 3228 | 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] | 3229 | pData->ap.rssi) || |
| 3230 | nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT, |
| 3231 | pData->ap.rtt) || |
| 3232 | nla_put_u32(skb, |
| 3233 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_RTT_SD, |
| 3234 | pData->ap.rtt_sd) || |
| 3235 | nla_put_u16(skb, |
| 3236 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_BEACON_PERIOD, |
| 3237 | pData->ap.beaconPeriod) || |
| 3238 | nla_put_u16(skb, |
| 3239 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_CAPABILITY, |
| 3240 | pData->ap.capability) || |
| 3241 | nla_put_u32(skb, |
| 3242 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_LENGTH, |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3243 | pData->ieLength) || |
| 3244 | nla_put_u8(skb, |
| 3245 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_MORE_DATA, |
| 3246 | pData->moreData)) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3247 | { |
| 3248 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3249 | goto nla_put_failure; |
| 3250 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3251 | |
| 3252 | if (pData->ieLength) { |
| 3253 | if (nla_put(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_RESULT_IE_DATA, |
| 3254 | pData->ieLength, |
| 3255 | pData->ie)) |
| 3256 | { |
| 3257 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3258 | goto nla_put_failure; |
| 3259 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3260 | } |
| 3261 | |
| 3262 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3263 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3264 | return; |
| 3265 | |
| 3266 | nla_put_failure: |
| 3267 | kfree_skb(skb); |
| 3268 | return; |
| 3269 | } |
| 3270 | |
| 3271 | static void wlan_hdd_cfg80211_extscan_scan_res_available_event(void *ctx, |
| 3272 | void *pMsg) |
| 3273 | { |
| 3274 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3275 | struct sk_buff *skb = NULL; |
| 3276 | tpSirEXTScanResultsAvailableIndParams pData = |
| 3277 | (tpSirEXTScanResultsAvailableIndParams) pMsg; |
| 3278 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3279 | ENTER(); |
| 3280 | |
| 3281 | if (wlan_hdd_validate_context(pHddCtx)){ |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3282 | hddLog(LOGE, |
| 3283 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3284 | return; |
| 3285 | } |
| 3286 | if (!pMsg) |
| 3287 | { |
| 3288 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3289 | return; |
| 3290 | } |
| 3291 | |
| 3292 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3293 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3294 | NULL, |
| 3295 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3296 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3297 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE_INDEX, |
| 3298 | GFP_KERNEL); |
| 3299 | |
| 3300 | if (!skb) { |
| 3301 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3302 | FL("cfg80211_vendor_event_alloc failed")); |
| 3303 | return; |
| 3304 | } |
| 3305 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3306 | hddLog(VOS_TRACE_LEVEL_INFO, "Req Id (%u)", pData->requestId); |
| 3307 | hddLog(VOS_TRACE_LEVEL_INFO, "Num results (%u)", |
| 3308 | pData->numResultsAvailable); |
| 3309 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3310 | pData->requestId) || |
| 3311 | nla_put_u32(skb, |
| 3312 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_RESULTS_AVAILABLE, |
| 3313 | pData->numResultsAvailable)) { |
| 3314 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3315 | goto nla_put_failure; |
| 3316 | } |
| 3317 | |
| 3318 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3319 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3320 | return; |
| 3321 | |
| 3322 | nla_put_failure: |
| 3323 | kfree_skb(skb); |
| 3324 | return; |
| 3325 | } |
| 3326 | |
| 3327 | static void wlan_hdd_cfg80211_extscan_scan_progress_event(void *ctx, void *pMsg) |
| 3328 | { |
| 3329 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3330 | struct sk_buff *skb = NULL; |
| 3331 | tpSirEXTScanProgressIndParams pData = |
| 3332 | (tpSirEXTScanProgressIndParams) pMsg; |
| 3333 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3334 | ENTER(); |
| 3335 | |
| 3336 | if (wlan_hdd_validate_context(pHddCtx)){ |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3337 | hddLog(LOGE, |
| 3338 | FL("HDD context is not valid or response")); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3339 | return; |
| 3340 | } |
| 3341 | if (!pMsg) |
| 3342 | { |
| 3343 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3344 | return; |
| 3345 | } |
| 3346 | |
| 3347 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 3348 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 3349 | NULL, |
| 3350 | #endif |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3351 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 3352 | QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT_INDEX, |
| 3353 | GFP_KERNEL); |
| 3354 | |
| 3355 | if (!skb) { |
| 3356 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3357 | FL("cfg80211_vendor_event_alloc failed")); |
| 3358 | return; |
| 3359 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3360 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Request Id (%u) "), pData->requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3361 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event type (%u)", |
| 3362 | pData->extScanEventType); |
| 3363 | hddLog(VOS_TRACE_LEVEL_INFO, "Scan event status (%u)", |
| 3364 | pData->status); |
| 3365 | |
| 3366 | if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_TYPE, |
| 3367 | pData->extScanEventType) || |
| 3368 | nla_put_u32(skb, |
Dasari Srinivas | 5a28865 | 2014-06-30 17:13:22 +0530 | [diff] [blame] | 3369 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_REQUEST_ID, |
| 3370 | pData->requestId) || |
| 3371 | nla_put_u32(skb, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3372 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_SCAN_EVENT_STATUS, |
| 3373 | pData->status)) { |
| 3374 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 3375 | goto nla_put_failure; |
| 3376 | } |
| 3377 | |
| 3378 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3379 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3380 | return; |
| 3381 | |
| 3382 | nla_put_failure: |
| 3383 | kfree_skb(skb); |
| 3384 | return; |
| 3385 | } |
| 3386 | |
| 3387 | void wlan_hdd_cfg80211_extscan_callback(void *ctx, const tANI_U16 evType, |
| 3388 | void *pMsg) |
| 3389 | { |
| 3390 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 3391 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3392 | ENTER(); |
| 3393 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3394 | if (wlan_hdd_validate_context(pHddCtx)) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3395 | return; |
| 3396 | } |
| 3397 | |
| 3398 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 3399 | |
| 3400 | |
| 3401 | switch(evType) { |
| 3402 | case SIR_HAL_EXTSCAN_START_RSP: |
| 3403 | wlan_hdd_cfg80211_extscan_start_rsp(ctx, pMsg); |
| 3404 | break; |
| 3405 | |
| 3406 | case SIR_HAL_EXTSCAN_STOP_RSP: |
| 3407 | wlan_hdd_cfg80211_extscan_stop_rsp(ctx, pMsg); |
| 3408 | break; |
| 3409 | case SIR_HAL_EXTSCAN_GET_CACHED_RESULTS_RSP: |
| 3410 | /* There is no need to send this response to upper layer |
| 3411 | Just log the message */ |
| 3412 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 3413 | FL("Rcvd SIR_HAL_EXTSCAN_CACHED_RESULTS_RSP")); |
| 3414 | break; |
| 3415 | case SIR_HAL_EXTSCAN_SET_BSS_HOTLIST_RSP: |
| 3416 | wlan_hdd_cfg80211_extscan_set_bss_hotlist_rsp(ctx, pMsg); |
| 3417 | break; |
| 3418 | |
| 3419 | case SIR_HAL_EXTSCAN_RESET_BSS_HOTLIST_RSP: |
| 3420 | wlan_hdd_cfg80211_extscan_reset_bss_hotlist_rsp(ctx, pMsg); |
| 3421 | break; |
| 3422 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3423 | case SIR_HAL_EXTSCAN_SET_SSID_HOTLIST_RSP: |
| 3424 | wlan_hdd_cfg80211_extscan_set_ssid_hotlist_rsp(ctx, pMsg); |
| 3425 | break; |
| 3426 | |
| 3427 | case SIR_HAL_EXTSCAN_RESET_SSID_HOTLIST_RSP: |
| 3428 | wlan_hdd_cfg80211_extscan_reset_ssid_hotlist_rsp(ctx, pMsg); |
| 3429 | break; |
| 3430 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3431 | case SIR_HAL_EXTSCAN_GET_CAPABILITIES_RSP: |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3432 | wlan_hdd_cfg80211_extscan_get_capabilities_rsp(ctx, pMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3433 | break; |
| 3434 | case SIR_HAL_EXTSCAN_PROGRESS_IND: |
| 3435 | wlan_hdd_cfg80211_extscan_scan_progress_event(ctx, pMsg); |
| 3436 | break; |
| 3437 | case SIR_HAL_EXTSCAN_SCAN_AVAILABLE_IND: |
| 3438 | wlan_hdd_cfg80211_extscan_scan_res_available_event(ctx, pMsg); |
| 3439 | break; |
| 3440 | case SIR_HAL_EXTSCAN_SCAN_RESULT_IND: |
| 3441 | wlan_hdd_cfg80211_extscan_cached_results_ind(ctx, pMsg); |
| 3442 | break; |
| 3443 | case SIR_HAL_EXTSCAN_HOTLIST_MATCH_IND: |
| 3444 | wlan_hdd_cfg80211_extscan_hotlist_match_ind(ctx, pMsg); |
| 3445 | break; |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3446 | case SIR_HAL_EXTSCAN_SSID_HOTLIST_MATCH_IND: |
| 3447 | wlan_hdd_cfg80211_extscan_hotlist_ssid_match_ind(ctx, pMsg); |
| 3448 | break; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3449 | case SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND: |
| 3450 | wlan_hdd_cfg80211_extscan_full_scan_result_event(ctx, pMsg); |
| 3451 | break; |
| 3452 | default: |
| 3453 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 3454 | break; |
| 3455 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3456 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3457 | } |
| 3458 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3459 | static int __wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3460 | struct wireless_dev *wdev, |
| 3461 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3462 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3463 | tSirGetEXTScanCapabilitiesReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3464 | struct net_device *dev = wdev->netdev; |
| 3465 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3466 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3467 | struct nlattr |
| 3468 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3469 | eHalStatus status; |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3470 | struct hdd_ext_scan_context *context; |
| 3471 | unsigned long rc; |
| 3472 | int ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3473 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3474 | ENTER(); |
| 3475 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3476 | status = wlan_hdd_validate_context(pHddCtx); |
| 3477 | if (0 != status) |
| 3478 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3479 | return -EINVAL; |
| 3480 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3481 | /* check the EXTScan Capability */ |
| 3482 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3483 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3484 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3485 | { |
| 3486 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3487 | FL("EXTScan not enabled/supported by Firmware")); |
| 3488 | return -EINVAL; |
| 3489 | } |
| 3490 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3491 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3492 | data, dataLen, |
| 3493 | wlan_hdd_extscan_config_policy)) { |
| 3494 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3495 | return -EINVAL; |
| 3496 | } |
| 3497 | |
| 3498 | /* Parse and fetch request Id */ |
| 3499 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3500 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3501 | return -EINVAL; |
| 3502 | } |
| 3503 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3504 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3505 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3506 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3507 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3508 | reqMsg.sessionId = pAdapter->sessionId; |
| 3509 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3510 | |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3511 | vos_spin_lock_acquire(&hdd_context_lock); |
| 3512 | context = &pHddCtx->ext_scan_context; |
| 3513 | context->request_id = reqMsg.requestId; |
| 3514 | INIT_COMPLETION(context->response_event); |
| 3515 | vos_spin_lock_release(&hdd_context_lock); |
| 3516 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3517 | status = sme_EXTScanGetCapabilities(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3518 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3519 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3520 | FL("sme_EXTScanGetCapabilities failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3521 | return -EINVAL; |
| 3522 | } |
Padma, Santhosh Kumar | a1aa4a3 | 2015-06-19 19:00:46 +0530 | [diff] [blame] | 3523 | |
| 3524 | rc = wait_for_completion_timeout(&context->response_event, |
| 3525 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 3526 | if (!rc) { |
| 3527 | hddLog(LOGE, FL("Target response timed out")); |
| 3528 | return -ETIMEDOUT; |
| 3529 | } |
| 3530 | |
| 3531 | ret = wlan_hdd_send_ext_scan_capability(pHddCtx); |
| 3532 | if (ret) |
| 3533 | hddLog(LOGE, FL("Failed to send ext scan capability to user space")); |
| 3534 | |
| 3535 | return ret; |
| 3536 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3537 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3538 | return 0; |
| 3539 | } |
| 3540 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3541 | static int wlan_hdd_cfg80211_extscan_get_capabilities(struct wiphy *wiphy, |
| 3542 | struct wireless_dev *wdev, |
| 3543 | const void *data, int dataLen) |
| 3544 | { |
| 3545 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3546 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3547 | vos_ssr_protect(__func__); |
| 3548 | ret = __wlan_hdd_cfg80211_extscan_get_capabilities(wiphy, wdev, data, dataLen); |
| 3549 | vos_ssr_unprotect(__func__); |
| 3550 | |
| 3551 | return ret; |
| 3552 | } |
| 3553 | |
| 3554 | static int __wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3555 | struct wireless_dev *wdev, |
| 3556 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3557 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3558 | tSirEXTScanGetCachedResultsReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3559 | struct net_device *dev = wdev->netdev; |
| 3560 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3561 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3562 | struct nlattr |
| 3563 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3564 | eHalStatus status; |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3565 | struct hdd_ext_scan_context *context; |
| 3566 | unsigned long rc; |
| 3567 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3568 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3569 | ENTER(); |
| 3570 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3571 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 3572 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 3573 | return -EINVAL; |
| 3574 | } |
| 3575 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3576 | status = wlan_hdd_validate_context(pHddCtx); |
| 3577 | if (0 != status) |
| 3578 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3579 | return -EINVAL; |
| 3580 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3581 | /* check the EXTScan Capability */ |
| 3582 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3583 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3584 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3585 | { |
| 3586 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3587 | FL("EXTScan not enabled/supported by Firmware")); |
| 3588 | return -EINVAL; |
| 3589 | } |
| 3590 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3591 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3592 | data, dataLen, |
| 3593 | wlan_hdd_extscan_config_policy)) { |
| 3594 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3595 | return -EINVAL; |
| 3596 | } |
| 3597 | /* Parse and fetch request Id */ |
| 3598 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3599 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3600 | return -EINVAL; |
| 3601 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3602 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3603 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3604 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3605 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3606 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3607 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3608 | reqMsg.sessionId = pAdapter->sessionId; |
| 3609 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3610 | |
| 3611 | /* Parse and fetch flush parameter */ |
| 3612 | if (!tb |
| 3613 | [QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]) |
| 3614 | { |
| 3615 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr flush failed")); |
| 3616 | goto failed; |
| 3617 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3618 | reqMsg.flush = nla_get_u8( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3619 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_CACHED_SCAN_RESULTS_CONFIG_PARAM_FLUSH]); |
| 3620 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3621 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Flush (%d)"), reqMsg.flush); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3622 | |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3623 | spin_lock(&hdd_context_lock); |
| 3624 | context = &pHddCtx->ext_scan_context; |
| 3625 | context->request_id = reqMsg.requestId; |
| 3626 | context->ignore_cached_results = false; |
| 3627 | INIT_COMPLETION(context->response_event); |
| 3628 | spin_unlock(&hdd_context_lock); |
| 3629 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3630 | status = sme_getCachedResults(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3631 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3632 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3633 | FL("sme_getCachedResults failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3634 | return -EINVAL; |
| 3635 | } |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3636 | |
| 3637 | rc = wait_for_completion_timeout(&context->response_event, |
| 3638 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 3639 | if (!rc) { |
| 3640 | hddLog(LOGE, FL("Target response timed out")); |
| 3641 | retval = -ETIMEDOUT; |
| 3642 | spin_lock(&hdd_context_lock); |
| 3643 | context->ignore_cached_results = true; |
| 3644 | spin_unlock(&hdd_context_lock); |
| 3645 | } else { |
| 3646 | spin_lock(&hdd_context_lock); |
| 3647 | retval = context->response_status; |
| 3648 | spin_unlock(&hdd_context_lock); |
| 3649 | } |
| 3650 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3651 | EXIT(); |
Padma, Santhosh Kumar | e1b8a94 | 2015-08-25 12:44:24 +0530 | [diff] [blame] | 3652 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3653 | |
| 3654 | failed: |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3655 | return -EINVAL; |
| 3656 | } |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3657 | static int wlan_hdd_cfg80211_extscan_get_cached_results(struct wiphy *wiphy, |
| 3658 | struct wireless_dev *wdev, |
| 3659 | const void *data, int dataLen) |
| 3660 | { |
| 3661 | int ret = 0; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3662 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3663 | vos_ssr_protect(__func__); |
| 3664 | ret = __wlan_hdd_cfg80211_extscan_get_cached_results(wiphy, wdev, data, dataLen); |
| 3665 | vos_ssr_unprotect(__func__); |
| 3666 | |
| 3667 | return ret; |
| 3668 | } |
| 3669 | |
| 3670 | static int __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3671 | struct wireless_dev *wdev, |
Edhar, Mahesh Kumar | ed8631f | 2015-01-20 14:31:47 +0530 | [diff] [blame] | 3672 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3673 | { |
| 3674 | tpSirEXTScanSetBssidHotListReqParams pReqMsg = NULL; |
| 3675 | struct net_device *dev = wdev->netdev; |
| 3676 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3677 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 3678 | struct nlattr |
| 3679 | *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3680 | struct nlattr |
| 3681 | *tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 3682 | struct nlattr *apTh; |
| 3683 | eHalStatus status; |
| 3684 | tANI_U8 i = 0; |
| 3685 | int rem; |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3686 | struct hdd_ext_scan_context *context; |
| 3687 | tANI_U32 request_id; |
| 3688 | unsigned long rc; |
| 3689 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3690 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3691 | ENTER(); |
| 3692 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3693 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 3694 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 3695 | return -EINVAL; |
| 3696 | } |
| 3697 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3698 | status = wlan_hdd_validate_context(pHddCtx); |
| 3699 | if (0 != status) |
| 3700 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3701 | return -EINVAL; |
| 3702 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3703 | /* check the EXTScan Capability */ |
| 3704 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3705 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3706 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3707 | { |
| 3708 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3709 | FL("EXTScan not enabled/supported by Firmware")); |
| 3710 | return -EINVAL; |
| 3711 | } |
| 3712 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3713 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3714 | data, dataLen, |
| 3715 | wlan_hdd_extscan_config_policy)) { |
| 3716 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 3717 | return -EINVAL; |
| 3718 | } |
| 3719 | |
| 3720 | /* Parse and fetch request Id */ |
| 3721 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 3722 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 3723 | return -EINVAL; |
| 3724 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3725 | pReqMsg = (tpSirEXTScanSetBssidHotListReqParams) |
| 3726 | vos_mem_malloc(sizeof(*pReqMsg)); |
| 3727 | if (!pReqMsg) { |
| 3728 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 3729 | return -ENOMEM; |
| 3730 | } |
| 3731 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3732 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3733 | pReqMsg->requestId = nla_get_u32( |
| 3734 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 3735 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 3736 | |
| 3737 | /* Parse and fetch number of APs */ |
| 3738 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]) { |
| 3739 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of AP failed")); |
| 3740 | goto fail; |
| 3741 | } |
| 3742 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3743 | /* Parse and fetch lost ap sample size */ |
| 3744 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE]) { |
| 3745 | hddLog(LOGE, FL("attr lost ap sample size failed")); |
| 3746 | goto fail; |
| 3747 | } |
| 3748 | |
| 3749 | pReqMsg->lostBssidSampleSize = nla_get_u32( |
| 3750 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_LOST_AP_SAMPLE_SIZE]); |
| 3751 | hddLog(LOG1, FL("Lost ap sample size %d"), pReqMsg->lostBssidSampleSize); |
| 3752 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3753 | pReqMsg->sessionId = pAdapter->sessionId; |
| 3754 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 3755 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3756 | pReqMsg->numBssid = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3757 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BSSID_HOTLIST_PARAMS_NUM_AP]); |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3758 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of AP (%d)"), pReqMsg->numBssid); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3759 | |
| 3760 | nla_for_each_nested(apTh, |
| 3761 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM], rem) { |
| 3762 | if(nla_parse(tb2, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 3763 | nla_data(apTh), nla_len(apTh), |
| 3764 | NULL)) { |
| 3765 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_parse failed")); |
| 3766 | goto fail; |
| 3767 | } |
| 3768 | |
| 3769 | /* Parse and fetch MAC address */ |
| 3770 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]) { |
| 3771 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac address failed")); |
| 3772 | goto fail; |
| 3773 | } |
| 3774 | memcpy(pReqMsg->ap[i].bssid, nla_data( |
| 3775 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_BSSID]), |
| 3776 | sizeof(tSirMacAddr)); |
| 3777 | hddLog(VOS_TRACE_LEVEL_INFO, FL("BSSID: %pM "), pReqMsg->ap[i].bssid); |
| 3778 | |
| 3779 | /* Parse and fetch low RSSI */ |
| 3780 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]) { |
| 3781 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr low RSSI failed")); |
| 3782 | goto fail; |
| 3783 | } |
| 3784 | pReqMsg->ap[i].low = nla_get_s32( |
| 3785 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_LOW]); |
| 3786 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI low (%d)"), pReqMsg->ap[i].low); |
| 3787 | |
| 3788 | /* Parse and fetch high RSSI */ |
| 3789 | if (!tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]) { |
| 3790 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr high RSSI failed")); |
| 3791 | goto fail; |
| 3792 | } |
| 3793 | pReqMsg->ap[i].high = nla_get_s32( |
| 3794 | tb2[QCA_WLAN_VENDOR_ATTR_EXTSCAN_AP_THRESHOLD_PARAM_RSSI_HIGH]); |
| 3795 | hddLog(VOS_TRACE_LEVEL_INFO, FL("RSSI High (%d)"), |
| 3796 | pReqMsg->ap[i].high); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3797 | i++; |
| 3798 | } |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3799 | |
| 3800 | context = &pHddCtx->ext_scan_context; |
| 3801 | spin_lock(&hdd_context_lock); |
| 3802 | INIT_COMPLETION(context->response_event); |
| 3803 | context->request_id = request_id = pReqMsg->requestId; |
| 3804 | spin_unlock(&hdd_context_lock); |
| 3805 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3806 | status = sme_SetBssHotlist(pHddCtx->hHal, pReqMsg); |
| 3807 | if (!HAL_STATUS_SUCCESS(status)) { |
| 3808 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3809 | FL("sme_SetBssHotlist failed(err=%d)"), status); |
| 3810 | vos_mem_free(pReqMsg); |
| 3811 | return -EINVAL; |
| 3812 | } |
| 3813 | |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3814 | /* request was sent -- wait for the response */ |
| 3815 | rc = wait_for_completion_timeout(&context->response_event, |
| 3816 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 3817 | |
| 3818 | if (!rc) { |
| 3819 | hddLog(LOGE, FL("sme_SetBssHotlist timed out")); |
| 3820 | retval = -ETIMEDOUT; |
| 3821 | } else { |
| 3822 | spin_lock(&hdd_context_lock); |
| 3823 | if (context->request_id == request_id) |
| 3824 | retval = context->response_status; |
| 3825 | else |
| 3826 | retval = -EINVAL; |
| 3827 | spin_unlock(&hdd_context_lock); |
| 3828 | } |
| 3829 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 3830 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 3831 | EXIT(); |
Padma, Santhosh Kumar | 37f4fd1 | 2015-08-19 14:37:37 +0530 | [diff] [blame] | 3832 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 3833 | |
| 3834 | fail: |
| 3835 | vos_mem_free(pReqMsg); |
| 3836 | return -EINVAL; |
| 3837 | } |
| 3838 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 3839 | static int wlan_hdd_cfg80211_extscan_set_bssid_hotlist(struct wiphy *wiphy, |
| 3840 | struct wireless_dev *wdev, |
| 3841 | const void *data, int dataLen) |
| 3842 | { |
| 3843 | int ret = 0; |
| 3844 | |
| 3845 | vos_ssr_protect(__func__); |
| 3846 | ret = __wlan_hdd_cfg80211_extscan_set_bssid_hotlist(wiphy, wdev, data, |
| 3847 | dataLen); |
| 3848 | vos_ssr_unprotect(__func__); |
| 3849 | |
| 3850 | return ret; |
| 3851 | } |
| 3852 | |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3853 | /* |
| 3854 | * define short names for the global vendor params |
| 3855 | * used by wlan_hdd_cfg80211_extscan_set_ssid_hotlist() |
| 3856 | */ |
| 3857 | #define PARAM_MAX \ |
| 3858 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX |
| 3859 | #define PARAM_REQUEST_ID \ |
| 3860 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID |
| 3861 | #define PARAMS_LOST_SSID_SAMPLE_SIZE \ |
| 3862 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_LOST_SSID_SAMPLE_SIZE |
| 3863 | #define PARAMS_NUM_SSID \ |
| 3864 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_HOTLIST_PARAMS_NUM_SSID |
| 3865 | #define THRESHOLD_PARAM \ |
| 3866 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM |
| 3867 | #define PARAM_SSID \ |
| 3868 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_SSID |
| 3869 | #define PARAM_BAND \ |
| 3870 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_BAND |
| 3871 | #define PARAM_RSSI_LOW \ |
| 3872 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_LOW |
| 3873 | #define PARAM_RSSI_HIGH \ |
| 3874 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SSID_THRESHOLD_PARAM_RSSI_HIGH |
| 3875 | |
| 3876 | /** |
| 3877 | * __wlan_hdd_cfg80211_extscan_set_ssid_hotlist() - set ssid hot list |
| 3878 | * @wiphy: Pointer to wireless phy |
| 3879 | * @wdev: Pointer to wireless device |
| 3880 | * @data: Pointer to data |
| 3881 | * @data_len: Data length |
| 3882 | * |
| 3883 | * Return: 0 on success, negative errno on failure |
| 3884 | */ |
| 3885 | static int |
| 3886 | __wlan_hdd_cfg80211_extscan_set_ssid_hotlist(struct wiphy *wiphy, |
| 3887 | struct wireless_dev *wdev, |
| 3888 | const void *data, |
| 3889 | int data_len) |
| 3890 | { |
| 3891 | tSirEXTScanSetSsidHotListReqParams *request; |
| 3892 | struct net_device *dev = wdev->netdev; |
| 3893 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 3894 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 3895 | struct nlattr *tb[PARAM_MAX + 1]; |
| 3896 | struct nlattr *tb2[PARAM_MAX + 1]; |
| 3897 | struct nlattr *ssids; |
| 3898 | struct hdd_ext_scan_context *context; |
| 3899 | uint32_t request_id; |
| 3900 | char ssid_string[SIR_MAC_MAX_SSID_LENGTH + 1] = {'\0'}; |
| 3901 | int ssid_len; |
| 3902 | eHalStatus status; |
| 3903 | int i, rem, retval; |
| 3904 | unsigned long rc; |
| 3905 | |
| 3906 | ENTER(); |
| 3907 | |
| 3908 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 3909 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 3910 | return -EINVAL; |
| 3911 | } |
| 3912 | |
| 3913 | retval = wlan_hdd_validate_context(hdd_ctx); |
| 3914 | if (0 != retval) { |
| 3915 | hddLog(LOGE, FL("HDD context is not valid")); |
| 3916 | return -EINVAL; |
| 3917 | } |
| 3918 | |
| 3919 | /* check the EXTScan Capability */ |
| 3920 | if ( (TRUE != hdd_ctx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 3921 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 3922 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 3923 | { |
| 3924 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 3925 | FL("EXTScan not enabled/supported by Firmware")); |
| 3926 | return -EINVAL; |
| 3927 | } |
| 3928 | |
| 3929 | if (nla_parse(tb, PARAM_MAX, |
| 3930 | data, data_len, |
| 3931 | wlan_hdd_extscan_config_policy)) { |
| 3932 | hddLog(LOGE, FL("Invalid ATTR")); |
| 3933 | return -EINVAL; |
| 3934 | } |
| 3935 | |
| 3936 | request = vos_mem_malloc(sizeof(*request)); |
| 3937 | if (!request) { |
| 3938 | hddLog(LOGE, FL("vos_mem_malloc failed")); |
| 3939 | return -ENOMEM; |
| 3940 | } |
| 3941 | |
| 3942 | /* Parse and fetch request Id */ |
| 3943 | if (!tb[PARAM_REQUEST_ID]) { |
| 3944 | hddLog(LOGE, FL("attr request id failed")); |
| 3945 | goto fail; |
| 3946 | } |
| 3947 | |
| 3948 | request->request_id = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 3949 | hddLog(LOG1, FL("Request Id %d"), request->request_id); |
| 3950 | |
| 3951 | /* Parse and fetch lost SSID sample size */ |
| 3952 | if (!tb[PARAMS_LOST_SSID_SAMPLE_SIZE]) { |
| 3953 | hddLog(LOGE, FL("attr number of Ssid failed")); |
| 3954 | goto fail; |
| 3955 | } |
| 3956 | request->lost_ssid_sample_size = |
| 3957 | nla_get_u32(tb[PARAMS_LOST_SSID_SAMPLE_SIZE]); |
| 3958 | hddLog(LOG1, FL("Lost SSID Sample Size %d"), |
| 3959 | request->lost_ssid_sample_size); |
| 3960 | |
| 3961 | /* Parse and fetch number of hotlist SSID */ |
| 3962 | if (!tb[PARAMS_NUM_SSID]) { |
| 3963 | hddLog(LOGE, FL("attr number of Ssid failed")); |
| 3964 | goto fail; |
| 3965 | } |
| 3966 | request->ssid_count = nla_get_u32(tb[PARAMS_NUM_SSID]); |
| 3967 | hddLog(LOG1, FL("Number of SSID %d"), request->ssid_count); |
| 3968 | |
| 3969 | request->session_id = adapter->sessionId; |
| 3970 | hddLog(LOG1, FL("Session Id (%d)"), request->session_id); |
| 3971 | |
| 3972 | i = 0; |
| 3973 | nla_for_each_nested(ssids, tb[THRESHOLD_PARAM], rem) { |
| 3974 | if (i >= WLAN_EXTSCAN_MAX_HOTLIST_SSIDS) { |
| 3975 | hddLog(LOGE, |
| 3976 | FL("Too Many SSIDs, %d exceeds %d"), |
| 3977 | i, WLAN_EXTSCAN_MAX_HOTLIST_SSIDS); |
| 3978 | break; |
| 3979 | } |
| 3980 | if (nla_parse(tb2, PARAM_MAX, |
| 3981 | nla_data(ssids), nla_len(ssids), |
| 3982 | wlan_hdd_extscan_config_policy)) { |
| 3983 | hddLog(LOGE, FL("nla_parse failed")); |
| 3984 | goto fail; |
| 3985 | } |
| 3986 | |
| 3987 | /* Parse and fetch SSID */ |
| 3988 | if (!tb2[PARAM_SSID]) { |
| 3989 | hddLog(LOGE, FL("attr ssid failed")); |
| 3990 | goto fail; |
| 3991 | } |
| 3992 | nla_memcpy(ssid_string, |
| 3993 | tb2[PARAM_SSID], |
| 3994 | sizeof(ssid_string)); |
| 3995 | hddLog(LOG1, FL("SSID %s"), |
| 3996 | ssid_string); |
| 3997 | ssid_len = strlen(ssid_string); |
| 3998 | memcpy(request->ssid[i].ssid.ssId, ssid_string, ssid_len); |
| 3999 | request->ssid[i].ssid.length = ssid_len; |
| 4000 | request->ssid[i].ssid.ssId[ssid_len] = '\0'; |
| 4001 | hddLog(LOG1, FL("After copying SSID %s"), |
| 4002 | request->ssid[i].ssid.ssId); |
| 4003 | hddLog(LOG1, FL("After copying length: %d"), |
| 4004 | ssid_len); |
| 4005 | |
| 4006 | /* Parse and fetch low RSSI */ |
| 4007 | if (!tb2[PARAM_BAND]) { |
| 4008 | hddLog(LOGE, FL("attr band failed")); |
| 4009 | goto fail; |
| 4010 | } |
| 4011 | request->ssid[i].band = nla_get_u8(tb2[PARAM_BAND]); |
| 4012 | hddLog(LOG1, FL("band %d"), request->ssid[i].band); |
| 4013 | |
| 4014 | /* Parse and fetch low RSSI */ |
| 4015 | if (!tb2[PARAM_RSSI_LOW]) { |
| 4016 | hddLog(LOGE, FL("attr low RSSI failed")); |
| 4017 | goto fail; |
| 4018 | } |
| 4019 | request->ssid[i].rssi_low = nla_get_s32(tb2[PARAM_RSSI_LOW]); |
| 4020 | hddLog(LOG1, FL("RSSI low %d"), request->ssid[i].rssi_low); |
| 4021 | |
| 4022 | /* Parse and fetch high RSSI */ |
| 4023 | if (!tb2[PARAM_RSSI_HIGH]) { |
| 4024 | hddLog(LOGE, FL("attr high RSSI failed")); |
| 4025 | goto fail; |
| 4026 | } |
| 4027 | request->ssid[i].rssi_high = nla_get_u32(tb2[PARAM_RSSI_HIGH]); |
| 4028 | hddLog(LOG1, FL("RSSI high %d"), request->ssid[i].rssi_high); |
| 4029 | i++; |
| 4030 | } |
| 4031 | |
| 4032 | context = &hdd_ctx->ext_scan_context; |
| 4033 | spin_lock(&hdd_context_lock); |
| 4034 | INIT_COMPLETION(context->response_event); |
| 4035 | context->request_id = request_id = request->request_id; |
| 4036 | spin_unlock(&hdd_context_lock); |
| 4037 | |
| 4038 | status = sme_set_ssid_hotlist(hdd_ctx->hHal, request); |
| 4039 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4040 | hddLog(LOGE, |
| 4041 | FL("sme_set_ssid_hotlist failed(err=%d)"), status); |
| 4042 | goto fail; |
| 4043 | } |
| 4044 | |
| 4045 | vos_mem_free(request); |
| 4046 | |
| 4047 | /* request was sent -- wait for the response */ |
| 4048 | rc = wait_for_completion_timeout(&context->response_event, |
| 4049 | msecs_to_jiffies |
| 4050 | (WLAN_WAIT_TIME_EXTSCAN)); |
| 4051 | if (!rc) { |
| 4052 | hddLog(LOGE, FL("sme_set_ssid_hotlist timed out")); |
| 4053 | retval = -ETIMEDOUT; |
| 4054 | } else { |
| 4055 | spin_lock(&hdd_context_lock); |
| 4056 | if (context->request_id == request_id) |
| 4057 | retval = context->response_status; |
| 4058 | else |
| 4059 | retval = -EINVAL; |
| 4060 | spin_unlock(&hdd_context_lock); |
| 4061 | } |
| 4062 | |
| 4063 | return retval; |
| 4064 | |
| 4065 | fail: |
| 4066 | vos_mem_free(request); |
| 4067 | return -EINVAL; |
| 4068 | } |
| 4069 | |
| 4070 | /* |
| 4071 | * done with short names for the global vendor params |
| 4072 | * used by wlan_hdd_cfg80211_extscan_set_ssid_hotlist() |
| 4073 | */ |
| 4074 | #undef PARAM_MAX |
| 4075 | #undef PARAM_REQUEST_ID |
| 4076 | #undef PARAMS_NUM_SSID |
| 4077 | #undef THRESHOLD_PARAM |
| 4078 | #undef PARAM_SSID |
| 4079 | #undef PARAM_BAND |
| 4080 | #undef PARAM_RSSI_LOW |
| 4081 | #undef PARAM_RSSI_HIGH |
| 4082 | |
| 4083 | static int wlan_hdd_cfg80211_extscan_set_ssid_hotlist(struct wiphy *wiphy, |
| 4084 | struct wireless_dev *wdev, |
| 4085 | const void *data, int dataLen) |
| 4086 | { |
| 4087 | int ret = 0; |
| 4088 | |
| 4089 | vos_ssr_protect(__func__); |
| 4090 | ret = __wlan_hdd_cfg80211_extscan_set_ssid_hotlist(wiphy, wdev, data, |
| 4091 | dataLen); |
| 4092 | vos_ssr_unprotect(__func__); |
| 4093 | |
| 4094 | return ret; |
| 4095 | } |
| 4096 | |
| 4097 | static int |
| 4098 | __wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(struct wiphy *wiphy, |
| 4099 | struct wireless_dev *wdev, |
| 4100 | const void *data, |
| 4101 | int data_len) |
| 4102 | { |
| 4103 | tSirEXTScanResetSsidHotlistReqParams request; |
| 4104 | struct net_device *dev = wdev->netdev; |
| 4105 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4106 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 4107 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4108 | struct hdd_ext_scan_context *context; |
| 4109 | uint32_t request_id; |
| 4110 | eHalStatus status; |
| 4111 | int retval; |
| 4112 | unsigned long rc; |
| 4113 | |
| 4114 | ENTER(); |
| 4115 | |
| 4116 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4117 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4118 | return -EINVAL; |
| 4119 | } |
| 4120 | |
| 4121 | retval = wlan_hdd_validate_context(hdd_ctx); |
| 4122 | if (0 != retval) { |
| 4123 | hddLog(LOGE, FL("HDD context is not valid")); |
| 4124 | return -EINVAL; |
| 4125 | } |
| 4126 | |
| 4127 | /* check the EXTScan Capability */ |
| 4128 | if ( (TRUE != hdd_ctx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4129 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4130 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 4131 | { |
| 4132 | hddLog(LOGE, |
| 4133 | FL("EXTScan not enabled/supported by Firmware")); |
| 4134 | return -EINVAL; |
| 4135 | } |
| 4136 | |
| 4137 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4138 | data, data_len, |
| 4139 | wlan_hdd_extscan_config_policy)) { |
| 4140 | hddLog(LOGE, FL("Invalid ATTR")); |
| 4141 | return -EINVAL; |
| 4142 | } |
| 4143 | |
| 4144 | /* Parse and fetch request Id */ |
| 4145 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4146 | hddLog(LOGE, FL("attr request id failed")); |
| 4147 | return -EINVAL; |
| 4148 | } |
| 4149 | |
| 4150 | request.requestId = nla_get_u32( |
| 4151 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4152 | request.sessionId = adapter->sessionId; |
| 4153 | hddLog(LOG1, FL("Request Id %d Session Id %d"), request.requestId, |
| 4154 | request.sessionId); |
| 4155 | |
| 4156 | context = &hdd_ctx->ext_scan_context; |
| 4157 | spin_lock(&hdd_context_lock); |
| 4158 | INIT_COMPLETION(context->response_event); |
| 4159 | context->request_id = request_id = request.requestId; |
| 4160 | spin_unlock(&hdd_context_lock); |
| 4161 | |
| 4162 | status = sme_reset_ssid_hotlist(hdd_ctx->hHal, &request); |
| 4163 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4164 | hddLog(LOGE, |
| 4165 | FL("sme_reset_ssid_hotlist failed(err=%d)"), status); |
| 4166 | return -EINVAL; |
| 4167 | } |
| 4168 | |
| 4169 | /* request was sent -- wait for the response */ |
| 4170 | rc = wait_for_completion_timeout(&context->response_event, |
| 4171 | msecs_to_jiffies |
| 4172 | (WLAN_WAIT_TIME_EXTSCAN)); |
| 4173 | if (!rc) { |
| 4174 | hddLog(LOGE, FL("sme_reset_ssid_hotlist timed out")); |
| 4175 | retval = -ETIMEDOUT; |
| 4176 | } else { |
| 4177 | spin_lock(&hdd_context_lock); |
| 4178 | if (context->request_id == request_id) |
| 4179 | retval = context->response_status; |
| 4180 | else |
| 4181 | retval = -EINVAL; |
| 4182 | spin_unlock(&hdd_context_lock); |
| 4183 | } |
| 4184 | |
| 4185 | return retval; |
| 4186 | } |
| 4187 | |
| 4188 | static int |
| 4189 | wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(struct wiphy *wiphy, |
| 4190 | struct wireless_dev *wdev, |
| 4191 | const void *data, |
| 4192 | int data_len) |
| 4193 | { |
| 4194 | int ret; |
| 4195 | |
| 4196 | vos_ssr_protect(__func__); |
| 4197 | ret = __wlan_hdd_cfg80211_extscan_reset_ssid_hotlist(wiphy, wdev, |
| 4198 | data, data_len); |
| 4199 | vos_ssr_unprotect(__func__); |
| 4200 | |
| 4201 | return ret; |
| 4202 | } |
| 4203 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4204 | static int __wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4205 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4206 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4207 | { |
| 4208 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4209 | tANI_U32 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 4210 | tANI_U8 numChannels = 0; |
| 4211 | 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] | 4212 | tANI_U32 requestId, maxChannels; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4213 | tWifiBand wifiBand; |
| 4214 | eHalStatus status; |
| 4215 | struct sk_buff *replySkb; |
| 4216 | tANI_U8 i; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4217 | int ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4218 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4219 | ENTER(); |
| 4220 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4221 | status = wlan_hdd_validate_context(pHddCtx); |
| 4222 | if (0 != status) |
| 4223 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4224 | return -EINVAL; |
| 4225 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4226 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4227 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4228 | data, dataLen, |
| 4229 | wlan_hdd_extscan_config_policy)) { |
| 4230 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4231 | return -EINVAL; |
| 4232 | } |
| 4233 | |
| 4234 | /* Parse and fetch request Id */ |
| 4235 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4236 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4237 | return -EINVAL; |
| 4238 | } |
| 4239 | requestId = nla_get_u32( |
| 4240 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
| 4241 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), requestId); |
| 4242 | |
| 4243 | /* Parse and fetch wifi band */ |
| 4244 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]) |
| 4245 | { |
| 4246 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr wifi band failed")); |
| 4247 | return -EINVAL; |
| 4248 | } |
| 4249 | wifiBand = nla_get_u32( |
| 4250 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_WIFI_BAND]); |
| 4251 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Wifi band (%d)"), wifiBand); |
| 4252 | |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4253 | /* Parse and fetch max channels */ |
| 4254 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]) |
| 4255 | { |
| 4256 | hddLog(LOGE, FL("attr max channels failed")); |
| 4257 | return -EINVAL; |
| 4258 | } |
| 4259 | maxChannels = nla_get_u32( |
| 4260 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_GET_VALID_CHANNELS_CONFIG_PARAM_MAX_CHANNELS]); |
| 4261 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max channels %d"), maxChannels); |
| 4262 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4263 | status = sme_GetValidChannelsByBand((tHalHandle)(pHddCtx->hHal), |
| 4264 | wifiBand, ChannelList, |
| 4265 | &numChannels); |
| 4266 | if (eHAL_STATUS_SUCCESS != status) { |
| 4267 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4268 | FL("sme_GetValidChannelsByBand failed (err=%d)"), status); |
| 4269 | return -EINVAL; |
| 4270 | } |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4271 | |
| 4272 | numChannels = VOS_MIN(numChannels, maxChannels); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4273 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of channels (%d)"), numChannels); |
Padma, Santhosh Kumar | 387aa9c | 2015-06-19 15:39:37 +0530 | [diff] [blame] | 4274 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4275 | for (i = 0; i < numChannels; i++) |
| 4276 | hddLog(VOS_TRACE_LEVEL_INFO, "Channel: %u ", ChannelList[i]); |
| 4277 | |
| 4278 | replySkb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 4279 | sizeof(u32) * numChannels + |
| 4280 | NLMSG_HDRLEN); |
| 4281 | |
| 4282 | if (!replySkb) { |
| 4283 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4284 | FL("valid channels: buffer alloc fail")); |
| 4285 | return -EINVAL; |
| 4286 | } |
| 4287 | if (nla_put_u32(replySkb, |
| 4288 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_NUM_CHANNELS, |
| 4289 | numChannels) || |
| 4290 | nla_put(replySkb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_RESULTS_CHANNELS, |
| 4291 | sizeof(u32) * numChannels, ChannelList)) { |
| 4292 | |
| 4293 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 4294 | kfree_skb(replySkb); |
| 4295 | return -EINVAL; |
| 4296 | } |
| 4297 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4298 | ret = cfg80211_vendor_cmd_reply(replySkb); |
| 4299 | |
| 4300 | EXIT(); |
| 4301 | return ret; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4302 | } |
| 4303 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4304 | static int wlan_hdd_cfg80211_extscan_get_valid_channels(struct wiphy *wiphy, |
| 4305 | struct wireless_dev *wdev, |
| 4306 | const void *data, int dataLen) |
| 4307 | { |
| 4308 | int ret = 0; |
| 4309 | |
| 4310 | vos_ssr_protect(__func__); |
| 4311 | ret = __wlan_hdd_cfg80211_extscan_get_valid_channels(wiphy, wdev, data, |
| 4312 | dataLen); |
| 4313 | vos_ssr_unprotect(__func__); |
| 4314 | |
| 4315 | return ret; |
| 4316 | } |
| 4317 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4318 | static int hdd_extscan_start_fill_bucket_channel_spec( |
| 4319 | hdd_context_t *pHddCtx, |
| 4320 | tpSirEXTScanStartReqParams pReqMsg, |
| 4321 | struct nlattr **tb) |
| 4322 | { |
| 4323 | struct nlattr *bucket[ |
| 4324 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4325 | struct nlattr *channel[ |
| 4326 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4327 | struct nlattr *buckets; |
| 4328 | struct nlattr *channels; |
| 4329 | int rem1, rem2; |
| 4330 | eHalStatus status; |
| 4331 | tANI_U8 bktIndex, j, numChannels; |
| 4332 | tANI_U32 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 4333 | tANI_U32 passive_max_chn_time, active_max_chn_time; |
| 4334 | |
| 4335 | bktIndex = 0; |
| 4336 | |
| 4337 | nla_for_each_nested(buckets, |
| 4338 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC], rem1) { |
| 4339 | if (nla_parse(bucket, |
| 4340 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4341 | nla_data(buckets), nla_len(buckets), NULL)) { |
| 4342 | hddLog(LOGE, FL("nla_parse failed")); |
| 4343 | return -EINVAL; |
| 4344 | } |
| 4345 | |
| 4346 | /* Parse and fetch bucket spec */ |
| 4347 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]) { |
| 4348 | hddLog(LOGE, FL("attr bucket index failed")); |
| 4349 | return -EINVAL; |
| 4350 | } |
| 4351 | pReqMsg->buckets[bktIndex].bucket = nla_get_u8( |
| 4352 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_INDEX]); |
| 4353 | hddLog(LOG1, FL("Bucket spec Index %d"), |
| 4354 | pReqMsg->buckets[bktIndex].bucket); |
| 4355 | |
| 4356 | /* Parse and fetch wifi band */ |
| 4357 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]) { |
| 4358 | hddLog(LOGE, FL("attr wifi band failed")); |
| 4359 | return -EINVAL; |
| 4360 | } |
| 4361 | pReqMsg->buckets[bktIndex].band = nla_get_u8( |
| 4362 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_BAND]); |
| 4363 | hddLog(LOG1, FL("Wifi band %d"), |
| 4364 | pReqMsg->buckets[bktIndex].band); |
| 4365 | |
| 4366 | /* Parse and fetch period */ |
| 4367 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]) { |
| 4368 | hddLog(LOGE, FL("attr period failed")); |
| 4369 | return -EINVAL; |
| 4370 | } |
| 4371 | pReqMsg->buckets[bktIndex].period = nla_get_u32( |
| 4372 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_PERIOD]); |
| 4373 | hddLog(LOG1, FL("period %d"), |
| 4374 | pReqMsg->buckets[bktIndex].period); |
| 4375 | |
| 4376 | /* Parse and fetch report events */ |
| 4377 | if (!bucket[ |
| 4378 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]) { |
| 4379 | hddLog(LOGE, FL("attr report events failed")); |
| 4380 | return -EINVAL; |
| 4381 | } |
| 4382 | pReqMsg->buckets[bktIndex].reportEvents = nla_get_u8( |
| 4383 | bucket[ |
| 4384 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_REPORT_EVENTS]); |
| 4385 | hddLog(LOG1, FL("report events %d"), |
| 4386 | pReqMsg->buckets[bktIndex].reportEvents); |
| 4387 | |
| 4388 | /* Parse and fetch max period */ |
| 4389 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]) { |
| 4390 | hddLog(LOGE, FL("attr max period failed")); |
| 4391 | return -EINVAL; |
| 4392 | } |
| 4393 | pReqMsg->buckets[bktIndex].max_period = nla_get_u32( |
| 4394 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_MAX_PERIOD]); |
| 4395 | hddLog(LOG1, FL("max period %u"), |
| 4396 | pReqMsg->buckets[bktIndex].max_period); |
| 4397 | |
| 4398 | /* Parse and fetch exponent */ |
| 4399 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]) { |
| 4400 | hddLog(LOGE, FL("attr exponent failed")); |
| 4401 | return -EINVAL; |
| 4402 | } |
| 4403 | pReqMsg->buckets[bktIndex].exponent = nla_get_u32( |
| 4404 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_EXPONENT]); |
| 4405 | hddLog(LOG1, FL("exponent %u"), |
| 4406 | pReqMsg->buckets[bktIndex].exponent); |
| 4407 | |
| 4408 | /* Parse and fetch step count */ |
| 4409 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]) { |
| 4410 | hddLog(LOGE, FL("attr step count failed")); |
| 4411 | return -EINVAL; |
| 4412 | } |
| 4413 | pReqMsg->buckets[bktIndex].step_count = nla_get_u32( |
| 4414 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_STEP_COUNT]); |
| 4415 | hddLog(LOG1, FL("Step count %u"), |
| 4416 | pReqMsg->buckets[bktIndex].step_count); |
| 4417 | |
| 4418 | ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &passive_max_chn_time); |
| 4419 | ccmCfgGetInt(pHddCtx->hHal, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &active_max_chn_time); |
| 4420 | |
| 4421 | /* Framework shall pass the channel list if the input WiFi band is |
| 4422 | * WIFI_BAND_UNSPECIFIED. |
| 4423 | * If the input WiFi band is specified (any value other than |
| 4424 | * WIFI_BAND_UNSPECIFIED) then driver populates the channel list |
| 4425 | */ |
| 4426 | if (pReqMsg->buckets[bktIndex].band != WIFI_BAND_UNSPECIFIED) { |
| 4427 | numChannels = 0; |
| 4428 | hddLog(LOG1, "WiFi band is specified, driver to fill channel list"); |
| 4429 | status = sme_GetValidChannelsByBand(pHddCtx->hHal, |
| 4430 | pReqMsg->buckets[bktIndex].band, |
| 4431 | chanList, &numChannels); |
| 4432 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4433 | hddLog(LOGE, |
| 4434 | FL("sme_GetValidChannelsByBand failed (err=%d)"), |
| 4435 | status); |
| 4436 | return -EINVAL; |
| 4437 | } |
| 4438 | |
| 4439 | pReqMsg->buckets[bktIndex].numChannels = |
| 4440 | VOS_MIN(numChannels, WLAN_EXTSCAN_MAX_CHANNELS); |
| 4441 | hddLog(LOG1, FL("Num channels %d"), |
| 4442 | pReqMsg->buckets[bktIndex].numChannels); |
| 4443 | |
| 4444 | for (j = 0; j < pReqMsg->buckets[bktIndex].numChannels; |
| 4445 | j++) { |
| 4446 | pReqMsg->buckets[bktIndex].channels[j].channel = |
| 4447 | chanList[j]; |
| 4448 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4449 | chnlClass = 0; |
| 4450 | if (CSR_IS_CHANNEL_DFS( |
| 4451 | vos_freq_to_chan(chanList[j]))) { |
| 4452 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4453 | passive = 1; |
| 4454 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4455 | dwellTimeMs = passive_max_chn_time; |
| 4456 | } else { |
| 4457 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4458 | passive = 0; |
| 4459 | pReqMsg->buckets[bktIndex].channels[j]. |
| 4460 | dwellTimeMs = active_max_chn_time; |
| 4461 | } |
| 4462 | |
| 4463 | hddLog(LOG1, |
| 4464 | "Channel %u Passive %u Dwell time %u ms", |
| 4465 | pReqMsg->buckets[bktIndex].channels[j].channel, |
| 4466 | pReqMsg->buckets[bktIndex].channels[j].passive, |
| 4467 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs); |
| 4468 | } |
| 4469 | |
| 4470 | bktIndex++; |
| 4471 | continue; |
| 4472 | } |
| 4473 | |
| 4474 | /* Parse and fetch number of channels */ |
| 4475 | if (!bucket[ |
| 4476 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]) { |
| 4477 | hddLog(LOGE, FL("attr num channels failed")); |
| 4478 | return -EINVAL; |
| 4479 | } |
| 4480 | |
| 4481 | pReqMsg->buckets[bktIndex].numChannels = |
| 4482 | nla_get_u32(bucket[ |
| 4483 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC_NUM_CHANNEL_SPECS]); |
| 4484 | hddLog(LOG1, FL("num channels %d"), |
| 4485 | pReqMsg->buckets[bktIndex].numChannels); |
| 4486 | |
| 4487 | if (!bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC]) { |
| 4488 | hddLog(LOGE, FL("attr channel spec failed")); |
| 4489 | return -EINVAL; |
| 4490 | } |
| 4491 | |
| 4492 | j = 0; |
| 4493 | nla_for_each_nested(channels, |
| 4494 | bucket[QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC], rem2) { |
| 4495 | if (nla_parse(channel, |
| 4496 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4497 | nla_data(channels), nla_len(channels), |
| 4498 | wlan_hdd_extscan_config_policy)) { |
| 4499 | hddLog(LOGE, FL("nla_parse failed")); |
| 4500 | return -EINVAL; |
| 4501 | } |
| 4502 | |
| 4503 | /* Parse and fetch channel */ |
| 4504 | if (!channel[ |
| 4505 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]) { |
| 4506 | hddLog(LOGE, FL("attr channel failed")); |
| 4507 | return -EINVAL; |
| 4508 | } |
| 4509 | pReqMsg->buckets[bktIndex].channels[j].channel = |
| 4510 | nla_get_u32(channel[ |
| 4511 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_CHANNEL]); |
| 4512 | hddLog(LOG1, FL("channel %u"), |
| 4513 | pReqMsg->buckets[bktIndex].channels[j].channel); |
| 4514 | |
| 4515 | /* Parse and fetch dwell time */ |
| 4516 | if (!channel[ |
| 4517 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]) { |
| 4518 | hddLog(LOGE, FL("attr dwelltime failed")); |
| 4519 | return -EINVAL; |
| 4520 | } |
| 4521 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs = |
| 4522 | nla_get_u32(channel[ |
| 4523 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_DWELL_TIME]); |
| 4524 | |
| 4525 | hddLog(LOG1, FL("Dwell time (%u ms)"), |
| 4526 | pReqMsg->buckets[bktIndex].channels[j].dwellTimeMs); |
| 4527 | |
| 4528 | |
| 4529 | /* Parse and fetch channel spec passive */ |
| 4530 | if (!channel[ |
| 4531 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]) { |
| 4532 | hddLog(LOGE, |
| 4533 | FL("attr channel spec passive failed")); |
| 4534 | return -EINVAL; |
| 4535 | } |
| 4536 | pReqMsg->buckets[bktIndex].channels[j].passive = |
| 4537 | nla_get_u8(channel[ |
| 4538 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_CHANNEL_SPEC_PASSIVE]); |
| 4539 | hddLog(LOG1, FL("Chnl spec passive %u"), |
| 4540 | pReqMsg->buckets[bktIndex].channels[j].passive); |
| 4541 | |
| 4542 | j++; |
| 4543 | } |
| 4544 | |
| 4545 | bktIndex++; |
| 4546 | } |
| 4547 | |
| 4548 | return 0; |
| 4549 | } |
| 4550 | |
| 4551 | |
| 4552 | /* |
| 4553 | * define short names for the global vendor params |
| 4554 | * used by wlan_hdd_cfg80211_extscan_start() |
| 4555 | */ |
| 4556 | #define PARAM_MAX \ |
| 4557 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX |
| 4558 | #define PARAM_REQUEST_ID \ |
| 4559 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID |
| 4560 | #define PARAM_BASE_PERIOD \ |
| 4561 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_BASE_PERIOD |
| 4562 | #define PARAM_MAX_AP_PER_SCAN \ |
| 4563 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_MAX_AP_PER_SCAN |
| 4564 | #define PARAM_RPT_THRHLD_PERCENT \ |
| 4565 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_PERCENT |
| 4566 | #define PARAM_RPT_THRHLD_NUM_SCANS \ |
| 4567 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_REPORT_THRESHOLD_NUM_SCANS |
| 4568 | #define PARAM_NUM_BUCKETS \ |
| 4569 | QCA_WLAN_VENDOR_ATTR_EXTSCAN_SCAN_CMD_PARAMS_NUM_BUCKETS |
| 4570 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4571 | static int __wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4572 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4573 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4574 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4575 | tpSirEXTScanStartReqParams pReqMsg = NULL; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4576 | struct net_device *dev = wdev->netdev; |
| 4577 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4578 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4579 | struct nlattr *tb[PARAM_MAX + 1]; |
| 4580 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4581 | eHalStatus status; |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4582 | tANI_U32 request_id; |
| 4583 | struct hdd_ext_scan_context *context; |
| 4584 | unsigned long rc; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4585 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4586 | ENTER(); |
| 4587 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4588 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4589 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4590 | return -EINVAL; |
| 4591 | } |
| 4592 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4593 | status = wlan_hdd_validate_context(pHddCtx); |
| 4594 | if (0 != status) |
| 4595 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4596 | return -EINVAL; |
| 4597 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4598 | /* check the EXTScan Capability */ |
| 4599 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4600 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4601 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4602 | { |
| 4603 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4604 | FL("EXTScan not enabled/supported by Firmware")); |
| 4605 | return -EINVAL; |
| 4606 | } |
| 4607 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4608 | if (nla_parse(tb, PARAM_MAX, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4609 | data, dataLen, |
| 4610 | wlan_hdd_extscan_config_policy)) { |
| 4611 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4612 | return -EINVAL; |
| 4613 | } |
| 4614 | |
| 4615 | /* Parse and fetch request Id */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4616 | if (!tb[PARAM_REQUEST_ID]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4617 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4618 | return -EINVAL; |
| 4619 | } |
| 4620 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4621 | pReqMsg = (tpSirEXTScanStartReqParams) |
| 4622 | vos_mem_malloc(sizeof(*pReqMsg)); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4623 | if (!pReqMsg) { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4624 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("vos_mem_malloc failed")); |
| 4625 | return -ENOMEM; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4626 | } |
| 4627 | |
| 4628 | pReqMsg->requestId = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4629 | tb[PARAM_REQUEST_ID]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4630 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), pReqMsg->requestId); |
| 4631 | |
| 4632 | pReqMsg->sessionId = pAdapter->sessionId; |
| 4633 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), pReqMsg->sessionId); |
| 4634 | |
| 4635 | /* Parse and fetch base period */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4636 | if (!tb[PARAM_BASE_PERIOD]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4637 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr base period failed")); |
| 4638 | goto fail; |
| 4639 | } |
| 4640 | pReqMsg->basePeriod = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4641 | tb[PARAM_BASE_PERIOD]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4642 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Base Period (%d)"), |
| 4643 | pReqMsg->basePeriod); |
| 4644 | |
| 4645 | /* Parse and fetch max AP per scan */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4646 | if (!tb[PARAM_MAX_AP_PER_SCAN]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4647 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr max_ap_per_scan failed")); |
| 4648 | goto fail; |
| 4649 | } |
| 4650 | pReqMsg->maxAPperScan = nla_get_u32( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4651 | tb[PARAM_MAX_AP_PER_SCAN]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4652 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Max AP per Scan (%d)"), |
| 4653 | pReqMsg->maxAPperScan); |
| 4654 | |
| 4655 | /* Parse and fetch report threshold */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4656 | if (!tb[PARAM_RPT_THRHLD_PERCENT]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4657 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr report_threshold failed")); |
| 4658 | goto fail; |
| 4659 | } |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4660 | pReqMsg->reportThresholdPercent = nla_get_u8( |
| 4661 | tb[PARAM_RPT_THRHLD_PERCENT]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4662 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Report Threshold (%d)"), |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4663 | pReqMsg->reportThresholdPercent); |
| 4664 | |
| 4665 | /* Parse and fetch report threshold num scans */ |
| 4666 | if (!tb[PARAM_RPT_THRHLD_NUM_SCANS]) { |
| 4667 | hddLog(LOGE, FL("attr report_threshold num scans failed")); |
| 4668 | goto fail; |
| 4669 | } |
| 4670 | pReqMsg->reportThresholdNumScans = nla_get_u8( |
| 4671 | tb[PARAM_RPT_THRHLD_NUM_SCANS]); |
| 4672 | hddLog(LOG1, FL("Report Threshold num scans %d"), |
| 4673 | pReqMsg->reportThresholdNumScans); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4674 | |
| 4675 | /* Parse and fetch number of buckets */ |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4676 | if (!tb[PARAM_NUM_BUCKETS]) { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4677 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr number of buckets failed")); |
| 4678 | goto fail; |
| 4679 | } |
| 4680 | pReqMsg->numBuckets = nla_get_u8( |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4681 | tb[PARAM_NUM_BUCKETS]); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4682 | if (pReqMsg->numBuckets > WLAN_EXTSCAN_MAX_BUCKETS) { |
| 4683 | hddLog(VOS_TRACE_LEVEL_WARN, FL("Exceeded MAX number of buckets " |
| 4684 | "Setting numBuckets to %u"), WLAN_EXTSCAN_MAX_BUCKETS); |
| 4685 | pReqMsg->numBuckets = WLAN_EXTSCAN_MAX_BUCKETS; |
| 4686 | } |
| 4687 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Number of Buckets (%d)"), |
| 4688 | pReqMsg->numBuckets); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4689 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4690 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_BUCKET_SPEC]) { |
| 4691 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bucket spec failed")); |
| 4692 | goto fail; |
| 4693 | } |
| 4694 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4695 | pReqMsg->homeAwayTime = pHddCtx->cfg_ini->nRestTimeConc; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4696 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4697 | if (hdd_extscan_start_fill_bucket_channel_spec(pHddCtx, pReqMsg, tb)) |
| 4698 | goto fail; |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4699 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4700 | context = &pHddCtx->ext_scan_context; |
| 4701 | spin_lock(&hdd_context_lock); |
| 4702 | INIT_COMPLETION(context->response_event); |
| 4703 | context->request_id = request_id = pReqMsg->requestId; |
| 4704 | spin_unlock(&hdd_context_lock); |
Dasari Srinivas | 8b2ce27 | 2014-09-16 16:57:30 +0530 | [diff] [blame] | 4705 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4706 | status = sme_EXTScanStart(pHddCtx->hHal, pReqMsg); |
| 4707 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4708 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4709 | FL("sme_EXTScanStart failed(err=%d)"), status); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4710 | goto fail; |
| 4711 | } |
| 4712 | |
| 4713 | /* request was sent -- wait for the response */ |
| 4714 | rc = wait_for_completion_timeout(&context->response_event, |
| 4715 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 4716 | |
| 4717 | if (!rc) { |
| 4718 | hddLog(LOGE, FL("sme_ExtScanStart timed out")); |
| 4719 | retval = -ETIMEDOUT; |
| 4720 | } else { |
| 4721 | spin_lock(&hdd_context_lock); |
| 4722 | if (context->request_id == request_id) |
| 4723 | retval = context->response_status; |
| 4724 | else |
| 4725 | retval = -EINVAL; |
| 4726 | spin_unlock(&hdd_context_lock); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4727 | } |
| 4728 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4729 | vos_mem_free(pReqMsg); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4730 | EXIT(); |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4731 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4732 | |
| 4733 | fail: |
| 4734 | vos_mem_free(pReqMsg); |
| 4735 | return -EINVAL; |
| 4736 | } |
| 4737 | |
Padma, Santhosh Kumar | 7b9190d | 2015-08-17 17:45:29 +0530 | [diff] [blame] | 4738 | /* |
| 4739 | * done with short names for the global vendor params |
| 4740 | * used by wlan_hdd_cfg80211_extscan_start() |
| 4741 | */ |
| 4742 | #undef PARAM_MAX |
| 4743 | #undef PARAM_REQUEST_ID |
| 4744 | #undef PARAM_BASE_PERIOD |
| 4745 | #undef PARAMS_MAX_AP_PER_SCAN |
| 4746 | #undef PARAMS_RPT_THRHLD_PERCENT |
| 4747 | #undef PARAMS_RPT_THRHLD_NUM_SCANS |
| 4748 | #undef PARAMS_NUM_BUCKETS |
| 4749 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4750 | static int wlan_hdd_cfg80211_extscan_start(struct wiphy *wiphy, |
| 4751 | struct wireless_dev *wdev, |
| 4752 | const void *data, int dataLen) |
| 4753 | { |
| 4754 | int ret = 0; |
| 4755 | |
| 4756 | vos_ssr_protect(__func__); |
| 4757 | ret = __wlan_hdd_cfg80211_extscan_start(wiphy, wdev, data, dataLen); |
| 4758 | vos_ssr_unprotect(__func__); |
| 4759 | |
| 4760 | return ret; |
| 4761 | } |
| 4762 | |
| 4763 | static int __wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4764 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4765 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4766 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4767 | tSirEXTScanStopReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4768 | struct net_device *dev = wdev->netdev; |
| 4769 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4770 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4771 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4772 | eHalStatus status; |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4773 | int retval; |
| 4774 | unsigned long rc; |
| 4775 | struct hdd_ext_scan_context *context; |
| 4776 | tANI_U32 request_id; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4777 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4778 | ENTER(); |
| 4779 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4780 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4781 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4782 | return -EINVAL; |
| 4783 | } |
| 4784 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4785 | status = wlan_hdd_validate_context(pHddCtx); |
| 4786 | if (0 != status) |
| 4787 | { |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4788 | return -EINVAL; |
| 4789 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4790 | /* check the EXTScan Capability */ |
| 4791 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4792 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4793 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4794 | { |
| 4795 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4796 | FL("EXTScan not enabled/supported by Firmware")); |
| 4797 | return -EINVAL; |
| 4798 | } |
| 4799 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4800 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4801 | data, dataLen, |
| 4802 | wlan_hdd_extscan_config_policy)) { |
| 4803 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4804 | return -EINVAL; |
| 4805 | } |
| 4806 | |
| 4807 | /* Parse and fetch request Id */ |
| 4808 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4809 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4810 | return -EINVAL; |
| 4811 | } |
| 4812 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4813 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4814 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4815 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4816 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4817 | reqMsg.sessionId = pAdapter->sessionId; |
| 4818 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4819 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4820 | context = &pHddCtx->ext_scan_context; |
| 4821 | spin_lock(&hdd_context_lock); |
| 4822 | INIT_COMPLETION(context->response_event); |
| 4823 | context->request_id = request_id = reqMsg.sessionId; |
| 4824 | spin_unlock(&hdd_context_lock); |
| 4825 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4826 | status = sme_EXTScanStop(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4827 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4828 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4829 | FL("sme_EXTScanStop failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4830 | return -EINVAL; |
| 4831 | } |
| 4832 | |
Padma, Santhosh Kumar | 57cff7f | 2015-08-17 18:33:14 +0530 | [diff] [blame] | 4833 | /* request was sent -- wait for the response */ |
| 4834 | rc = wait_for_completion_timeout(&context->response_event, |
| 4835 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 4836 | |
| 4837 | if (!rc) { |
| 4838 | hddLog(LOGE, FL("sme_ExtScanStop timed out")); |
| 4839 | retval = -ETIMEDOUT; |
| 4840 | } else { |
| 4841 | spin_lock(&hdd_context_lock); |
| 4842 | if (context->request_id == request_id) |
| 4843 | retval = context->response_status; |
| 4844 | else |
| 4845 | retval = -EINVAL; |
| 4846 | spin_unlock(&hdd_context_lock); |
| 4847 | } |
| 4848 | |
| 4849 | return retval; |
| 4850 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4851 | EXIT(); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4852 | return 0; |
| 4853 | } |
| 4854 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4855 | static int wlan_hdd_cfg80211_extscan_stop(struct wiphy *wiphy, |
| 4856 | struct wireless_dev *wdev, |
| 4857 | const void *data, int dataLen) |
| 4858 | { |
| 4859 | int ret = 0; |
| 4860 | |
| 4861 | vos_ssr_protect(__func__); |
| 4862 | ret = __wlan_hdd_cfg80211_extscan_stop(wiphy, wdev, data, dataLen); |
| 4863 | vos_ssr_unprotect(__func__); |
| 4864 | |
| 4865 | return ret; |
| 4866 | } |
| 4867 | |
| 4868 | static int __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4869 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 4870 | const void *data, int dataLen) |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4871 | { |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4872 | tSirEXTScanResetBssidHotlistReqParams reqMsg; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4873 | struct net_device *dev = wdev->netdev; |
| 4874 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 4875 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 4876 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX + 1]; |
| 4877 | eHalStatus status; |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4878 | struct hdd_ext_scan_context *context; |
| 4879 | tANI_U32 request_id; |
| 4880 | unsigned long rc; |
| 4881 | int retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4882 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4883 | ENTER(); |
| 4884 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4885 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 4886 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 4887 | return -EINVAL; |
| 4888 | } |
| 4889 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4890 | status = wlan_hdd_validate_context(pHddCtx); |
| 4891 | if (0 != status) |
| 4892 | { |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4893 | hddLog(LOGE, FL("HDD context is not valid")); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4894 | return -EINVAL; |
| 4895 | } |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4896 | /* check the EXTScan Capability */ |
| 4897 | if ( (TRUE != pHddCtx->cfg_ini->fEnableEXTScan) || |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 4898 | (TRUE != sme_IsFeatureSupportedByFW(EXTENDED_SCAN)) || |
| 4899 | (TRUE != sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED))) |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4900 | { |
| 4901 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4902 | FL("EXTScan not enabled/supported by Firmware")); |
| 4903 | return -EINVAL; |
| 4904 | } |
| 4905 | |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4906 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_MAX, |
| 4907 | data, dataLen, |
| 4908 | wlan_hdd_extscan_config_policy)) { |
| 4909 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 4910 | return -EINVAL; |
| 4911 | } |
| 4912 | |
| 4913 | /* Parse and fetch request Id */ |
| 4914 | if (!tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]) { |
| 4915 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr request id failed")); |
| 4916 | return -EINVAL; |
| 4917 | } |
| 4918 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4919 | reqMsg.requestId = nla_get_u32( |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4920 | tb[QCA_WLAN_VENDOR_ATTR_EXTSCAN_SUBCMD_CONFIG_PARAM_REQUEST_ID]); |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4921 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Req Id (%d)"), reqMsg.requestId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4922 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4923 | reqMsg.sessionId = pAdapter->sessionId; |
| 4924 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Session Id (%d)"), reqMsg.sessionId); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4925 | |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4926 | context = &pHddCtx->ext_scan_context; |
| 4927 | spin_lock(&hdd_context_lock); |
| 4928 | INIT_COMPLETION(context->response_event); |
| 4929 | context->request_id = request_id = reqMsg.requestId; |
| 4930 | spin_unlock(&hdd_context_lock); |
| 4931 | |
Dino Mycle | e8843b3 | 2014-07-04 14:21:45 +0530 | [diff] [blame] | 4932 | status = sme_ResetBssHotlist(pHddCtx->hHal, &reqMsg); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4933 | if (!HAL_STATUS_SUCCESS(status)) { |
| 4934 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 4935 | FL("sme_ResetBssHotlist failed(err=%d)"), status); |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4936 | return -EINVAL; |
| 4937 | } |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4938 | |
| 4939 | /* request was sent -- wait for the response */ |
| 4940 | rc = wait_for_completion_timeout(&context->response_event, |
| 4941 | msecs_to_jiffies(WLAN_WAIT_TIME_EXTSCAN)); |
| 4942 | if (!rc) { |
| 4943 | hddLog(LOGE, FL("sme_ResetBssHotlist timed out")); |
| 4944 | retval = -ETIMEDOUT; |
| 4945 | } else { |
| 4946 | spin_lock(&hdd_context_lock); |
| 4947 | if (context->request_id == request_id) |
| 4948 | retval = context->response_status; |
| 4949 | else |
| 4950 | retval = -EINVAL; |
| 4951 | spin_unlock(&hdd_context_lock); |
| 4952 | } |
| 4953 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 4954 | EXIT(); |
Padma, Santhosh Kumar | 04a3bab | 2015-08-20 13:09:35 +0530 | [diff] [blame] | 4955 | return retval; |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4956 | } |
| 4957 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 4958 | static int wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(struct wiphy *wiphy, |
| 4959 | struct wireless_dev *wdev, |
| 4960 | const void *data, int dataLen) |
| 4961 | { |
| 4962 | int ret = 0; |
| 4963 | |
| 4964 | vos_ssr_protect(__func__); |
| 4965 | ret = __wlan_hdd_cfg80211_extscan_reset_bssid_hotlist(wiphy, wdev, data, dataLen); |
| 4966 | vos_ssr_unprotect(__func__); |
| 4967 | |
| 4968 | return ret; |
| 4969 | } |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 4970 | #endif /* WLAN_FEATURE_EXTSCAN */ |
| 4971 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 4972 | /*EXT TDLS*/ |
| 4973 | static const struct nla_policy |
| 4974 | wlan_hdd_tdls_config_enable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX +1] = |
| 4975 | { |
| 4976 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4977 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL] = {.type = NLA_S32 }, |
| 4978 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS] = |
| 4979 | {.type = NLA_S32 }, |
| 4980 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS] = {.type = NLA_S32 }, |
| 4981 | [QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS] = {.type = NLA_S32 }, |
| 4982 | |
| 4983 | }; |
| 4984 | |
| 4985 | static const struct nla_policy |
| 4986 | wlan_hdd_tdls_config_disable_policy[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX +1] = |
| 4987 | { |
| 4988 | [QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4989 | |
| 4990 | }; |
| 4991 | |
| 4992 | static const struct nla_policy |
| 4993 | wlan_hdd_tdls_config_state_change_policy[ |
| 4994 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAX +1] = |
| 4995 | { |
| 4996 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 4997 | [QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE] = {.type = NLA_S32 }, |
| 4998 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 4999 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL] = {.type = NLA_S32 }, |
| 5000 | [QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS] = |
| 5001 | {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5002 | |
| 5003 | }; |
| 5004 | |
| 5005 | static const struct nla_policy |
| 5006 | wlan_hdd_tdls_config_get_status_policy[ |
| 5007 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX +1] = |
| 5008 | { |
| 5009 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR] = {.type = NLA_UNSPEC }, |
| 5010 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE] = {.type = NLA_S32 }, |
| 5011 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON] = {.type = NLA_S32 }, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5012 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL] = {.type = NLA_S32 }, |
| 5013 | [QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS] |
| 5014 | = {.type = NLA_S32 }, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5015 | |
| 5016 | }; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5017 | |
| 5018 | static const struct nla_policy |
| 5019 | wlan_hdd_mac_config[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX+1] = |
| 5020 | { |
| 5021 | [QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI] = {.type = NLA_UNSPEC }, |
| 5022 | }; |
| 5023 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5024 | static int __wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5025 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5026 | const void *data, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5027 | int data_len) |
| 5028 | { |
| 5029 | |
| 5030 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5031 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX + 1]; |
| 5032 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5033 | ENTER(); |
| 5034 | |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5035 | if (0 != wlan_hdd_validate_context(pHddCtx)){ |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5036 | return -EINVAL; |
| 5037 | } |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 5038 | if (0 == pHddCtx->cfg_ini->enableMacSpoofing) { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 5039 | hddLog(VOS_TRACE_LEVEL_INFO, FL("MAC_SPOOFED_SCAN disabled in ini")); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5040 | return -ENOTSUPP; |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5041 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5042 | if (TRUE != sme_IsFeatureSupportedByFW(MAC_SPOOFED_SCAN)){ |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 5043 | 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] | 5044 | return -ENOTSUPP; |
| 5045 | } |
| 5046 | |
| 5047 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI_MAX, |
| 5048 | data, data_len, wlan_hdd_mac_config)) { |
| 5049 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5050 | return -EINVAL; |
| 5051 | } |
| 5052 | |
| 5053 | /* Parse and fetch mac address */ |
| 5054 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]) { |
| 5055 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5056 | return -EINVAL; |
| 5057 | } |
| 5058 | |
| 5059 | memcpy(pHddCtx->spoofMacAddr.randomMacAddr.bytes, nla_data( |
| 5060 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 5061 | VOS_MAC_ADDR_LAST_3_BYTES); |
| 5062 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5063 | pHddCtx->spoofMacAddr.isEnabled = TRUE; |
| 5064 | |
| 5065 | 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] | 5066 | tb[QCA_WLAN_VENDOR_ATTR_SET_SCANNING_MAC_OUI]), |
| 5067 | VOS_MAC_ADDR_FIRST_3_BYTES); |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5068 | if ((pHddCtx->spoofMacAddr.randomMacAddr.bytes[0] == 0) && |
| 5069 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[1] == 0) && |
| 5070 | (pHddCtx->spoofMacAddr.randomMacAddr.bytes[2] == 0)) |
| 5071 | { |
| 5072 | hddLog(LOG1, FL("ZERO MAC OUI Recieved. Disabling Spoofing")); |
| 5073 | vos_mem_zero(pHddCtx->spoofMacAddr.randomMacAddr.bytes, |
| 5074 | VOS_MAC_ADDRESS_LEN); |
| 5075 | pHddCtx->spoofMacAddr.isEnabled = FALSE; |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5076 | } |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5077 | |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 5078 | if (VOS_STATUS_SUCCESS != hdd_processSpoofMacAddrRequest(pHddCtx)) |
| 5079 | { |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5080 | hddLog(LOGE, FL("Failed to send Spoof Mac Addr to FW")); |
| 5081 | } |
| 5082 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5083 | EXIT(); |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 5084 | return 0; |
| 5085 | } |
| 5086 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5087 | static int wlan_hdd_cfg80211_set_spoofed_mac_oui(struct wiphy *wiphy, |
| 5088 | struct wireless_dev *wdev, |
| 5089 | const void *data, |
| 5090 | int data_len) |
| 5091 | { |
| 5092 | int ret = 0; |
| 5093 | |
| 5094 | vos_ssr_protect(__func__); |
| 5095 | ret = __wlan_hdd_cfg80211_set_spoofed_mac_oui(wiphy, wdev, data, data_len); |
| 5096 | vos_ssr_unprotect(__func__); |
| 5097 | |
| 5098 | return ret; |
| 5099 | } |
| 5100 | |
| 5101 | static int __wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5102 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5103 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5104 | int data_len) |
| 5105 | { |
| 5106 | u8 peer[6] = {0}; |
| 5107 | struct net_device *dev = wdev->netdev; |
| 5108 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5109 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5110 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX + 1]; |
| 5111 | eHalStatus ret; |
| 5112 | tANI_S32 state; |
| 5113 | tANI_S32 reason; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5114 | tANI_S32 global_operating_class = 0; |
| 5115 | tANI_S32 channel = 0; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5116 | struct sk_buff *skb = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5117 | int retVal; |
| 5118 | |
| 5119 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5120 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5121 | if (!pAdapter) { |
| 5122 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5123 | return -EINVAL; |
| 5124 | } |
| 5125 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5126 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5127 | if (0 != ret) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5128 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5129 | return -EINVAL; |
| 5130 | } |
| 5131 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5132 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5133 | return -ENOTSUPP; |
| 5134 | } |
| 5135 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAX, |
| 5136 | data, data_len, |
| 5137 | wlan_hdd_tdls_config_get_status_policy)) { |
| 5138 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5139 | return -EINVAL; |
| 5140 | } |
| 5141 | |
| 5142 | /* Parse and fetch mac address */ |
| 5143 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]) { |
| 5144 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5145 | return -EINVAL; |
| 5146 | } |
| 5147 | |
| 5148 | memcpy(peer, nla_data( |
| 5149 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_MAC_ADDR]), |
| 5150 | sizeof(peer)); |
| 5151 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5152 | |
Konamki, Sreelakshmi | abb59ed | 2015-06-12 12:13:23 +0530 | [diff] [blame] | 5153 | wlan_hdd_tdls_get_status(pAdapter, peer, &state, &reason); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5154 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5155 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5156 | 4 * sizeof(s32) + |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5157 | NLMSG_HDRLEN); |
| 5158 | |
| 5159 | if (!skb) { |
| 5160 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5161 | FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 5162 | return -EINVAL; |
| 5163 | } |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5164 | 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] | 5165 | reason, |
| 5166 | state, |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5167 | global_operating_class, |
| 5168 | channel, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5169 | MAC_ADDR_ARRAY(peer)); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5170 | if (nla_put_s32(skb, |
| 5171 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_STATE, |
| 5172 | state) || |
| 5173 | nla_put_s32(skb, |
| 5174 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_REASON, |
| 5175 | reason) || |
| 5176 | nla_put_s32(skb, |
| 5177 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_GLOBAL_OPERATING_CLASS, |
| 5178 | global_operating_class) || |
| 5179 | nla_put_s32(skb, |
| 5180 | QCA_WLAN_VENDOR_ATTR_TDLS_GET_STATUS_CHANNEL, |
| 5181 | channel)) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5182 | |
| 5183 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 5184 | goto nla_put_failure; |
| 5185 | } |
| 5186 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5187 | retVal = cfg80211_vendor_cmd_reply(skb); |
| 5188 | EXIT(); |
| 5189 | return retVal; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5190 | |
| 5191 | nla_put_failure: |
| 5192 | kfree_skb(skb); |
| 5193 | return -EINVAL; |
| 5194 | } |
| 5195 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5196 | static int wlan_hdd_cfg80211_exttdls_get_status(struct wiphy *wiphy, |
| 5197 | struct wireless_dev *wdev, |
| 5198 | const void *data, |
| 5199 | int data_len) |
| 5200 | { |
| 5201 | int ret = 0; |
| 5202 | |
| 5203 | vos_ssr_protect(__func__); |
| 5204 | ret = __wlan_hdd_cfg80211_exttdls_get_status(wiphy, wdev, data, data_len); |
| 5205 | vos_ssr_unprotect(__func__); |
| 5206 | |
| 5207 | return ret; |
| 5208 | } |
| 5209 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 5210 | static int wlan_hdd_cfg80211_exttdls_callback( |
| 5211 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 5212 | const tANI_U8* mac, |
| 5213 | #else |
| 5214 | tANI_U8* mac, |
| 5215 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5216 | tANI_S32 state, |
| 5217 | tANI_S32 reason, |
| 5218 | void *ctx) |
| 5219 | { |
| 5220 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)ctx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5221 | struct sk_buff *skb = NULL; |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5222 | tANI_S32 global_operating_class = 0; |
| 5223 | tANI_S32 channel = 0; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5224 | hdd_context_t *pHddCtx; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5225 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5226 | ENTER(); |
| 5227 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5228 | if (!pAdapter) { |
| 5229 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5230 | return -EINVAL; |
| 5231 | } |
| 5232 | |
| 5233 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5234 | if (wlan_hdd_validate_context(pHddCtx)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5235 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5236 | return -EINVAL; |
| 5237 | } |
| 5238 | |
| 5239 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5240 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5241 | return -ENOTSUPP; |
| 5242 | } |
Anand N Sunkad | 26ca6cc | 2015-07-29 09:54:52 +0530 | [diff] [blame] | 5243 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 5244 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 5245 | NULL, |
| 5246 | #endif |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5247 | EXTTDLS_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 5248 | QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE_CHANGE_INDEX, |
| 5249 | GFP_KERNEL); |
| 5250 | |
| 5251 | if (!skb) { |
| 5252 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 5253 | FL("cfg80211_vendor_event_alloc failed")); |
| 5254 | return -EINVAL; |
| 5255 | } |
| 5256 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Entering ")); |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5257 | hddLog(VOS_TRACE_LEVEL_INFO, "Reason: (%d) Status: (%d) Class: (%d) Channel: (%d)", |
| 5258 | reason, |
| 5259 | state, |
| 5260 | global_operating_class, |
| 5261 | channel); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5262 | hddLog(VOS_TRACE_LEVEL_WARN, "tdls peer " MAC_ADDRESS_STR, |
| 5263 | MAC_ADDR_ARRAY(mac)); |
| 5264 | |
Atul Mittal | 0a9f68d | 2014-10-16 15:26:38 +0530 | [diff] [blame] | 5265 | if (nla_put(skb, |
| 5266 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_MAC_ADDR, |
| 5267 | VOS_MAC_ADDR_SIZE, mac) || |
| 5268 | nla_put_s32(skb, |
| 5269 | QCA_WLAN_VENDOR_ATTR_TDLS_NEW_STATE, |
| 5270 | state) || |
| 5271 | nla_put_s32(skb, |
| 5272 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_REASON, |
| 5273 | reason) || |
| 5274 | nla_put_s32(skb, |
| 5275 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_CHANNEL, |
| 5276 | channel) || |
| 5277 | nla_put_s32(skb, |
| 5278 | QCA_WLAN_VENDOR_ATTR_TDLS_STATE_GLOBAL_OPERATING_CLASS, |
| 5279 | global_operating_class) |
| 5280 | ) { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5281 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla put fail")); |
| 5282 | goto nla_put_failure; |
| 5283 | } |
| 5284 | |
| 5285 | cfg80211_vendor_event(skb, GFP_KERNEL); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5286 | EXIT(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5287 | return (0); |
| 5288 | |
| 5289 | nla_put_failure: |
| 5290 | kfree_skb(skb); |
| 5291 | return -EINVAL; |
| 5292 | } |
| 5293 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5294 | static int __wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5295 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5296 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5297 | int data_len) |
| 5298 | { |
| 5299 | u8 peer[6] = {0}; |
| 5300 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5301 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5302 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX + 1]; |
| 5303 | eHalStatus status; |
| 5304 | tdls_req_params_t pReqMsg = {0}; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5305 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5306 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5307 | |
| 5308 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5309 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5310 | if (!dev) { |
| 5311 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 5312 | return -EINVAL; |
| 5313 | } |
| 5314 | |
| 5315 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5316 | if (!pAdapter) { |
| 5317 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 5318 | return -EINVAL; |
| 5319 | } |
| 5320 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5321 | status = wlan_hdd_validate_context(pHddCtx); |
| 5322 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5323 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5324 | return -EINVAL; |
| 5325 | } |
| 5326 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5327 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5328 | return -ENOTSUPP; |
| 5329 | } |
| 5330 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX, |
| 5331 | data, data_len, |
| 5332 | wlan_hdd_tdls_config_enable_policy)) { |
| 5333 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5334 | return -EINVAL; |
| 5335 | } |
| 5336 | |
| 5337 | /* Parse and fetch mac address */ |
| 5338 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]) { |
| 5339 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5340 | return -EINVAL; |
| 5341 | } |
| 5342 | |
| 5343 | memcpy(peer, nla_data( |
| 5344 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAC_ADDR]), |
| 5345 | sizeof(peer)); |
| 5346 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5347 | |
| 5348 | /* Parse and fetch channel */ |
| 5349 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]) { |
| 5350 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr channel failed")); |
| 5351 | return -EINVAL; |
| 5352 | } |
| 5353 | pReqMsg.channel = nla_get_s32( |
| 5354 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_CHANNEL]); |
| 5355 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Channel Num (%d)"), pReqMsg.channel); |
| 5356 | |
| 5357 | /* Parse and fetch global operating class */ |
| 5358 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]) { |
| 5359 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr operating class failed")); |
| 5360 | return -EINVAL; |
| 5361 | } |
| 5362 | pReqMsg.global_operating_class = nla_get_s32( |
| 5363 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_GLOBAL_OPERATING_CLASS]); |
| 5364 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Operating class (%d)"), |
| 5365 | pReqMsg.global_operating_class); |
| 5366 | |
| 5367 | /* Parse and fetch latency ms */ |
| 5368 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]) { |
| 5369 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr latency failed")); |
| 5370 | return -EINVAL; |
| 5371 | } |
| 5372 | pReqMsg.max_latency_ms = nla_get_s32( |
| 5373 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MAX_LATENCY_MS]); |
| 5374 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Latency (%d)"), |
| 5375 | pReqMsg.max_latency_ms); |
| 5376 | |
| 5377 | /* Parse and fetch required bandwidth kbps */ |
| 5378 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]) { |
| 5379 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bandwidth failed")); |
| 5380 | return -EINVAL; |
| 5381 | } |
| 5382 | |
| 5383 | pReqMsg.min_bandwidth_kbps = nla_get_s32( |
| 5384 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_ENABLE_MIN_BANDWIDTH_KBPS]); |
| 5385 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Bandwidth (%d)"), |
| 5386 | pReqMsg.min_bandwidth_kbps); |
| 5387 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5388 | ret = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5389 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 5390 | &pReqMsg, |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5391 | wlan_hdd_cfg80211_exttdls_callback); |
| 5392 | |
| 5393 | EXIT(); |
| 5394 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5395 | } |
| 5396 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5397 | static int wlan_hdd_cfg80211_exttdls_enable(struct wiphy *wiphy, |
| 5398 | struct wireless_dev *wdev, |
| 5399 | const void *data, |
| 5400 | int data_len) |
| 5401 | { |
| 5402 | int ret = 0; |
| 5403 | |
| 5404 | vos_ssr_protect(__func__); |
| 5405 | ret = __wlan_hdd_cfg80211_exttdls_enable(wiphy, wdev, data, data_len); |
| 5406 | vos_ssr_unprotect(__func__); |
| 5407 | |
| 5408 | return ret; |
| 5409 | } |
| 5410 | |
| 5411 | static int __wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5412 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5413 | const void *data, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5414 | int data_len) |
| 5415 | { |
| 5416 | u8 peer[6] = {0}; |
| 5417 | struct net_device *dev = wdev->netdev; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5418 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5419 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX + 1]; |
| 5420 | eHalStatus status; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5421 | int ret; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5422 | hdd_adapter_t *pAdapter; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5423 | |
| 5424 | ENTER(); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5425 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 5426 | if (!dev) { |
| 5427 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 5428 | return -EINVAL; |
| 5429 | } |
| 5430 | |
| 5431 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5432 | if (!pAdapter) { |
| 5433 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 5434 | return -EINVAL; |
| 5435 | } |
| 5436 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5437 | status = wlan_hdd_validate_context(pHddCtx); |
| 5438 | if (0 != status) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5439 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid HDD context")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5440 | return -EINVAL; |
| 5441 | } |
| 5442 | if (pHddCtx->cfg_ini->fTDLSExternalControl == FALSE) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 5443 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS external control is disabled")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5444 | return -ENOTSUPP; |
| 5445 | } |
| 5446 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAX, |
| 5447 | data, data_len, |
| 5448 | wlan_hdd_tdls_config_disable_policy)) { |
| 5449 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 5450 | return -EINVAL; |
| 5451 | } |
| 5452 | /* Parse and fetch mac address */ |
| 5453 | if (!tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]) { |
| 5454 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr mac addr failed")); |
| 5455 | return -EINVAL; |
| 5456 | } |
| 5457 | |
| 5458 | memcpy(peer, nla_data( |
| 5459 | tb[QCA_WLAN_VENDOR_ATTR_TDLS_DISABLE_MAC_ADDR]), |
| 5460 | sizeof(peer)); |
| 5461 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(peer)); |
| 5462 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5463 | ret = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
| 5464 | |
| 5465 | EXIT(); |
| 5466 | return ret; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 5467 | } |
| 5468 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5469 | static int wlan_hdd_cfg80211_exttdls_disable(struct wiphy *wiphy, |
| 5470 | struct wireless_dev *wdev, |
| 5471 | const void *data, |
| 5472 | int data_len) |
| 5473 | { |
| 5474 | int ret = 0; |
| 5475 | |
| 5476 | vos_ssr_protect(__func__); |
| 5477 | ret = __wlan_hdd_cfg80211_exttdls_disable(wiphy, wdev, data, data_len); |
| 5478 | vos_ssr_unprotect(__func__); |
| 5479 | |
| 5480 | return ret; |
| 5481 | } |
| 5482 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5483 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5484 | __wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5485 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5486 | const void *data, int data_len) |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5487 | { |
| 5488 | struct net_device *dev = wdev->netdev; |
| 5489 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5490 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5491 | struct sk_buff *skb = NULL; |
| 5492 | tANI_U32 fset = 0; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5493 | int ret = 0; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5494 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5495 | ENTER(); |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5496 | |
| 5497 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5498 | if (0 != ret) |
| 5499 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5500 | return ret; |
| 5501 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5502 | if (wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) { |
| 5503 | hddLog(LOG1, FL("Infra Station mode is supported by driver")); |
| 5504 | fset |= WIFI_FEATURE_INFRA; |
| 5505 | } |
| 5506 | |
| 5507 | if (TRUE == hdd_is_5g_supported(pHddCtx)) { |
| 5508 | hddLog(LOG1, FL("INFRA_5G is supported by firmware")); |
| 5509 | fset |= WIFI_FEATURE_INFRA_5G; |
| 5510 | } |
| 5511 | |
| 5512 | #ifdef WLAN_FEATURE_P2P |
| 5513 | if ((wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_CLIENT)) && |
| 5514 | (wiphy->interface_modes & BIT(NL80211_IFTYPE_P2P_GO))) { |
| 5515 | hddLog(LOG1, FL("WiFi-Direct is supported by driver")); |
| 5516 | fset |= WIFI_FEATURE_P2P; |
| 5517 | } |
| 5518 | #endif |
| 5519 | |
| 5520 | /* Soft-AP is supported currently by default */ |
| 5521 | fset |= WIFI_FEATURE_SOFT_AP; |
| 5522 | |
Kanchanapally, Vidyullatha | 683aed0 | 2015-03-24 16:58:38 +0530 | [diff] [blame] | 5523 | /* HOTSPOT is a supplicant feature, enable it by default */ |
| 5524 | fset |= WIFI_FEATURE_HOTSPOT; |
| 5525 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5526 | #ifdef WLAN_FEATURE_EXTSCAN |
| 5527 | if ((TRUE == pHddCtx->cfg_ini->fEnableEXTScan) && |
Padma, Santhosh Kumar | 2ac5499 | 2015-10-12 18:20:58 +0530 | [diff] [blame] | 5528 | sme_IsFeatureSupportedByFW(EXTENDED_SCAN) && |
| 5529 | sme_IsFeatureSupportedByFW(EXT_SCAN_ENHANCED)) { |
| 5530 | hddLog(LOG1, FL("Enhanced EXTScan is supported by firmware")); |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5531 | fset |= WIFI_FEATURE_EXTSCAN; |
| 5532 | } |
| 5533 | #endif |
| 5534 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5535 | if (sme_IsFeatureSupportedByFW(NAN)) { |
| 5536 | hddLog(LOG1, FL("NAN is supported by firmware")); |
| 5537 | fset |= WIFI_FEATURE_NAN; |
| 5538 | } |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5539 | |
| 5540 | /* D2D RTT is not supported currently by default */ |
| 5541 | if (sme_IsFeatureSupportedByFW(RTT)) { |
| 5542 | hddLog(LOG1, FL("RTT is supported by firmware")); |
| 5543 | fset |= WIFI_FEATURE_D2AP_RTT; |
| 5544 | } |
| 5545 | |
| 5546 | #ifdef FEATURE_WLAN_BATCH_SCAN |
| 5547 | if (fset & WIFI_FEATURE_EXTSCAN) { |
| 5548 | hddLog(LOG1, FL("Batch scan is supported as extscan is supported")); |
| 5549 | fset &= ~WIFI_FEATURE_BATCH_SCAN; |
| 5550 | } else if (sme_IsFeatureSupportedByFW(BATCH_SCAN)) { |
| 5551 | hddLog(LOG1, FL("Batch scan is supported by firmware")); |
| 5552 | fset |= WIFI_FEATURE_BATCH_SCAN; |
| 5553 | } |
| 5554 | #endif |
| 5555 | |
| 5556 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 5557 | if (pHddCtx->cfg_ini->configPNOScanSupport && |
| 5558 | (eHAL_STATUS_SUCCESS == wlan_hdd_is_pno_allowed(pAdapter))) { |
| 5559 | hddLog(LOG1, FL("PNO is supported by firmware")); |
| 5560 | fset |= WIFI_FEATURE_PNO; |
| 5561 | } |
| 5562 | #endif |
| 5563 | |
| 5564 | /* STA+STA is supported currently by default */ |
| 5565 | fset |= WIFI_FEATURE_ADDITIONAL_STA; |
| 5566 | |
| 5567 | #ifdef FEATURE_WLAN_TDLS |
| 5568 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSSupport) && |
| 5569 | sme_IsFeatureSupportedByFW(TDLS)) { |
| 5570 | hddLog(LOG1, FL("TDLS is supported by firmware")); |
| 5571 | fset |= WIFI_FEATURE_TDLS; |
| 5572 | } |
| 5573 | |
| 5574 | /* TDLS_OFFCHANNEL is not supported currently by default */ |
| 5575 | #endif |
| 5576 | |
| 5577 | #ifdef WLAN_AP_STA_CONCURRENCY |
| 5578 | /* AP+STA concurrency is supported currently by default */ |
| 5579 | fset |= WIFI_FEATURE_AP_STA; |
| 5580 | #endif |
| 5581 | |
Mukul Sharma | 5add053 | 2015-08-17 15:57:47 +0530 | [diff] [blame] | 5582 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 5583 | fset |= WIFI_FEATURE_LINK_LAYER_STATS; |
| 5584 | hddLog(LOG1, FL("Link layer stats is supported by driver")); |
| 5585 | #endif |
| 5586 | |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5587 | skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(fset) + |
| 5588 | NLMSG_HDRLEN); |
| 5589 | |
| 5590 | if (!skb) { |
| 5591 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 5592 | return -EINVAL; |
| 5593 | } |
| 5594 | hddLog(LOG1, FL("Supported Features : 0x%x"), fset); |
| 5595 | |
| 5596 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_FEATURE_SET, fset)) { |
| 5597 | hddLog(LOGE, FL("nla put fail")); |
| 5598 | goto nla_put_failure; |
| 5599 | } |
| 5600 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5601 | ret = cfg80211_vendor_cmd_reply(skb); |
| 5602 | EXIT(); |
| 5603 | return ret; |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 5604 | |
| 5605 | nla_put_failure: |
| 5606 | kfree_skb(skb); |
| 5607 | return -EINVAL; |
| 5608 | } |
| 5609 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5610 | static int |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5611 | wlan_hdd_cfg80211_get_supported_features(struct wiphy *wiphy, |
| 5612 | struct wireless_dev *wdev, |
| 5613 | const void *data, int data_len) |
| 5614 | { |
| 5615 | int ret = 0; |
| 5616 | |
| 5617 | vos_ssr_protect(__func__); |
| 5618 | ret = __wlan_hdd_cfg80211_get_supported_features(wiphy, wdev, data, data_len); |
| 5619 | vos_ssr_unprotect(__func__); |
| 5620 | |
| 5621 | return ret; |
| 5622 | } |
| 5623 | |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 5624 | |
| 5625 | static const struct |
| 5626 | nla_policy |
| 5627 | qca_wlan_vendor_wifi_logger_get_ring_data_policy |
| 5628 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1] = { |
| 5629 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID] |
| 5630 | = {.type = NLA_U32 }, |
| 5631 | }; |
| 5632 | |
| 5633 | static int |
| 5634 | __wlan_hdd_cfg80211_wifi_logger_get_ring_data(struct wiphy *wiphy, |
| 5635 | struct wireless_dev *wdev, |
| 5636 | const void *data, |
| 5637 | int data_len) |
| 5638 | { |
| 5639 | int ret; |
| 5640 | VOS_STATUS status; |
| 5641 | uint32_t ring_id; |
| 5642 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 5643 | struct nlattr *tb |
| 5644 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX + 1]; |
| 5645 | |
| 5646 | ENTER(); |
| 5647 | |
| 5648 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 5649 | if (0 != ret) { |
| 5650 | return ret; |
| 5651 | } |
| 5652 | |
| 5653 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_MAX, |
| 5654 | data, data_len, |
| 5655 | qca_wlan_vendor_wifi_logger_get_ring_data_policy)) { |
| 5656 | hddLog(LOGE, FL("Invalid attribute")); |
| 5657 | return -EINVAL; |
| 5658 | } |
| 5659 | |
| 5660 | /* Parse and fetch ring id */ |
| 5661 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]) { |
| 5662 | hddLog(LOGE, FL("attr ATTR failed")); |
| 5663 | return -EINVAL; |
| 5664 | } |
| 5665 | |
| 5666 | ring_id = nla_get_u32( |
| 5667 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_GET_RING_DATA_ID]); |
| 5668 | |
| 5669 | hddLog(LOG1, FL("Bug report triggered by framework")); |
| 5670 | |
| 5671 | status = vos_fatal_event_logs_req(WLAN_LOG_TYPE_NON_FATAL, |
| 5672 | WLAN_LOG_INDICATOR_FRAMEWORK, |
| 5673 | WLAN_LOG_REASON_CODE_FRAMEWORK, |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 5674 | TRUE, TRUE |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 5675 | ); |
| 5676 | if (VOS_STATUS_SUCCESS != status) { |
| 5677 | hddLog(LOGE, FL("Failed to trigger bug report")); |
| 5678 | |
| 5679 | return -EINVAL; |
| 5680 | } |
| 5681 | |
| 5682 | return 0; |
| 5683 | |
| 5684 | |
| 5685 | } |
| 5686 | |
| 5687 | |
| 5688 | static int |
| 5689 | wlan_hdd_cfg80211_wifi_logger_get_ring_data(struct wiphy *wiphy, |
| 5690 | struct wireless_dev *wdev, |
| 5691 | const void *data, |
| 5692 | int data_len) |
| 5693 | { |
| 5694 | int ret = 0; |
| 5695 | |
| 5696 | vos_ssr_protect(__func__); |
| 5697 | ret = __wlan_hdd_cfg80211_wifi_logger_get_ring_data(wiphy, |
| 5698 | wdev, data, data_len); |
| 5699 | vos_ssr_unprotect(__func__); |
| 5700 | |
| 5701 | return ret; |
| 5702 | |
| 5703 | } |
| 5704 | |
| 5705 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5706 | static int |
| 5707 | __wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5708 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5709 | const void *data, int data_len) |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5710 | { |
| 5711 | uint32_t feature_set_matrix[WLAN_HDD_MAX_FEATURE_SET] = {0}; |
| 5712 | uint8_t i, feature_sets, max_feature_sets; |
| 5713 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX + 1]; |
| 5714 | struct sk_buff *reply_skb; |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5715 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5716 | int ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5717 | |
| 5718 | ENTER(); |
| 5719 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5720 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5721 | if (0 != ret) |
| 5722 | { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5723 | return ret; |
| 5724 | } |
| 5725 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5726 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_MAX, |
| 5727 | data, data_len, NULL)) { |
| 5728 | hddLog(LOGE, FL("Invalid ATTR")); |
| 5729 | return -EINVAL; |
| 5730 | } |
| 5731 | |
| 5732 | /* Parse and fetch max feature set */ |
| 5733 | if (!tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]) { |
| 5734 | hddLog(LOGE, FL("Attr max feature set size failed")); |
| 5735 | return -EINVAL; |
| 5736 | } |
| 5737 | max_feature_sets = nla_get_u32( |
| 5738 | tb[QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_CONFIG_PARAM_SET_SIZE_MAX]); |
| 5739 | hddLog(LOG1, FL("Max feature set size (%d)"), max_feature_sets); |
| 5740 | |
| 5741 | /* Fill feature combination matrix */ |
| 5742 | feature_sets = 0; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5743 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5744 | WIFI_FEATURE_P2P; |
| 5745 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5746 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5747 | WIFI_FEATURE_SOFT_AP; |
| 5748 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5749 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_P2P | |
| 5750 | WIFI_FEATURE_SOFT_AP; |
| 5751 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5752 | feature_set_matrix[feature_sets++] = WIFI_FEATURE_INFRA | |
| 5753 | WIFI_FEATURE_SOFT_AP | |
| 5754 | WIFI_FEATURE_P2P; |
| 5755 | |
| 5756 | /* Add more feature combinations here */ |
| 5757 | |
| 5758 | feature_sets = VOS_MIN(feature_sets, max_feature_sets); |
| 5759 | hddLog(LOG1, FL("Number of feature sets (%d)"), feature_sets); |
| 5760 | hddLog(LOG1, "Feature set matrix"); |
| 5761 | for (i = 0; i < feature_sets; i++) |
| 5762 | hddLog(LOG1, "[%d] 0x%02X", i, feature_set_matrix[i]); |
| 5763 | |
| 5764 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, sizeof(u32) + |
| 5765 | sizeof(u32) * feature_sets + |
| 5766 | NLMSG_HDRLEN); |
| 5767 | |
| 5768 | if (reply_skb) { |
| 5769 | if (nla_put_u32(reply_skb, |
| 5770 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET_SIZE, |
| 5771 | feature_sets) || |
| 5772 | nla_put(reply_skb, |
| 5773 | QCA_WLAN_VENDOR_ATTR_GET_CONCURRENCY_MATRIX_RESULTS_SET, |
| 5774 | sizeof(u32) * feature_sets, feature_set_matrix)) { |
| 5775 | hddLog(LOGE, FL("nla put fail")); |
| 5776 | kfree_skb(reply_skb); |
| 5777 | return -EINVAL; |
| 5778 | } |
| 5779 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 5780 | ret = cfg80211_vendor_cmd_reply(reply_skb); |
| 5781 | EXIT(); |
| 5782 | return ret; |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5783 | } |
| 5784 | hddLog(LOGE, FL("Feature set matrix: buffer alloc fail")); |
| 5785 | return -ENOMEM; |
| 5786 | |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 5787 | } |
| 5788 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5789 | static int |
| 5790 | wlan_hdd_cfg80211_get_concurrency_matrix(struct wiphy *wiphy, |
| 5791 | struct wireless_dev *wdev, |
| 5792 | const void *data, int data_len) |
| 5793 | { |
| 5794 | int ret = 0; |
| 5795 | |
| 5796 | vos_ssr_protect(__func__); |
| 5797 | ret = __wlan_hdd_cfg80211_get_concurrency_matrix(wiphy, wdev, data, |
| 5798 | data_len); |
| 5799 | vos_ssr_unprotect(__func__); |
| 5800 | |
| 5801 | return ret; |
| 5802 | } |
| 5803 | |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5804 | |
| 5805 | static int |
| 5806 | __wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy, |
| 5807 | struct wireless_dev *wdev, |
| 5808 | const void *data, int data_len) |
| 5809 | { |
| 5810 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 5811 | int ret; |
| 5812 | ENTER(); |
| 5813 | |
| 5814 | ret = wlan_hdd_validate_context(pHddCtx); |
| 5815 | if (0 != ret) |
| 5816 | { |
| 5817 | return ret; |
| 5818 | } |
| 5819 | |
| 5820 | if( !pHddCtx->cfg_ini->enableFwrMemDump || |
| 5821 | (FALSE == sme_IsFeatureSupportedByFW(MEMORY_DUMP_SUPPORTED))) |
| 5822 | { |
| 5823 | hddLog(VOS_TRACE_LEVEL_INFO, FL("FW dump Logging not supported")); |
| 5824 | return -EINVAL; |
| 5825 | } |
| 5826 | /*call common API for FW mem dump req*/ |
| 5827 | ret = wlan_hdd_fw_mem_dump_req(pHddCtx); |
| 5828 | |
c_manjee | 04b4c5c | 2015-10-13 18:35:01 +0530 | [diff] [blame] | 5829 | if (true == ret) |
| 5830 | { |
| 5831 | /*indicate to userspace the status of fw mem dump */ |
| 5832 | wlan_indicate_mem_dump_complete(true); |
| 5833 | } |
| 5834 | else |
| 5835 | { |
| 5836 | /*else send failure to userspace */ |
| 5837 | wlan_indicate_mem_dump_complete(false); |
| 5838 | } |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5839 | EXIT(); |
| 5840 | return ret; |
| 5841 | } |
| 5842 | |
| 5843 | /** |
| 5844 | * wlan_hdd_cfg80211_get_fw_mem_dump() - Get FW memory dump |
| 5845 | * @wiphy: pointer to wireless wiphy structure. |
| 5846 | * @wdev: pointer to wireless_dev structure. |
| 5847 | * @data: Pointer to the NL data. |
| 5848 | * @data_len:Length of @data |
| 5849 | * |
| 5850 | * This is called when wlan driver needs to get the firmware memory dump |
| 5851 | * via vendor specific command. |
| 5852 | * |
| 5853 | * Return: 0 on success, error number otherwise. |
| 5854 | */ |
| 5855 | |
| 5856 | static int |
| 5857 | wlan_hdd_cfg80211_get_fw_mem_dump(struct wiphy *wiphy, |
| 5858 | struct wireless_dev *wdev, |
| 5859 | const void *data, int data_len) |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5860 | { |
| 5861 | int ret = 0; |
| 5862 | vos_ssr_protect(__func__); |
| 5863 | ret = __wlan_hdd_cfg80211_get_fw_mem_dump(wiphy, wdev, data, |
| 5864 | data_len); |
| 5865 | vos_ssr_unprotect(__func__); |
| 5866 | return ret; |
| 5867 | } |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5868 | |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5869 | static const struct |
| 5870 | nla_policy |
| 5871 | qca_wlan_vendor_wifi_logger_start_policy |
| 5872 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1] = { |
| 5873 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID] |
| 5874 | = {.type = NLA_U32 }, |
| 5875 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL] |
| 5876 | = {.type = NLA_U32 }, |
| 5877 | [QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS] |
| 5878 | = {.type = NLA_U32 }, |
| 5879 | }; |
| 5880 | |
| 5881 | /** |
| 5882 | * __wlan_hdd_cfg80211_wifi_logger_start() - This function is used to enable |
| 5883 | * or disable the collection of packet statistics from the firmware |
| 5884 | * @wiphy: WIPHY structure pointer |
| 5885 | * @wdev: Wireless device structure pointer |
| 5886 | * @data: Pointer to the data received |
| 5887 | * @data_len: Length of the data received |
| 5888 | * |
| 5889 | * This function is used to enable or disable the collection of packet |
| 5890 | * statistics from the firmware |
| 5891 | * |
| 5892 | * Return: 0 on success and errno on failure |
| 5893 | */ |
| 5894 | static int __wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy, |
| 5895 | struct wireless_dev *wdev, |
| 5896 | const void *data, |
| 5897 | int data_len) |
| 5898 | { |
| 5899 | eHalStatus status; |
| 5900 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 5901 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX + 1]; |
| 5902 | tAniWifiStartLog start_log; |
| 5903 | |
| 5904 | status = wlan_hdd_validate_context(hdd_ctx); |
| 5905 | if (0 != status) { |
| 5906 | return -EINVAL; |
| 5907 | } |
| 5908 | |
| 5909 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_START_MAX, |
| 5910 | data, data_len, |
| 5911 | qca_wlan_vendor_wifi_logger_start_policy)) { |
| 5912 | hddLog(LOGE, FL("Invalid attribute")); |
| 5913 | return -EINVAL; |
| 5914 | } |
| 5915 | |
| 5916 | /* Parse and fetch ring id */ |
| 5917 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]) { |
| 5918 | hddLog(LOGE, FL("attr ATTR failed")); |
| 5919 | return -EINVAL; |
| 5920 | } |
| 5921 | start_log.ringId = nla_get_u32( |
| 5922 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_RING_ID]); |
| 5923 | hddLog(LOG1, FL("Ring ID=%d"), start_log.ringId); |
| 5924 | |
| 5925 | /* Parse and fetch verbose level */ |
| 5926 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]) { |
| 5927 | hddLog(LOGE, FL("attr verbose_level failed")); |
| 5928 | return -EINVAL; |
| 5929 | } |
| 5930 | start_log.verboseLevel = nla_get_u32( |
| 5931 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_VERBOSE_LEVEL]); |
| 5932 | hddLog(LOG1, FL("verbose_level=%d"), start_log.verboseLevel); |
| 5933 | |
| 5934 | /* Parse and fetch flag */ |
| 5935 | if (!tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]) { |
| 5936 | hddLog(LOGE, FL("attr flag failed")); |
| 5937 | return -EINVAL; |
| 5938 | } |
| 5939 | start_log.flag = nla_get_u32( |
| 5940 | tb[QCA_WLAN_VENDOR_ATTR_WIFI_LOGGER_FLAGS]); |
| 5941 | hddLog(LOG1, FL("flag=%d"), start_log.flag); |
| 5942 | |
| 5943 | if ((RING_ID_PER_PACKET_STATS == start_log.ringId) && |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 5944 | (!hdd_ctx->cfg_ini->wlanPerPktStatsLogEnable || |
| 5945 | !vos_isPktStatsEnabled())) |
| 5946 | |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5947 | { |
| 5948 | hddLog(LOGE, FL("per pkt stats not enabled")); |
| 5949 | return -EINVAL; |
| 5950 | } |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5951 | |
Sushant Kaushik | 3320057 | 2015-08-05 16:46:20 +0530 | [diff] [blame] | 5952 | vos_set_ring_log_level(start_log.ringId, start_log.verboseLevel); |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5953 | return 0; |
| 5954 | } |
| 5955 | |
| 5956 | /** |
| 5957 | * wlan_hdd_cfg80211_wifi_logger_start() - Wrapper function used to enable |
| 5958 | * or disable the collection of packet statistics from the firmware |
| 5959 | * @wiphy: WIPHY structure pointer |
| 5960 | * @wdev: Wireless device structure pointer |
| 5961 | * @data: Pointer to the data received |
| 5962 | * @data_len: Length of the data received |
| 5963 | * |
| 5964 | * This function is used to enable or disable the collection of packet |
| 5965 | * statistics from the firmware |
| 5966 | * |
| 5967 | * Return: 0 on success and errno on failure |
| 5968 | */ |
| 5969 | static int wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy, |
| 5970 | struct wireless_dev *wdev, |
| 5971 | const void *data, |
| 5972 | int data_len) |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5973 | { |
| 5974 | int ret = 0; |
| 5975 | |
| 5976 | vos_ssr_protect(__func__); |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 5977 | |
| 5978 | ret = __wlan_hdd_cfg80211_wifi_logger_start(wiphy, |
| 5979 | wdev, data, data_len); |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5980 | vos_ssr_unprotect(__func__); |
| 5981 | |
| 5982 | return ret; |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 5983 | } |
| 5984 | |
| 5985 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5986 | static const struct nla_policy |
| 5987 | wlan_hdd_set_no_dfs_flag_config_policy[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX |
| 5988 | +1] = |
| 5989 | { |
| 5990 | [QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG] = {.type = NLA_U32 }, |
| 5991 | }; |
| 5992 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 5993 | static int __wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5994 | struct wireless_dev *wdev, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 5995 | const void *data, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 5996 | int data_len) |
| 5997 | { |
| 5998 | struct net_device *dev = wdev->netdev; |
| 5999 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6000 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 6001 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6002 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX + 1]; |
| 6003 | eHalStatus status; |
| 6004 | u32 dfsFlag = 0; |
| 6005 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6006 | ENTER(); |
| 6007 | |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6008 | status = wlan_hdd_validate_context(pHddCtx); |
| 6009 | if (0 != status) { |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6010 | return -EINVAL; |
| 6011 | } |
| 6012 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG_MAX, |
| 6013 | data, data_len, |
| 6014 | wlan_hdd_set_no_dfs_flag_config_policy)) { |
| 6015 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 6016 | return -EINVAL; |
| 6017 | } |
| 6018 | |
| 6019 | /* Parse and fetch required bandwidth kbps */ |
| 6020 | if (!tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]) { |
| 6021 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr dfs flag failed")); |
| 6022 | return -EINVAL; |
| 6023 | } |
| 6024 | |
| 6025 | dfsFlag = nla_get_u32( |
| 6026 | tb[QCA_WLAN_VENDOR_ATTR_SET_NO_DFS_FLAG]); |
| 6027 | hddLog(VOS_TRACE_LEVEL_INFO, FL(" DFS flag (%d)"), |
| 6028 | dfsFlag); |
| 6029 | |
| 6030 | pHddCtx->disable_dfs_flag = dfsFlag; |
| 6031 | |
| 6032 | sme_disable_dfs_channel(hHal, dfsFlag); |
| 6033 | sme_FilterScanResults(hHal, pAdapter->sessionId); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6034 | |
| 6035 | EXIT(); |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 6036 | return 0; |
| 6037 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 6038 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6039 | static int wlan_hdd_cfg80211_disable_dfs_channels(struct wiphy *wiphy, |
| 6040 | struct wireless_dev *wdev, |
| 6041 | const void *data, |
| 6042 | int data_len) |
| 6043 | { |
| 6044 | int ret = 0; |
| 6045 | |
| 6046 | vos_ssr_protect(__func__); |
| 6047 | ret = __wlan_hdd_cfg80211_disable_dfs_channels(wiphy, wdev, data, data_len); |
| 6048 | vos_ssr_unprotect(__func__); |
| 6049 | |
| 6050 | return ret; |
| 6051 | |
| 6052 | } |
| 6053 | |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6054 | const struct |
| 6055 | nla_policy qca_wlan_vendor_attr[QCA_WLAN_VENDOR_ATTR_MAX+1] = |
| 6056 | { |
| 6057 | [QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY] = { .type = NLA_U32 }, |
| 6058 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 6059 | }; |
| 6060 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6061 | static int __wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
Jeff Johnson | 393c270 | 2014-12-16 11:09:35 +0530 | [diff] [blame] | 6062 | struct wireless_dev *wdev, const void *data, int data_len) |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6063 | { |
| 6064 | |
| 6065 | u8 bssid[6] = {0}; |
| 6066 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 6067 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 6068 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6069 | v_U32_t isFwrRoamEnabled = FALSE; |
| 6070 | int ret; |
| 6071 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6072 | ENTER(); |
| 6073 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6074 | ret = wlan_hdd_validate_context(pHddCtx); |
| 6075 | if (0 != ret) { |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6076 | return ret; |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6077 | } |
| 6078 | |
| 6079 | ret = nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, |
| 6080 | data, data_len, |
| 6081 | qca_wlan_vendor_attr); |
| 6082 | if (ret){ |
| 6083 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid ATTR")); |
| 6084 | return -EINVAL; |
| 6085 | } |
| 6086 | |
| 6087 | /* Parse and fetch Enable flag */ |
| 6088 | if (!tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]) { |
| 6089 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr enable failed")); |
| 6090 | return -EINVAL; |
| 6091 | } |
| 6092 | |
| 6093 | isFwrRoamEnabled = nla_get_u32( |
| 6094 | tb[QCA_WLAN_VENDOR_ATTR_ROAMING_POLICY]); |
| 6095 | |
| 6096 | hddLog(VOS_TRACE_LEVEL_INFO, FL("isFwrRoamEnabled (%d)"), isFwrRoamEnabled); |
| 6097 | |
| 6098 | /* Parse and fetch bssid */ |
| 6099 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 6100 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("attr bss id failed")); |
| 6101 | return -EINVAL; |
| 6102 | } |
| 6103 | |
| 6104 | memcpy(bssid, nla_data( |
| 6105 | tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 6106 | sizeof(bssid)); |
| 6107 | hddLog(VOS_TRACE_LEVEL_INFO, FL(MAC_ADDRESS_STR),MAC_ADDR_ARRAY(bssid)); |
| 6108 | |
| 6109 | //Update roaming |
| 6110 | status = sme_ConfigFwrRoaming((tHalHandle)(pHddCtx->hHal), isFwrRoamEnabled); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 6111 | EXIT(); |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 6112 | return status; |
| 6113 | } |
| 6114 | |
Mahesh A Saptasagar | e5440c7 | 2015-01-28 21:21:07 +0530 | [diff] [blame] | 6115 | static int wlan_hdd_cfg80211_firmware_roaming(struct wiphy *wiphy, |
| 6116 | struct wireless_dev *wdev, const void *data, int data_len) |
| 6117 | { |
| 6118 | int ret = 0; |
| 6119 | |
| 6120 | vos_ssr_protect(__func__); |
| 6121 | ret = __wlan_hdd_cfg80211_firmware_roaming(wiphy, wdev, data, data_len); |
| 6122 | vos_ssr_unprotect(__func__); |
| 6123 | |
| 6124 | return ret; |
| 6125 | } |
| 6126 | |
Sushant Kaushik | 847890c | 2015-09-28 16:05:17 +0530 | [diff] [blame] | 6127 | static const struct |
| 6128 | nla_policy |
| 6129 | qca_wlan_vendor_get_wifi_info_policy[ |
| 6130 | QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX +1] = { |
| 6131 | [QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION] = {.type = NLA_U8 }, |
| 6132 | [QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION] = {.type = NLA_U8 }, |
| 6133 | }; |
| 6134 | |
| 6135 | |
| 6136 | /** |
| 6137 | * __wlan_hdd_cfg80211_get_wifi_info() - Get the wifi driver related info |
| 6138 | * @wiphy: pointer to wireless wiphy structure. |
| 6139 | * @wdev: pointer to wireless_dev structure. |
| 6140 | * @data: Pointer to the data to be passed via vendor interface |
| 6141 | * @data_len:Length of the data to be passed |
| 6142 | * |
| 6143 | * This is called when wlan driver needs to send wifi driver related info |
| 6144 | * (driver/fw version) to the user space application upon request. |
| 6145 | * |
| 6146 | * Return: Return the Success or Failure code. |
| 6147 | */ |
| 6148 | static int __wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy, |
| 6149 | struct wireless_dev *wdev, |
| 6150 | const void *data, int data_len) |
| 6151 | { |
| 6152 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6153 | struct nlattr *tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX + 1]; |
| 6154 | tSirVersionString version; |
| 6155 | uint32 version_len; |
| 6156 | uint8 attr; |
| 6157 | int status; |
| 6158 | struct sk_buff *reply_skb = NULL; |
| 6159 | |
| 6160 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 6161 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 6162 | return -EINVAL; |
| 6163 | } |
| 6164 | |
| 6165 | status = wlan_hdd_validate_context(hdd_ctx); |
| 6166 | if (0 != status) { |
| 6167 | hddLog(LOGE, FL("HDD context is not valid")); |
| 6168 | return -EINVAL; |
| 6169 | } |
| 6170 | |
| 6171 | if (nla_parse(tb_vendor, QCA_WLAN_VENDOR_ATTR_WIFI_INFO_GET_MAX, data, |
| 6172 | data_len, qca_wlan_vendor_get_wifi_info_policy)) { |
| 6173 | hddLog(LOGE, FL("WIFI_INFO_GET NL CMD parsing failed")); |
| 6174 | return -EINVAL; |
| 6175 | } |
| 6176 | |
| 6177 | if (tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION]) { |
| 6178 | hddLog(LOG1, FL("Rcvd req for Driver version Driver version is %s"), |
| 6179 | QWLAN_VERSIONSTR); |
| 6180 | strlcpy(version, QWLAN_VERSIONSTR, sizeof(version)); |
| 6181 | attr = QCA_WLAN_VENDOR_ATTR_WIFI_INFO_DRIVER_VERSION; |
| 6182 | } else if (tb_vendor[QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION]) { |
| 6183 | hddLog(LOG1, FL("Rcvd req for FW version FW version is %s"), |
| 6184 | hdd_ctx->fw_Version); |
| 6185 | strlcpy(version, hdd_ctx->fw_Version, sizeof(version)); |
| 6186 | attr = QCA_WLAN_VENDOR_ATTR_WIFI_INFO_FIRMWARE_VERSION; |
| 6187 | } else { |
| 6188 | hddLog(LOGE, FL("Invalid attribute in get wifi info request")); |
| 6189 | return -EINVAL; |
| 6190 | } |
| 6191 | |
| 6192 | version_len = strlen(version); |
| 6193 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 6194 | version_len + NLA_HDRLEN + NLMSG_HDRLEN); |
| 6195 | if (!reply_skb) { |
| 6196 | hddLog(LOGE, FL("cfg80211_vendor_cmd_alloc_reply_skb failed")); |
| 6197 | return -ENOMEM; |
| 6198 | } |
| 6199 | |
| 6200 | if (nla_put(reply_skb, attr, version_len, version)) { |
| 6201 | hddLog(LOGE, FL("nla put fail")); |
| 6202 | kfree_skb(reply_skb); |
| 6203 | return -EINVAL; |
| 6204 | } |
| 6205 | |
| 6206 | return cfg80211_vendor_cmd_reply(reply_skb); |
| 6207 | } |
| 6208 | |
| 6209 | /** |
| 6210 | * __wlan_hdd_cfg80211_get_wifi_info() - Get the wifi driver related info |
| 6211 | * @wiphy: pointer to wireless wiphy structure. |
| 6212 | * @wdev: pointer to wireless_dev structure. |
| 6213 | * @data: Pointer to the data to be passed via vendor interface |
| 6214 | * @data_len:Length of the data to be passed |
| 6215 | * @data_len: Length of the data received |
| 6216 | * |
| 6217 | * This function is used to enable or disable the collection of packet |
| 6218 | * statistics from the firmware |
| 6219 | * |
| 6220 | * Return: 0 on success and errno on failure |
| 6221 | */ |
| 6222 | |
| 6223 | static int |
| 6224 | wlan_hdd_cfg80211_get_wifi_info(struct wiphy *wiphy, |
| 6225 | struct wireless_dev *wdev, |
| 6226 | const void *data, int data_len) |
| 6227 | |
| 6228 | |
| 6229 | { |
| 6230 | int ret = 0; |
| 6231 | |
| 6232 | vos_ssr_protect(__func__); |
| 6233 | ret = __wlan_hdd_cfg80211_get_wifi_info(wiphy, |
| 6234 | wdev, data, data_len); |
| 6235 | vos_ssr_unprotect(__func__); |
| 6236 | |
| 6237 | return ret; |
| 6238 | } |
| 6239 | |
| 6240 | |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 6241 | /* |
| 6242 | * define short names for the global vendor params |
| 6243 | * used by __wlan_hdd_cfg80211_monitor_rssi() |
| 6244 | */ |
| 6245 | #define PARAM_MAX QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX |
| 6246 | #define PARAM_REQUEST_ID QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID |
| 6247 | #define PARAM_CONTROL QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CONTROL |
| 6248 | #define PARAM_MIN_RSSI QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MIN_RSSI |
| 6249 | #define PARAM_MAX_RSSI QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_MAX_RSSI |
| 6250 | |
| 6251 | /**--------------------------------------------------------------------------- |
| 6252 | |
| 6253 | \brief hdd_rssi_monitor_start_done - callback to be executed when rssi |
| 6254 | monitor start is completed successfully. |
| 6255 | |
| 6256 | \return - None |
| 6257 | |
| 6258 | --------------------------------------------------------------------------*/ |
| 6259 | void hdd_rssi_monitor_start_done(void *fwRssiMonitorCbContext, VOS_STATUS status) |
| 6260 | { |
| 6261 | hdd_context_t* pHddCtx = (hdd_context_t*)fwRssiMonitorCbContext; |
| 6262 | |
| 6263 | if (NULL == pHddCtx) |
| 6264 | { |
| 6265 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6266 | "%s: HDD context is NULL",__func__); |
| 6267 | return; |
| 6268 | } |
| 6269 | |
| 6270 | if (VOS_STATUS_SUCCESS == status) |
| 6271 | { |
| 6272 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rssi Monitor start successful")); |
| 6273 | } |
| 6274 | else |
| 6275 | { |
| 6276 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Rssi Monitor start not successful")); |
| 6277 | } |
| 6278 | |
| 6279 | return; |
| 6280 | } |
| 6281 | |
| 6282 | /**--------------------------------------------------------------------------- |
| 6283 | |
| 6284 | \brief hdd_rssi_monitor_stop_done - callback to be executed when rssi monitor |
| 6285 | stop is completed successfully. |
| 6286 | |
| 6287 | \return - None |
| 6288 | |
| 6289 | --------------------------------------------------------------------------*/ |
| 6290 | void hdd_rssi_monitor_stop_done(void *fwRssiMonitorCbContext, VOS_STATUS status) |
| 6291 | { |
| 6292 | hdd_context_t* pHddCtx = (hdd_context_t*)fwRssiMonitorCbContext; |
| 6293 | |
| 6294 | if (NULL == pHddCtx) |
| 6295 | { |
| 6296 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 6297 | "%s: HDD context is NULL",__func__); |
| 6298 | return; |
| 6299 | } |
| 6300 | |
| 6301 | if (VOS_STATUS_SUCCESS == status) |
| 6302 | { |
| 6303 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rssi Monitor stop successful")); |
| 6304 | } |
| 6305 | else |
| 6306 | { |
| 6307 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Rssi Monitor stop not successful")); |
| 6308 | } |
| 6309 | |
| 6310 | return; |
| 6311 | } |
| 6312 | |
| 6313 | /** |
| 6314 | * __wlan_hdd_cfg80211_monitor_rssi() - monitor rssi |
| 6315 | * @wiphy: Pointer to wireless phy |
| 6316 | * @wdev: Pointer to wireless device |
| 6317 | * @data: Pointer to data |
| 6318 | * @data_len: Data length |
| 6319 | * |
| 6320 | * Return: 0 on success, negative errno on failure |
| 6321 | */ |
| 6322 | |
| 6323 | static int |
| 6324 | __wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy, |
| 6325 | struct wireless_dev *wdev, |
| 6326 | const void *data, |
| 6327 | int data_len) |
| 6328 | { |
| 6329 | struct net_device *dev = wdev->netdev; |
| 6330 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6331 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6332 | hdd_station_ctx_t *pHddStaCtx; |
| 6333 | struct nlattr *tb[PARAM_MAX + 1]; |
| 6334 | tpSirRssiMonitorReq pReq; |
| 6335 | eHalStatus status; |
| 6336 | int ret; |
| 6337 | uint32_t control; |
| 6338 | static const struct nla_policy policy[PARAM_MAX + 1] = { |
| 6339 | [PARAM_REQUEST_ID] = { .type = NLA_U32 }, |
| 6340 | [PARAM_CONTROL] = { .type = NLA_U32 }, |
| 6341 | [PARAM_MIN_RSSI] = { .type = NLA_S8 }, |
| 6342 | [PARAM_MAX_RSSI] = { .type = NLA_S8 }, |
| 6343 | }; |
| 6344 | |
| 6345 | ENTER(); |
| 6346 | |
| 6347 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6348 | if (0 != ret) { |
| 6349 | return -EINVAL; |
| 6350 | } |
| 6351 | |
| 6352 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) { |
| 6353 | hddLog(LOGE, FL("Not in Connected state!")); |
| 6354 | return -ENOTSUPP; |
| 6355 | } |
| 6356 | |
| 6357 | if (nla_parse(tb, PARAM_MAX, data, data_len, policy)) { |
| 6358 | hddLog(LOGE, FL("Invalid ATTR")); |
| 6359 | return -EINVAL; |
| 6360 | } |
| 6361 | |
| 6362 | if (!tb[PARAM_REQUEST_ID]) { |
| 6363 | hddLog(LOGE, FL("attr request id failed")); |
| 6364 | return -EINVAL; |
| 6365 | } |
| 6366 | |
| 6367 | if (!tb[PARAM_CONTROL]) { |
| 6368 | hddLog(LOGE, FL("attr control failed")); |
| 6369 | return -EINVAL; |
| 6370 | } |
| 6371 | |
| 6372 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6373 | |
| 6374 | pReq = vos_mem_malloc(sizeof(tSirRssiMonitorReq)); |
| 6375 | if(NULL == pReq) |
| 6376 | { |
| 6377 | hddLog(LOGE, |
| 6378 | FL("vos_mem_alloc failed ")); |
| 6379 | return eHAL_STATUS_FAILED_ALLOC; |
| 6380 | } |
| 6381 | vos_mem_set(pReq, sizeof(tSirRssiMonitorReq), 0); |
| 6382 | |
| 6383 | pReq->requestId = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 6384 | pReq->sessionId = pAdapter->sessionId; |
| 6385 | pReq->rssiMonitorCbContext = hdd_ctx; |
| 6386 | control = nla_get_u32(tb[PARAM_CONTROL]); |
| 6387 | vos_mem_copy( &pReq->currentBssId, pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 6388 | |
| 6389 | hddLog(LOG1, FL("Request Id: %u Session_id: %d Control: %d"), |
| 6390 | pReq->requestId, pReq->sessionId, control); |
| 6391 | |
| 6392 | if (control == QCA_WLAN_RSSI_MONITORING_START) { |
| 6393 | if (!tb[PARAM_MIN_RSSI]) { |
| 6394 | hddLog(LOGE, FL("attr min rssi failed")); |
| 6395 | return -EINVAL; |
| 6396 | } |
| 6397 | |
| 6398 | if (!tb[PARAM_MAX_RSSI]) { |
| 6399 | hddLog(LOGE, FL("attr max rssi failed")); |
| 6400 | return -EINVAL; |
| 6401 | } |
| 6402 | |
| 6403 | pReq->minRssi = nla_get_s8(tb[PARAM_MIN_RSSI]); |
| 6404 | pReq->maxRssi = nla_get_s8(tb[PARAM_MAX_RSSI]); |
| 6405 | pReq->rssiMonitorCallback = hdd_rssi_monitor_start_done; |
| 6406 | |
| 6407 | if (!(pReq->minRssi < pReq->maxRssi)) { |
| 6408 | hddLog(LOGW, FL("min_rssi: %d must be less than max_rssi: %d"), |
| 6409 | pReq->minRssi, pReq->maxRssi); |
| 6410 | return -EINVAL; |
| 6411 | } |
| 6412 | hddLog(LOG1, FL("Min_rssi: %d Max_rssi: %d"), |
| 6413 | pReq->minRssi, pReq->maxRssi); |
| 6414 | status = sme_StartRssiMonitoring(hdd_ctx->hHal, pReq); |
| 6415 | |
| 6416 | } |
| 6417 | else if (control == QCA_WLAN_RSSI_MONITORING_STOP) { |
| 6418 | pReq->rssiMonitorCallback = hdd_rssi_monitor_stop_done; |
| 6419 | status = sme_StopRssiMonitoring(hdd_ctx->hHal, pReq); |
| 6420 | } |
| 6421 | else { |
| 6422 | hddLog(LOGE, FL("Invalid control cmd: %d"), control); |
| 6423 | return -EINVAL; |
| 6424 | } |
| 6425 | |
| 6426 | if (!HAL_STATUS_SUCCESS(status)) { |
| 6427 | hddLog(LOGE, |
| 6428 | FL("sme_set_rssi_monitoring failed(err=%d)"), status); |
| 6429 | return -EINVAL; |
| 6430 | } |
| 6431 | |
| 6432 | return 0; |
| 6433 | } |
| 6434 | |
| 6435 | /* |
| 6436 | * done with short names for the global vendor params |
| 6437 | * used by __wlan_hdd_cfg80211_monitor_rssi() |
| 6438 | */ |
| 6439 | #undef PARAM_MAX |
| 6440 | #undef PARAM_CONTROL |
| 6441 | #undef PARAM_REQUEST_ID |
| 6442 | #undef PARAM_MAX_RSSI |
| 6443 | #undef PARAM_MIN_RSSI |
| 6444 | |
| 6445 | /** |
| 6446 | * wlan_hdd_cfg80211_monitor_rssi() - SSR wrapper to rssi monitoring |
| 6447 | * @wiphy: wiphy structure pointer |
| 6448 | * @wdev: Wireless device structure pointer |
| 6449 | * @data: Pointer to the data received |
| 6450 | * @data_len: Length of @data |
| 6451 | * |
| 6452 | * Return: 0 on success; errno on failure |
| 6453 | */ |
| 6454 | static int |
| 6455 | wlan_hdd_cfg80211_monitor_rssi(struct wiphy *wiphy, struct wireless_dev *wdev, |
| 6456 | const void *data, int data_len) |
| 6457 | { |
| 6458 | int ret; |
| 6459 | |
| 6460 | vos_ssr_protect(__func__); |
| 6461 | ret = __wlan_hdd_cfg80211_monitor_rssi(wiphy, wdev, data, data_len); |
| 6462 | vos_ssr_unprotect(__func__); |
| 6463 | |
| 6464 | return ret; |
| 6465 | } |
| 6466 | |
| 6467 | /** |
| 6468 | * hdd_rssi_threshold_breached_cb() - rssi breached NL event |
| 6469 | * @hddctx: HDD context |
| 6470 | * @data: rssi breached event data |
| 6471 | * |
| 6472 | * This function reads the rssi breached event %data and fill in the skb with |
| 6473 | * NL attributes and send up the NL event. |
| 6474 | * This callback execute in atomic context and must not invoke any |
| 6475 | * blocking calls. |
| 6476 | * |
| 6477 | * Return: none |
| 6478 | */ |
| 6479 | void hdd_rssi_threshold_breached_cb(void *hddctx, |
| 6480 | struct rssi_breach_event *data) |
| 6481 | { |
| 6482 | hdd_context_t *pHddCtx = (hdd_context_t *)hddctx; |
| 6483 | int status; |
| 6484 | struct sk_buff *skb; |
| 6485 | |
| 6486 | ENTER(); |
| 6487 | status = wlan_hdd_validate_context(pHddCtx); |
| 6488 | |
| 6489 | if (0 != status) { |
| 6490 | return; |
| 6491 | } |
| 6492 | |
| 6493 | if (!data) { |
| 6494 | hddLog(LOGE, FL("data is null")); |
| 6495 | return; |
| 6496 | } |
| 6497 | |
| 6498 | skb = cfg80211_vendor_event_alloc(pHddCtx->wiphy, |
| 6499 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 6500 | NULL, |
| 6501 | #endif |
| 6502 | EXTSCAN_EVENT_BUF_SIZE + NLMSG_HDRLEN, |
| 6503 | QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX, |
| 6504 | GFP_KERNEL); |
| 6505 | |
| 6506 | if (!skb) { |
| 6507 | hddLog(LOGE, FL("cfg80211_vendor_event_alloc failed")); |
| 6508 | return; |
| 6509 | } |
| 6510 | |
| 6511 | hddLog(LOG1, "Req Id: %u Current rssi: %d", |
| 6512 | data->request_id, data->curr_rssi); |
| 6513 | hddLog(LOG1, "Current BSSID: "MAC_ADDRESS_STR, |
| 6514 | MAC_ADDR_ARRAY(data->curr_bssid.bytes)); |
| 6515 | |
| 6516 | if (nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_REQUEST_ID, |
| 6517 | data->request_id) || |
| 6518 | nla_put(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_BSSID, |
| 6519 | sizeof(data->curr_bssid), data->curr_bssid.bytes) || |
| 6520 | nla_put_s8(skb, QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_CUR_RSSI, |
| 6521 | data->curr_rssi)) { |
| 6522 | hddLog(LOGE, FL("nla put fail")); |
| 6523 | goto fail; |
| 6524 | } |
| 6525 | |
| 6526 | cfg80211_vendor_event(skb, GFP_KERNEL); |
| 6527 | return; |
| 6528 | |
| 6529 | fail: |
| 6530 | kfree_skb(skb); |
| 6531 | return; |
| 6532 | } |
| 6533 | |
| 6534 | |
| 6535 | |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 6536 | /** |
| 6537 | * __wlan_hdd_cfg80211_setband() - set band |
| 6538 | * @wiphy: Pointer to wireless phy |
| 6539 | * @wdev: Pointer to wireless device |
| 6540 | * @data: Pointer to data |
| 6541 | * @data_len: Data length |
| 6542 | * |
| 6543 | * Return: 0 on success, negative errno on failure |
| 6544 | */ |
| 6545 | static int |
| 6546 | __wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 6547 | struct wireless_dev *wdev, |
| 6548 | const void *data, |
| 6549 | int data_len) |
| 6550 | { |
| 6551 | struct net_device *dev = wdev->netdev; |
| 6552 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6553 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX + 1]; |
| 6554 | int ret; |
| 6555 | static const struct nla_policy policy[QCA_WLAN_VENDOR_ATTR_MAX + 1] |
| 6556 | = {[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE] = { .type = NLA_U32 }}; |
| 6557 | |
| 6558 | ENTER(); |
| 6559 | |
| 6560 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6561 | if (0 != ret) { |
| 6562 | hddLog(LOGE, FL("HDD context is not valid")); |
| 6563 | return ret; |
| 6564 | } |
| 6565 | |
| 6566 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, |
| 6567 | policy)) { |
| 6568 | hddLog(LOGE, FL("Invalid ATTR")); |
| 6569 | return -EINVAL; |
| 6570 | } |
| 6571 | |
| 6572 | if (!tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE]) { |
| 6573 | hddLog(LOGE, FL("attr QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE failed")); |
| 6574 | return -EINVAL; |
| 6575 | } |
| 6576 | |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 6577 | hdd_ctx->isSetBandByNL = TRUE; |
| 6578 | ret = hdd_setBand(dev, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 6579 | nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_SETBAND_VALUE])); |
Hanumantha Reddy Pothula | 1347e43 | 2015-08-05 09:53:44 +0530 | [diff] [blame] | 6580 | hdd_ctx->isSetBandByNL = FALSE; |
| 6581 | |
| 6582 | EXIT(); |
| 6583 | return ret; |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 6584 | } |
| 6585 | |
| 6586 | /** |
| 6587 | * wlan_hdd_cfg80211_setband() - Wrapper to offload packets |
| 6588 | * @wiphy: wiphy structure pointer |
| 6589 | * @wdev: Wireless device structure pointer |
| 6590 | * @data: Pointer to the data received |
| 6591 | * @data_len: Length of @data |
| 6592 | * |
| 6593 | * Return: 0 on success; errno on failure |
| 6594 | */ |
| 6595 | static int wlan_hdd_cfg80211_setband(struct wiphy *wiphy, |
| 6596 | struct wireless_dev *wdev, |
| 6597 | const void *data, |
| 6598 | int data_len) |
| 6599 | { |
| 6600 | int ret = 0; |
| 6601 | |
| 6602 | vos_ssr_protect(__func__); |
| 6603 | ret = __wlan_hdd_cfg80211_setband(wiphy, |
| 6604 | wdev, data, data_len); |
| 6605 | vos_ssr_unprotect(__func__); |
| 6606 | |
| 6607 | return ret; |
| 6608 | } |
| 6609 | |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 6610 | #ifdef WLAN_FEATURE_OFFLOAD_PACKETS |
| 6611 | /** |
| 6612 | * hdd_map_req_id_to_pattern_id() - map request id to pattern id |
| 6613 | * @hdd_ctx: HDD context |
| 6614 | * @request_id: [input] request id |
| 6615 | * @pattern_id: [output] pattern id |
| 6616 | * |
| 6617 | * This function loops through request id to pattern id array |
| 6618 | * if the slot is available, store the request id and return pattern id |
| 6619 | * if entry exists, return the pattern id |
| 6620 | * |
| 6621 | * Return: 0 on success and errno on failure |
| 6622 | */ |
| 6623 | static int hdd_map_req_id_to_pattern_id(hdd_context_t *hdd_ctx, |
| 6624 | uint32_t request_id, |
| 6625 | uint8_t *pattern_id) |
| 6626 | { |
| 6627 | uint32_t i; |
| 6628 | |
| 6629 | mutex_lock(&hdd_ctx->op_ctx.op_lock); |
| 6630 | for (i = 0; i < MAXNUM_PERIODIC_TX_PTRNS; i++) |
| 6631 | { |
| 6632 | if (hdd_ctx->op_ctx.op_table[i].request_id == 0) |
| 6633 | { |
| 6634 | hdd_ctx->op_ctx.op_table[i].request_id = request_id; |
| 6635 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 6636 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6637 | return 0; |
| 6638 | } else if (hdd_ctx->op_ctx.op_table[i].request_id == |
| 6639 | request_id) { |
| 6640 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 6641 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6642 | return 0; |
| 6643 | } |
| 6644 | } |
| 6645 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6646 | return -EINVAL; |
| 6647 | } |
| 6648 | |
| 6649 | /** |
| 6650 | * hdd_unmap_req_id_to_pattern_id() - unmap request id to pattern id |
| 6651 | * @hdd_ctx: HDD context |
| 6652 | * @request_id: [input] request id |
| 6653 | * @pattern_id: [output] pattern id |
| 6654 | * |
| 6655 | * This function loops through request id to pattern id array |
| 6656 | * reset request id to 0 (slot available again) and |
| 6657 | * return pattern id |
| 6658 | * |
| 6659 | * Return: 0 on success and errno on failure |
| 6660 | */ |
| 6661 | static int hdd_unmap_req_id_to_pattern_id(hdd_context_t *hdd_ctx, |
| 6662 | uint32_t request_id, |
| 6663 | uint8_t *pattern_id) |
| 6664 | { |
| 6665 | uint32_t i; |
| 6666 | |
| 6667 | mutex_lock(&hdd_ctx->op_ctx.op_lock); |
| 6668 | for (i = 0; i < MAXNUM_PERIODIC_TX_PTRNS; i++) |
| 6669 | { |
| 6670 | if (hdd_ctx->op_ctx.op_table[i].request_id == request_id) |
| 6671 | { |
| 6672 | hdd_ctx->op_ctx.op_table[i].request_id = 0; |
| 6673 | *pattern_id = hdd_ctx->op_ctx.op_table[i].pattern_id; |
| 6674 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6675 | return 0; |
| 6676 | } |
| 6677 | } |
| 6678 | mutex_unlock(&hdd_ctx->op_ctx.op_lock); |
| 6679 | return -EINVAL; |
| 6680 | } |
| 6681 | |
| 6682 | |
| 6683 | /* |
| 6684 | * define short names for the global vendor params |
| 6685 | * used by __wlan_hdd_cfg80211_offloaded_packets() |
| 6686 | */ |
| 6687 | #define PARAM_MAX QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_MAX |
| 6688 | #define PARAM_REQUEST_ID \ |
| 6689 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_REQUEST_ID |
| 6690 | #define PARAM_CONTROL \ |
| 6691 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SENDING_CONTROL |
| 6692 | #define PARAM_IP_PACKET \ |
| 6693 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_IP_PACKET_DATA |
| 6694 | #define PARAM_SRC_MAC_ADDR \ |
| 6695 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_SRC_MAC_ADDR |
| 6696 | #define PARAM_DST_MAC_ADDR \ |
| 6697 | QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_DST_MAC_ADDR |
| 6698 | #define PARAM_PERIOD QCA_WLAN_VENDOR_ATTR_OFFLOADED_PACKETS_PERIOD |
| 6699 | |
| 6700 | /** |
| 6701 | * wlan_hdd_add_tx_ptrn() - add tx pattern |
| 6702 | * @adapter: adapter pointer |
| 6703 | * @hdd_ctx: hdd context |
| 6704 | * @tb: nl attributes |
| 6705 | * |
| 6706 | * This function reads the NL attributes and forms a AddTxPtrn message |
| 6707 | * posts it to SME. |
| 6708 | * |
| 6709 | */ |
| 6710 | static int |
| 6711 | wlan_hdd_add_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx, |
| 6712 | struct nlattr **tb) |
| 6713 | { |
| 6714 | struct sSirAddPeriodicTxPtrn *add_req; |
| 6715 | eHalStatus status; |
| 6716 | uint32_t request_id, ret, len; |
| 6717 | uint8_t pattern_id = 0; |
| 6718 | v_MACADDR_t dst_addr; |
| 6719 | uint16_t eth_type = htons(ETH_P_IP); |
| 6720 | |
| 6721 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(adapter))) |
| 6722 | { |
| 6723 | hddLog(LOGE, FL("Not in Connected state!")); |
| 6724 | return -ENOTSUPP; |
| 6725 | } |
| 6726 | |
| 6727 | add_req = vos_mem_malloc(sizeof(*add_req)); |
| 6728 | if (!add_req) |
| 6729 | { |
| 6730 | hddLog(LOGE, FL("memory allocation failed")); |
| 6731 | return -ENOMEM; |
| 6732 | } |
| 6733 | |
| 6734 | /* Parse and fetch request Id */ |
| 6735 | if (!tb[PARAM_REQUEST_ID]) |
| 6736 | { |
| 6737 | hddLog(LOGE, FL("attr request id failed")); |
| 6738 | goto fail; |
| 6739 | } |
| 6740 | |
| 6741 | request_id = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 6742 | hddLog(LOG1, FL("Request Id: %u"), request_id); |
| 6743 | if (request_id == 0) |
| 6744 | { |
| 6745 | hddLog(LOGE, FL("request_id cannot be zero")); |
| 6746 | return -EINVAL; |
| 6747 | } |
| 6748 | |
| 6749 | if (!tb[PARAM_PERIOD]) |
| 6750 | { |
| 6751 | hddLog(LOGE, FL("attr period failed")); |
| 6752 | goto fail; |
| 6753 | } |
| 6754 | add_req->usPtrnIntervalMs = nla_get_u32(tb[PARAM_PERIOD]); |
| 6755 | hddLog(LOG1, FL("Period: %u ms"), add_req->usPtrnIntervalMs); |
| 6756 | if (add_req->usPtrnIntervalMs == 0) |
| 6757 | { |
| 6758 | hddLog(LOGE, FL("Invalid interval zero, return failure")); |
| 6759 | goto fail; |
| 6760 | } |
| 6761 | |
| 6762 | if (!tb[PARAM_SRC_MAC_ADDR]) |
| 6763 | { |
| 6764 | hddLog(LOGE, FL("attr source mac address failed")); |
| 6765 | goto fail; |
| 6766 | } |
| 6767 | nla_memcpy(add_req->macAddress, tb[PARAM_SRC_MAC_ADDR], |
| 6768 | VOS_MAC_ADDR_SIZE); |
| 6769 | hddLog(LOG1, "input src mac address: "MAC_ADDRESS_STR, |
| 6770 | MAC_ADDR_ARRAY(add_req->macAddress)); |
| 6771 | |
| 6772 | if (memcmp(add_req->macAddress, adapter->macAddressCurrent.bytes, |
| 6773 | VOS_MAC_ADDR_SIZE)) |
| 6774 | { |
| 6775 | hddLog(LOGE, |
| 6776 | FL("input src mac address and connected ap bssid are different")); |
| 6777 | goto fail; |
| 6778 | } |
| 6779 | |
| 6780 | if (!tb[PARAM_DST_MAC_ADDR]) |
| 6781 | { |
| 6782 | hddLog(LOGE, FL("attr dst mac address failed")); |
| 6783 | goto fail; |
| 6784 | } |
| 6785 | nla_memcpy(dst_addr.bytes, tb[PARAM_DST_MAC_ADDR], VOS_MAC_ADDR_SIZE); |
| 6786 | hddLog(LOG1, "input dst mac address: "MAC_ADDRESS_STR, |
| 6787 | MAC_ADDR_ARRAY(dst_addr.bytes)); |
| 6788 | |
| 6789 | if (!tb[PARAM_IP_PACKET]) |
| 6790 | { |
| 6791 | hddLog(LOGE, FL("attr ip packet failed")); |
| 6792 | goto fail; |
| 6793 | } |
| 6794 | add_req->ucPtrnSize = nla_len(tb[PARAM_IP_PACKET]); |
| 6795 | hddLog(LOG1, FL("IP packet len: %u"), add_req->ucPtrnSize); |
| 6796 | |
| 6797 | if (add_req->ucPtrnSize < 0 || |
| 6798 | add_req->ucPtrnSize > (PERIODIC_TX_PTRN_MAX_SIZE - |
| 6799 | HDD_ETH_HEADER_LEN)) |
| 6800 | { |
| 6801 | hddLog(LOGE, FL("Invalid IP packet len: %d"), |
| 6802 | add_req->ucPtrnSize); |
| 6803 | goto fail; |
| 6804 | } |
| 6805 | |
| 6806 | len = 0; |
| 6807 | vos_mem_copy(&add_req->ucPattern[0], dst_addr.bytes, VOS_MAC_ADDR_SIZE); |
| 6808 | len += VOS_MAC_ADDR_SIZE; |
| 6809 | vos_mem_copy(&add_req->ucPattern[len], add_req->macAddress, |
| 6810 | VOS_MAC_ADDR_SIZE); |
| 6811 | len += VOS_MAC_ADDR_SIZE; |
| 6812 | vos_mem_copy(&add_req->ucPattern[len], ð_type, 2); |
| 6813 | len += 2; |
| 6814 | |
| 6815 | /* |
| 6816 | * This is the IP packet, add 14 bytes Ethernet (802.3) header |
| 6817 | * ------------------------------------------------------------ |
| 6818 | * | 14 bytes Ethernet (802.3) header | IP header and payload | |
| 6819 | * ------------------------------------------------------------ |
| 6820 | */ |
| 6821 | vos_mem_copy(&add_req->ucPattern[len], |
| 6822 | nla_data(tb[PARAM_IP_PACKET]), |
| 6823 | add_req->ucPtrnSize); |
| 6824 | add_req->ucPtrnSize += len; |
| 6825 | |
| 6826 | VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 6827 | add_req->ucPattern, add_req->ucPtrnSize); |
| 6828 | |
| 6829 | ret = hdd_map_req_id_to_pattern_id(hdd_ctx, request_id, &pattern_id); |
| 6830 | if (ret) |
| 6831 | { |
| 6832 | hddLog(LOGW, FL("req id to pattern id failed (ret=%d)"), ret); |
| 6833 | goto fail; |
| 6834 | } |
| 6835 | add_req->ucPtrnId = pattern_id; |
| 6836 | hddLog(LOG1, FL("pattern id: %d"), add_req->ucPtrnId); |
| 6837 | |
| 6838 | status = sme_AddPeriodicTxPtrn(hdd_ctx->hHal, add_req); |
| 6839 | if (!HAL_STATUS_SUCCESS(status)) |
| 6840 | { |
| 6841 | hddLog(LOGE, |
| 6842 | FL("sme_AddPeriodicTxPtrn failed (err=%d)"), status); |
| 6843 | goto fail; |
| 6844 | } |
| 6845 | |
| 6846 | EXIT(); |
| 6847 | vos_mem_free(add_req); |
| 6848 | return 0; |
| 6849 | |
| 6850 | fail: |
| 6851 | vos_mem_free(add_req); |
| 6852 | return -EINVAL; |
| 6853 | } |
| 6854 | |
| 6855 | /** |
| 6856 | * wlan_hdd_del_tx_ptrn() - delete tx pattern |
| 6857 | * @adapter: adapter pointer |
| 6858 | * @hdd_ctx: hdd context |
| 6859 | * @tb: nl attributes |
| 6860 | * |
| 6861 | * This function reads the NL attributes and forms a DelTxPtrn message |
| 6862 | * posts it to SME. |
| 6863 | * |
| 6864 | */ |
| 6865 | static int |
| 6866 | wlan_hdd_del_tx_ptrn(hdd_adapter_t *adapter, hdd_context_t *hdd_ctx, |
| 6867 | struct nlattr **tb) |
| 6868 | { |
| 6869 | struct sSirDelPeriodicTxPtrn *del_req; |
| 6870 | eHalStatus status; |
| 6871 | uint32_t request_id, ret; |
| 6872 | uint8_t pattern_id = 0; |
| 6873 | |
| 6874 | /* Parse and fetch request Id */ |
| 6875 | if (!tb[PARAM_REQUEST_ID]) |
| 6876 | { |
| 6877 | hddLog(LOGE, FL("attr request id failed")); |
| 6878 | return -EINVAL; |
| 6879 | } |
| 6880 | request_id = nla_get_u32(tb[PARAM_REQUEST_ID]); |
| 6881 | if (request_id == 0) |
| 6882 | { |
| 6883 | hddLog(LOGE, FL("request_id cannot be zero")); |
| 6884 | return -EINVAL; |
| 6885 | } |
| 6886 | |
| 6887 | ret = hdd_unmap_req_id_to_pattern_id(hdd_ctx, request_id, &pattern_id); |
| 6888 | if (ret) |
| 6889 | { |
| 6890 | hddLog(LOGW, FL("req id to pattern id failed (ret=%d)"), ret); |
| 6891 | return -EINVAL; |
| 6892 | } |
| 6893 | |
| 6894 | del_req = vos_mem_malloc(sizeof(*del_req)); |
| 6895 | if (!del_req) |
| 6896 | { |
| 6897 | hddLog(LOGE, FL("memory allocation failed")); |
| 6898 | return -ENOMEM; |
| 6899 | } |
| 6900 | |
| 6901 | vos_mem_set(del_req, sizeof(*del_req), 0); |
| 6902 | vos_mem_copy(del_req->macAddress, adapter->macAddressCurrent.bytes, |
| 6903 | VOS_MAC_ADDR_SIZE); |
| 6904 | hddLog(LOG1, MAC_ADDRESS_STR, MAC_ADDR_ARRAY(del_req->macAddress)); |
| 6905 | del_req->ucPatternIdBitmap |= (0x1 << pattern_id); |
| 6906 | hddLog(LOG1, FL("Request Id: %u Pattern id: %d, bitmap %04x"), |
| 6907 | request_id, pattern_id, del_req->ucPatternIdBitmap); |
| 6908 | |
| 6909 | status = sme_DelPeriodicTxPtrn(hdd_ctx->hHal, del_req); |
| 6910 | if (!HAL_STATUS_SUCCESS(status)) |
| 6911 | { |
| 6912 | hddLog(LOGE, |
| 6913 | FL("sme_DelPeriodicTxPtrn failed (err=%d)"), status); |
| 6914 | goto fail; |
| 6915 | } |
| 6916 | |
| 6917 | EXIT(); |
| 6918 | vos_mem_free(del_req); |
| 6919 | return 0; |
| 6920 | |
| 6921 | fail: |
| 6922 | vos_mem_free(del_req); |
| 6923 | return -EINVAL; |
| 6924 | } |
| 6925 | |
| 6926 | |
| 6927 | /** |
| 6928 | * __wlan_hdd_cfg80211_offloaded_packets() - send offloaded packets |
| 6929 | * @wiphy: Pointer to wireless phy |
| 6930 | * @wdev: Pointer to wireless device |
| 6931 | * @data: Pointer to data |
| 6932 | * @data_len: Data length |
| 6933 | * |
| 6934 | * Return: 0 on success, negative errno on failure |
| 6935 | */ |
| 6936 | static int |
| 6937 | __wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy, |
| 6938 | struct wireless_dev *wdev, |
| 6939 | const void *data, |
| 6940 | int data_len) |
| 6941 | { |
| 6942 | struct net_device *dev = wdev->netdev; |
| 6943 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6944 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 6945 | struct nlattr *tb[PARAM_MAX + 1]; |
| 6946 | uint8_t control; |
| 6947 | int ret; |
| 6948 | static const struct nla_policy policy[PARAM_MAX + 1] = |
| 6949 | { |
| 6950 | [PARAM_REQUEST_ID] = { .type = NLA_U32 }, |
| 6951 | [PARAM_CONTROL] = { .type = NLA_U32 }, |
| 6952 | [PARAM_SRC_MAC_ADDR] = { .type = NLA_BINARY, |
| 6953 | .len = VOS_MAC_ADDR_SIZE }, |
| 6954 | [PARAM_DST_MAC_ADDR] = { .type = NLA_BINARY, |
| 6955 | .len = VOS_MAC_ADDR_SIZE }, |
| 6956 | [PARAM_PERIOD] = { .type = NLA_U32 }, |
| 6957 | }; |
| 6958 | |
| 6959 | ENTER(); |
| 6960 | |
| 6961 | ret = wlan_hdd_validate_context(hdd_ctx); |
| 6962 | if (0 != ret) |
| 6963 | { |
| 6964 | hddLog(LOGE, FL("HDD context is not valid")); |
| 6965 | return ret; |
| 6966 | } |
| 6967 | |
| 6968 | if (!sme_IsFeatureSupportedByFW(WLAN_PERIODIC_TX_PTRN)) |
| 6969 | { |
| 6970 | hddLog(LOGE, |
| 6971 | FL("Periodic Tx Pattern Offload feature is not supported in FW!")); |
| 6972 | return -ENOTSUPP; |
| 6973 | } |
| 6974 | |
| 6975 | if (nla_parse(tb, PARAM_MAX, data, data_len, policy)) |
| 6976 | { |
| 6977 | hddLog(LOGE, FL("Invalid ATTR")); |
| 6978 | return -EINVAL; |
| 6979 | } |
| 6980 | |
| 6981 | if (!tb[PARAM_CONTROL]) |
| 6982 | { |
| 6983 | hddLog(LOGE, FL("attr control failed")); |
| 6984 | return -EINVAL; |
| 6985 | } |
| 6986 | control = nla_get_u32(tb[PARAM_CONTROL]); |
| 6987 | hddLog(LOG1, FL("Control: %d"), control); |
| 6988 | |
| 6989 | if (control == WLAN_START_OFFLOADED_PACKETS) |
| 6990 | return wlan_hdd_add_tx_ptrn(adapter, hdd_ctx, tb); |
| 6991 | else if (control == WLAN_STOP_OFFLOADED_PACKETS) |
| 6992 | return wlan_hdd_del_tx_ptrn(adapter, hdd_ctx, tb); |
| 6993 | else |
| 6994 | { |
| 6995 | hddLog(LOGE, FL("Invalid control: %d"), control); |
| 6996 | return -EINVAL; |
| 6997 | } |
| 6998 | } |
| 6999 | |
| 7000 | /* |
| 7001 | * done with short names for the global vendor params |
| 7002 | * used by __wlan_hdd_cfg80211_offloaded_packets() |
| 7003 | */ |
| 7004 | #undef PARAM_MAX |
| 7005 | #undef PARAM_REQUEST_ID |
| 7006 | #undef PARAM_CONTROL |
| 7007 | #undef PARAM_IP_PACKET |
| 7008 | #undef PARAM_SRC_MAC_ADDR |
| 7009 | #undef PARAM_DST_MAC_ADDR |
| 7010 | #undef PARAM_PERIOD |
| 7011 | |
| 7012 | /** |
| 7013 | * wlan_hdd_cfg80211_offloaded_packets() - Wrapper to offload packets |
| 7014 | * @wiphy: wiphy structure pointer |
| 7015 | * @wdev: Wireless device structure pointer |
| 7016 | * @data: Pointer to the data received |
| 7017 | * @data_len: Length of @data |
| 7018 | * |
| 7019 | * Return: 0 on success; errno on failure |
| 7020 | */ |
| 7021 | static int wlan_hdd_cfg80211_offloaded_packets(struct wiphy *wiphy, |
| 7022 | struct wireless_dev *wdev, |
| 7023 | const void *data, |
| 7024 | int data_len) |
| 7025 | { |
| 7026 | int ret = 0; |
| 7027 | |
| 7028 | vos_ssr_protect(__func__); |
| 7029 | ret = __wlan_hdd_cfg80211_offloaded_packets(wiphy, |
| 7030 | wdev, data, data_len); |
| 7031 | vos_ssr_unprotect(__func__); |
| 7032 | |
| 7033 | return ret; |
| 7034 | } |
| 7035 | #endif |
| 7036 | |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7037 | static const struct |
| 7038 | nla_policy |
| 7039 | qca_wlan_vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_MAX+1] = { |
| 7040 | [QCA_WLAN_VENDOR_ATTR_MAC_ADDR] = { .type = NLA_UNSPEC }, |
| 7041 | }; |
| 7042 | |
| 7043 | /** |
| 7044 | * wlan_hdd_cfg80211_get_link_properties() - This function is used to |
| 7045 | * get link properties like nss, rate flags and operating frequency for |
| 7046 | * the connection with the given peer. |
| 7047 | * @wiphy: WIPHY structure pointer |
| 7048 | * @wdev: Wireless device structure pointer |
| 7049 | * @data: Pointer to the data received |
| 7050 | * @data_len: Length of the data received |
| 7051 | * |
| 7052 | * This function return the above link properties on success. |
| 7053 | * |
| 7054 | * Return: 0 on success and errno on failure |
| 7055 | */ |
| 7056 | static int wlan_hdd_cfg80211_get_link_properties(struct wiphy *wiphy, |
| 7057 | struct wireless_dev *wdev, |
| 7058 | const void *data, |
| 7059 | int data_len) |
| 7060 | { |
| 7061 | hdd_context_t *hdd_ctx = wiphy_priv(wiphy); |
| 7062 | struct net_device *dev = wdev->netdev; |
| 7063 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7064 | hdd_station_ctx_t *hdd_sta_ctx; |
| 7065 | struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_MAX+1]; |
| 7066 | uint8_t peer_mac[VOS_MAC_ADDR_SIZE]; |
| 7067 | uint32_t sta_id; |
| 7068 | struct sk_buff *reply_skb; |
| 7069 | uint32_t rate_flags = 0; |
| 7070 | uint8_t nss; |
| 7071 | uint8_t final_rate_flags = 0; |
| 7072 | uint32_t freq; |
| 7073 | v_CONTEXT_t pVosContext = NULL; |
| 7074 | ptSapContext pSapCtx = NULL; |
| 7075 | |
| 7076 | if (0 != wlan_hdd_validate_context(hdd_ctx)) { |
| 7077 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is not valid")); |
| 7078 | return -EINVAL; |
| 7079 | } |
| 7080 | |
| 7081 | if (nla_parse(tb, QCA_WLAN_VENDOR_ATTR_MAX, data, data_len, |
| 7082 | qca_wlan_vendor_attr_policy)) { |
| 7083 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Invalid attribute")); |
| 7084 | return -EINVAL; |
| 7085 | } |
| 7086 | |
| 7087 | if (!tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]) { |
| 7088 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7089 | FL("Attribute peerMac not provided for mode=%d"), |
| 7090 | adapter->device_mode); |
| 7091 | return -EINVAL; |
| 7092 | } |
| 7093 | |
| 7094 | memcpy(peer_mac, nla_data(tb[QCA_WLAN_VENDOR_ATTR_MAC_ADDR]), |
| 7095 | sizeof(peer_mac)); |
| 7096 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 7097 | FL("peerMac="MAC_ADDRESS_STR" for device_mode:%d"), |
| 7098 | MAC_ADDR_ARRAY(peer_mac), adapter->device_mode); |
| 7099 | |
| 7100 | if (adapter->device_mode == WLAN_HDD_INFRA_STATION || |
| 7101 | adapter->device_mode == WLAN_HDD_P2P_CLIENT) { |
| 7102 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 7103 | if ((hdd_sta_ctx->conn_info.connState != |
| 7104 | eConnectionState_Associated) || |
| 7105 | !vos_mem_compare(hdd_sta_ctx->conn_info.bssId, peer_mac, |
| 7106 | VOS_MAC_ADDRESS_LEN)) { |
| 7107 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7108 | FL("Not Associated to mac "MAC_ADDRESS_STR), |
| 7109 | MAC_ADDR_ARRAY(peer_mac)); |
| 7110 | return -EINVAL; |
| 7111 | } |
| 7112 | |
| 7113 | nss = 1; //pronto supports only one spatial stream |
| 7114 | freq = vos_chan_to_freq( |
| 7115 | hdd_sta_ctx->conn_info.operationChannel); |
| 7116 | rate_flags = hdd_sta_ctx->conn_info.rate_flags; |
| 7117 | |
| 7118 | } else if (adapter->device_mode == WLAN_HDD_P2P_GO || |
| 7119 | adapter->device_mode == WLAN_HDD_SOFTAP) { |
| 7120 | |
| 7121 | pVosContext = ( WLAN_HDD_GET_CTX(adapter))->pvosContext; |
| 7122 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 7123 | if(pSapCtx == NULL){ |
| 7124 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 7125 | FL("psapCtx is NULL")); |
| 7126 | return -ENOENT; |
| 7127 | } |
| 7128 | |
| 7129 | |
| 7130 | for (sta_id = 0; sta_id < WLAN_MAX_STA_COUNT; sta_id++) { |
| 7131 | if (pSapCtx->aStaInfo[sta_id].isUsed && |
| 7132 | !vos_is_macaddr_broadcast( |
| 7133 | &pSapCtx->aStaInfo[sta_id].macAddrSTA) && |
| 7134 | vos_mem_compare( |
| 7135 | &pSapCtx->aStaInfo[sta_id].macAddrSTA, |
| 7136 | peer_mac, VOS_MAC_ADDRESS_LEN)) |
| 7137 | break; |
| 7138 | } |
| 7139 | |
| 7140 | if (WLAN_MAX_STA_COUNT == sta_id) { |
| 7141 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7142 | FL("No active peer with mac="MAC_ADDRESS_STR), |
| 7143 | MAC_ADDR_ARRAY(peer_mac)); |
| 7144 | return -EINVAL; |
| 7145 | } |
| 7146 | |
| 7147 | nss = 1; //pronto supports only one spatial stream |
| 7148 | freq = vos_chan_to_freq( |
| 7149 | (WLAN_HDD_GET_AP_CTX_PTR(adapter))->operatingChannel); |
| 7150 | rate_flags = pSapCtx->aStaInfo[sta_id].rate_flags; |
| 7151 | } else { |
| 7152 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7153 | FL("Not Associated! with mac"MAC_ADDRESS_STR), |
| 7154 | MAC_ADDR_ARRAY(peer_mac)); |
| 7155 | return -EINVAL; |
| 7156 | } |
| 7157 | |
| 7158 | if (!(rate_flags & eHAL_TX_RATE_LEGACY)) { |
| 7159 | if (rate_flags & eHAL_TX_RATE_VHT80) { |
| 7160 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7161 | final_rate_flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 7162 | } else if (rate_flags & eHAL_TX_RATE_VHT40) { |
| 7163 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7164 | final_rate_flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7165 | } else if (rate_flags & eHAL_TX_RATE_VHT20) { |
| 7166 | final_rate_flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 7167 | } else if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) { |
| 7168 | final_rate_flags |= RATE_INFO_FLAGS_MCS; |
| 7169 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 7170 | final_rate_flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 7171 | } |
| 7172 | |
| 7173 | if (rate_flags & eHAL_TX_RATE_SGI) { |
| 7174 | if (!(final_rate_flags & RATE_INFO_FLAGS_VHT_MCS)) |
| 7175 | final_rate_flags |= RATE_INFO_FLAGS_MCS; |
| 7176 | final_rate_flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 7177 | } |
| 7178 | } |
| 7179 | |
| 7180 | reply_skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, |
| 7181 | sizeof(u8) + sizeof(u8) + sizeof(u32) + NLMSG_HDRLEN); |
| 7182 | |
| 7183 | if (NULL == reply_skb) { |
| 7184 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7185 | FL("getLinkProperties: skb alloc failed")); |
| 7186 | return -EINVAL; |
| 7187 | } |
| 7188 | |
| 7189 | if (nla_put_u8(reply_skb, |
| 7190 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_NSS, |
| 7191 | nss) || |
| 7192 | nla_put_u8(reply_skb, |
| 7193 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_RATE_FLAGS, |
| 7194 | final_rate_flags) || |
| 7195 | nla_put_u32(reply_skb, |
| 7196 | QCA_WLAN_VENDOR_ATTR_LINK_PROPERTIES_FREQ, |
| 7197 | freq)) { |
| 7198 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("nla_put failed")); |
| 7199 | kfree_skb(reply_skb); |
| 7200 | return -EINVAL; |
| 7201 | } |
| 7202 | |
| 7203 | return cfg80211_vendor_cmd_reply(reply_skb); |
| 7204 | } |
| 7205 | |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7206 | #define PARAM_WIFICONFIG_MAX QCA_WLAN_VENDOR_ATTR_CONFIG_MAX |
| 7207 | #define PARAM_MODULATED_DTIM QCA_WLAN_VENDOR_ATTR_CONFIG_MODULATED_DTIM |
| 7208 | #define PARAM_STATS_AVG_FACTOR QCA_WLAN_VENDOR_ATTR_CONFIG_STATS_AVG_FACTOR |
| 7209 | #define PARAM_GUARD_TIME QCA_WLAN_VENDOR_ATTR_CONFIG_GUARD_TIME |
| 7210 | |
| 7211 | /** |
| 7212 | * __wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration |
| 7213 | * vendor command |
| 7214 | * |
| 7215 | * @wiphy: wiphy device pointer |
| 7216 | * @wdev: wireless device pointer |
| 7217 | * @data: Vendor command data buffer |
| 7218 | * @data_len: Buffer length |
| 7219 | * |
| 7220 | * Handles QCA_WLAN_VENDOR_ATTR_CONFIG_MAX. |
| 7221 | * |
| 7222 | * Return: EOK or other error codes. |
| 7223 | */ |
| 7224 | |
| 7225 | static int __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, |
| 7226 | struct wireless_dev *wdev, |
| 7227 | const void *data, |
| 7228 | int data_len) |
| 7229 | { |
| 7230 | struct net_device *dev = wdev->netdev; |
| 7231 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 7232 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 7233 | hdd_station_ctx_t *pHddStaCtx; |
| 7234 | struct nlattr *tb[PARAM_WIFICONFIG_MAX + 1]; |
| 7235 | tpSetWifiConfigParams pReq; |
| 7236 | eHalStatus status; |
| 7237 | int ret_val; |
| 7238 | static const struct nla_policy policy[PARAM_WIFICONFIG_MAX + 1] = { |
| 7239 | [PARAM_STATS_AVG_FACTOR] = { .type = NLA_U16 }, |
| 7240 | [PARAM_MODULATED_DTIM] = { .type = NLA_U32 }, |
| 7241 | [PARAM_GUARD_TIME] = { .type = NLA_U32}, |
| 7242 | }; |
| 7243 | |
| 7244 | ENTER(); |
| 7245 | |
| 7246 | if (VOS_FTM_MODE == hdd_get_conparam()) { |
| 7247 | hddLog(LOGE, FL("Command not allowed in FTM mode")); |
| 7248 | return -EINVAL; |
| 7249 | } |
| 7250 | |
| 7251 | ret_val = wlan_hdd_validate_context(pHddCtx); |
| 7252 | if (ret_val) { |
| 7253 | return ret_val; |
| 7254 | } |
| 7255 | |
| 7256 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 7257 | |
| 7258 | if (!hdd_connIsConnected(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))) { |
| 7259 | hddLog(LOGE, FL("Not in Connected state!")); |
| 7260 | return -ENOTSUPP; |
| 7261 | } |
| 7262 | |
| 7263 | if (nla_parse(tb, PARAM_WIFICONFIG_MAX, data, data_len, policy)) { |
| 7264 | hddLog(LOGE, FL("Invalid ATTR")); |
| 7265 | return -EINVAL; |
| 7266 | } |
| 7267 | |
| 7268 | /* check the Wifi Capability */ |
| 7269 | if ( (TRUE != pHddCtx->cfg_ini->fEnableWifiConfig) && |
| 7270 | (TRUE != sme_IsFeatureSupportedByFW(WIFI_CONFIG))) |
| 7271 | { |
| 7272 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7273 | FL("WIFICONFIG not supported by Firmware")); |
| 7274 | return -EINVAL; |
| 7275 | } |
| 7276 | |
| 7277 | pReq = vos_mem_malloc(sizeof(tSetWifiConfigParams)); |
| 7278 | |
| 7279 | if (!pReq) { |
| 7280 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 7281 | "%s: Not able to allocate memory for tSetWifiConfigParams", |
| 7282 | __func__); |
| 7283 | return eHAL_STATUS_E_MALLOC_FAILED; |
| 7284 | } |
| 7285 | |
| 7286 | vos_mem_set(pReq, sizeof(tSetWifiConfigParams), 0); |
| 7287 | |
| 7288 | pReq->sessionId = pAdapter->sessionId; |
| 7289 | vos_mem_copy( &pReq->bssId, pHddStaCtx->conn_info.bssId, WNI_CFG_BSSID_LEN); |
| 7290 | |
| 7291 | if (tb[PARAM_MODULATED_DTIM]) { |
| 7292 | pReq->paramValue = nla_get_u32( |
| 7293 | tb[PARAM_MODULATED_DTIM]); |
| 7294 | hddLog(LOG1, FL("Modulated DTIM: pReq->paramValue:%d "), |
| 7295 | pReq->paramValue); |
| 7296 | pHddCtx->cfg_ini->fMaxLIModulatedDTIM = pReq->paramValue; |
| 7297 | hdd_set_pwrparams(pHddCtx); |
| 7298 | if (BMPS == pmcGetPmcState(pHddCtx->hHal)) { |
| 7299 | hddLog( LOG1, FL("WifiConfig: Requesting FullPower!")); |
| 7300 | |
| 7301 | sme_RequestFullPower(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 7302 | iw_full_power_cbfn, pAdapter, |
| 7303 | eSME_FULL_PWR_NEEDED_BY_HDD); |
| 7304 | } |
| 7305 | else |
| 7306 | { |
| 7307 | hddLog( LOG1, FL("WifiConfig Not in BMPS state")); |
| 7308 | } |
| 7309 | } |
| 7310 | |
| 7311 | if (tb[PARAM_STATS_AVG_FACTOR]) { |
| 7312 | pReq->paramType = WIFI_CONFIG_SET_AVG_STATS_FACTOR; |
| 7313 | pReq->paramValue = nla_get_u16( |
| 7314 | tb[PARAM_STATS_AVG_FACTOR]); |
| 7315 | hddLog(LOG1, FL("AVG_STATS_FACTOR pReq->paramType:%d,pReq->paramValue:%d "), |
| 7316 | pReq->paramType, pReq->paramValue); |
| 7317 | status = sme_set_wificonfig_params(pHddCtx->hHal, pReq); |
| 7318 | |
| 7319 | if (eHAL_STATUS_SUCCESS != status) |
| 7320 | { |
| 7321 | vos_mem_free(pReq); |
| 7322 | pReq = NULL; |
| 7323 | ret_val = -EPERM; |
| 7324 | return ret_val; |
| 7325 | } |
| 7326 | } |
| 7327 | |
| 7328 | |
| 7329 | if (tb[PARAM_GUARD_TIME]) { |
| 7330 | pReq->paramType = WIFI_CONFIG_SET_GUARD_TIME; |
| 7331 | pReq->paramValue = nla_get_u32( |
| 7332 | tb[PARAM_GUARD_TIME]); |
| 7333 | hddLog(LOG1, FL("GUARD_TIME pReq->paramType:%d,pReq->paramValue:%d "), |
| 7334 | pReq->paramType, pReq->paramValue); |
| 7335 | status = sme_set_wificonfig_params(pHddCtx->hHal, pReq); |
| 7336 | |
| 7337 | if (eHAL_STATUS_SUCCESS != status) |
| 7338 | { |
| 7339 | vos_mem_free(pReq); |
| 7340 | pReq = NULL; |
| 7341 | ret_val = -EPERM; |
| 7342 | return ret_val; |
| 7343 | } |
| 7344 | |
| 7345 | } |
| 7346 | |
| 7347 | EXIT(); |
| 7348 | return ret_val; |
| 7349 | } |
| 7350 | |
| 7351 | /** |
| 7352 | * wlan_hdd_cfg80211_wifi_configuration_set() - Wifi configuration |
| 7353 | * vendor command |
| 7354 | * |
| 7355 | * @wiphy: wiphy device pointer |
| 7356 | * @wdev: wireless device pointer |
| 7357 | * @data: Vendor command data buffer |
| 7358 | * @data_len: Buffer length |
| 7359 | * |
| 7360 | * Handles QCA_WLAN_VENDOR_ATTR_CONFIG_MAX. |
| 7361 | * |
| 7362 | * Return: EOK or other error codes. |
| 7363 | */ |
| 7364 | static int wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, |
| 7365 | struct wireless_dev *wdev, |
| 7366 | const void *data, |
| 7367 | int data_len) |
| 7368 | { |
| 7369 | int ret; |
| 7370 | |
| 7371 | vos_ssr_protect(__func__); |
| 7372 | ret = __wlan_hdd_cfg80211_wifi_configuration_set(wiphy, wdev, |
| 7373 | data, data_len); |
| 7374 | vos_ssr_unprotect(__func__); |
| 7375 | |
| 7376 | return ret; |
| 7377 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7378 | const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = |
| 7379 | { |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 7380 | { |
| 7381 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7382 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAMING, |
| 7383 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7384 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7385 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7386 | .doit = wlan_hdd_cfg80211_firmware_roaming |
Mukul Sharma | 2a27163 | 2014-10-13 14:59:01 +0530 | [diff] [blame] | 7387 | }, |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 7388 | |
| 7389 | { |
| 7390 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7391 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN, |
| 7392 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7393 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7394 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7395 | .doit = wlan_hdd_cfg80211_nan_request |
| 7396 | }, |
| 7397 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7398 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 7399 | { |
| 7400 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7401 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR, |
| 7402 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7403 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7404 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7405 | .doit = wlan_hdd_cfg80211_ll_stats_clear |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7406 | }, |
| 7407 | |
| 7408 | { |
| 7409 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7410 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET, |
| 7411 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7412 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7413 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7414 | .doit = wlan_hdd_cfg80211_ll_stats_set |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7415 | }, |
| 7416 | |
| 7417 | { |
| 7418 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7419 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET, |
| 7420 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7421 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7422 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7423 | .doit = wlan_hdd_cfg80211_ll_stats_get |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7424 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7425 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7426 | #ifdef WLAN_FEATURE_EXTSCAN |
| 7427 | { |
| 7428 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7429 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START, |
| 7430 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7431 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7432 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7433 | .doit = wlan_hdd_cfg80211_extscan_start |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7434 | }, |
| 7435 | { |
| 7436 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7437 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP, |
| 7438 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7439 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7440 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7441 | .doit = wlan_hdd_cfg80211_extscan_stop |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7442 | }, |
| 7443 | { |
| 7444 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7445 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_VALID_CHANNELS, |
| 7446 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7447 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7448 | .doit = wlan_hdd_cfg80211_extscan_get_valid_channels |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7449 | }, |
| 7450 | { |
| 7451 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7452 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES, |
| 7453 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7454 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7455 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7456 | .doit = wlan_hdd_cfg80211_extscan_get_capabilities |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7457 | }, |
| 7458 | { |
| 7459 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7460 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS, |
| 7461 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7462 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7463 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7464 | .doit = wlan_hdd_cfg80211_extscan_get_cached_results |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7465 | }, |
| 7466 | { |
| 7467 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7468 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST, |
| 7469 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7470 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7471 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7472 | .doit = wlan_hdd_cfg80211_extscan_set_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7473 | }, |
| 7474 | { |
| 7475 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7476 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST, |
| 7477 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7478 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7479 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7480 | .doit = wlan_hdd_cfg80211_extscan_reset_bssid_hotlist |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7481 | }, |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 7482 | { |
| 7483 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7484 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SSID_HOTLIST, |
| 7485 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7486 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7487 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7488 | .doit = wlan_hdd_cfg80211_extscan_set_ssid_hotlist |
| 7489 | }, |
| 7490 | { |
| 7491 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7492 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SSID_HOTLIST, |
| 7493 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7494 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7495 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7496 | .doit = wlan_hdd_cfg80211_extscan_reset_ssid_hotlist |
| 7497 | }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7498 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7499 | /*EXT TDLS*/ |
| 7500 | { |
| 7501 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7502 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_ENABLE, |
| 7503 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7504 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7505 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7506 | .doit = wlan_hdd_cfg80211_exttdls_enable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7507 | }, |
| 7508 | { |
| 7509 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7510 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_DISABLE, |
| 7511 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7512 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7513 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7514 | .doit = wlan_hdd_cfg80211_exttdls_disable |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7515 | }, |
| 7516 | { |
| 7517 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7518 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_GET_STATUS, |
| 7519 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7520 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7521 | .doit = wlan_hdd_cfg80211_exttdls_get_status |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7522 | }, |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 7523 | { |
| 7524 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7525 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_SUPPORTED_FEATURES, |
| 7526 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7527 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7528 | .doit = wlan_hdd_cfg80211_get_supported_features |
Dasari Srinivas | 7875a30 | 2014-09-26 17:50:57 +0530 | [diff] [blame] | 7529 | }, |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 7530 | { |
| 7531 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7532 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_NO_DFS_FLAG, |
| 7533 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7534 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7535 | .doit = wlan_hdd_cfg80211_disable_dfs_channels |
Agarwal Ashish | 738843c | 2014-09-25 12:27:56 +0530 | [diff] [blame] | 7536 | }, |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 7537 | { |
| 7538 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7539 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MAC_OUI, |
| 7540 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7541 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7542 | .doit = wlan_hdd_cfg80211_set_spoofed_mac_oui |
Siddharth Bhal | a3a5cb4 | 2014-09-29 21:13:13 +0530 | [diff] [blame] | 7543 | }, |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 7544 | { |
| 7545 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7546 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_CONCURRENCY_MATRIX, |
| 7547 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7548 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
Edhar, Mahesh Kumar | 59129f5 | 2015-01-14 14:26:04 +0530 | [diff] [blame] | 7549 | .doit = wlan_hdd_cfg80211_get_concurrency_matrix |
Dasari Srinivas | e18b2cf | 2014-10-28 17:09:42 +0530 | [diff] [blame] | 7550 | }, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 7551 | { |
| 7552 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 7553 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP, |
| 7554 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7555 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7556 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7557 | .doit = wlan_hdd_cfg80211_get_fw_mem_dump |
| 7558 | }, |
| 7559 | { |
| 7560 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
Srinivas Dasari | 41d97c9 | 2015-07-29 13:09:39 +0530 | [diff] [blame] | 7561 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SETBAND, |
| 7562 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7563 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7564 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7565 | .doit = wlan_hdd_cfg80211_setband |
Sushant Kaushik | 8e64498 | 2015-09-23 12:18:54 +0530 | [diff] [blame] | 7566 | }, |
| 7567 | { |
| 7568 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7569 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_START, |
| 7570 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7571 | WIPHY_VENDOR_CMD_NEED_NETDEV, |
| 7572 | .doit = wlan_hdd_cfg80211_wifi_logger_start |
| 7573 | }, |
Sushant Kaushik | 847890c | 2015-09-28 16:05:17 +0530 | [diff] [blame] | 7574 | { |
| 7575 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7576 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO, |
| 7577 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7578 | WIPHY_VENDOR_CMD_NEED_NETDEV| |
| 7579 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7580 | .doit = wlan_hdd_cfg80211_get_wifi_info |
Sachin Ahuja | c08f72a | 2015-09-22 15:25:47 +0530 | [diff] [blame] | 7581 | }, |
| 7582 | { |
| 7583 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7584 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_RING_DATA, |
| 7585 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7586 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7587 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7588 | .doit = wlan_hdd_cfg80211_wifi_logger_get_ring_data |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 7589 | }, |
| 7590 | { |
| 7591 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7592 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI, |
| 7593 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7594 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7595 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7596 | .doit = wlan_hdd_cfg80211_monitor_rssi |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 7597 | }, |
| 7598 | #ifdef WLAN_FEATURE_OFFLOAD_PACKETS |
| 7599 | { |
| 7600 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7601 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_OFFLOADED_PACKETS, |
| 7602 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7603 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7604 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7605 | .doit = wlan_hdd_cfg80211_offloaded_packets |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7606 | }, |
Srinivas Girigowda | 8bf64cb | 2015-09-30 19:50:09 +0530 | [diff] [blame] | 7607 | #endif |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7608 | { |
| 7609 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7610 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LINK_PROPERTIES, |
| 7611 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7612 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7613 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7614 | .doit = wlan_hdd_cfg80211_get_link_properties |
Arun Khandavalli | 7eeb159 | 2015-10-19 21:36:57 +0530 | [diff] [blame] | 7615 | }, |
| 7616 | { |
| 7617 | .info.vendor_id = QCA_NL80211_VENDOR_ID, |
| 7618 | .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION, |
| 7619 | .flags = WIPHY_VENDOR_CMD_NEED_WDEV | |
| 7620 | WIPHY_VENDOR_CMD_NEED_NETDEV | |
| 7621 | WIPHY_VENDOR_CMD_NEED_RUNNING, |
| 7622 | .doit = wlan_hdd_cfg80211_wifi_configuration_set |
Deepthi Gowri | ae6a166 | 2015-10-12 12:59:37 +0530 | [diff] [blame] | 7623 | } |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7624 | }; |
| 7625 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 7626 | /* vendor specific events */ |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7627 | static const |
| 7628 | struct nl80211_vendor_cmd_info wlan_hdd_cfg80211_vendor_events[] = |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 7629 | { |
| 7630 | #ifdef FEATURE_WLAN_CH_AVOID |
| 7631 | { |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7632 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7633 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 7634 | }, |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7635 | #endif /* FEATURE_WLAN_CH_AVOID Index = 0*/ |
| 7636 | #ifdef WLAN_FEATURE_LINK_LAYER_STATS |
| 7637 | { |
| 7638 | /* Index = 1*/ |
| 7639 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7640 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET |
| 7641 | }, |
| 7642 | { |
| 7643 | /* Index = 2*/ |
| 7644 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7645 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET |
| 7646 | }, |
| 7647 | { |
| 7648 | /* Index = 3*/ |
| 7649 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7650 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR |
| 7651 | }, |
| 7652 | { |
| 7653 | /* Index = 4*/ |
| 7654 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7655 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_RADIO_RESULTS |
| 7656 | }, |
| 7657 | { |
| 7658 | /* Index = 5*/ |
| 7659 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7660 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_IFACE_RESULTS |
| 7661 | }, |
| 7662 | { |
| 7663 | /* Index = 6*/ |
| 7664 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7665 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_PEERS_RESULTS |
| 7666 | }, |
| 7667 | #endif /* WLAN_FEATURE_LINK_LAYER_STATS */ |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7668 | #ifdef WLAN_FEATURE_EXTSCAN |
| 7669 | { |
| 7670 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7671 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_START |
| 7672 | }, |
| 7673 | { |
| 7674 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7675 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_STOP |
| 7676 | }, |
| 7677 | { |
| 7678 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7679 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CAPABILITIES |
| 7680 | }, |
| 7681 | { |
| 7682 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7683 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_GET_CACHED_RESULTS |
| 7684 | }, |
| 7685 | { |
| 7686 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7687 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_RESULTS_AVAILABLE |
| 7688 | }, |
| 7689 | { |
| 7690 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7691 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_FULL_SCAN_RESULT |
| 7692 | }, |
| 7693 | { |
| 7694 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7695 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SCAN_EVENT |
| 7696 | }, |
| 7697 | { |
| 7698 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7699 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_AP_FOUND |
| 7700 | }, |
| 7701 | { |
| 7702 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7703 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_BSSID_HOTLIST |
| 7704 | }, |
| 7705 | { |
| 7706 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7707 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_BSSID_HOTLIST |
| 7708 | }, |
Padma, Santhosh Kumar | 9acee01 | 2015-08-21 19:58:01 +0530 | [diff] [blame] | 7709 | { |
| 7710 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7711 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_SET_SSID_HOTLIST |
| 7712 | }, |
| 7713 | { |
| 7714 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7715 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_RESET_SSID_HOTLIST |
| 7716 | }, |
| 7717 | [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND_INDEX] = { |
| 7718 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7719 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_FOUND |
| 7720 | }, |
| 7721 | [QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST_INDEX] = { |
| 7722 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7723 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_EXTSCAN_HOTLIST_SSID_LOST |
| 7724 | }, |
Dino Mycle | 6fb96c1 | 2014-06-10 11:52:40 +0530 | [diff] [blame] | 7725 | #endif /* WLAN_FEATURE_EXTSCAN */ |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 7726 | /*EXT TDLS*/ |
| 7727 | { |
| 7728 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7729 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_TDLS_STATE |
| 7730 | }, |
c_manjee | cfd1efb | 2015-09-25 19:32:34 +0530 | [diff] [blame] | 7731 | [QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP_INDEX] = { |
| 7732 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7733 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_WIFI_LOGGER_MEMORY_DUMP |
| 7734 | }, |
| 7735 | |
Srinivas Dasari | 030bad3 | 2015-02-18 23:23:54 +0530 | [diff] [blame] | 7736 | |
| 7737 | { |
| 7738 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7739 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_NAN |
| 7740 | }, |
| 7741 | |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 7742 | { |
| 7743 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7744 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_INFO, |
Gupta, Kapil | 7c34b32 | 2015-09-30 13:12:35 +0530 | [diff] [blame] | 7745 | }, |
| 7746 | [QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI_INDEX] = { |
| 7747 | .vendor_id = QCA_NL80211_VENDOR_ID, |
| 7748 | .subcmd = QCA_NL80211_VENDOR_SUBCMD_MONITOR_RSSI |
| 7749 | }, |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 7750 | |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 7751 | }; |
| 7752 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7753 | /* |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 7754 | * FUNCTION: wlan_hdd_cfg80211_wiphy_alloc |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7755 | * This function is called by hdd_wlan_startup() |
| 7756 | * during initialization. |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 7757 | * This function is used to allocate wiphy structure. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7758 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 7759 | struct wiphy *wlan_hdd_cfg80211_wiphy_alloc(int priv_size) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7760 | { |
| 7761 | struct wiphy *wiphy; |
| 7762 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7763 | /* |
| 7764 | * Create wiphy device |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7765 | */ |
| 7766 | wiphy = wiphy_new(&wlan_hdd_cfg80211_ops, priv_size); |
| 7767 | |
| 7768 | if (!wiphy) |
| 7769 | { |
| 7770 | /* Print error and jump into err label and free the memory */ |
| 7771 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wiphy init failed", __func__); |
| 7772 | return NULL; |
| 7773 | } |
| 7774 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 7775 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7776 | return wiphy; |
| 7777 | } |
| 7778 | |
| 7779 | /* |
| 7780 | * FUNCTION: wlan_hdd_cfg80211_update_band |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7781 | * This function is called from the supplicant through a |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7782 | * private ioctl to change the band value |
| 7783 | */ |
| 7784 | int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand) |
| 7785 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 7786 | int i, j; |
| 7787 | eNVChannelEnabledType channelEnabledState; |
| 7788 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7789 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 7790 | |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 7791 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7792 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 7793 | |
| 7794 | if (NULL == wiphy->bands[i]) |
| 7795 | { |
| 7796 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[i] is NULL, i = %d", |
| 7797 | __func__, i); |
| 7798 | continue; |
| 7799 | } |
| 7800 | |
| 7801 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 7802 | { |
| 7803 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 7804 | |
| 7805 | channelEnabledState = vos_nv_getChannelEnabledState( |
| 7806 | band->channels[j].hw_value); |
| 7807 | |
| 7808 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == eBand) // 5G only |
| 7809 | { |
Abhishek Singh | 678227a | 2014-11-04 10:52:38 +0530 | [diff] [blame] | 7810 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 7811 | continue; |
| 7812 | } |
| 7813 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == eBand) // 2G only |
| 7814 | { |
| 7815 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 7816 | continue; |
| 7817 | } |
| 7818 | |
| 7819 | if (NV_CHANNEL_DISABLE == channelEnabledState || |
| 7820 | NV_CHANNEL_INVALID == channelEnabledState) |
| 7821 | { |
| 7822 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 7823 | } |
| 7824 | else if (NV_CHANNEL_DFS == channelEnabledState) |
| 7825 | { |
| 7826 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 7827 | band->channels[j].flags |= IEEE80211_CHAN_RADAR; |
| 7828 | } |
| 7829 | else |
| 7830 | { |
| 7831 | band->channels[j].flags &= ~(IEEE80211_CHAN_DISABLED |
| 7832 | |IEEE80211_CHAN_RADAR); |
| 7833 | } |
| 7834 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7835 | } |
| 7836 | return 0; |
| 7837 | } |
| 7838 | /* |
| 7839 | * FUNCTION: wlan_hdd_cfg80211_init |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7840 | * This function is called by hdd_wlan_startup() |
| 7841 | * during initialization. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7842 | * This function is used to initialize and register wiphy structure. |
| 7843 | */ |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 7844 | int wlan_hdd_cfg80211_init(struct device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7845 | struct wiphy *wiphy, |
| 7846 | hdd_config_t *pCfg |
| 7847 | ) |
| 7848 | { |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 7849 | int i, j; |
Vinay Krishna Eranna | facf5e2 | 2014-02-24 13:16:25 +0530 | [diff] [blame] | 7850 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 7851 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7852 | ENTER(); |
| 7853 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7854 | /* Now bind the underlying wlan device with wiphy */ |
| 7855 | set_wiphy_dev(wiphy, dev); |
| 7856 | |
| 7857 | wiphy->mgmt_stypes = wlan_hdd_txrx_stypes; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7858 | |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 7859 | #ifndef CONFIG_ENABLE_LINUX_REG |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 7860 | /* the flag for the other case would be initialzed in |
| 7861 | vos_init_wiphy_from_nv_bin */ |
Amar Singhal | 0a40223 | 2013-10-11 20:57:16 -0700 | [diff] [blame] | 7862 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; |
Kiet Lam | 6c58333 | 2013-10-14 05:37:09 +0530 | [diff] [blame] | 7863 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 7864 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7865 | /* This will disable updating of NL channels from passive to |
| 7866 | * active if a beacon is received on passive channel. */ |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 7867 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 7868 | wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS; |
| 7869 | #else |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7870 | wiphy->flags |= WIPHY_FLAG_DISABLE_BEACON_HINTS; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 7871 | #endif |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7872 | |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 7873 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7874 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 7875 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME |
| 7876 | | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD |
| 7877 | | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 7878 | | WIPHY_FLAG_OFFCHAN_TX; |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 7879 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) |
| 7880 | wiphy->regulatory_flags = REGULATORY_COUNTRY_IE_IGNORE; |
| 7881 | #else |
| 7882 | wiphy->country_ie_pref = NL80211_COUNTRY_IE_IGNORE_CORE; |
| 7883 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7884 | #endif |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 7885 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7886 | #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] | 7887 | if (pCfg->isFastTransitionEnabled |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 7888 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 7889 | || pCfg->isFastRoamIniFeatureEnabled |
| 7890 | #endif |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 7891 | #ifdef FEATURE_WLAN_ESE |
| 7892 | || pCfg->isEseIniFeatureEnabled |
Srinivas Girigowda | 640728a | 2013-03-28 12:21:54 -0700 | [diff] [blame] | 7893 | #endif |
| 7894 | ) |
| 7895 | { |
| 7896 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM; |
| 7897 | } |
James Zmuda | 77fb5ae | 2013-01-29 08:00:17 -0800 | [diff] [blame] | 7898 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7899 | #ifdef FEATURE_WLAN_TDLS |
| 7900 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS |
| 7901 | | WIPHY_FLAG_TDLS_EXTERNAL_SETUP; |
| 7902 | #endif |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7903 | #ifdef FEATURE_WLAN_SCAN_PNO |
Hardik Kantilal Patel | 3dfd879 | 2013-11-13 20:34:57 +0530 | [diff] [blame] | 7904 | if (pCfg->configPNOScanSupport) |
| 7905 | { |
| 7906 | wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN; |
| 7907 | wiphy->max_sched_scan_ssids = SIR_PNO_MAX_SUPP_NETWORKS; |
| 7908 | wiphy->max_match_sets = SIR_PNO_MAX_SUPP_NETWORKS; |
| 7909 | wiphy->max_sched_scan_ie_len = SIR_MAC_MAX_IE_LENGTH; |
| 7910 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 7911 | #endif/*FEATURE_WLAN_SCAN_PNO*/ |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 7912 | |
Abhishek Singh | 10d8597 | 2015-04-17 10:27:23 +0530 | [diff] [blame] | 7913 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 7914 | wiphy->features |= NL80211_FEATURE_HT_IBSS; |
| 7915 | #endif |
| 7916 | |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7917 | #ifdef CONFIG_ENABLE_LINUX_REG |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 7918 | /* even with WIPHY_FLAG_CUSTOM_REGULATORY, |
| 7919 | driver can still register regulatory callback and |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7920 | it will get regulatory settings in wiphy->band[], but |
Madan Mohan Koyyalamudi | c3a240c | 2012-09-28 15:34:08 -0700 | [diff] [blame] | 7921 | driver need to determine what to do with both |
| 7922 | regulatory settings */ |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7923 | |
| 7924 | wiphy->reg_notifier = wlan_hdd_linux_reg_notifier; |
Amar Singhal | a49cbc5 | 2013-10-08 18:37:44 -0700 | [diff] [blame] | 7925 | #else |
| 7926 | wiphy->reg_notifier = wlan_hdd_crda_reg_notifier; |
Amar Singhal | fddc28c | 2013-09-05 13:03:40 -0700 | [diff] [blame] | 7927 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 7928 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 7929 | wiphy->max_scan_ssids = MAX_SCAN_SSID; |
| 7930 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 7931 | wiphy->max_scan_ie_len = SIR_MAC_MAX_ADD_IE_LENGTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7932 | |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 7933 | wiphy->max_acl_mac_addrs = MAX_ACL_MAC_ADDRESS; |
| 7934 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7935 | /* Supports STATION & AD-HOC modes right now */ |
Bhargav Shah | 0d2e3e5 | 2015-07-24 16:51:01 +0530 | [diff] [blame] | 7936 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
| 7937 | | BIT(NL80211_IFTYPE_ADHOC) |
| 7938 | | BIT(NL80211_IFTYPE_P2P_CLIENT) |
| 7939 | | BIT(NL80211_IFTYPE_P2P_GO) |
| 7940 | | BIT(NL80211_IFTYPE_AP); |
| 7941 | |
| 7942 | if (VOS_MONITOR_MODE == hdd_get_conparam()) |
| 7943 | { |
| 7944 | wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); |
| 7945 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7946 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 7947 | if( pCfg->advertiseConcurrentOperation ) |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 7948 | { |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 7949 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 7950 | if( pCfg->enableMCC ) |
| 7951 | { |
| 7952 | /* Currently, supports up to two channels */ |
| 7953 | wlan_hdd_iface_combination.num_different_channels = 2; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 7954 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 7955 | if( !pCfg->allowMCCGODiffBI ) |
| 7956 | wlan_hdd_iface_combination.beacon_int_infra_match = true; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 7957 | |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 7958 | } |
| 7959 | wiphy->iface_combinations = &wlan_hdd_iface_combination; |
| 7960 | wiphy->n_iface_combinations = 1; |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 7961 | #endif |
Rashmi Ramanna | bd3feb7 | 2014-02-25 16:14:48 +0530 | [diff] [blame] | 7962 | } |
Sudhir Sattayappa Kohalli | 278eee5 | 2013-01-16 17:35:13 -0800 | [diff] [blame] | 7963 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 7964 | /* Before registering we need to update the ht capabilitied based |
| 7965 | * on ini values*/ |
| 7966 | if( !pCfg->ShortGI20MhzEnable ) |
| 7967 | { |
| 7968 | wlan_hdd_band_2_4_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_20; |
| 7969 | 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] | 7970 | } |
| 7971 | |
| 7972 | if( !pCfg->ShortGI40MhzEnable ) |
| 7973 | { |
| 7974 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SGI_40; |
| 7975 | } |
| 7976 | |
| 7977 | if( !pCfg->nChannelBondingMode5GHz ) |
| 7978 | { |
| 7979 | wlan_hdd_band_5_GHZ.ht_cap.cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 7980 | } |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 7981 | /* |
| 7982 | * In case of static linked driver at the time of driver unload, |
| 7983 | * module exit doesn't happens. Module cleanup helps in cleaning |
| 7984 | * of static memory. |
| 7985 | * If driver load happens statically, at the time of driver unload, |
| 7986 | * wiphy flags don't get reset because of static memory. |
| 7987 | * It's better not to store channel in static memory. |
| 7988 | */ |
| 7989 | wiphy->bands[IEEE80211_BAND_2GHZ] = &wlan_hdd_band_2_4_GHZ; |
| 7990 | wiphy->bands[IEEE80211_BAND_2GHZ]->channels = |
| 7991 | (struct ieee80211_channel *)vos_mem_malloc(sizeof(hdd_channels_2_4_GHZ)); |
| 7992 | if (wiphy->bands[IEEE80211_BAND_2GHZ]->channels == NULL) |
| 7993 | { |
| 7994 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 7995 | FL("Not enough memory to allocate channels")); |
| 7996 | return -ENOMEM; |
| 7997 | } |
| 7998 | vos_mem_copy(wiphy->bands[IEEE80211_BAND_2GHZ]->channels, |
| 7999 | &hdd_channels_2_4_GHZ[0], |
| 8000 | sizeof(hdd_channels_2_4_GHZ)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8001 | |
Agrawal Ashish | 97dec50 | 2015-11-26 20:20:58 +0530 | [diff] [blame] | 8002 | if (true == hdd_is_5g_supported(pHddCtx)) |
| 8003 | { |
| 8004 | wiphy->bands[IEEE80211_BAND_5GHZ] = &wlan_hdd_band_5_GHZ; |
| 8005 | wiphy->bands[IEEE80211_BAND_5GHZ]->channels = |
| 8006 | (struct ieee80211_channel *)vos_mem_malloc(sizeof(hdd_channels_5_GHZ)); |
| 8007 | if (wiphy->bands[IEEE80211_BAND_5GHZ]->channels == NULL) |
| 8008 | { |
| 8009 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8010 | FL("Not enough memory to allocate channels")); |
| 8011 | vos_mem_free(wiphy->bands[IEEE80211_BAND_2GHZ]->channels); |
| 8012 | wiphy->bands[IEEE80211_BAND_2GHZ]->channels = NULL; |
| 8013 | return -ENOMEM; |
| 8014 | } |
| 8015 | vos_mem_copy(wiphy->bands[IEEE80211_BAND_5GHZ]->channels, |
| 8016 | &hdd_channels_5_GHZ[0], |
| 8017 | sizeof(hdd_channels_5_GHZ)); |
| 8018 | } |
Gopichand Nakkala | 1f7a64f | 2013-04-01 18:37:17 +0530 | [diff] [blame] | 8019 | |
| 8020 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 8021 | { |
| 8022 | |
| 8023 | if (NULL == wiphy->bands[i]) |
| 8024 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 8025 | 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] | 8026 | __func__, i); |
| 8027 | continue; |
| 8028 | } |
| 8029 | |
| 8030 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 8031 | { |
| 8032 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 8033 | |
| 8034 | if (IEEE80211_BAND_2GHZ == i && eCSR_BAND_5G == pCfg->nBandCapability) // 5G only |
| 8035 | { |
| 8036 | // Enable social channels for P2P |
| 8037 | if (WLAN_HDD_IS_SOCIAL_CHANNEL(band->channels[j].center_freq)) |
| 8038 | band->channels[j].flags &= ~IEEE80211_CHAN_DISABLED; |
| 8039 | else |
| 8040 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 8041 | continue; |
| 8042 | } |
| 8043 | else if (IEEE80211_BAND_5GHZ == i && eCSR_BAND_24 == pCfg->nBandCapability) // 2G only |
| 8044 | { |
| 8045 | band->channels[j].flags |= IEEE80211_CHAN_DISABLED; |
| 8046 | continue; |
| 8047 | } |
| 8048 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8049 | } |
| 8050 | /*Initialise the supported cipher suite details*/ |
| 8051 | wiphy->cipher_suites = hdd_cipher_suites; |
| 8052 | wiphy->n_cipher_suites = ARRAY_SIZE(hdd_cipher_suites); |
| 8053 | |
| 8054 | /*signal strength in mBm (100*dBm) */ |
| 8055 | wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; |
| 8056 | |
| 8057 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Sushant Kaushik | 4f640e4 | 2014-07-08 12:27:09 +0530 | [diff] [blame] | 8058 | wiphy->max_remain_on_channel_duration = 5000; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8059 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8060 | |
Sunil Dutt | c69bccb | 2014-05-26 21:30:20 +0530 | [diff] [blame] | 8061 | wiphy->n_vendor_commands = ARRAY_SIZE(hdd_wiphy_vendor_commands); |
| 8062 | wiphy->vendor_commands = hdd_wiphy_vendor_commands; |
Rajesh Chauhan | 98a31f8 | 2014-01-06 20:15:25 -0800 | [diff] [blame] | 8063 | wiphy->vendor_events = wlan_hdd_cfg80211_vendor_events; |
| 8064 | wiphy->n_vendor_events = ARRAY_SIZE(wlan_hdd_cfg80211_vendor_events); |
| 8065 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8066 | EXIT(); |
| 8067 | return 0; |
| 8068 | } |
| 8069 | |
| 8070 | /* In this function we are registering wiphy. */ |
| 8071 | int wlan_hdd_cfg80211_register(struct wiphy *wiphy) |
| 8072 | { |
| 8073 | ENTER(); |
| 8074 | /* Register our wiphy dev with cfg80211 */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8075 | if (0 > wiphy_register(wiphy)) |
| 8076 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8077 | /* print error */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8078 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy register failed", __func__); |
| 8079 | return -EIO; |
| 8080 | } |
| 8081 | |
| 8082 | EXIT(); |
| 8083 | return 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8084 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8085 | |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8086 | /* In this function we are updating channel list when, |
| 8087 | regulatory domain is FCC and country code is US. |
| 8088 | Here In FCC standard 5GHz UNII-1 Bands are indoor only. |
| 8089 | As per FCC smart phone is not a indoor device. |
| 8090 | GO should not opeate on indoor channels */ |
| 8091 | void wlan_hdd_cfg80211_update_reg_info(struct wiphy *wiphy) |
| 8092 | { |
| 8093 | int j; |
| 8094 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 8095 | tANI_U8 defaultCountryCode[3] = SME_INVALID_COUNTRY_CODE; |
| 8096 | //Default counrtycode from NV at the time of wiphy initialization. |
| 8097 | if (eHAL_STATUS_SUCCESS != sme_GetDefaultCountryCodeFrmNv(pHddCtx->hHal, |
| 8098 | &defaultCountryCode[0])) |
| 8099 | { |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 8100 | hddLog(LOGE, FL("Failed to get default country code from NV")); |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8101 | } |
| 8102 | if ((defaultCountryCode[0]== 'U') && (defaultCountryCode[1]=='S')) |
| 8103 | { |
Madan Mohan Koyyalamudi | 7127826 | 2013-04-12 22:00:48 +0530 | [diff] [blame] | 8104 | if (NULL == wiphy->bands[IEEE80211_BAND_5GHZ]) |
| 8105 | { |
| 8106 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: wiphy->bands[IEEE80211_BAND_5GHZ] is NULL",__func__ ); |
| 8107 | return; |
| 8108 | } |
| 8109 | for (j = 0; j < wiphy->bands[IEEE80211_BAND_5GHZ]->n_channels; j++) |
| 8110 | { |
| 8111 | struct ieee80211_supported_band *band = wiphy->bands[IEEE80211_BAND_5GHZ]; |
| 8112 | // Mark UNII -1 band channel as passive |
| 8113 | if (WLAN_HDD_CHANNEL_IN_UNII_1_BAND(band->channels[j].center_freq)) |
| 8114 | band->channels[j].flags |= IEEE80211_CHAN_PASSIVE_SCAN; |
| 8115 | } |
| 8116 | } |
| 8117 | } |
| 8118 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 8119 | /* This function registers for all frame which supplicant is interested in */ |
| 8120 | void wlan_hdd_cfg80211_register_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8121 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8122 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8123 | /* Register for all P2P action, public action etc frames */ |
| 8124 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 8125 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8126 | ENTER(); |
| 8127 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8128 | /* Right now we are registering these frame when driver is getting |
| 8129 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 8130 | frame register ops, we will move this code as a part of that */ |
| 8131 | /* GAS Initial Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8132 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8133 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 8134 | |
| 8135 | /* GAS Initial Response */ |
| 8136 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8137 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8138 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8139 | /* GAS Comeback Request */ |
| 8140 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8141 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 8142 | |
| 8143 | /* GAS Comeback Response */ |
| 8144 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8145 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 8146 | |
| 8147 | /* P2P Public Action */ |
| 8148 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8149 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8150 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 8151 | |
| 8152 | /* P2P Action */ |
| 8153 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8154 | (v_U8_t*)P2P_ACTION_FRAME, |
| 8155 | P2P_ACTION_FRAME_SIZE ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 8156 | |
Gopichand Nakkala | e3d56e7 | 2013-04-21 23:33:32 +0530 | [diff] [blame] | 8157 | /* WNM BSS Transition Request frame */ |
| 8158 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8159 | (v_U8_t*)WNM_BSS_ACTION_FRAME, |
| 8160 | WNM_BSS_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 8161 | |
| 8162 | /* WNM-Notification */ |
| 8163 | sme_RegisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8164 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 8165 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8166 | } |
| 8167 | |
Agarwal Ashish | 8fa0e9a | 2014-05-23 00:40:12 +0530 | [diff] [blame] | 8168 | void wlan_hdd_cfg80211_deregister_frames(hdd_adapter_t* pAdapter) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8169 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8170 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 8171 | /* Register for all P2P action, public action etc frames */ |
| 8172 | v_U16_t type = (SIR_MAC_MGMT_FRAME << 2) | ( SIR_MAC_MGMT_ACTION << 4); |
| 8173 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8174 | ENTER(); |
| 8175 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8176 | /* Right now we are registering these frame when driver is getting |
| 8177 | initialized. Once we will move to 2.6.37 kernel, in which we have |
| 8178 | frame register ops, we will move this code as a part of that */ |
| 8179 | /* GAS Initial Request */ |
| 8180 | |
| 8181 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8182 | (v_U8_t*)GAS_INITIAL_REQ, GAS_INITIAL_REQ_SIZE ); |
| 8183 | |
| 8184 | /* GAS Initial Response */ |
| 8185 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8186 | (v_U8_t*)GAS_INITIAL_RSP, GAS_INITIAL_RSP_SIZE ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8187 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8188 | /* GAS Comeback Request */ |
| 8189 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8190 | (v_U8_t*)GAS_COMEBACK_REQ, GAS_COMEBACK_REQ_SIZE ); |
| 8191 | |
| 8192 | /* GAS Comeback Response */ |
| 8193 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8194 | (v_U8_t*)GAS_COMEBACK_RSP, GAS_COMEBACK_RSP_SIZE ); |
| 8195 | |
| 8196 | /* P2P Public Action */ |
| 8197 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8198 | (v_U8_t*)P2P_PUBLIC_ACTION_FRAME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8199 | P2P_PUBLIC_ACTION_FRAME_SIZE ); |
| 8200 | |
| 8201 | /* P2P Action */ |
| 8202 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8203 | (v_U8_t*)P2P_ACTION_FRAME, |
| 8204 | P2P_ACTION_FRAME_SIZE ); |
Leela Venkata Kiran Kumar Reddy Chirala | e8e62c8 | 2013-10-29 18:23:26 -0700 | [diff] [blame] | 8205 | /* WNM-Notification */ |
| 8206 | sme_DeregisterMgmtFrame(hHal, pAdapter->sessionId, type, |
| 8207 | (v_U8_t*)WNM_NOTIFICATION_FRAME, |
| 8208 | WNM_NOTIFICATION_FRAME_SIZE ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8209 | } |
| 8210 | |
| 8211 | #ifdef FEATURE_WLAN_WAPI |
| 8212 | 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] | 8213 | const u8 *mac_addr, const u8 *key , int key_Len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8214 | { |
| 8215 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 8216 | tCsrRoamSetKey setKey; |
| 8217 | v_BOOL_t isConnected = TRUE; |
| 8218 | int status = 0; |
| 8219 | v_U32_t roamId= 0xFF; |
| 8220 | tANI_U8 *pKeyPtr = NULL; |
| 8221 | int n = 0; |
| 8222 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8223 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 8224 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 8225 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8226 | |
Gopichand Nakkala | e748020 | 2013-02-11 15:24:22 +0530 | [diff] [blame] | 8227 | vos_mem_zero(&setKey, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8228 | setKey.keyId = key_index; // Store Key ID |
| 8229 | setKey.encType = eCSR_ENCRYPT_TYPE_WPI; // SET WAPI Encryption |
| 8230 | setKey.keyDirection = eSIR_TX_RX; // Key Directionn both TX and RX |
| 8231 | setKey.paeRole = 0 ; // the PAE role |
| 8232 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 8233 | { |
| 8234 | vos_set_macaddr_broadcast( (v_MACADDR_t *)setKey.peerMac ); |
| 8235 | } |
| 8236 | else |
| 8237 | { |
| 8238 | isConnected = hdd_connIsConnected(pHddStaCtx); |
| 8239 | vos_mem_copy(setKey.peerMac,&pHddStaCtx->conn_info.bssId,WNI_CFG_BSSID_LEN); |
| 8240 | } |
| 8241 | setKey.keyLength = key_Len; |
| 8242 | pKeyPtr = setKey.Key; |
| 8243 | memcpy( pKeyPtr, key, key_Len); |
| 8244 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8245 | hddLog(VOS_TRACE_LEVEL_INFO,"%s: WAPI KEY LENGTH:0x%04x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8246 | __func__, key_Len); |
| 8247 | for (n = 0 ; n < key_Len; n++) |
| 8248 | hddLog(VOS_TRACE_LEVEL_INFO, "%s WAPI KEY Data[%d]:%02x ", |
| 8249 | __func__,n,setKey.Key[n]); |
| 8250 | |
| 8251 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 8252 | if ( isConnected ) |
| 8253 | { |
| 8254 | status= sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 8255 | pAdapter->sessionId, &setKey, &roamId ); |
| 8256 | } |
| 8257 | if ( status != 0 ) |
| 8258 | { |
| 8259 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8260 | "[%4d] sme_RoamSetKey returned ERROR status= %d", |
| 8261 | __LINE__, status ); |
| 8262 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 8263 | } |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 8264 | /* Need to clear any trace of key value in the memory. |
| 8265 | * Thus zero out the memory even though it is local |
| 8266 | * variable. |
| 8267 | */ |
| 8268 | vos_mem_zero(&setKey, sizeof(setKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8269 | } |
| 8270 | #endif /* FEATURE_WLAN_WAPI*/ |
| 8271 | |
| 8272 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8273 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8274 | beacon_data_t **ppBeacon, |
| 8275 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8276 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8277 | int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8278 | beacon_data_t **ppBeacon, |
| 8279 | struct cfg80211_beacon_data *params, |
| 8280 | int dtim_period) |
| 8281 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8282 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8283 | int size; |
| 8284 | beacon_data_t *beacon = NULL; |
| 8285 | beacon_data_t *old = NULL; |
| 8286 | int head_len,tail_len; |
| 8287 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8288 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8289 | if (params->head && !params->head_len) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8290 | { |
| 8291 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8292 | FL("head_len is NULL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8293 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8294 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8295 | |
| 8296 | old = pAdapter->sessionCtx.ap.beacon; |
| 8297 | |
| 8298 | if (!params->head && !old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8299 | { |
| 8300 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8301 | FL("session(%d) old and new heads points to NULL"), |
| 8302 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8303 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8304 | } |
| 8305 | |
| 8306 | if (params->tail && !params->tail_len) |
| 8307 | { |
| 8308 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8309 | FL("tail_len is zero but tail is not NULL")); |
| 8310 | return -EINVAL; |
| 8311 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8312 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8313 | #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,38)) |
| 8314 | /* Kernel 3.0 is not updating dtim_period for set beacon */ |
| 8315 | if (!params->dtim_period) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8316 | { |
| 8317 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8318 | FL("dtim period is 0")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8319 | return -EINVAL; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8320 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8321 | #endif |
| 8322 | |
| 8323 | if(params->head) |
| 8324 | head_len = params->head_len; |
| 8325 | else |
| 8326 | head_len = old->head_len; |
| 8327 | |
| 8328 | if(params->tail || !old) |
| 8329 | tail_len = params->tail_len; |
| 8330 | else |
| 8331 | tail_len = old->tail_len; |
| 8332 | |
| 8333 | size = sizeof(beacon_data_t) + head_len + tail_len; |
| 8334 | |
| 8335 | beacon = kzalloc(size, GFP_KERNEL); |
| 8336 | |
| 8337 | if( beacon == NULL ) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8338 | { |
| 8339 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 8340 | FL("Mem allocation for beacon failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8341 | return -ENOMEM; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8342 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8343 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8344 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8345 | if(params->dtim_period || !old ) |
| 8346 | beacon->dtim_period = params->dtim_period; |
| 8347 | else |
| 8348 | beacon->dtim_period = old->dtim_period; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8349 | #else |
| 8350 | if(dtim_period || !old ) |
| 8351 | beacon->dtim_period = dtim_period; |
| 8352 | else |
| 8353 | beacon->dtim_period = old->dtim_period; |
| 8354 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8355 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8356 | beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); |
| 8357 | beacon->tail = beacon->head + head_len; |
| 8358 | beacon->head_len = head_len; |
| 8359 | beacon->tail_len = tail_len; |
| 8360 | |
| 8361 | if(params->head) { |
| 8362 | memcpy (beacon->head,params->head,beacon->head_len); |
| 8363 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8364 | else { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8365 | if(old) |
| 8366 | memcpy (beacon->head,old->head,beacon->head_len); |
| 8367 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8368 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8369 | if(params->tail) { |
| 8370 | memcpy (beacon->tail,params->tail,beacon->tail_len); |
| 8371 | } |
| 8372 | else { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8373 | if(old) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8374 | memcpy (beacon->tail,old->tail,beacon->tail_len); |
| 8375 | } |
| 8376 | |
| 8377 | *ppBeacon = beacon; |
| 8378 | |
| 8379 | kfree(old); |
| 8380 | |
| 8381 | return 0; |
| 8382 | |
| 8383 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8384 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 8385 | v_U8_t* wlan_hdd_cfg80211_get_ie_ptr( |
| 8386 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 8387 | const v_U8_t *pIes, |
| 8388 | #else |
| 8389 | v_U8_t *pIes, |
| 8390 | #endif |
| 8391 | int length, v_U8_t eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8392 | { |
| 8393 | int left = length; |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 8394 | v_U8_t *ptr = (v_U8_t *)pIes; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8395 | v_U8_t elem_id,elem_len; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8396 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8397 | while(left >= 2) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8398 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8399 | elem_id = ptr[0]; |
| 8400 | elem_len = ptr[1]; |
| 8401 | left -= 2; |
| 8402 | if(elem_len > left) |
| 8403 | { |
| 8404 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 8405 | FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8406 | eid,elem_len,left); |
| 8407 | return NULL; |
| 8408 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8409 | if (elem_id == eid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8410 | { |
| 8411 | return ptr; |
| 8412 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8413 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8414 | left -= elem_len; |
| 8415 | ptr += (elem_len + 2); |
| 8416 | } |
| 8417 | return NULL; |
| 8418 | } |
| 8419 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8420 | /* Check if rate is 11g rate or not */ |
| 8421 | static int wlan_hdd_rate_is_11g(u8 rate) |
| 8422 | { |
Sanjay Devnani | 28322e2 | 2013-06-21 16:13:40 -0700 | [diff] [blame] | 8423 | 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] | 8424 | u8 i; |
| 8425 | for (i = 0; i < 8; i++) |
| 8426 | { |
| 8427 | if(rate == gRateArray[i]) |
| 8428 | return TRUE; |
| 8429 | } |
| 8430 | return FALSE; |
| 8431 | } |
| 8432 | |
| 8433 | /* Check for 11g rate and set proper 11g only mode */ |
| 8434 | static void wlan_hdd_check_11gmode(u8 *pIe, u8* require_ht, |
| 8435 | u8* pCheckRatesfor11g, eSapPhyMode* pSapHw_mode) |
| 8436 | { |
| 8437 | u8 i, num_rates = pIe[0]; |
| 8438 | |
| 8439 | pIe += 1; |
| 8440 | for ( i = 0; i < num_rates; i++) |
| 8441 | { |
| 8442 | if( *pCheckRatesfor11g && (TRUE == wlan_hdd_rate_is_11g(pIe[i] & RATE_MASK))) |
| 8443 | { |
| 8444 | /* If rate set have 11g rate than change the mode to 11G */ |
| 8445 | *pSapHw_mode = eSAP_DOT11_MODE_11g; |
| 8446 | if (pIe[i] & BASIC_RATE_MASK) |
| 8447 | { |
| 8448 | /* If we have 11g rate as basic rate, it means mode |
| 8449 | is 11g only mode. |
| 8450 | */ |
| 8451 | *pSapHw_mode = eSAP_DOT11_MODE_11g_ONLY; |
| 8452 | *pCheckRatesfor11g = FALSE; |
| 8453 | } |
| 8454 | } |
| 8455 | else if((BASIC_RATE_MASK | WLAN_BSS_MEMBERSHIP_SELECTOR_HT_PHY) == pIe[i]) |
| 8456 | { |
| 8457 | *require_ht = TRUE; |
| 8458 | } |
| 8459 | } |
| 8460 | return; |
| 8461 | } |
| 8462 | |
| 8463 | static void wlan_hdd_set_sapHwmode(hdd_adapter_t *pHostapdAdapter) |
| 8464 | { |
| 8465 | tsap_Config_t *pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 8466 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 8467 | struct ieee80211_mgmt *pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 8468 | u8 checkRatesfor11g = TRUE; |
| 8469 | u8 require_ht = FALSE; |
| 8470 | u8 *pIe=NULL; |
| 8471 | |
| 8472 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11b; |
| 8473 | |
| 8474 | pIe = wlan_hdd_cfg80211_get_ie_ptr(&pMgmt_frame->u.beacon.variable[0], |
| 8475 | pBeacon->head_len, WLAN_EID_SUPP_RATES); |
| 8476 | if (pIe != NULL) |
| 8477 | { |
| 8478 | pIe += 1; |
| 8479 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 8480 | &pConfig->SapHw_mode); |
| 8481 | } |
| 8482 | |
| 8483 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 8484 | WLAN_EID_EXT_SUPP_RATES); |
| 8485 | if (pIe != NULL) |
| 8486 | { |
| 8487 | |
| 8488 | pIe += 1; |
| 8489 | wlan_hdd_check_11gmode(pIe, &require_ht, &checkRatesfor11g, |
| 8490 | &pConfig->SapHw_mode); |
| 8491 | } |
| 8492 | |
| 8493 | if( pConfig->channel > 14 ) |
| 8494 | { |
| 8495 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11a; |
| 8496 | } |
| 8497 | |
| 8498 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
| 8499 | WLAN_EID_HT_CAPABILITY); |
| 8500 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8501 | if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8502 | { |
| 8503 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n; |
| 8504 | if(require_ht) |
| 8505 | pConfig->SapHw_mode= eSAP_DOT11_MODE_11n_ONLY; |
| 8506 | } |
| 8507 | } |
| 8508 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8509 | static int wlan_hdd_add_ie(hdd_adapter_t* pHostapdAdapter, v_U8_t *genie, |
| 8510 | v_U8_t *total_ielen, v_U8_t *oui, v_U8_t oui_size) |
| 8511 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 8512 | v_U16_t ielen = 0; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8513 | v_U8_t *pIe = NULL; |
| 8514 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 8515 | |
| 8516 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(oui, oui_size, |
| 8517 | pBeacon->tail, pBeacon->tail_len); |
| 8518 | |
| 8519 | if (pIe) |
| 8520 | { |
| 8521 | ielen = pIe[1] + 2; |
| 8522 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 8523 | { |
| 8524 | vos_mem_copy(&genie[*total_ielen], pIe, ielen); |
| 8525 | } |
| 8526 | else |
| 8527 | { |
| 8528 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Ie Length is too big***"); |
| 8529 | return -EINVAL; |
| 8530 | } |
| 8531 | *total_ielen += ielen; |
| 8532 | } |
| 8533 | return 0; |
| 8534 | } |
| 8535 | |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 8536 | static void wlan_hdd_add_hostapd_conf_vsie(hdd_adapter_t* pHostapdAdapter, |
| 8537 | v_U8_t *genie, v_U8_t *total_ielen) |
| 8538 | { |
| 8539 | beacon_data_t *pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 8540 | int left = pBeacon->tail_len; |
| 8541 | v_U8_t *ptr = pBeacon->tail; |
| 8542 | v_U8_t elem_id, elem_len; |
| 8543 | v_U16_t ielen = 0; |
| 8544 | |
| 8545 | if ( NULL == ptr || 0 == left ) |
| 8546 | return; |
| 8547 | |
| 8548 | while (left >= 2) |
| 8549 | { |
| 8550 | elem_id = ptr[0]; |
| 8551 | elem_len = ptr[1]; |
| 8552 | left -= 2; |
| 8553 | if (elem_len > left) |
| 8554 | { |
| 8555 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 8556 | "****Invalid IEs eid = %d elem_len=%d left=%d*****", |
| 8557 | elem_id, elem_len, left); |
| 8558 | return; |
| 8559 | } |
| 8560 | if (IE_EID_VENDOR == elem_id) |
| 8561 | { |
| 8562 | /* skipping the VSIE's which we don't want to include or |
| 8563 | * it will be included by existing code |
| 8564 | */ |
| 8565 | if ((memcmp( &ptr[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) != 0 ) && |
| 8566 | #ifdef WLAN_FEATURE_WFD |
| 8567 | (memcmp( &ptr[2], WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE) != 0) && |
| 8568 | #endif |
| 8569 | (memcmp( &ptr[2], WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 8570 | (memcmp( &ptr[2], BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 8571 | (memcmp( &ptr[2], "\x00\x50\xf2\x02", WPA_OUI_TYPE_SIZE) != 0) && |
| 8572 | (memcmp( &ptr[2], WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) != 0) && |
| 8573 | (memcmp( &ptr[2], P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE) != 0)) |
| 8574 | { |
| 8575 | ielen = ptr[1] + 2; |
| 8576 | if ((*total_ielen + ielen) <= MAX_GENIE_LEN) |
| 8577 | { |
| 8578 | vos_mem_copy(&genie[*total_ielen], ptr, ielen); |
| 8579 | *total_ielen += ielen; |
| 8580 | } |
| 8581 | else |
| 8582 | { |
| 8583 | hddLog( VOS_TRACE_LEVEL_ERROR, |
| 8584 | "IE Length is too big " |
| 8585 | "IEs eid=%d elem_len=%d total_ie_lent=%d", |
| 8586 | elem_id, elem_len, *total_ielen); |
| 8587 | } |
| 8588 | } |
| 8589 | } |
| 8590 | |
| 8591 | left -= elem_len; |
| 8592 | ptr += (elem_len + 2); |
| 8593 | } |
| 8594 | return; |
| 8595 | } |
| 8596 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8597 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8598 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 8599 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 8600 | #else |
| 8601 | static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, |
| 8602 | struct cfg80211_beacon_data *params) |
| 8603 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8604 | { |
| 8605 | v_U8_t *genie; |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8606 | v_U8_t total_ielen = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8607 | v_U8_t addIE[1] = {0}; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8608 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8609 | |
| 8610 | genie = vos_mem_malloc(MAX_GENIE_LEN); |
| 8611 | |
| 8612 | if(genie == NULL) { |
| 8613 | |
| 8614 | return -ENOMEM; |
| 8615 | } |
| 8616 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8617 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 8618 | &total_ielen, WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8619 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8620 | hddLog(LOGE, |
| 8621 | FL("Adding WPS IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8622 | ret = -EINVAL; |
| 8623 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8624 | } |
| 8625 | |
| 8626 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8627 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 8628 | &total_ielen, WFD_OUI_TYPE, WFD_OUI_TYPE_SIZE)) |
| 8629 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8630 | hddLog(LOGE, |
| 8631 | FL("Adding WFD IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8632 | ret = -EINVAL; |
| 8633 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8634 | } |
| 8635 | #endif |
| 8636 | |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8637 | if (0 != wlan_hdd_add_ie(pHostapdAdapter, genie, |
| 8638 | &total_ielen, P2P_OUI_TYPE, P2P_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8639 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 8640 | hddLog(LOGE, |
| 8641 | FL("Adding P2P IE failed")); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8642 | ret = -EINVAL; |
| 8643 | goto done; |
| 8644 | } |
| 8645 | |
| 8646 | if (WLAN_HDD_SOFTAP == pHostapdAdapter->device_mode) |
| 8647 | { |
Arif Hussain | e7f3ea5 | 2013-09-12 21:56:36 -0700 | [diff] [blame] | 8648 | wlan_hdd_add_hostapd_conf_vsie(pHostapdAdapter, genie, &total_ielen); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8649 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8650 | |
| 8651 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8652 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, genie, total_ielen, NULL, |
| 8653 | eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 8654 | { |
| 8655 | hddLog(LOGE, |
| 8656 | "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] | 8657 | ret = -EINVAL; |
| 8658 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8659 | } |
| 8660 | |
| 8661 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8662 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 8663 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 8664 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 8665 | ==eHAL_STATUS_FAILURE) |
| 8666 | { |
| 8667 | hddLog(LOGE, |
| 8668 | "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] | 8669 | ret = -EINVAL; |
| 8670 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8671 | } |
| 8672 | |
| 8673 | // Added for ProResp IE |
| 8674 | if ( (params->proberesp_ies != NULL) && (params->proberesp_ies_len != 0) ) |
| 8675 | { |
| 8676 | u16 rem_probe_resp_ie_len = params->proberesp_ies_len; |
| 8677 | u8 probe_rsp_ie_len[3] = {0}; |
| 8678 | u8 counter = 0; |
| 8679 | /* Check Probe Resp Length if it is greater then 255 then Store |
| 8680 | Probe Resp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 & |
| 8681 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are not able |
| 8682 | Store More then 255 bytes into One Variable. |
| 8683 | */ |
| 8684 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 8685 | { |
| 8686 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 8687 | { |
| 8688 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 8689 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 8690 | } |
| 8691 | else |
| 8692 | { |
| 8693 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 8694 | rem_probe_resp_ie_len = 0; |
| 8695 | } |
| 8696 | } |
| 8697 | |
| 8698 | rem_probe_resp_ie_len = 0; |
| 8699 | |
| 8700 | if (probe_rsp_ie_len[0] > 0) |
| 8701 | { |
| 8702 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8703 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 8704 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 8705 | probe_rsp_ie_len[0], NULL, |
| 8706 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 8707 | { |
| 8708 | hddLog(LOGE, |
| 8709 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8710 | ret = -EINVAL; |
| 8711 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8712 | } |
| 8713 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 8714 | } |
| 8715 | |
| 8716 | if (probe_rsp_ie_len[1] > 0) |
| 8717 | { |
| 8718 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8719 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 8720 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 8721 | probe_rsp_ie_len[1], NULL, |
| 8722 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 8723 | { |
| 8724 | hddLog(LOGE, |
| 8725 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8726 | ret = -EINVAL; |
| 8727 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8728 | } |
| 8729 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 8730 | } |
| 8731 | |
| 8732 | if (probe_rsp_ie_len[2] > 0) |
| 8733 | { |
| 8734 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8735 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 8736 | (tANI_U8*)¶ms->proberesp_ies[rem_probe_resp_ie_len], |
| 8737 | probe_rsp_ie_len[2], NULL, |
| 8738 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 8739 | { |
| 8740 | hddLog(LOGE, |
| 8741 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8742 | ret = -EINVAL; |
| 8743 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8744 | } |
| 8745 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 8746 | } |
| 8747 | |
| 8748 | if (probe_rsp_ie_len[1] == 0 ) |
| 8749 | { |
| 8750 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8751 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, (tANI_U8*)addIE, 0, NULL, |
| 8752 | eANI_BOOLEAN_FALSE) ) |
| 8753 | { |
| 8754 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8755 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8756 | } |
| 8757 | } |
| 8758 | |
| 8759 | if (probe_rsp_ie_len[2] == 0 ) |
| 8760 | { |
| 8761 | if ( eHAL_STATUS_FAILURE == ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8762 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, (tANI_U8*)addIE, 0, NULL, |
| 8763 | eANI_BOOLEAN_FALSE) ) |
| 8764 | { |
| 8765 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8766 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8767 | } |
| 8768 | } |
| 8769 | |
| 8770 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8771 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 8772 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 8773 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 8774 | == eHAL_STATUS_FAILURE) |
| 8775 | { |
| 8776 | hddLog(LOGE, |
| 8777 | "Could not pass on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8778 | ret = -EINVAL; |
| 8779 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8780 | } |
| 8781 | } |
| 8782 | else |
| 8783 | { |
| 8784 | // Reset WNI_CFG_PROBE_RSP Flags |
| 8785 | wlan_hdd_reset_prob_rspies(pHostapdAdapter); |
| 8786 | |
| 8787 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8788 | "%s: No Probe Response IE received in set beacon", |
| 8789 | __func__); |
| 8790 | } |
| 8791 | |
| 8792 | // Added for AssocResp IE |
| 8793 | if ( (params->assocresp_ies != NULL) && (params->assocresp_ies_len != 0) ) |
| 8794 | { |
| 8795 | if (ccmCfgSetStr((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8796 | WNI_CFG_ASSOC_RSP_ADDNIE_DATA, (tANI_U8*)params->assocresp_ies, |
| 8797 | params->assocresp_ies_len, NULL, |
| 8798 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 8799 | { |
| 8800 | hddLog(LOGE, |
| 8801 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_DATA to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8802 | ret = -EINVAL; |
| 8803 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8804 | } |
| 8805 | |
| 8806 | if (ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8807 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 1, NULL, |
| 8808 | test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags) ? |
| 8809 | eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE) |
| 8810 | == eHAL_STATUS_FAILURE) |
| 8811 | { |
| 8812 | hddLog(LOGE, |
| 8813 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8814 | ret = -EINVAL; |
| 8815 | goto done; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8816 | } |
| 8817 | } |
| 8818 | else |
| 8819 | { |
| 8820 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 8821 | "%s: No Assoc Response IE received in set beacon", |
| 8822 | __func__); |
| 8823 | |
| 8824 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt((WLAN_HDD_GET_CTX(pHostapdAdapter))->hHal, |
| 8825 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 8826 | eANI_BOOLEAN_FALSE) ) |
| 8827 | { |
| 8828 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8829 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8830 | } |
| 8831 | } |
| 8832 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 8833 | done: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8834 | vos_mem_free(genie); |
Gopichand Nakkala | 2b25f4e | 2013-03-21 19:14:07 +0530 | [diff] [blame] | 8835 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8836 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8837 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8838 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8839 | * FUNCTION: wlan_hdd_validate_operation_channel |
| 8840 | * called by wlan_hdd_cfg80211_start_bss() and |
| 8841 | * wlan_hdd_cfg80211_set_channel() |
| 8842 | * This function validates whether given channel is part of valid |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8843 | * channel list. |
| 8844 | */ |
Varun Reddy Yeturu | 920df21 | 2013-05-22 08:07:23 -0700 | [diff] [blame] | 8845 | 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] | 8846 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8847 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8848 | v_U32_t num_ch = 0; |
| 8849 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 8850 | u32 indx = 0; |
| 8851 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8852 | v_U8_t fValidChannel = FALSE, count = 0; |
| 8853 | 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] | 8854 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8855 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 8856 | |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8857 | if ( hdd_pConfig_ini->sapAllowAllChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8858 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8859 | /* Validate the channel */ |
| 8860 | for (count = RF_CHAN_1 ; count <= RF_CHAN_165 ; count++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8861 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8862 | if ( channel == rfChannels[count].channelNum ) |
| 8863 | { |
| 8864 | fValidChannel = TRUE; |
| 8865 | break; |
| 8866 | } |
| 8867 | } |
| 8868 | if (fValidChannel != TRUE) |
| 8869 | { |
| 8870 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8871 | "%s: Invalid Channel [%d]", __func__, channel); |
| 8872 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8873 | } |
| 8874 | } |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8875 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8876 | { |
Madan Mohan Koyylamudi | 64267f7 | 2013-02-05 14:07:08 +0530 | [diff] [blame] | 8877 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 8878 | valid_ch, &num_ch)) |
| 8879 | { |
| 8880 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8881 | "%s: failed to get valid channel list", __func__); |
| 8882 | return VOS_STATUS_E_FAILURE; |
| 8883 | } |
| 8884 | for (indx = 0; indx < num_ch; indx++) |
| 8885 | { |
| 8886 | if (channel == valid_ch[indx]) |
| 8887 | { |
| 8888 | break; |
| 8889 | } |
| 8890 | } |
| 8891 | |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 8892 | if (indx >= num_ch) |
| 8893 | { |
| 8894 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 8895 | { |
| 8896 | eCsrBand band; |
| 8897 | unsigned int freq; |
| 8898 | |
| 8899 | sme_GetFreqBand(hHal, &band); |
| 8900 | |
| 8901 | if (eCSR_BAND_5G == band) |
| 8902 | { |
| 8903 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 8904 | if (channel <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 8905 | { |
| 8906 | freq = ieee80211_channel_to_frequency(channel, |
| 8907 | IEEE80211_BAND_2GHZ); |
| 8908 | } |
| 8909 | else |
| 8910 | { |
| 8911 | freq = ieee80211_channel_to_frequency(channel, |
| 8912 | IEEE80211_BAND_5GHZ); |
| 8913 | } |
| 8914 | #else |
| 8915 | freq = ieee80211_channel_to_frequency(channel); |
| 8916 | #endif |
| 8917 | if(WLAN_HDD_IS_SOCIAL_CHANNEL(freq)) |
| 8918 | return VOS_STATUS_SUCCESS; |
| 8919 | } |
| 8920 | } |
| 8921 | |
| 8922 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 8923 | "%s: Invalid Channel [%d]", __func__, channel); |
| 8924 | return VOS_STATUS_E_FAILURE; |
| 8925 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8926 | } |
Rashmi Ramanna | 3b59e12 | 2014-04-10 14:45:13 +0530 | [diff] [blame] | 8927 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8928 | return VOS_STATUS_SUCCESS; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 8929 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 8930 | } |
| 8931 | |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 8932 | /** |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8933 | * FUNCTION: __wlan_hdd_cfg80211_set_channel |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 8934 | * This function is used to set the channel number |
| 8935 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 8936 | 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] | 8937 | struct ieee80211_channel *chan, |
| 8938 | enum nl80211_channel_type channel_type |
| 8939 | ) |
| 8940 | { |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8941 | hdd_adapter_t *pAdapter = NULL; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 8942 | v_U32_t num_ch = 0; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 8943 | int channel = 0; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 8944 | int freq = chan->center_freq; /* freq is in MHZ */ |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8945 | hdd_context_t *pHddCtx; |
| 8946 | int status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 8947 | |
| 8948 | ENTER(); |
| 8949 | |
| 8950 | if( NULL == dev ) |
| 8951 | { |
| 8952 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8953 | "%s: Called with dev = NULL.", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 8954 | return -ENODEV; |
| 8955 | } |
| 8956 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 8957 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 8958 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 8959 | TRACE_CODE_HDD_CFG80211_SET_CHANNEL, pAdapter->sessionId, |
| 8960 | channel_type )); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 8961 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 8962 | "%s: device_mode = %s (%d) freq = %d", __func__, |
| 8963 | hdd_device_modetoString(pAdapter->device_mode), |
| 8964 | pAdapter->device_mode, chan->center_freq); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8965 | |
| 8966 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 8967 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8968 | if (0 != status) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 8969 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 8970 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 8971 | } |
| 8972 | |
| 8973 | /* |
| 8974 | * Do freq to chan conversion |
| 8975 | * TODO: for 11a |
| 8976 | */ |
| 8977 | |
| 8978 | channel = ieee80211_frequency_to_channel(freq); |
| 8979 | |
| 8980 | /* Check freq range */ |
| 8981 | if ((WNI_CFG_CURRENT_CHANNEL_STAMIN > channel) || |
| 8982 | (WNI_CFG_CURRENT_CHANNEL_STAMAX < channel)) |
| 8983 | { |
| 8984 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8985 | "%s: Channel [%d] is outside valid range from %d to %d", |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 8986 | __func__, channel, WNI_CFG_CURRENT_CHANNEL_STAMIN, |
| 8987 | WNI_CFG_CURRENT_CHANNEL_STAMAX); |
| 8988 | return -EINVAL; |
| 8989 | } |
| 8990 | |
| 8991 | num_ch = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 8992 | |
Gopichand Nakkala | 6ab1956 | 2013-03-07 13:59:42 +0530 | [diff] [blame] | 8993 | if ((WLAN_HDD_SOFTAP != pAdapter->device_mode) && |
| 8994 | (WLAN_HDD_P2P_GO != pAdapter->device_mode)) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 8995 | { |
| 8996 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 8997 | { |
| 8998 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 8999 | "%s: Invalid Channel [%d]", __func__, channel); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9000 | return -EINVAL; |
| 9001 | } |
| 9002 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 9003 | "%s: set channel to [%d] for device mode =%d", |
| 9004 | __func__, channel,pAdapter->device_mode); |
| 9005 | } |
| 9006 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9007 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9008 | ) |
| 9009 | { |
| 9010 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 9011 | tCsrRoamProfile * pRoamProfile = &pWextState->roamProfile; |
| 9012 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9013 | |
| 9014 | if (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) |
| 9015 | { |
| 9016 | /* Link is up then return cant set channel*/ |
| 9017 | hddLog( VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9018 | "%s: IBSS Associated, can't set the channel", __func__); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9019 | return -EINVAL; |
| 9020 | } |
| 9021 | |
| 9022 | num_ch = pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 9023 | pHddStaCtx->conn_info.operationChannel = channel; |
| 9024 | pRoamProfile->ChannelInfo.ChannelList = |
| 9025 | &pHddStaCtx->conn_info.operationChannel; |
| 9026 | } |
| 9027 | else if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9028 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9029 | ) |
| 9030 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9031 | if (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
| 9032 | { |
| 9033 | if(VOS_STATUS_SUCCESS != |
| 9034 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 9035 | { |
| 9036 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9037 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9038 | return -EINVAL; |
| 9039 | } |
| 9040 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 9041 | } |
| 9042 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9043 | { |
| 9044 | hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini; |
| 9045 | |
| 9046 | /* If auto channel selection is configured as enable/ 1 then ignore |
| 9047 | channel set by supplicant |
| 9048 | */ |
| 9049 | if ( cfg_param->apAutoChannelSelection ) |
| 9050 | { |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9051 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = |
| 9052 | AUTO_CHANNEL_SELECT; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9053 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9054 | "%s: set channel to auto channel (0) for device mode =%s (%d)", |
| 9055 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9056 | pAdapter->device_mode); |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9057 | } |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9058 | else |
| 9059 | { |
| 9060 | if(VOS_STATUS_SUCCESS != |
| 9061 | wlan_hdd_validate_operation_channel(pAdapter,channel)) |
| 9062 | { |
| 9063 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9064 | "%s: Invalid Channel [%d]", __func__, channel); |
Gopichand Nakkala | c8fa7b6 | 2013-03-11 13:56:41 +0530 | [diff] [blame] | 9065 | return -EINVAL; |
| 9066 | } |
| 9067 | (WLAN_HDD_GET_AP_CTX_PTR(pAdapter))->sapConfig.channel = channel; |
| 9068 | } |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9069 | } |
| 9070 | } |
| 9071 | else |
| 9072 | { |
| 9073 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 9074 | "%s: Invalid device mode failed to set valid channel", __func__); |
| 9075 | return -EINVAL; |
| 9076 | } |
| 9077 | EXIT(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9078 | return status; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9079 | } |
| 9080 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 9081 | static int wlan_hdd_cfg80211_set_channel( struct wiphy *wiphy, |
| 9082 | struct net_device *dev, |
| 9083 | struct ieee80211_channel *chan, |
| 9084 | enum nl80211_channel_type channel_type |
| 9085 | ) |
| 9086 | { |
| 9087 | int ret; |
| 9088 | |
| 9089 | vos_ssr_protect(__func__); |
| 9090 | ret = __wlan_hdd_cfg80211_set_channel(wiphy, dev, chan, channel_type); |
| 9091 | vos_ssr_unprotect(__func__); |
| 9092 | |
| 9093 | return ret; |
| 9094 | } |
| 9095 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9096 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9097 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 9098 | struct beacon_parameters *params) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9099 | #else |
| 9100 | static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, |
| 9101 | struct cfg80211_beacon_data *params, |
| 9102 | const u8 *ssid, size_t ssid_len, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 9103 | enum nl80211_hidden_ssid hidden_ssid, |
| 9104 | v_U8_t auth_type) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9105 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9106 | { |
| 9107 | tsap_Config_t *pConfig; |
| 9108 | beacon_data_t *pBeacon = NULL; |
| 9109 | struct ieee80211_mgmt *pMgmt_frame; |
| 9110 | v_U8_t *pIe=NULL; |
| 9111 | v_U16_t capab_info; |
| 9112 | eCsrAuthType RSNAuthType; |
| 9113 | eCsrEncryptionType RSNEncryptType; |
| 9114 | eCsrEncryptionType mcRSNEncryptType; |
| 9115 | int status = VOS_STATUS_SUCCESS; |
| 9116 | tpWLAN_SAPEventCB pSapEventCallback; |
| 9117 | hdd_hostapd_state_t *pHostapdState; |
| 9118 | v_U8_t wpaRsnIEdata[(SIR_MAC_MAX_IE_LENGTH * 2)+4]; //Max ie length 255 * 2(WPA+RSN) + 2 bytes (vendor specific ID) * 2 |
| 9119 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pHostapdAdapter))->pvosContext; |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 9120 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pHostapdAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9121 | struct qc_mac_acl_entry *acl_entry = NULL; |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 9122 | hdd_config_t *iniConfig; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9123 | v_SINT_t i; |
Madan Mohan Koyyalamudi | 543172b | 2012-12-05 16:40:18 -0800 | [diff] [blame] | 9124 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pHostapdAdapter); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 9125 | tSmeConfigParams *psmeConfig; |
Chet Lanctot | 4014244 | 2014-05-20 13:39:25 -0700 | [diff] [blame] | 9126 | v_BOOL_t MFPCapable = VOS_FALSE; |
| 9127 | v_BOOL_t MFPRequired = VOS_FALSE; |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 9128 | v_BOOL_t sapEnable11AC = |
| 9129 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->sapEnable11AC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9130 | ENTER(); |
| 9131 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 9132 | iniConfig = pHddCtx->cfg_ini; |
| 9133 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9134 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pHostapdAdapter); |
| 9135 | |
| 9136 | pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; |
| 9137 | |
| 9138 | pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; |
| 9139 | |
| 9140 | pMgmt_frame = (struct ieee80211_mgmt*)pBeacon->head; |
| 9141 | |
| 9142 | pConfig->beacon_int = pMgmt_frame->u.beacon.beacon_int; |
| 9143 | |
| 9144 | //channel is already set in the set_channel Call back |
| 9145 | //pConfig->channel = pCommitConfig->channel; |
| 9146 | |
| 9147 | /*Protection parameter to enable or disable*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9148 | pConfig->protEnabled = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9149 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtEnabled; |
| 9150 | |
| 9151 | pConfig->dtim_period = pBeacon->dtim_period; |
| 9152 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9153 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH,"****pConfig->dtim_period=%d***", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9154 | pConfig->dtim_period); |
| 9155 | |
Madan Mohan Koyyalamudi | e0ca11f | 2012-11-27 15:57:52 -0800 | [diff] [blame] | 9156 | if (pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9157 | { |
| 9158 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9159 | WLAN_EID_COUNTRY); |
Kiet Lam | 083504c | 2013-11-25 14:17:45 +0530 | [diff] [blame] | 9160 | if(memcmp(pHddCtx->cfg_ini->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0) |
| 9161 | { |
| 9162 | tANI_BOOLEAN restartNeeded; |
| 9163 | pConfig->ieee80211d = 1; |
| 9164 | vos_mem_copy(pConfig->countryCode, pHddCtx->cfg_ini->apCntryCode, 3); |
| 9165 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 9166 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
| 9167 | } |
| 9168 | else if(pIe) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9169 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9170 | tANI_BOOLEAN restartNeeded; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9171 | pConfig->ieee80211d = 1; |
| 9172 | vos_mem_copy(pConfig->countryCode, &pIe[2], 3); |
| 9173 | sme_setRegInfo(hHal, pConfig->countryCode); |
| 9174 | sme_ResetCountryCodeInformation(hHal, &restartNeeded); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9175 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9176 | else |
| 9177 | { |
| 9178 | pConfig->ieee80211d = 0; |
| 9179 | } |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 9180 | /* |
| 9181 | * If auto channel is configured i.e. channel is 0, |
| 9182 | * so skip channel validation. |
| 9183 | */ |
| 9184 | if( AUTO_CHANNEL_SELECT != pConfig->channel ) |
| 9185 | { |
| 9186 | if(VOS_STATUS_SUCCESS != wlan_hdd_validate_operation_channel(pHostapdAdapter,pConfig->channel)) |
| 9187 | { |
| 9188 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9189 | "%s: Invalid Channel [%d]", __func__, pConfig->channel); |
Madan Mohan Koyylamudi | a16d020 | 2013-02-01 11:05:57 +0530 | [diff] [blame] | 9190 | return -EINVAL; |
| 9191 | } |
| 9192 | } |
| 9193 | else |
| 9194 | { |
| 9195 | if(1 != pHddCtx->is_dynamic_channel_range_set) |
| 9196 | { |
| 9197 | hdd_config_t *hdd_pConfig= (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini; |
| 9198 | WLANSAP_SetChannelRange(hHal, hdd_pConfig->apStartChannelNum, |
| 9199 | hdd_pConfig->apEndChannelNum,hdd_pConfig->apOperatingBand); |
| 9200 | } |
| 9201 | pHddCtx->is_dynamic_channel_range_set = 0; |
| 9202 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9203 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 9204 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9205 | { |
| 9206 | pConfig->ieee80211d = 0; |
| 9207 | } |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 9208 | |
| 9209 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9210 | if (params->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 9211 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 9212 | else if (params->auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 9213 | pConfig->authType = eSAP_SHARED_KEY; |
| 9214 | else |
| 9215 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 9216 | #else |
| 9217 | if (auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) |
| 9218 | pConfig->authType = eSAP_OPEN_SYSTEM; |
| 9219 | else if (auth_type == NL80211_AUTHTYPE_SHARED_KEY) |
| 9220 | pConfig->authType = eSAP_SHARED_KEY; |
| 9221 | else |
| 9222 | pConfig->authType = eSAP_AUTO_SWITCH; |
| 9223 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9224 | |
| 9225 | capab_info = pMgmt_frame->u.beacon.capab_info; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9226 | |
| 9227 | pConfig->privacy = (pMgmt_frame->u.beacon.capab_info & |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9228 | WLAN_CAPABILITY_PRIVACY) ? VOS_TRUE : VOS_FALSE; |
| 9229 | |
| 9230 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->uPrivacy = pConfig->privacy; |
| 9231 | |
| 9232 | /*Set wps station to configured*/ |
| 9233 | pIe = wlan_hdd_get_wps_ie_ptr(pBeacon->tail, pBeacon->tail_len); |
| 9234 | |
| 9235 | if(pIe) |
| 9236 | { |
| 9237 | if(pIe[1] < (2 + WPS_OUI_TYPE_SIZE)) |
| 9238 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9239 | hddLog( VOS_TRACE_LEVEL_ERROR, "**Wps Ie Length is too small***"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9240 | return -EINVAL; |
| 9241 | } |
| 9242 | else if(memcmp(&pIe[2], WPS_OUI_TYPE, WPS_OUI_TYPE_SIZE) == 0) |
| 9243 | { |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 9244 | hddLog( VOS_TRACE_LEVEL_INFO, "** WPS IE(len %d) ***", (pIe[1]+2)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9245 | /* Check 15 bit of WPS IE as it contain information for wps state |
| 9246 | * WPS state |
| 9247 | */ |
| 9248 | if(SAP_WPS_ENABLED_UNCONFIGURED == pIe[15]) |
| 9249 | { |
| 9250 | pConfig->wps_state = SAP_WPS_ENABLED_UNCONFIGURED; |
| 9251 | } else if(SAP_WPS_ENABLED_CONFIGURED == pIe[15]) |
| 9252 | { |
| 9253 | pConfig->wps_state = SAP_WPS_ENABLED_CONFIGURED; |
| 9254 | } |
| 9255 | } |
| 9256 | } |
| 9257 | else |
| 9258 | { |
| 9259 | pConfig->wps_state = SAP_WPS_DISABLED; |
| 9260 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9261 | pConfig->fwdWPSPBCProbeReq = 1; // Forward WPS PBC probe request frame up |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9262 | |
c_hpothu | fe599e9 | 2014-06-16 11:38:55 +0530 | [diff] [blame] | 9263 | pConfig->RSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 9264 | pConfig->mcRSNEncryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 9265 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType = |
| 9266 | eCSR_ENCRYPT_TYPE_NONE; |
| 9267 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9268 | pConfig->RSNWPAReqIELength = 0; |
| 9269 | pConfig->pRSNWPAReqIE = NULL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9270 | pIe = wlan_hdd_cfg80211_get_ie_ptr(pBeacon->tail, pBeacon->tail_len, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9271 | WLAN_EID_RSN); |
| 9272 | if(pIe && pIe[1]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9273 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9274 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 9275 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 9276 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9277 | /* The actual processing may eventually be more extensive than |
| 9278 | * this. Right now, just consume any PMKIDs that are sent in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9279 | * by the app. |
| 9280 | * */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9281 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9282 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 9283 | &RSNEncryptType, |
| 9284 | &mcRSNEncryptType, |
| 9285 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 9286 | &MFPCapable, |
| 9287 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9288 | pConfig->pRSNWPAReqIE[1]+2, |
| 9289 | pConfig->pRSNWPAReqIE ); |
| 9290 | |
| 9291 | if( VOS_STATUS_SUCCESS == status ) |
| 9292 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9293 | /* Now copy over all the security attributes you have |
| 9294 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9295 | * */ |
| 9296 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 9297 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 9298 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 9299 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 9300 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9301 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9302 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 9303 | } |
| 9304 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9305 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9306 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 9307 | pBeacon->tail, pBeacon->tail_len); |
| 9308 | |
| 9309 | if(pIe && pIe[1] && (pIe[0] == DOT11F_EID_WPA)) |
| 9310 | { |
| 9311 | if (pConfig->pRSNWPAReqIE) |
| 9312 | { |
| 9313 | /*Mixed mode WPA/WPA2*/ |
| 9314 | memcpy((&wpaRsnIEdata[0] + pConfig->RSNWPAReqIELength), pIe, pIe[1] + 2); |
| 9315 | pConfig->RSNWPAReqIELength += pIe[1] + 2; |
| 9316 | } |
| 9317 | else |
| 9318 | { |
| 9319 | pConfig->RSNWPAReqIELength = pIe[1] + 2; |
| 9320 | memcpy(&wpaRsnIEdata[0], pIe, pConfig->RSNWPAReqIELength); |
| 9321 | pConfig->pRSNWPAReqIE = &wpaRsnIEdata[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9322 | status = hdd_softap_unpackIE( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9323 | vos_get_context( VOS_MODULE_ID_SME, pVosContext), |
| 9324 | &RSNEncryptType, |
| 9325 | &mcRSNEncryptType, |
| 9326 | &RSNAuthType, |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 9327 | &MFPCapable, |
| 9328 | &MFPRequired, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9329 | pConfig->pRSNWPAReqIE[1]+2, |
| 9330 | pConfig->pRSNWPAReqIE ); |
| 9331 | |
| 9332 | if( VOS_STATUS_SUCCESS == status ) |
| 9333 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9334 | /* Now copy over all the security attributes you have |
| 9335 | * parsed out |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9336 | * */ |
| 9337 | pConfig->RSNEncryptType = RSNEncryptType; // Use the cipher type in the RSN IE |
| 9338 | pConfig->mcRSNEncryptType = mcRSNEncryptType; |
| 9339 | (WLAN_HDD_GET_AP_CTX_PTR(pHostapdAdapter))->ucEncryptType |
| 9340 | = RSNEncryptType; |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 9341 | hddLog( LOG1, FL("CSR AuthType = %d, " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9342 | "EncryptionType = %d mcEncryptionType = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9343 | RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
| 9344 | } |
| 9345 | } |
| 9346 | } |
| 9347 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9348 | if (pConfig->RSNWPAReqIELength > sizeof wpaRsnIEdata) { |
| 9349 | hddLog( VOS_TRACE_LEVEL_ERROR, "**RSNWPAReqIELength is too large***"); |
| 9350 | return -EINVAL; |
| 9351 | } |
| 9352 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9353 | pConfig->SSIDinfo.ssidHidden = VOS_FALSE; |
| 9354 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9355 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9356 | if (params->ssid != NULL) |
| 9357 | { |
| 9358 | memcpy(pConfig->SSIDinfo.ssid.ssId, params->ssid, params->ssid_len); |
| 9359 | pConfig->SSIDinfo.ssid.length = params->ssid_len; |
| 9360 | if (params->hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 9361 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 9362 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9363 | #else |
| 9364 | if (ssid != NULL) |
| 9365 | { |
| 9366 | memcpy(pConfig->SSIDinfo.ssid.ssId, ssid, ssid_len); |
| 9367 | pConfig->SSIDinfo.ssid.length = ssid_len; |
| 9368 | if (hidden_ssid != NL80211_HIDDEN_SSID_NOT_IN_USE) |
| 9369 | pConfig->SSIDinfo.ssidHidden = VOS_TRUE; |
| 9370 | } |
| 9371 | #endif |
| 9372 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9373 | vos_mem_copy(pConfig->self_macaddr.bytes, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9374 | pHostapdAdapter->macAddressCurrent.bytes, sizeof(v_MACADDR_t)); |
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 | /* default value */ |
| 9377 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 9378 | pConfig->num_accept_mac = 0; |
| 9379 | pConfig->num_deny_mac = 0; |
| 9380 | |
| 9381 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(BLACKLIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 9382 | pBeacon->tail, pBeacon->tail_len); |
| 9383 | |
| 9384 | /* pIe for black list is following form: |
| 9385 | type : 1 byte |
| 9386 | length : 1 byte |
| 9387 | OUI : 4 bytes |
| 9388 | acl type : 1 byte |
| 9389 | no of mac addr in black list: 1 byte |
| 9390 | 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] | 9391 | */ |
| 9392 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9393 | { |
| 9394 | pConfig->SapMacaddr_acl = pIe[6]; |
| 9395 | pConfig->num_deny_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9396 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no deny mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9397 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 9398 | if (pConfig->num_deny_mac > MAX_ACL_MAC_ADDRESS) |
| 9399 | pConfig->num_deny_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9400 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 9401 | for (i = 0; i < pConfig->num_deny_mac; i++) |
| 9402 | { |
| 9403 | vos_mem_copy(&pConfig->deny_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 9404 | acl_entry++; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9405 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9406 | } |
| 9407 | pIe = wlan_hdd_get_vendor_oui_ie_ptr(WHITELIST_OUI_TYPE, WPA_OUI_TYPE_SIZE, |
| 9408 | pBeacon->tail, pBeacon->tail_len); |
| 9409 | |
| 9410 | /* pIe for white list is following form: |
| 9411 | type : 1 byte |
| 9412 | length : 1 byte |
| 9413 | OUI : 4 bytes |
| 9414 | acl type : 1 byte |
| 9415 | no of mac addr in white list: 1 byte |
| 9416 | 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] | 9417 | */ |
| 9418 | if ((pIe != NULL) && (pIe[1] != 0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9419 | { |
| 9420 | pConfig->SapMacaddr_acl = pIe[6]; |
| 9421 | pConfig->num_accept_mac = pIe[7]; |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9422 | hddLog(VOS_TRACE_LEVEL_INFO,"acl type = %d no accept mac = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9423 | pIe[6], pIe[7]); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 9424 | if (pConfig->num_accept_mac > MAX_ACL_MAC_ADDRESS) |
| 9425 | pConfig->num_accept_mac = MAX_ACL_MAC_ADDRESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9426 | acl_entry = (struct qc_mac_acl_entry *)(pIe + 8); |
| 9427 | for (i = 0; i < pConfig->num_accept_mac; i++) |
| 9428 | { |
| 9429 | vos_mem_copy(&pConfig->accept_mac[i], acl_entry->addr, sizeof(qcmacaddr)); |
| 9430 | acl_entry++; |
| 9431 | } |
| 9432 | } |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 9433 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9434 | wlan_hdd_set_sapHwmode(pHostapdAdapter); |
| 9435 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9436 | #ifdef WLAN_FEATURE_11AC |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 9437 | /* Overwrite the hostapd setting for HW mode only for 11ac. |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 9438 | * This is valid only if mode is set to 11n in hostapd, sapEnable11AC |
| 9439 | * 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] | 9440 | * Otherwise, leave whatever is set in hostapd (a OR b OR g OR n mode) |
| 9441 | */ |
Ravi Kumar Vaishnav | bbaebbe | 2013-01-15 17:09:48 -0800 | [diff] [blame] | 9442 | if( ((pConfig->SapHw_mode == eSAP_DOT11_MODE_11n) || |
| 9443 | (pConfig->SapHw_mode == eSAP_DOT11_MODE_11n_ONLY)) && |
Sushant Kaushik | 7dc0327 | 2015-02-18 11:25:12 +0530 | [diff] [blame] | 9444 | (sapEnable11AC) && (sme_IsFeatureSupportedByDriver(DOT11AC)) && |
| 9445 | (sme_IsFeatureSupportedByFW(DOT11AC)) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9446 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 9447 | v_U32_t operatingBand = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9448 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11ac; |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 9449 | ccmCfgGetInt(hHal, WNI_CFG_SAP_CHANNEL_SELECT_OPERATING_BAND, &operatingBand); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 9450 | |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 9451 | /* If ACS disable and selected channel <= 14 |
| 9452 | * OR |
| 9453 | * ACS enabled and ACS operating band is choosen as 2.4 |
| 9454 | * AND |
| 9455 | * VHT in 2.4G Disabled |
| 9456 | * THEN |
| 9457 | * Fallback to 11N mode |
| 9458 | */ |
| 9459 | if (((AUTO_CHANNEL_SELECT != pConfig->channel && pConfig->channel <= SIR_11B_CHANNEL_END) |
| 9460 | || (AUTO_CHANNEL_SELECT == pConfig->channel && |
Deepthi Gowri | 7db41f3 | 2014-10-13 17:02:29 +0530 | [diff] [blame] | 9461 | operatingBand == eSAP_RF_SUBBAND_2_4_GHZ)) && |
Siddharth Bhal | 5cba24e | 2014-05-08 18:59:39 +0530 | [diff] [blame] | 9462 | iniConfig->enableVhtFor24GHzBand == FALSE) |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 9463 | { |
Siddharth Bhal | f42f859 | 2014-05-15 13:39:07 +0530 | [diff] [blame] | 9464 | hddLog(LOGW, FL("Setting hwmode to 11n, operatingBand = %d, Channel = %d"), |
| 9465 | operatingBand, pConfig->channel); |
Ravi Joshi | 83bfaa1 | 2013-05-28 22:12:08 -0700 | [diff] [blame] | 9466 | pConfig->SapHw_mode = eSAP_DOT11_MODE_11n; |
| 9467 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9468 | } |
| 9469 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9470 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9471 | // ht_capab is not what the name conveys,this is used for protection bitmap |
| 9472 | pConfig->ht_capab = |
| 9473 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apProtection; |
| 9474 | |
| 9475 | if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) |
| 9476 | { |
| 9477 | hddLog(LOGE, FL("SAP Not able to set AP IEs")); |
| 9478 | return -EINVAL; |
| 9479 | } |
| 9480 | |
| 9481 | //Uapsd Enabled Bit |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9482 | pConfig->UapsdEnable = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9483 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apUapsdEnabled; |
| 9484 | //Enable OBSS protection |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9485 | pConfig->obssProtEnabled = |
| 9486 | (WLAN_HDD_GET_CTX(pHostapdAdapter))->cfg_ini->apOBSSProtEnabled; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9487 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 9488 | #ifdef WLAN_FEATURE_11W |
| 9489 | pConfig->mfpCapable = MFPCapable; |
| 9490 | pConfig->mfpRequired = MFPRequired; |
| 9491 | hddLog(LOGW, FL("Soft AP MFP capable %d, MFP required %d\n"), |
| 9492 | pConfig->mfpCapable, pConfig->mfpRequired); |
| 9493 | #endif |
| 9494 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9495 | hddLog(LOGW, FL("SOftAP macaddress : "MAC_ADDRESS_STR), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9496 | MAC_ADDR_ARRAY(pHostapdAdapter->macAddressCurrent.bytes)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9497 | hddLog(LOGW,FL("ssid =%s, beaconint=%d, channel=%d"), |
| 9498 | pConfig->SSIDinfo.ssid.ssId, (int)pConfig->beacon_int, |
| 9499 | (int)pConfig->channel); |
| 9500 | hddLog(LOGW,FL("hw_mode=%x, privacy=%d, authType=%d"), |
| 9501 | pConfig->SapHw_mode, pConfig->privacy, |
| 9502 | pConfig->authType); |
| 9503 | hddLog(LOGW,FL("RSN/WPALen=%d, Uapsd = %d"), |
| 9504 | (int)pConfig->RSNWPAReqIELength, pConfig->UapsdEnable); |
| 9505 | hddLog(LOGW,FL("ProtEnabled = %d, OBSSProtEnabled = %d"), |
| 9506 | pConfig->protEnabled, pConfig->obssProtEnabled); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9507 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9508 | if(test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9509 | { |
| 9510 | //Bss already started. just return. |
| 9511 | //TODO Probably it should update some beacon params. |
| 9512 | hddLog( LOGE, "Bss Already started...Ignore the request"); |
| 9513 | EXIT(); |
| 9514 | return 0; |
| 9515 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9516 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 9517 | if (vos_max_concurrent_connections_reached()) { |
| 9518 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 9519 | return -EINVAL; |
| 9520 | } |
| 9521 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9522 | pConfig->persona = pHostapdAdapter->device_mode; |
| 9523 | |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 9524 | psmeConfig = (tSmeConfigParams*) vos_mem_malloc(sizeof(tSmeConfigParams)); |
| 9525 | if ( NULL != psmeConfig) |
| 9526 | { |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 9527 | vos_mem_zero(psmeConfig, sizeof (tSmeConfigParams)); |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 9528 | sme_GetConfigParam(hHal, psmeConfig); |
| 9529 | pConfig->scanBandPreference = psmeConfig->csrConfig.scanBandPreference; |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 9530 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 9531 | if (((pHostapdAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 9532 | || (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 9533 | && pHddCtx->cfg_ini->apHT40_24GEnabled) |
| 9534 | { |
| 9535 | psmeConfig->csrConfig.apHT40_24GEnabled = 1; |
| 9536 | sme_UpdateConfig (hHal, psmeConfig); |
| 9537 | } |
| 9538 | #endif |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 9539 | vos_mem_free(psmeConfig); |
| 9540 | } |
Peng Xu | afc34e3 | 2014-09-25 13:23:55 +0530 | [diff] [blame] | 9541 | pConfig->acsBandSwitchThreshold = iniConfig->acsBandSwitchThreshold; |
Peng Xu | 2446a89 | 2014-09-05 17:21:18 +0530 | [diff] [blame] | 9542 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9543 | pSapEventCallback = hdd_hostapd_SAPEventCB; |
| 9544 | if(WLANSAP_StartBss(pVosContext, pSapEventCallback, pConfig, |
| 9545 | (v_PVOID_t)pHostapdAdapter->dev) != VOS_STATUS_SUCCESS) |
| 9546 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9547 | hddLog(LOGE,FL("SAP Start Bss fail")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9548 | return -EINVAL; |
| 9549 | } |
| 9550 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9551 | hddLog(LOG1, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9552 | FL("Waiting for Scan to complete(auto mode) and BSS to start")); |
| 9553 | |
| 9554 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9555 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9556 | if (!VOS_IS_STATUS_SUCCESS(status)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9557 | { |
| 9558 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9559 | ("ERROR: HDD vos wait for single_event failed!!")); |
Tushnim Bhattacharyya | ad37df1 | 2013-10-02 12:01:33 -0700 | [diff] [blame] | 9560 | smeGetCommandQStatus(hHal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9561 | VOS_ASSERT(0); |
| 9562 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9563 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9564 | set_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags); |
Kaushik, Sushant | f607080 | 2014-10-15 15:09:23 +0530 | [diff] [blame] | 9565 | /* Initialize WMM configuation */ |
| 9566 | hdd_wmm_init(pHostapdAdapter); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 9567 | wlan_hdd_incr_active_session(pHddCtx, pHostapdAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9568 | |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 9569 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 9570 | if (pHostapdAdapter->device_mode == WLAN_HDD_P2P_GO) |
| 9571 | { |
| 9572 | if(globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) |
| 9573 | { |
| 9574 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 9575 | hddLog(LOGE,"[P2P State] From Go nego completed to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 9576 | "Non-autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 9577 | } |
| 9578 | else if(globalP2PConnectionStatus == P2P_NOT_ACTIVE) |
| 9579 | { |
| 9580 | globalP2PConnectionStatus = P2P_GO_COMPLETED_STATE; |
| 9581 | hddLog(LOGE,"[P2P State] From Inactive to " |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 9582 | "Autonomous Group started"); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 9583 | } |
| 9584 | } |
| 9585 | #endif |
| 9586 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9587 | pHostapdState->bCommit = TRUE; |
| 9588 | EXIT(); |
| 9589 | |
| 9590 | return 0; |
| 9591 | } |
| 9592 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9593 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9594 | static int __wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9595 | struct net_device *dev, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9596 | struct beacon_parameters *params) |
| 9597 | { |
| 9598 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9599 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9600 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9601 | |
| 9602 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9603 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9604 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9605 | TRACE_CODE_HDD_CFG80211_ADD_BEACON, |
| 9606 | pAdapter->sessionId, params->interval)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9607 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%s (%d)", |
| 9608 | hdd_device_modetoString(pAdapter->device_mode), |
| 9609 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9610 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9611 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9612 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9613 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9614 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9615 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9616 | } |
| 9617 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 9618 | if (vos_max_concurrent_connections_reached()) { |
| 9619 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 9620 | return -EINVAL; |
| 9621 | } |
| 9622 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9623 | if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9624 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9625 | ) |
| 9626 | { |
| 9627 | beacon_data_t *old,*new; |
| 9628 | |
| 9629 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9630 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9631 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9632 | { |
| 9633 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 9634 | FL("already beacon info added to session(%d)"), |
| 9635 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9636 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9637 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9638 | |
| 9639 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 9640 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9641 | if(status != VOS_STATUS_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9642 | { |
| 9643 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9644 | "%s:Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9645 | return -EINVAL; |
| 9646 | } |
| 9647 | |
| 9648 | pAdapter->sessionCtx.ap.beacon = new; |
| 9649 | |
| 9650 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 9651 | } |
| 9652 | |
| 9653 | EXIT(); |
| 9654 | return status; |
| 9655 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9656 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9657 | static int wlan_hdd_cfg80211_add_beacon(struct wiphy *wiphy, |
| 9658 | struct net_device *dev, |
| 9659 | struct beacon_parameters *params) |
| 9660 | { |
| 9661 | int ret; |
| 9662 | |
| 9663 | vos_ssr_protect(__func__); |
| 9664 | ret = __wlan_hdd_cfg80211_add_beacon(wiphy, dev, params); |
| 9665 | vos_ssr_unprotect(__func__); |
| 9666 | |
| 9667 | return ret; |
| 9668 | } |
| 9669 | |
| 9670 | static int __wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9671 | struct net_device *dev, |
| 9672 | struct beacon_parameters *params) |
| 9673 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9674 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9675 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 9676 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9677 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9678 | |
| 9679 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 9680 | |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9681 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9682 | TRACE_CODE_HDD_CFG80211_SET_BEACON, |
| 9683 | pAdapter->sessionId, pHddStaCtx->conn_info.authType)); |
| 9684 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9685 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9686 | pAdapter->device_mode); |
| 9687 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9688 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9689 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9690 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9691 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9692 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9693 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9694 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9695 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9696 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9697 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9698 | { |
| 9699 | beacon_data_t *old,*new; |
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 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9702 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9703 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9704 | { |
| 9705 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9706 | FL("session(%d) old and new heads points to NULL"), |
| 9707 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9708 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9709 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9710 | |
| 9711 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter,&new,params); |
| 9712 | |
| 9713 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 9714 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9715 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9716 | return -EINVAL; |
| 9717 | } |
| 9718 | |
| 9719 | pAdapter->sessionCtx.ap.beacon = new; |
| 9720 | |
| 9721 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params); |
| 9722 | } |
| 9723 | |
| 9724 | EXIT(); |
| 9725 | return status; |
| 9726 | } |
| 9727 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9728 | static int wlan_hdd_cfg80211_set_beacon(struct wiphy *wiphy, |
| 9729 | struct net_device *dev, |
| 9730 | struct beacon_parameters *params) |
| 9731 | { |
| 9732 | int ret; |
| 9733 | |
| 9734 | vos_ssr_protect(__func__); |
| 9735 | ret = __wlan_hdd_cfg80211_set_beacon(wiphy, dev, params); |
| 9736 | vos_ssr_unprotect(__func__); |
| 9737 | |
| 9738 | return ret; |
| 9739 | } |
| 9740 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9741 | #endif //(LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9742 | |
| 9743 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9744 | static int __wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9745 | struct net_device *dev) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9746 | #else |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9747 | static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9748 | struct net_device *dev) |
| 9749 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9750 | { |
| 9751 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9752 | hdd_context_t *pHddCtx = NULL; |
| 9753 | hdd_scaninfo_t *pScanInfo = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9754 | VOS_STATUS status; |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9755 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9756 | |
| 9757 | ENTER(); |
| 9758 | |
| 9759 | if (NULL == pAdapter) |
| 9760 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 9761 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 9762 | "%s: HDD adapter context is Null", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9763 | return -ENODEV; |
| 9764 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9765 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9766 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9767 | TRACE_CODE_HDD_CFG80211_STOP_AP, |
| 9768 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9769 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 9770 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9771 | if (0 != status) |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9772 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9773 | return status; |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9774 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9775 | |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 9776 | pScanInfo = &pHddCtx->scan_info; |
| 9777 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9778 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 9779 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9780 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9781 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9782 | ret = wlan_hdd_scan_abort(pAdapter); |
| 9783 | |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 9784 | if (ret < 0) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9785 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9786 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9787 | FL("Timeout occurred while waiting for abortscan %ld"), ret); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9788 | |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9789 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9790 | { |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9791 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9792 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 9793 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9794 | VOS_ASSERT(pScanInfo->mScanPending); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9795 | return -EAGAIN; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9796 | } |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 9797 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 9798 | } |
| 9799 | |
Rashmi Ramanna | 1f0948d | 2014-08-28 15:33:48 +0530 | [diff] [blame] | 9800 | /* Delete all associated STAs before stopping AP/P2P GO */ |
| 9801 | hdd_del_all_sta(pAdapter); |
Arun Kumar Khandavalli | a3bd800 | 2014-01-17 16:21:19 +0530 | [diff] [blame] | 9802 | hdd_hostapd_stop(dev); |
| 9803 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9804 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9805 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9806 | ) |
| 9807 | { |
| 9808 | beacon_data_t *old; |
| 9809 | |
| 9810 | old = pAdapter->sessionCtx.ap.beacon; |
| 9811 | |
| 9812 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9813 | { |
| 9814 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 9815 | FL("session(%d) beacon data points to NULL"), |
| 9816 | pAdapter->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9817 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9819 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9820 | hdd_cleanup_actionframe(pHddCtx, pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9821 | |
| 9822 | mutex_lock(&pHddCtx->sap_lock); |
| 9823 | if(test_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags)) |
| 9824 | { |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9825 | if ( VOS_STATUS_SUCCESS == (status = WLANSAP_StopBss(pHddCtx->pvosContext) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9826 | { |
| 9827 | hdd_hostapd_state_t *pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 9828 | |
| 9829 | status = vos_wait_single_event(&pHostapdState->vosEvent, 10000); |
| 9830 | |
| 9831 | if (!VOS_IS_STATUS_SUCCESS(status)) |
| 9832 | { |
| 9833 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9834 | ("ERROR: HDD vos wait for single_event failed!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9835 | VOS_ASSERT(0); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9836 | } |
| 9837 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9838 | clear_bit(SOFTAP_BSS_STARTED, &pAdapter->event_flags); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 9839 | /* BSS stopped, clear the active sessions for this device mode */ |
| 9840 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9841 | } |
| 9842 | mutex_unlock(&pHddCtx->sap_lock); |
| 9843 | |
| 9844 | if(status != VOS_STATUS_SUCCESS) |
| 9845 | { |
| 9846 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9847 | "%s:Error!!! Stopping the BSS",__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9848 | return -EINVAL; |
| 9849 | } |
| 9850 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9851 | if (ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9852 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 0,NULL, eANI_BOOLEAN_FALSE) |
| 9853 | ==eHAL_STATUS_FAILURE) |
| 9854 | { |
| 9855 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9856 | "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] | 9857 | } |
| 9858 | |
Jeff Johnson | 4416a78 | 2013-03-25 14:17:50 -0700 | [diff] [blame] | 9859 | if ( eHAL_STATUS_FAILURE == ccmCfgSetInt(pHddCtx->hHal, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9860 | WNI_CFG_ASSOC_RSP_ADDNIE_FLAG, 0, NULL, |
| 9861 | eANI_BOOLEAN_FALSE) ) |
| 9862 | { |
| 9863 | hddLog(LOGE, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 9864 | "Could not pass on WNI_CFG_ASSOC_RSP_ADDNIE_FLAG to CCM"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9865 | } |
| 9866 | |
| 9867 | // Reset WNI_CFG_PROBE_RSP Flags |
| 9868 | wlan_hdd_reset_prob_rspies(pAdapter); |
| 9869 | |
| 9870 | pAdapter->sessionCtx.ap.beacon = NULL; |
| 9871 | kfree(old); |
Madan Mohan Koyyalamudi | 26bd714 | 2012-10-30 18:14:19 -0700 | [diff] [blame] | 9872 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 9873 | if((pAdapter->device_mode == WLAN_HDD_P2P_GO) && |
| 9874 | (globalP2PConnectionStatus == P2P_GO_COMPLETED_STATE)) |
| 9875 | { |
| 9876 | hddLog(LOGE,"[P2P State] From GO completed to Inactive state " |
| 9877 | "GO got removed"); |
| 9878 | globalP2PConnectionStatus = P2P_NOT_ACTIVE; |
| 9879 | } |
| 9880 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 9881 | } |
| 9882 | EXIT(); |
| 9883 | return status; |
| 9884 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9885 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9886 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9887 | static int wlan_hdd_cfg80211_del_beacon(struct wiphy *wiphy, |
| 9888 | struct net_device *dev) |
| 9889 | { |
| 9890 | int ret; |
| 9891 | |
| 9892 | vos_ssr_protect(__func__); |
| 9893 | ret = __wlan_hdd_cfg80211_del_beacon(wiphy, dev); |
| 9894 | vos_ssr_unprotect(__func__); |
| 9895 | |
| 9896 | return ret; |
| 9897 | } |
| 9898 | #else |
| 9899 | static int wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy, |
| 9900 | struct net_device *dev) |
| 9901 | { |
| 9902 | int ret; |
| 9903 | |
| 9904 | vos_ssr_protect(__func__); |
| 9905 | ret = __wlan_hdd_cfg80211_stop_ap(wiphy, dev); |
| 9906 | vos_ssr_unprotect(__func__); |
| 9907 | |
| 9908 | return ret; |
| 9909 | } |
| 9910 | #endif |
| 9911 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9912 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
| 9913 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 9914 | static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9915 | struct net_device *dev, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9916 | struct cfg80211_ap_settings *params) |
| 9917 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9918 | hdd_adapter_t *pAdapter; |
| 9919 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9920 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9921 | |
| 9922 | ENTER(); |
| 9923 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 9924 | if (NULL == dev || NULL == params) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 9925 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9926 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 9927 | "%s: Device or params is Null", __func__); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9928 | return -ENODEV; |
| 9929 | } |
| 9930 | |
| 9931 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 9932 | if (NULL == pAdapter) |
| 9933 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9934 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9935 | "%s: HDD adapter is Null", __func__); |
| 9936 | return -ENODEV; |
| 9937 | } |
| 9938 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 9939 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 9940 | TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, |
| 9941 | params-> beacon_interval)); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9942 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) |
| 9943 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9944 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9945 | "%s: HDD adapter magic is invalid", __func__); |
| 9946 | return -ENODEV; |
| 9947 | } |
| 9948 | |
| 9949 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9950 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9951 | if (0 != status) |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9952 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 9953 | return status; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9954 | } |
| 9955 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 9956 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %s (%d)", |
| 9957 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 9958 | pAdapter->device_mode); |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9959 | |
| 9960 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9961 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9962 | ) |
| 9963 | { |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9964 | beacon_data_t *old, *new; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9965 | |
| 9966 | old = pAdapter->sessionCtx.ap.beacon; |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9967 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9968 | if (old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9969 | { |
| 9970 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 9971 | FL("already beacon info added to session(%d)"), |
| 9972 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9973 | return -EALREADY; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 9974 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9975 | |
Girish Gowli | b143d7a | 2015-02-18 19:39:55 +0530 | [diff] [blame] | 9976 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 9977 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 9978 | &new, |
| 9979 | ¶ms->beacon); |
| 9980 | #else |
| 9981 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, |
| 9982 | &new, |
| 9983 | ¶ms->beacon, |
| 9984 | params->dtim_period); |
| 9985 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9986 | |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9987 | if (status != 0) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9988 | { |
| 9989 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Pratik Bhalgat | a0c7f26 | 2012-11-22 17:40:24 +0530 | [diff] [blame] | 9990 | "%s:Error!!! Allocating the new beacon", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 9991 | return -EINVAL; |
| 9992 | } |
| 9993 | pAdapter->sessionCtx.ap.beacon = new; |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 9994 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 9995 | wlan_hdd_cfg80211_set_channel(wiphy, dev, |
| 9996 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0)) |
| 9997 | params->channel, params->channel_type); |
| 9998 | #else |
| 9999 | params->chandef.chan, cfg80211_get_chandef_type(&(params->chandef))); |
| 10000 | #endif |
Viral Modi | 3a32cc5 | 2013-02-08 11:14:52 -0800 | [diff] [blame] | 10001 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10002 | status = wlan_hdd_cfg80211_start_bss(pAdapter, ¶ms->beacon, params->ssid, |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 10003 | params->ssid_len, params->hidden_ssid, |
| 10004 | params->auth_type); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10005 | } |
| 10006 | |
| 10007 | EXIT(); |
| 10008 | return status; |
| 10009 | } |
| 10010 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10011 | static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, |
| 10012 | struct net_device *dev, |
| 10013 | struct cfg80211_ap_settings *params) |
| 10014 | { |
| 10015 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10016 | |
Mukul Sharma | b0e0a98 | 2014-12-15 18:58:53 +0530 | [diff] [blame] | 10017 | vos_ssr_protect(__func__); |
| 10018 | ret = __wlan_hdd_cfg80211_start_ap(wiphy, dev, params); |
| 10019 | vos_ssr_unprotect(__func__); |
| 10020 | |
| 10021 | return ret; |
| 10022 | } |
| 10023 | |
| 10024 | static int __wlan_hdd_cfg80211_change_beacon(struct wiphy *wiphy, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10025 | struct net_device *dev, |
| 10026 | struct cfg80211_beacon_data *params) |
| 10027 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10028 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10029 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10030 | int status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10031 | |
| 10032 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10033 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10034 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10035 | TRACE_CODE_HDD_CFG80211_CHANGE_BEACON, |
| 10036 | pAdapter->sessionId, pAdapter->device_mode)); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10037 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d", |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10038 | __func__, pAdapter->device_mode); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10039 | |
| 10040 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10041 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10042 | if (0 != status) |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 10043 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10044 | return status; |
Madan Mohan Koyyalamudi | b2c3689 | 2012-10-18 20:52:38 -0700 | [diff] [blame] | 10045 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10046 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10047 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10048 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10049 | ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10050 | { |
| 10051 | beacon_data_t *old,*new; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10052 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10053 | old = pAdapter->sessionCtx.ap.beacon; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10054 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10055 | if (!old) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10056 | { |
| 10057 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10058 | FL("session(%d) beacon data points to NULL"), |
| 10059 | pAdapter->sessionId); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10060 | return -ENOENT; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10061 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10062 | |
| 10063 | status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, params, 0); |
| 10064 | |
| 10065 | if(status != VOS_STATUS_SUCCESS) { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10066 | hddLog(VOS_TRACE_LEVEL_FATAL, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10067 | "%s: Error!!! Allocating the new beacon",__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10068 | return -EINVAL; |
| 10069 | } |
| 10070 | |
| 10071 | pAdapter->sessionCtx.ap.beacon = new; |
| 10072 | |
Kanchanapally, Vidyullatha | acc5925 | 2015-05-20 16:49:07 +0530 | [diff] [blame] | 10073 | status = wlan_hdd_cfg80211_start_bss(pAdapter, params, NULL, 0, 0, |
| 10074 | pAdapter->sessionCtx.ap.sapConfig.authType); |
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_change_beacon(struct wiphy *wiphy, |
| 10082 | struct net_device *dev, |
| 10083 | struct cfg80211_beacon_data *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_change_beacon(wiphy, dev, params); |
| 10089 | vos_ssr_unprotect(__func__); |
| 10090 | |
| 10091 | return ret; |
| 10092 | } |
| 10093 | |
| 10094 | #endif //(LINUX_VERSION_CODE > KERNEL_VERSION(3,3,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10095 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 10096 | static int __wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10097 | struct net_device *dev, |
| 10098 | struct bss_parameters *params) |
| 10099 | { |
| 10100 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10101 | hdd_context_t *pHddCtx; |
| 10102 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10103 | |
| 10104 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10105 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10106 | if (NULL == pAdapter) |
| 10107 | { |
| 10108 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10109 | "%s: HDD adapter is Null", __func__); |
| 10110 | return -ENODEV; |
| 10111 | } |
| 10112 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10113 | ret = wlan_hdd_validate_context(pHddCtx); |
| 10114 | if (0 != ret) |
| 10115 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10116 | return ret; |
| 10117 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10118 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10119 | TRACE_CODE_HDD_CFG80211_CHANGE_BSS, |
| 10120 | pAdapter->sessionId, params->ap_isolate)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10121 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10122 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10123 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10124 | |
| 10125 | if((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10126 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10127 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10128 | { |
| 10129 | /* ap_isolate == -1 means that in change bss, upper layer doesn't |
| 10130 | * want to update this parameter */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10131 | if (-1 != params->ap_isolate) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10132 | { |
| 10133 | pAdapter->sessionCtx.ap.apDisableIntraBssFwd = !!params->ap_isolate; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10134 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10135 | } |
| 10136 | |
| 10137 | EXIT(); |
| 10138 | return 0; |
| 10139 | } |
| 10140 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 10141 | static int wlan_hdd_cfg80211_change_bss (struct wiphy *wiphy, |
| 10142 | struct net_device *dev, |
| 10143 | struct bss_parameters *params) |
| 10144 | { |
| 10145 | int ret; |
| 10146 | |
| 10147 | vos_ssr_protect(__func__); |
| 10148 | ret = __wlan_hdd_cfg80211_change_bss(wiphy, dev, params); |
| 10149 | vos_ssr_unprotect(__func__); |
| 10150 | |
| 10151 | return ret; |
| 10152 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10153 | /* FUNCTION: wlan_hdd_change_country_code_cd |
| 10154 | * to wait for contry code completion |
| 10155 | */ |
| 10156 | void* wlan_hdd_change_country_code_cb(void *pAdapter) |
| 10157 | { |
| 10158 | hdd_adapter_t *call_back_pAdapter = pAdapter; |
| 10159 | complete(&call_back_pAdapter->change_country_code); |
| 10160 | return NULL; |
| 10161 | } |
| 10162 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10163 | /* |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 10164 | * FUNCTION: __wlan_hdd_cfg80211_change_iface |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10165 | * This function is used to set the interface type (INFRASTRUCTURE/ADHOC) |
| 10166 | */ |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 10167 | int __wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10168 | struct net_device *ndev, |
| 10169 | enum nl80211_iftype type, |
| 10170 | u32 *flags, |
| 10171 | struct vif_params *params |
| 10172 | ) |
| 10173 | { |
| 10174 | struct wireless_dev *wdev; |
| 10175 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10176 | hdd_context_t *pHddCtx; |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 10177 | hdd_adapter_t *pP2pAdapter = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10178 | tCsrRoamProfile *pRoamProfile = NULL; |
| 10179 | eCsrRoamBssType LastBSSType; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10180 | hdd_config_t *pConfig = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10181 | eMib_dot11DesiredBssType connectedBssType; |
| 10182 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10183 | long ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10184 | |
| 10185 | ENTER(); |
| 10186 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10187 | if (!pAdapter) |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10188 | { |
| 10189 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10190 | "%s: Adapter context is null", __func__); |
| 10191 | return VOS_STATUS_E_FAILURE; |
| 10192 | } |
| 10193 | |
| 10194 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 10195 | if (!pHddCtx) |
| 10196 | { |
| 10197 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10198 | "%s: HDD context is null", __func__); |
| 10199 | return VOS_STATUS_E_FAILURE; |
| 10200 | } |
| 10201 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10202 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10203 | TRACE_CODE_HDD_CFG80211_CHANGE_IFACE, |
| 10204 | pAdapter->sessionId, type)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10205 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10206 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10207 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10208 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10209 | } |
| 10210 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10211 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 10212 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10213 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10214 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10215 | if (vos_max_concurrent_connections_reached()) { |
| 10216 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 10217 | return -EINVAL; |
| 10218 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 10219 | pConfig = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10220 | wdev = ndev->ieee80211_ptr; |
| 10221 | |
| 10222 | #ifdef WLAN_BTAMP_FEATURE |
| 10223 | if((NL80211_IFTYPE_P2P_CLIENT == type)|| |
| 10224 | (NL80211_IFTYPE_ADHOC == type)|| |
| 10225 | (NL80211_IFTYPE_AP == type)|| |
| 10226 | (NL80211_IFTYPE_P2P_GO == type)) |
| 10227 | { |
| 10228 | pHddCtx->isAmpAllowed = VOS_FALSE; |
| 10229 | // stop AMP traffic |
| 10230 | status = WLANBAP_StopAmp(); |
| 10231 | if(VOS_STATUS_SUCCESS != status ) |
| 10232 | { |
| 10233 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 10234 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 10235 | "%s: Failed to stop AMP", __func__); |
| 10236 | return -EINVAL; |
| 10237 | } |
| 10238 | } |
| 10239 | #endif //WLAN_BTAMP_FEATURE |
| 10240 | /* Reset the current device mode bit mask*/ |
| 10241 | wlan_hdd_clear_concurrency_mode(pHddCtx, pAdapter->device_mode); |
| 10242 | |
Masti, Narayanraddi | 575ccc7 | 2015-08-17 18:04:57 +0530 | [diff] [blame] | 10243 | if ((pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) && |
| 10244 | ((type == NL80211_IFTYPE_P2P_CLIENT) || |
| 10245 | (type == NL80211_IFTYPE_P2P_GO))) |
| 10246 | { |
| 10247 | /* Notify Mode change in case of concurrency. |
| 10248 | * Below function invokes TDLS teardown Functionality Since TDLS is |
| 10249 | * not Supported in case of concurrency i.e Once P2P session |
| 10250 | * is detected disable offchannel and teardown TDLS links |
| 10251 | */ |
| 10252 | hddLog(LOG1, |
| 10253 | FL("Device mode = %d Interface type = %d"), |
| 10254 | pAdapter->device_mode, type); |
| 10255 | hdd_tdls_notify_mode_change(pAdapter, pHddCtx); |
| 10256 | } |
Masti, Narayanraddi | fdde4d0 | 2015-04-16 14:41:51 +0530 | [diff] [blame] | 10257 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10258 | if( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10259 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10260 | || (pAdapter->device_mode == WLAN_HDD_P2P_DEVICE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10261 | ) |
| 10262 | { |
| 10263 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 10264 | if (!pWextState) |
| 10265 | { |
| 10266 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10267 | "%s: pWextState is null", __func__); |
| 10268 | return VOS_STATUS_E_FAILURE; |
| 10269 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10270 | pRoamProfile = &pWextState->roamProfile; |
| 10271 | LastBSSType = pRoamProfile->BSSType; |
| 10272 | |
| 10273 | switch (type) |
| 10274 | { |
| 10275 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10276 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10277 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10278 | "%s: setting interface Type to INFRASTRUCTURE", __func__); |
| 10279 | pRoamProfile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10280 | #ifdef WLAN_FEATURE_11AC |
| 10281 | if(pConfig->dot11Mode == eHDD_DOT11_MODE_AUTO) |
| 10282 | { |
| 10283 | pConfig->dot11Mode = eHDD_DOT11_MODE_11ac; |
| 10284 | } |
| 10285 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10286 | pRoamProfile->phyMode = |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10287 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10288 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 10289 | //Check for sub-string p2p to confirm its a p2p interface |
| 10290 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10291 | { |
Mahesh A Saptasagar | c48ae8a | 2015-08-09 00:04:35 +0530 | [diff] [blame] | 10292 | #ifdef FEATURE_WLAN_TDLS |
| 10293 | mutex_lock(&pHddCtx->tdls_lock); |
| 10294 | wlan_hdd_tdls_exit(pAdapter, TRUE); |
| 10295 | mutex_unlock(&pHddCtx->tdls_lock); |
| 10296 | #endif |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 10297 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 10298 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 10299 | } |
| 10300 | else |
| 10301 | { |
| 10302 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10303 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 10304 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10305 | break; |
Mahesh A Saptasagar | 36cdc80 | 2015-01-07 18:41:17 +0530 | [diff] [blame] | 10306 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10307 | case NL80211_IFTYPE_ADHOC: |
| 10308 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 10309 | "%s: setting interface Type to ADHOC", __func__); |
| 10310 | pRoamProfile->BSSType = eCSR_BSS_TYPE_START_IBSS; |
| 10311 | pRoamProfile->phyMode = |
| 10312 | hdd_cfg_xlate_to_csr_phy_mode(pConfig->dot11Mode); |
Shailender Karmuchi | a734f33 | 2013-04-19 14:02:48 -0700 | [diff] [blame] | 10313 | pAdapter->device_mode = WLAN_HDD_IBSS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10314 | wdev->iftype = type; |
Katya Nigam | 1fd2440 | 2015-02-16 14:52:19 +0530 | [diff] [blame] | 10315 | hdd_set_ibss_ops( pAdapter ); |
| 10316 | hdd_ibss_init_tx_rx( pAdapter ); |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 10317 | |
| 10318 | status = hdd_sta_id_hash_attach(pAdapter); |
| 10319 | if (VOS_STATUS_SUCCESS != status) { |
| 10320 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10321 | FL("Failed to initialize hash for IBSS")); |
| 10322 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10323 | break; |
| 10324 | |
| 10325 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10326 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10327 | { |
| 10328 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 10329 | "%s: setting interface Type to %s", __func__, |
| 10330 | (type == NL80211_IFTYPE_AP) ? "SoftAP" : "P2pGo"); |
| 10331 | |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 10332 | //Cancel any remain on channel for GO mode |
| 10333 | if (NL80211_IFTYPE_P2P_GO == type) |
| 10334 | { |
| 10335 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
| 10336 | } |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 10337 | if (NL80211_IFTYPE_AP == type) |
| 10338 | { |
| 10339 | /* As Loading WLAN Driver one interface being created for p2p device |
| 10340 | * address. This will take one HW STA and the max number of clients |
| 10341 | * that can connect to softAP will be reduced by one. so while changing |
| 10342 | * the interface type to NL80211_IFTYPE_AP (SoftAP) remove p2p0 |
| 10343 | * interface as it is not required in SoftAP mode. |
| 10344 | */ |
| 10345 | |
| 10346 | // Get P2P Adapter |
| 10347 | pP2pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_P2P_DEVICE); |
| 10348 | |
| 10349 | if (pP2pAdapter) |
| 10350 | { |
Agarwal Ashish | 3a38bd1 | 2014-06-12 15:16:52 +0530 | [diff] [blame] | 10351 | hdd_stop_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 10352 | hdd_deinit_adapter(pHddCtx, pP2pAdapter, TRUE); |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 10353 | hdd_close_adapter(pHddCtx, pP2pAdapter, VOS_TRUE); |
| 10354 | } |
| 10355 | } |
Swaroop Golti | a2e3221 | 2014-04-09 23:37:33 +0530 | [diff] [blame] | 10356 | //Disable IMPS & BMPS for SAP/GO |
| 10357 | if(VOS_STATUS_E_FAILURE == |
| 10358 | hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_P2P_GO)) |
| 10359 | { |
| 10360 | //Fail to Exit BMPS |
| 10361 | VOS_ASSERT(0); |
| 10362 | } |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 10363 | |
| 10364 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
| 10365 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10366 | #ifdef FEATURE_WLAN_TDLS |
Mohit Khanna | 0f23209 | 2012-09-11 14:46:08 -0700 | [diff] [blame] | 10367 | |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10368 | /* A Mutex Lock is introduced while changing the mode to |
| 10369 | * protect the concurrent access for the Adapters by TDLS |
| 10370 | * module. |
| 10371 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10372 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10373 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10374 | //De-init the adapter. |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 10375 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10376 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10377 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 10378 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10379 | #ifdef FEATURE_WLAN_TDLS |
| 10380 | mutex_unlock(&pHddCtx->tdls_lock); |
| 10381 | #endif |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 10382 | if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) && |
| 10383 | (pConfig->apRandomBssidEnabled)) |
| 10384 | { |
| 10385 | /* To meet Android requirements create a randomized |
| 10386 | MAC address of the form 02:1A:11:Fx:xx:xx */ |
| 10387 | get_random_bytes(&ndev->dev_addr[3], 3); |
| 10388 | ndev->dev_addr[0] = 0x02; |
| 10389 | ndev->dev_addr[1] = 0x1A; |
| 10390 | ndev->dev_addr[2] = 0x11; |
| 10391 | ndev->dev_addr[3] |= 0xF0; |
| 10392 | memcpy(pAdapter->macAddressCurrent.bytes, ndev->dev_addr, |
| 10393 | VOS_MAC_ADDR_SIZE); |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 10394 | pr_info("wlan: Generated HotSpot BSSID " MAC_ADDRESS_STR"\n", |
| 10395 | MAC_ADDR_ARRAY(ndev->dev_addr)); |
Madan Mohan Koyyalamudi | 3ff2a0b | 2012-10-15 14:33:46 -0700 | [diff] [blame] | 10396 | } |
| 10397 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10398 | hdd_set_ap_ops( pAdapter->dev ); |
| 10399 | |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10400 | /* This is for only SAP mode where users can |
| 10401 | * control country through ini. |
| 10402 | * P2P GO follows station country code |
| 10403 | * acquired during the STA scanning. */ |
| 10404 | if((NL80211_IFTYPE_AP == type) && |
| 10405 | (memcmp(pConfig->apCntryCode, CFG_AP_COUNTRY_CODE_DEFAULT, 3) != 0)) |
| 10406 | { |
| 10407 | int status = 0; |
| 10408 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_INFO, |
| 10409 | "%s: setting country code from INI ", __func__); |
| 10410 | init_completion(&pAdapter->change_country_code); |
| 10411 | status = (int)sme_ChangeCountryCode(pHddCtx->hHal, |
| 10412 | (void *)(tSmeChangeCountryCallback) |
| 10413 | wlan_hdd_change_country_code_cb, |
| 10414 | pConfig->apCntryCode, pAdapter, |
| 10415 | pHddCtx->pvosContext, |
Abhishek Singh | a306a44 | 2013-11-07 18:39:01 +0530 | [diff] [blame] | 10416 | eSIR_FALSE, |
| 10417 | eSIR_TRUE); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10418 | if (eHAL_STATUS_SUCCESS == status) |
| 10419 | { |
| 10420 | /* Wait for completion */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10421 | ret = wait_for_completion_interruptible_timeout( |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10422 | &pAdapter->change_country_code, |
| 10423 | msecs_to_jiffies(WLAN_WAIT_TIME_COUNTRY)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10424 | if (ret <= 0) |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10425 | { |
| 10426 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10427 | FL("SME Timed out while setting country code %ld"), |
| 10428 | ret); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 10429 | |
| 10430 | if (pHddCtx->isLogpInProgress) |
| 10431 | { |
| 10432 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10433 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 10434 | return -EAGAIN; |
| 10435 | } |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10436 | } |
| 10437 | } |
| 10438 | else |
| 10439 | { |
| 10440 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 10441 | "%s: SME Change Country code failed",__func__); |
Kiet Lam | 1084136 | 2013-11-01 11:36:50 +0530 | [diff] [blame] | 10442 | return -EINVAL; |
| 10443 | } |
| 10444 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10445 | status = hdd_init_ap_mode(pAdapter); |
| 10446 | if(status != VOS_STATUS_SUCCESS) |
| 10447 | { |
| 10448 | hddLog(VOS_TRACE_LEVEL_FATAL, |
| 10449 | "%s: Error initializing the ap mode", __func__); |
| 10450 | return -EINVAL; |
| 10451 | } |
| 10452 | hdd_set_conparam(1); |
| 10453 | |
Nirav Shah | 7e3c813 | 2015-06-22 23:51:42 +0530 | [diff] [blame] | 10454 | status = hdd_sta_id_hash_attach(pAdapter); |
| 10455 | if (VOS_STATUS_SUCCESS != status) |
| 10456 | { |
| 10457 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10458 | FL("Failed to initialize hash for AP")); |
| 10459 | return -EINVAL; |
| 10460 | } |
| 10461 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10462 | /*interface type changed update in wiphy structure*/ |
| 10463 | if(wdev) |
| 10464 | { |
| 10465 | wdev->iftype = type; |
| 10466 | pHddCtx->change_iface = type; |
| 10467 | } |
| 10468 | else |
| 10469 | { |
| 10470 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10471 | "%s: ERROR !!!! Wireless dev is NULL", __func__); |
| 10472 | return -EINVAL; |
| 10473 | } |
| 10474 | goto done; |
| 10475 | } |
| 10476 | |
| 10477 | default: |
| 10478 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 10479 | __func__); |
| 10480 | return -EOPNOTSUPP; |
| 10481 | } |
| 10482 | } |
| 10483 | else if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10484 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10485 | ) |
| 10486 | { |
| 10487 | switch(type) |
| 10488 | { |
| 10489 | case NL80211_IFTYPE_STATION: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10490 | case NL80211_IFTYPE_P2P_CLIENT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10491 | case NL80211_IFTYPE_ADHOC: |
Deepthi Gowri | 500fc47 | 2014-08-11 19:53:10 +0530 | [diff] [blame] | 10492 | |
| 10493 | hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10494 | #ifdef FEATURE_WLAN_TDLS |
| 10495 | |
| 10496 | /* A Mutex Lock is introduced while changing the mode to |
| 10497 | * protect the concurrent access for the Adapters by TDLS |
| 10498 | * module. |
| 10499 | */ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10500 | mutex_lock(&pHddCtx->tdls_lock); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10501 | #endif |
c_hpothu | 002231a | 2015-02-05 14:58:51 +0530 | [diff] [blame] | 10502 | hdd_deinit_adapter( pHddCtx, pAdapter, TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10503 | wdev->iftype = type; |
Gopichand Nakkala | f527dc6 | 2012-12-31 16:35:10 -0800 | [diff] [blame] | 10504 | //Check for sub-string p2p to confirm its a p2p interface |
| 10505 | if (NULL != strstr(ndev->name,"p2p")) |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 10506 | { |
| 10507 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
| 10508 | WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT; |
| 10509 | } |
| 10510 | else |
| 10511 | { |
| 10512 | pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ? |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10513 | WLAN_HDD_INFRA_STATION: WLAN_HDD_P2P_CLIENT; |
Gopichand Nakkala | 864d355 | 2012-12-31 16:08:51 -0800 | [diff] [blame] | 10514 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10515 | hdd_set_conparam(0); |
| 10516 | pHddCtx->change_iface = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10517 | memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx)); |
| 10518 | hdd_set_station_ops( pAdapter->dev ); |
Madan Mohan Koyyalamudi | 9679744 | 2013-10-08 16:04:42 +0530 | [diff] [blame] | 10519 | #ifdef FEATURE_WLAN_TDLS |
| 10520 | mutex_unlock(&pHddCtx->tdls_lock); |
| 10521 | #endif |
Sunil Dutt | 66485cb | 2013-12-19 19:05:03 +0530 | [diff] [blame] | 10522 | status = hdd_init_station_mode( pAdapter ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10523 | if( VOS_STATUS_SUCCESS != status ) |
| 10524 | return -EOPNOTSUPP; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10525 | /* In case of JB, for P2P-GO, only change interface will be called, |
| 10526 | * This is the right place to enable back bmps_imps() |
| 10527 | */ |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 10528 | if (pHddCtx->hdd_wlan_suspended) |
| 10529 | { |
| 10530 | hdd_set_pwrparams(pHddCtx); |
| 10531 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10532 | hdd_enable_bmps_imps(pHddCtx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10533 | goto done; |
| 10534 | case NL80211_IFTYPE_AP: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10535 | case NL80211_IFTYPE_P2P_GO: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10536 | wdev->iftype = type; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10537 | pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ? |
| 10538 | WLAN_HDD_SOFTAP : WLAN_HDD_P2P_GO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10539 | goto done; |
| 10540 | default: |
| 10541 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported interface Type", |
| 10542 | __func__); |
| 10543 | return -EOPNOTSUPP; |
| 10544 | |
| 10545 | } |
| 10546 | |
| 10547 | } |
| 10548 | else |
| 10549 | { |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 10550 | hddLog(VOS_TRACE_LEVEL_ERROR,"%s: unsupported device mode(%s (%d))", |
| 10551 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 10552 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10553 | return -EOPNOTSUPP; |
| 10554 | } |
| 10555 | |
| 10556 | |
| 10557 | if(pRoamProfile) |
| 10558 | { |
| 10559 | if ( LastBSSType != pRoamProfile->BSSType ) |
| 10560 | { |
| 10561 | /*interface type changed update in wiphy structure*/ |
| 10562 | wdev->iftype = type; |
| 10563 | |
| 10564 | /*the BSS mode changed, We need to issue disconnect |
| 10565 | if connected or in IBSS disconnect state*/ |
| 10566 | if ( hdd_connGetConnectedBssType( |
| 10567 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), &connectedBssType ) || |
| 10568 | ( eCSR_BSS_TYPE_START_IBSS == LastBSSType ) ) |
| 10569 | { |
| 10570 | /*need to issue a disconnect to CSR.*/ |
| 10571 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 10572 | if( eHAL_STATUS_SUCCESS == |
| 10573 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 10574 | pAdapter->sessionId, |
| 10575 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 10576 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10577 | ret = wait_for_completion_interruptible_timeout( |
| 10578 | &pAdapter->disconnect_comp_var, |
| 10579 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 10580 | if (ret <= 0) |
| 10581 | { |
| 10582 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10583 | FL("wait on disconnect_comp_var failed %ld"), ret); |
| 10584 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10585 | } |
| 10586 | } |
| 10587 | } |
| 10588 | } |
| 10589 | |
| 10590 | done: |
| 10591 | /*set bitmask based on updated value*/ |
| 10592 | wlan_hdd_set_concurrency_mode(pHddCtx, pAdapter->device_mode); |
Leo Chang | 6fe1f92 | 2013-06-07 19:21:24 -0700 | [diff] [blame] | 10593 | |
| 10594 | /* Only STA mode support TM now |
| 10595 | * all other mode, TM feature should be disabled */ |
| 10596 | if ( (pHddCtx->cfg_ini->thermalMitigationEnable) && |
| 10597 | (~VOS_STA & pHddCtx->concurrency_mode) ) |
| 10598 | { |
| 10599 | hddDevTmLevelChangedHandler(pHddCtx->parent_dev, 0); |
| 10600 | } |
| 10601 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10602 | #ifdef WLAN_BTAMP_FEATURE |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10603 | if((NL80211_IFTYPE_STATION == type) && (pHddCtx->concurrency_mode <= 1) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 10604 | (pHddCtx->no_of_open_sessions[WLAN_HDD_INFRA_STATION] <=1)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10605 | { |
| 10606 | //we are ok to do AMP |
| 10607 | pHddCtx->isAmpAllowed = VOS_TRUE; |
| 10608 | } |
| 10609 | #endif //WLAN_BTAMP_FEATURE |
| 10610 | EXIT(); |
| 10611 | return 0; |
| 10612 | } |
| 10613 | |
Mahesh A Saptasagar | 0e59c47 | 2014-04-14 19:17:41 +0530 | [diff] [blame] | 10614 | /* |
| 10615 | * FUNCTION: wlan_hdd_cfg80211_change_iface |
| 10616 | * wrapper function to protect the actual implementation from SSR. |
| 10617 | */ |
| 10618 | int wlan_hdd_cfg80211_change_iface( struct wiphy *wiphy, |
| 10619 | struct net_device *ndev, |
| 10620 | enum nl80211_iftype type, |
| 10621 | u32 *flags, |
| 10622 | struct vif_params *params |
| 10623 | ) |
| 10624 | { |
| 10625 | int ret; |
| 10626 | |
| 10627 | vos_ssr_protect(__func__); |
| 10628 | ret = __wlan_hdd_cfg80211_change_iface(wiphy, ndev, type, flags, params); |
| 10629 | vos_ssr_unprotect(__func__); |
| 10630 | |
| 10631 | return ret; |
| 10632 | } |
| 10633 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10634 | #ifdef FEATURE_WLAN_TDLS |
| 10635 | static int wlan_hdd_tdls_add_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 10636 | struct net_device *dev, |
| 10637 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 10638 | const u8 *mac, |
| 10639 | #else |
| 10640 | u8 *mac, |
| 10641 | #endif |
| 10642 | bool update, tCsrStaParams *StaParams) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10643 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10644 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10645 | hddTdlsPeer_t *pTdlsPeer; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10646 | long ret; |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10647 | tANI_U16 numCurrTdlsPeers; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10648 | hdd_adapter_t *pAdapter; |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 10649 | VOS_STATUS status; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10650 | |
| 10651 | ENTER(); |
| 10652 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 10653 | if (!dev) { |
| 10654 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Dev pointer is NULL")); |
| 10655 | return -EINVAL; |
| 10656 | } |
| 10657 | |
| 10658 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 10659 | if (!pAdapter) { |
| 10660 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adapter is NULL")); |
| 10661 | return -EINVAL; |
| 10662 | } |
| 10663 | |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 10664 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10665 | { |
| 10666 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10667 | "Invalid arguments"); |
| 10668 | return -EINVAL; |
| 10669 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 10670 | |
| 10671 | if ((eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) || |
| 10672 | (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode)) |
| 10673 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10674 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 10675 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 10676 | MAC_ADDRESS_STR " Request declined.", |
| 10677 | __func__, MAC_ADDR_ARRAY(mac)); |
| 10678 | return -ENOTSUPP; |
| 10679 | } |
| 10680 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10681 | if (pHddCtx->isLogpInProgress) |
| 10682 | { |
| 10683 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10684 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 10685 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 10686 | mac, |
| 10687 | eTDLS_LINK_IDLE, |
| 10688 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10689 | return -EBUSY; |
| 10690 | } |
| 10691 | |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 10692 | mutex_lock(&pHddCtx->tdls_lock); |
Naresh Jayaram | 9c6f446 | 2014-02-13 12:20:31 +0530 | [diff] [blame] | 10693 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, mac); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10694 | |
| 10695 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10696 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10697 | "%s: " MAC_ADDRESS_STR " (update %d) not exist. return invalid", |
| 10698 | __func__, MAC_ADDR_ARRAY(mac), update); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 10699 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10700 | return -EINVAL; |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 10701 | } |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10702 | |
| 10703 | /* in add station, we accept existing valid staId if there is */ |
| 10704 | if ((0 == update) && |
| 10705 | ((pTdlsPeer->link_status >= eTDLS_LINK_CONNECTING) || |
| 10706 | (TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10707 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10708 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10709 | "%s: " MAC_ADDRESS_STR |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10710 | " link_status %d. staId %d. add station ignored.", |
| 10711 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, pTdlsPeer->staId); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10712 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10713 | return 0; |
| 10714 | } |
| 10715 | /* in change station, we accept only when staId is valid */ |
| 10716 | if ((1 == update) && |
| 10717 | ((pTdlsPeer->link_status > eTDLS_LINK_CONNECTING) || |
| 10718 | (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)))) |
| 10719 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10720 | tANI_U16 staId = pTdlsPeer->staId; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10721 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10722 | "%s: " MAC_ADDRESS_STR |
| 10723 | " link status %d. staId %d. change station %s.", |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10724 | __func__, MAC_ADDR_ARRAY(mac), pTdlsPeer->link_status, staId, |
| 10725 | (TDLS_STA_INDEX_VALID(staId)) ? "ignored" : "declined"); |
| 10726 | mutex_unlock(&pHddCtx->tdls_lock); |
| 10727 | return (TDLS_STA_INDEX_VALID(staId)) ? 0 : -EPERM; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10728 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10729 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 10730 | |
| 10731 | /* 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] | 10732 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, mac, TRUE, TRUE)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10733 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10734 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10735 | "%s: " MAC_ADDRESS_STR |
| 10736 | " TDLS setup is ongoing. Request declined.", |
| 10737 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10738 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10739 | } |
| 10740 | |
| 10741 | /* first to check if we reached to maximum supported TDLS peer. |
| 10742 | TODO: for now, return -EPERM looks working fine, |
| 10743 | but need to check if any other errno fit into this category.*/ |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10744 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 10745 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10746 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10747 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10748 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 10749 | " TDLS Max peer already connected. Request declined." |
| 10750 | " Num of peers (%d), Max allowed (%d).", |
| 10751 | __func__, MAC_ADDR_ARRAY(mac), numCurrTdlsPeers, |
| 10752 | HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10753 | goto error; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10754 | } |
| 10755 | else |
| 10756 | { |
| 10757 | hddTdlsPeer_t *pTdlsPeer; |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10758 | mutex_lock(&pHddCtx->tdls_lock); |
| 10759 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, mac, FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10760 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10761 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10762 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10763 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10764 | "%s: " MAC_ADDRESS_STR " already connected. Request declined.", |
| 10765 | __func__, MAC_ADDR_ARRAY(mac)); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10766 | return -EPERM; |
| 10767 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 10768 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10769 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10770 | if (0 == update) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 10771 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 10772 | mac, |
| 10773 | eTDLS_LINK_CONNECTING, |
| 10774 | eTDLS_LINK_SUCCESS); |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10775 | |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 10776 | /* debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 10777 | if (NULL != StaParams) |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10778 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10779 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10780 | "%s: TDLS Peer Parameters.", __func__); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10781 | if(StaParams->htcap_present) |
| 10782 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10783 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10784 | "ht_capa->cap_info: %0x", StaParams->HTCap.capInfo); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10785 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10786 | "ht_capa->extended_capabilities: %0x", |
| 10787 | StaParams->HTCap.extendedHtCapInfo); |
| 10788 | } |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10789 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10790 | "params->capability: %0x",StaParams->capability); |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10791 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 10792 | "params->ext_capab_len: %0x",StaParams->extn_capability[0]); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10793 | if(StaParams->vhtcap_present) |
| 10794 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10795 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10796 | "rxMcsMap %x rxHighest %x txMcsMap %x txHighest %x", |
| 10797 | StaParams->VHTCap.suppMcs.rxMcsMap, StaParams->VHTCap.suppMcs.rxHighest, |
| 10798 | StaParams->VHTCap.suppMcs.txMcsMap, StaParams->VHTCap.suppMcs.txHighest); |
| 10799 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10800 | { |
| 10801 | int i = 0; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 10802 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "Supported rates:"); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10803 | for (i = 0; i < sizeof(StaParams->supported_rates); i++) |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 10804 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10805 | "[%d]: %x ", i, StaParams->supported_rates[i]); |
| 10806 | } |
Jeff Johnson | d75fe01 | 2013-04-06 10:53:06 -0700 | [diff] [blame] | 10807 | } /* end debug code */ |
Gopichand Nakkala | 838be5d | 2013-04-10 22:41:51 +0530 | [diff] [blame] | 10808 | else if ((1 == update) && (NULL == StaParams)) |
| 10809 | { |
| 10810 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 10811 | "%s : update is true, but staParams is NULL. Error!", __func__); |
| 10812 | return -EPERM; |
| 10813 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10814 | |
| 10815 | INIT_COMPLETION(pAdapter->tdls_add_station_comp); |
| 10816 | |
| 10817 | if (!update) |
| 10818 | { |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 10819 | /*Before adding sta make sure that device exited from BMPS*/ |
| 10820 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 10821 | { |
| 10822 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10823 | "%s: Adding tdls peer sta. Disable BMPS", __func__); |
| 10824 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 10825 | if (status != VOS_STATUS_SUCCESS) { |
| 10826 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 10827 | } |
| 10828 | } |
| 10829 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 10830 | ret = sme_AddTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10831 | pAdapter->sessionId, mac); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 10832 | if (ret != eHAL_STATUS_SUCCESS) { |
Ganesh Kondabattini | f065c1f | 2015-08-05 23:05:23 +0530 | [diff] [blame] | 10833 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 10834 | FL("Failed to add TDLS peer STA. Enable Bmps")); |
| 10835 | wlan_hdd_tdls_check_bmps(pAdapter); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 10836 | return -EPERM; |
| 10837 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10838 | } |
| 10839 | else |
| 10840 | { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 10841 | ret = sme_ChangeTdlsPeerSta(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10842 | pAdapter->sessionId, mac, StaParams); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 10843 | if (ret != eHAL_STATUS_SUCCESS) { |
| 10844 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to change TDLS peer STA params")); |
| 10845 | return -EPERM; |
| 10846 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10847 | } |
| 10848 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10849 | ret = wait_for_completion_interruptible_timeout(&pAdapter->tdls_add_station_comp, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10850 | msecs_to_jiffies(WAIT_TIME_TDLS_ADD_STA)); |
| 10851 | |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10852 | if (ret <= 0) |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10853 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10854 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10855 | "%s: timeout waiting for tdls add station indication %ld", |
| 10856 | __func__, ret); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 10857 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10858 | } |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 10859 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10860 | if ( eHAL_STATUS_SUCCESS != pAdapter->tdlsAddStaStatus) |
| 10861 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 10862 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10863 | "%s: Add Station is unsucessful", __func__); |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 10864 | return -EPERM; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10865 | } |
| 10866 | |
| 10867 | return 0; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10868 | |
| 10869 | error: |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 10870 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 10871 | mac, |
| 10872 | eTDLS_LINK_IDLE, |
| 10873 | eTDLS_LINK_UNSPECIFIED); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 10874 | return -EPERM; |
| 10875 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10876 | } |
| 10877 | #endif |
| 10878 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 10879 | static int __wlan_hdd_change_station(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10880 | struct net_device *dev, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 10881 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 10882 | const u8 *mac, |
| 10883 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10884 | u8 *mac, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 10885 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10886 | struct station_parameters *params) |
| 10887 | { |
| 10888 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 10889 | hdd_adapter_t *pAdapter; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10890 | hdd_context_t *pHddCtx; |
| 10891 | hdd_station_ctx_t *pHddStaCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10892 | v_MACADDR_t STAMacAddress; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10893 | int ret = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 10894 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10895 | tCsrStaParams StaParams = {0}; |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10896 | tANI_U8 isBufSta = 0; |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 10897 | tANI_U8 isOffChannelSupported = 0; |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 10898 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 10899 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 10900 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 10901 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 10902 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10903 | if ((NULL == pAdapter)) |
| 10904 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 10905 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10906 | "invalid adapter "); |
| 10907 | return -EINVAL; |
| 10908 | } |
| 10909 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 10910 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 10911 | TRACE_CODE_HDD_CHANGE_STATION, |
| 10912 | pAdapter->sessionId, params->listen_interval)); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10913 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10914 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10915 | ret = wlan_hdd_validate_context(pHddCtx); |
| 10916 | if (0 != ret) |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10917 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10918 | return ret; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10919 | } |
| 10920 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10921 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 10922 | |
| 10923 | if (NULL == pHddStaCtx) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10924 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 10925 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 10926 | "invalid HDD station context"); |
| 10927 | return -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 10928 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10929 | vos_mem_copy(STAMacAddress.bytes, mac, sizeof(v_MACADDR_t)); |
| 10930 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10931 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
| 10932 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10933 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 10934 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_AUTHORIZED)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10935 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 10936 | status = hdd_softap_change_STA_state( pAdapter, &STAMacAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10937 | WLANTL_STA_AUTHENTICATED); |
| 10938 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10939 | if (status != VOS_STATUS_SUCCESS) |
| 10940 | { |
| 10941 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 10942 | "%s: Not able to change TL state to AUTHENTICATED", __func__); |
| 10943 | return -EINVAL; |
| 10944 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 10945 | } |
| 10946 | } |
Hoonki Lee | a6d49be | 2013-04-05 09:43:25 -0700 | [diff] [blame] | 10947 | else if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
| 10948 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT)) { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 10949 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10950 | if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 10951 | StaParams.capability = params->capability; |
| 10952 | StaParams.uapsd_queues = params->uapsd_queues; |
| 10953 | StaParams.max_sp = params->max_sp; |
| 10954 | |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 10955 | /* Convert (first channel , number of channels) tuple to |
| 10956 | * the total list of channels. This goes with the assumption |
| 10957 | * that if the first channel is < 14, then the next channels |
| 10958 | * are an incremental of 1 else an incremental of 4 till the number |
| 10959 | * of channels. |
| 10960 | */ |
| 10961 | if (0 != params->supported_channels_len) { |
| 10962 | int i = 0,j = 0,k = 0, no_of_channels = 0 ; |
| 10963 | for ( i = 0 ; i < params->supported_channels_len ; i+=2) |
| 10964 | { |
| 10965 | int wifi_chan_index; |
| 10966 | StaParams.supported_channels[j] = params->supported_channels[i]; |
| 10967 | wifi_chan_index = |
| 10968 | ((StaParams.supported_channels[j] <= HDD_CHANNEL_14 ) ? 1 : 4 ); |
| 10969 | no_of_channels = params->supported_channels[i+1]; |
| 10970 | for(k=1; k <= no_of_channels; k++) |
| 10971 | { |
| 10972 | StaParams.supported_channels[j+1] = |
| 10973 | StaParams.supported_channels[j] + wifi_chan_index; |
| 10974 | j+=1; |
| 10975 | } |
| 10976 | } |
| 10977 | StaParams.supported_channels_len = j; |
| 10978 | } |
| 10979 | vos_mem_copy(StaParams.supported_oper_classes, |
| 10980 | params->supported_oper_classes, |
| 10981 | params->supported_oper_classes_len); |
| 10982 | StaParams.supported_oper_classes_len = |
| 10983 | params->supported_oper_classes_len; |
| 10984 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10985 | if (0 != params->ext_capab_len) |
| 10986 | vos_mem_copy(StaParams.extn_capability, params->ext_capab, |
| 10987 | sizeof(StaParams.extn_capability)); |
| 10988 | |
| 10989 | if (NULL != params->ht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10990 | { |
| 10991 | StaParams.htcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10992 | vos_mem_copy(&StaParams.HTCap, params->ht_capa, sizeof(tSirHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 10993 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 10994 | |
| 10995 | StaParams.supported_rates_len = params->supported_rates_len; |
| 10996 | |
| 10997 | /* Note : The Maximum sizeof supported_rates sent by the Supplicant is 32. |
| 10998 | * The supported_rates array , for all the structures propogating till Add Sta |
| 10999 | * to the firmware has to be modified , if the supplicant (ieee80211) is |
| 11000 | * modified to send more rates. |
| 11001 | */ |
| 11002 | |
| 11003 | /* To avoid Data Currption , set to max length to SIR_MAC_MAX_SUPP_RATES |
| 11004 | */ |
| 11005 | if (StaParams.supported_rates_len > SIR_MAC_MAX_SUPP_RATES) |
| 11006 | StaParams.supported_rates_len = SIR_MAC_MAX_SUPP_RATES; |
| 11007 | |
| 11008 | if (0 != StaParams.supported_rates_len) { |
| 11009 | int i = 0; |
| 11010 | vos_mem_copy(StaParams.supported_rates, params->supported_rates, |
| 11011 | StaParams.supported_rates_len); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11012 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11013 | "Supported Rates with Length %d", StaParams.supported_rates_len); |
| 11014 | for (i=0; i < StaParams.supported_rates_len; i++) |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 11015 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11016 | "[%d]: %0x", i, StaParams.supported_rates[i]); |
| 11017 | } |
| 11018 | |
| 11019 | if (NULL != params->vht_capa) |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11020 | { |
| 11021 | StaParams.vhtcap_present = 1; |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11022 | vos_mem_copy(&StaParams.VHTCap, params->vht_capa, sizeof(tSirVHTCap)); |
Hoonki Lee | 66b75f3 | 2013-04-16 18:30:07 -0700 | [diff] [blame] | 11023 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 11024 | |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11025 | if (0 != params->ext_capab_len ) { |
| 11026 | /*Define A Macro : TODO Sunil*/ |
| 11027 | if ((1<<4) & StaParams.extn_capability[3]) { |
| 11028 | isBufSta = 1; |
| 11029 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 11030 | /* TDLS Channel Switching Support */ |
| 11031 | if ((1<<6) & StaParams.extn_capability[3]) { |
| 11032 | isOffChannelSupported = 1; |
| 11033 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11034 | } |
Naresh Jayaram | 3180aa4 | 2014-02-12 21:47:26 +0530 | [diff] [blame] | 11035 | status = wlan_hdd_tdls_set_peer_caps( pAdapter, mac, |
| 11036 | &StaParams, isBufSta, |
| 11037 | isOffChannelSupported); |
| 11038 | |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 11039 | if (VOS_STATUS_SUCCESS != status) { |
| 11040 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11041 | "%s: wlan_hdd_tdls_set_peer_caps failed!", __func__); |
| 11042 | return -EINVAL; |
| 11043 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 11044 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 1, &StaParams); |
| 11045 | |
| 11046 | if (VOS_STATUS_SUCCESS != status) { |
| 11047 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11048 | "%s: sme_ChangeTdlsPeerSta failed!", __func__); |
| 11049 | return -EINVAL; |
| 11050 | } |
| 11051 | } |
Gopichand Nakkala | b085622 | 2013-03-12 22:39:05 -0700 | [diff] [blame] | 11052 | #endif |
Gopichand Nakkala | 6239acd | 2013-06-14 14:48:00 +0530 | [diff] [blame] | 11053 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11054 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11055 | return status; |
| 11056 | } |
| 11057 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11058 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 11059 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 11060 | struct net_device *dev, |
| 11061 | const u8 *mac, |
| 11062 | struct station_parameters *params) |
| 11063 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11064 | static int wlan_hdd_change_station(struct wiphy *wiphy, |
| 11065 | struct net_device *dev, |
| 11066 | u8 *mac, |
| 11067 | struct station_parameters *params) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 11068 | #endif |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11069 | { |
| 11070 | int ret; |
| 11071 | |
| 11072 | vos_ssr_protect(__func__); |
| 11073 | ret = __wlan_hdd_change_station(wiphy, dev, mac, params); |
| 11074 | vos_ssr_unprotect(__func__); |
| 11075 | |
| 11076 | return ret; |
| 11077 | } |
| 11078 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11079 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11080 | * FUNCTION: __wlan_hdd_cfg80211_add_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11081 | * This function is used to initialize the key information |
| 11082 | */ |
| 11083 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11084 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11085 | struct net_device *ndev, |
| 11086 | u8 key_index, bool pairwise, |
| 11087 | const u8 *mac_addr, |
| 11088 | struct key_params *params |
| 11089 | ) |
| 11090 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11091 | static int __wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11092 | struct net_device *ndev, |
| 11093 | u8 key_index, const u8 *mac_addr, |
| 11094 | struct key_params *params |
| 11095 | ) |
| 11096 | #endif |
| 11097 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11098 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11099 | tCsrRoamSetKey setKey; |
| 11100 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11101 | int status; |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11102 | v_U32_t roamId= 0xFF; |
| 11103 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11104 | hdd_hostapd_state_t *pHostapdState; |
| 11105 | VOS_STATUS vos_status; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11106 | eHalStatus halStatus; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11107 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11108 | |
| 11109 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11110 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11111 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11112 | TRACE_CODE_HDD_CFG80211_ADD_KEY, |
| 11113 | pAdapter->sessionId, params->key_len)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11114 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11115 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11116 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11117 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11118 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11119 | } |
| 11120 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11121 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 11122 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11123 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11124 | |
| 11125 | if (CSR_MAX_NUM_KEY <= key_index) |
| 11126 | { |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11127 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11128 | key_index); |
| 11129 | |
| 11130 | return -EINVAL; |
| 11131 | } |
| 11132 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11133 | if (CSR_MAX_KEY_LEN < params->key_len) |
| 11134 | { |
| 11135 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key length %d", __func__, |
| 11136 | params->key_len); |
| 11137 | |
| 11138 | return -EINVAL; |
| 11139 | } |
| 11140 | |
| 11141 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 11142 | "%s: called with key index = %d & key length %d", |
| 11143 | __func__, key_index, params->key_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11144 | |
| 11145 | /*extract key idx, key len and key*/ |
| 11146 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 11147 | setKey.keyId = key_index; |
| 11148 | setKey.keyLength = params->key_len; |
| 11149 | vos_mem_copy(&setKey.Key[0],params->key, params->key_len); |
| 11150 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11151 | switch (params->cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11152 | { |
| 11153 | case WLAN_CIPHER_SUITE_WEP40: |
| 11154 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 11155 | break; |
| 11156 | |
| 11157 | case WLAN_CIPHER_SUITE_WEP104: |
| 11158 | setKey.encType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 11159 | break; |
| 11160 | |
| 11161 | case WLAN_CIPHER_SUITE_TKIP: |
| 11162 | { |
| 11163 | u8 *pKey = &setKey.Key[0]; |
| 11164 | setKey.encType = eCSR_ENCRYPT_TYPE_TKIP; |
| 11165 | |
| 11166 | vos_mem_zero(pKey, CSR_MAX_KEY_LEN); |
| 11167 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11168 | /*Supplicant sends the 32bytes key in this order |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11169 | |
| 11170 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11171 | | Tk1 |TX-MIC | RX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11172 | |--------------|----------|----------| |
| 11173 | <---16bytes---><--8bytes--><--8bytes--> |
| 11174 | |
| 11175 | */ |
| 11176 | /*Sme expects the 32 bytes key to be in the below order |
| 11177 | |
| 11178 | |--------------|----------|----------| |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11179 | | Tk1 |RX-MIC | TX Mic | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11180 | |--------------|----------|----------| |
| 11181 | <---16bytes---><--8bytes--><--8bytes--> |
| 11182 | */ |
| 11183 | /* Copy the Temporal Key 1 (TK1) */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11184 | vos_mem_copy(pKey, params->key, 16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11185 | |
| 11186 | /*Copy the rx mic first*/ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11187 | vos_mem_copy(&pKey[16], ¶ms->key[24], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11188 | |
| 11189 | /*Copy the tx mic */ |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11190 | vos_mem_copy(&pKey[24], ¶ms->key[16], 8); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11191 | |
| 11192 | |
| 11193 | break; |
| 11194 | } |
| 11195 | |
| 11196 | case WLAN_CIPHER_SUITE_CCMP: |
| 11197 | setKey.encType = eCSR_ENCRYPT_TYPE_AES; |
| 11198 | break; |
| 11199 | |
| 11200 | #ifdef FEATURE_WLAN_WAPI |
| 11201 | case WLAN_CIPHER_SUITE_SMS4: |
| 11202 | { |
| 11203 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 11204 | wlan_hdd_cfg80211_set_key_wapi(pAdapter, key_index, mac_addr, |
| 11205 | params->key, params->key_len); |
| 11206 | return 0; |
| 11207 | } |
| 11208 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11209 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 11210 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11211 | case WLAN_CIPHER_SUITE_KRK: |
| 11212 | setKey.encType = eCSR_ENCRYPT_TYPE_KRK; |
| 11213 | break; |
| 11214 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11215 | |
| 11216 | #ifdef WLAN_FEATURE_11W |
| 11217 | case WLAN_CIPHER_SUITE_AES_CMAC: |
| 11218 | setKey.encType = eCSR_ENCRYPT_TYPE_AES_CMAC; |
Chet Lanctot | 3b5158a | 2013-03-31 16:45:21 -0700 | [diff] [blame] | 11219 | break; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 11220 | #endif |
| 11221 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11222 | default: |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 11223 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unsupported cipher type %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11224 | __func__, params->cipher); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11225 | status = -EOPNOTSUPP; |
| 11226 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11227 | } |
| 11228 | |
| 11229 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: encryption type %d", |
| 11230 | __func__, setKey.encType); |
| 11231 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11232 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11233 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11234 | (!pairwise) |
| 11235 | #else |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11236 | (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11237 | #endif |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11238 | ) |
| 11239 | { |
| 11240 | /* set group key*/ |
| 11241 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11242 | "%s- %d: setting Broadcast key", |
| 11243 | __func__, __LINE__); |
| 11244 | setKey.keyDirection = eSIR_RX_ONLY; |
| 11245 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 11246 | } |
| 11247 | else |
| 11248 | { |
| 11249 | /* set pairwise key*/ |
| 11250 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11251 | "%s- %d: setting pairwise key", |
| 11252 | __func__, __LINE__); |
| 11253 | setKey.keyDirection = eSIR_TX_RX; |
| 11254 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 11255 | } |
| 11256 | if ((WLAN_HDD_IBSS == pAdapter->device_mode) && !pairwise) |
| 11257 | { |
| 11258 | setKey.keyDirection = eSIR_TX_RX; |
| 11259 | /*Set the group key*/ |
| 11260 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11261 | pAdapter->sessionId, &setKey, &roamId ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11262 | |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11263 | if ( 0 != status ) |
| 11264 | { |
| 11265 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11266 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11267 | status = -EINVAL; |
| 11268 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11269 | } |
| 11270 | /*Save the keys here and call sme_RoamSetKey for setting |
| 11271 | the PTK after peer joins the IBSS network*/ |
| 11272 | vos_mem_copy(&pAdapter->sessionCtx.station.ibss_enc_key, |
| 11273 | &setKey, sizeof(tCsrRoamSetKey)); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11274 | goto end; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 11275 | } |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11276 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) || |
| 11277 | (pAdapter->device_mode == WLAN_HDD_P2P_GO)) |
| 11278 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11279 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11280 | if( pHostapdState->bssState == BSS_START ) |
| 11281 | { |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 11282 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11283 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
| 11284 | |
| 11285 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 11286 | { |
| 11287 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11288 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 11289 | __LINE__, vos_status ); |
| 11290 | |
| 11291 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 11292 | |
| 11293 | status = -EINVAL; |
| 11294 | goto end; |
| 11295 | } |
| 11296 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11297 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
| 11298 | |
| 11299 | if ( status != eHAL_STATUS_SUCCESS ) |
| 11300 | { |
| 11301 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11302 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 11303 | __LINE__, status ); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11304 | status = -EINVAL; |
| 11305 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11306 | } |
| 11307 | } |
| 11308 | |
| 11309 | /* Saving WEP keys */ |
| 11310 | else if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == setKey.encType || |
| 11311 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == setKey.encType ) |
| 11312 | { |
| 11313 | //Save the wep key in ap context. Issue setkey after the BSS is started. |
| 11314 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 11315 | vos_mem_copy(&pAPCtx->wepKey[key_index], &setKey, sizeof(tCsrRoamSetKey)); |
| 11316 | } |
| 11317 | else |
| 11318 | { |
| 11319 | //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] | 11320 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11321 | vos_mem_copy(&pAPCtx->groupKey, &setKey, sizeof(tCsrRoamSetKey)); |
| 11322 | } |
| 11323 | } |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11324 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) || |
| 11325 | (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11326 | { |
| 11327 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11328 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11329 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11330 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11331 | if (!pairwise) |
| 11332 | #else |
| 11333 | if (!mac_addr || is_broadcast_ether_addr(mac_addr)) |
| 11334 | #endif |
| 11335 | { |
| 11336 | /* set group key*/ |
| 11337 | if (pHddStaCtx->roam_info.deferKeyComplete) |
| 11338 | { |
| 11339 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 11340 | "%s- %d: Perform Set key Complete", |
| 11341 | __func__, __LINE__); |
| 11342 | hdd_PerformRoamSetKeyComplete(pAdapter); |
| 11343 | } |
| 11344 | } |
| 11345 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11346 | pWextState->roamProfile.Keys.KeyLength[key_index] = (u8)params->key_len; |
| 11347 | |
Venkata Prathyusha Kuntupalli | ee2ce71 | 2013-01-17 14:09:24 -0800 | [diff] [blame] | 11348 | pWextState->roamProfile.Keys.defaultIndex = key_index; |
| 11349 | |
| 11350 | |
Jeff Johnson | f77ef0a | 2013-03-27 09:29:14 -0700 | [diff] [blame] | 11351 | vos_mem_copy(&pWextState->roamProfile.Keys.KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11352 | params->key, params->key_len); |
| 11353 | |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11354 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11355 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 11356 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11357 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11358 | "%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] | 11359 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 11360 | setKey.peerMac[2], setKey.peerMac[3], |
| 11361 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11362 | setKey.keyDirection); |
| 11363 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 11364 | vos_status = wlan_hdd_check_ula_done(pAdapter); |
Nirav Shah | 4f765af | 2015-01-21 19:51:30 +0530 | [diff] [blame] | 11365 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 11366 | if ( vos_status != VOS_STATUS_SUCCESS ) |
| 11367 | { |
| 11368 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11369 | "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d", |
| 11370 | __LINE__, vos_status ); |
| 11371 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 11372 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11373 | |
Nirav Shah | 4b53d4b | 2015-05-08 05:35:00 -0700 | [diff] [blame] | 11374 | status = -EINVAL; |
| 11375 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11376 | |
| 11377 | } |
| 11378 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11379 | #ifdef WLAN_FEATURE_VOWIFI_11R |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11380 | /* The supplicant may attempt to set the PTK once pre-authentication |
| 11381 | is done. Save the key in the UMAC and include it in the ADD BSS |
| 11382 | request */ |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11383 | halStatus = sme_FTUpdateKey( WLAN_HDD_GET_HAL_CTX(pAdapter), &setKey); |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11384 | if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS ) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11385 | { |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11386 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
| 11387 | "%s: Update PreAuth Key success", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11388 | status = 0; |
| 11389 | goto end; |
Gopichand Nakkala | 3d29592 | 2013-05-07 16:19:14 +0530 | [diff] [blame] | 11390 | } |
| 11391 | else if ( halStatus == eHAL_STATUS_FT_PREAUTH_KEY_FAILED ) |
| 11392 | { |
| 11393 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11394 | "%s: Update PreAuth Key failed", __func__); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11395 | status = -EINVAL; |
| 11396 | goto end; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 11397 | } |
| 11398 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11399 | |
| 11400 | /* issue set key request to SME*/ |
| 11401 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 11402 | pAdapter->sessionId, &setKey, &roamId ); |
| 11403 | |
| 11404 | if ( 0 != status ) |
| 11405 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11406 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11407 | "%s: sme_RoamSetKey failed, returned %d", __func__, status); |
| 11408 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11409 | status = -EINVAL; |
| 11410 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11411 | } |
| 11412 | |
| 11413 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11414 | /* in case of IBSS as there was no information available about WEP keys during |
| 11415 | * 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] | 11416 | * with correct value*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11417 | if ( (eCSR_BSS_TYPE_START_IBSS == pWextState->roamProfile.BSSType) && |
| 11418 | !( ( IW_AUTH_KEY_MGMT_802_1X |
| 11419 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11420 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == pHddStaCtx->conn_info.authType) |
| 11421 | ) |
| 11422 | && |
| 11423 | ( (WLAN_CIPHER_SUITE_WEP40 == params->cipher) |
| 11424 | || (WLAN_CIPHER_SUITE_WEP104 == params->cipher) |
| 11425 | ) |
| 11426 | ) |
| 11427 | { |
| 11428 | setKey.keyDirection = eSIR_RX_ONLY; |
| 11429 | vos_mem_copy(setKey.peerMac,groupmacaddr,WNI_CFG_BSSID_LEN); |
| 11430 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11431 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11432 | "%s: set key peerMac %2x:%2x:%2x:%2x:%2x:%2x, direction %d", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11433 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 11434 | setKey.peerMac[2], setKey.peerMac[3], |
| 11435 | setKey.peerMac[4], setKey.peerMac[5], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11436 | setKey.keyDirection); |
| 11437 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11438 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11439 | pAdapter->sessionId, &setKey, &roamId ); |
| 11440 | |
| 11441 | if ( 0 != status ) |
| 11442 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11443 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11444 | "%s: sme_RoamSetKey failed for group key (IBSS), returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11445 | __func__, status); |
| 11446 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11447 | status = -EINVAL; |
| 11448 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11449 | } |
| 11450 | } |
| 11451 | } |
| 11452 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11453 | end: |
| 11454 | /* Need to clear any trace of key value in the memory. |
| 11455 | * Thus zero out the memory even though it is local |
| 11456 | * variable. |
| 11457 | */ |
| 11458 | vos_mem_zero(&setKey, sizeof(setKey)); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 11459 | EXIT(); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 11460 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11461 | } |
| 11462 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11463 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11464 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 11465 | struct net_device *ndev, |
| 11466 | u8 key_index, bool pairwise, |
| 11467 | const u8 *mac_addr, |
| 11468 | struct key_params *params |
| 11469 | ) |
| 11470 | #else |
| 11471 | static int wlan_hdd_cfg80211_add_key( struct wiphy *wiphy, |
| 11472 | struct net_device *ndev, |
| 11473 | u8 key_index, const u8 *mac_addr, |
| 11474 | struct key_params *params |
| 11475 | ) |
| 11476 | #endif |
| 11477 | { |
| 11478 | int ret; |
| 11479 | vos_ssr_protect(__func__); |
| 11480 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11481 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, pairwise, |
| 11482 | mac_addr, params); |
| 11483 | #else |
| 11484 | ret = __wlan_hdd_cfg80211_add_key(wiphy, ndev, key_index, mac_addr, |
| 11485 | params); |
| 11486 | #endif |
| 11487 | vos_ssr_unprotect(__func__); |
| 11488 | |
| 11489 | return ret; |
| 11490 | } |
| 11491 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11492 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11493 | * FUNCTION: __wlan_hdd_cfg80211_get_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11494 | * This function is used to get the key information |
| 11495 | */ |
| 11496 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11497 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11498 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11499 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11500 | u8 key_index, bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11501 | const u8 *mac_addr, void *cookie, |
| 11502 | void (*callback)(void *cookie, struct key_params*) |
| 11503 | ) |
| 11504 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11505 | static int __wlan_hdd_cfg80211_get_key( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11506 | struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11507 | struct net_device *ndev, |
| 11508 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 11509 | void (*callback)(void *cookie, struct key_params*) |
| 11510 | ) |
| 11511 | #endif |
| 11512 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11513 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11514 | hdd_wext_state_t *pWextState = NULL; |
| 11515 | tCsrRoamProfile *pRoamProfile = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11516 | struct key_params params; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11517 | hdd_context_t *pHddCtx; |
| 11518 | int ret = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11519 | |
| 11520 | ENTER(); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11521 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11522 | if (NULL == pAdapter) |
| 11523 | { |
| 11524 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11525 | "%s: HDD adapter is Null", __func__); |
| 11526 | return -ENODEV; |
| 11527 | } |
| 11528 | |
| 11529 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11530 | ret = wlan_hdd_validate_context(pHddCtx); |
| 11531 | if (0 != ret) |
| 11532 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 11533 | return ret; |
| 11534 | } |
| 11535 | |
| 11536 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11537 | pRoamProfile = &(pWextState->roamProfile); |
| 11538 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 11539 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 11540 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 11541 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11542 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11543 | memset(¶ms, 0, sizeof(params)); |
| 11544 | |
| 11545 | if (CSR_MAX_NUM_KEY <= key_index) |
| 11546 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 11547 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid key index %d"), key_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11548 | return -EINVAL; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11549 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11550 | |
| 11551 | switch(pRoamProfile->EncryptionType.encryptionType[0]) |
| 11552 | { |
| 11553 | case eCSR_ENCRYPT_TYPE_NONE: |
| 11554 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 11555 | break; |
| 11556 | |
| 11557 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 11558 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 11559 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 11560 | break; |
| 11561 | |
| 11562 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 11563 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 11564 | params.cipher = WLAN_CIPHER_SUITE_WEP104; |
| 11565 | break; |
| 11566 | |
| 11567 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 11568 | params.cipher = WLAN_CIPHER_SUITE_TKIP; |
| 11569 | break; |
| 11570 | |
| 11571 | case eCSR_ENCRYPT_TYPE_AES: |
| 11572 | params.cipher = WLAN_CIPHER_SUITE_AES_CMAC; |
| 11573 | break; |
| 11574 | |
| 11575 | default: |
| 11576 | params.cipher = IW_AUTH_CIPHER_NONE; |
| 11577 | break; |
| 11578 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11579 | |
c_hpothu | aaf1969 | 2014-05-17 17:01:48 +0530 | [diff] [blame] | 11580 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11581 | TRACE_CODE_HDD_CFG80211_GET_KEY, |
| 11582 | pAdapter->sessionId, params.cipher)); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11583 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11584 | params.key_len = pRoamProfile->Keys.KeyLength[key_index]; |
| 11585 | params.seq_len = 0; |
| 11586 | params.seq = NULL; |
| 11587 | params.key = &pRoamProfile->Keys.KeyMaterial[key_index][0]; |
| 11588 | callback(cookie, ¶ms); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 11589 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11590 | return 0; |
| 11591 | } |
| 11592 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11593 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11594 | static int wlan_hdd_cfg80211_get_key( |
| 11595 | struct wiphy *wiphy, |
| 11596 | struct net_device *ndev, |
| 11597 | u8 key_index, bool pairwise, |
| 11598 | const u8 *mac_addr, void *cookie, |
| 11599 | void (*callback)(void *cookie, struct key_params*) |
| 11600 | ) |
| 11601 | #else |
| 11602 | static int wlan_hdd_cfg80211_get_key( |
| 11603 | struct wiphy *wiphy, |
| 11604 | struct net_device *ndev, |
| 11605 | u8 key_index, const u8 *mac_addr, void *cookie, |
| 11606 | void (*callback)(void *cookie, struct key_params*) |
| 11607 | ) |
| 11608 | #endif |
| 11609 | { |
| 11610 | int ret; |
| 11611 | |
| 11612 | vos_ssr_protect(__func__); |
| 11613 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11614 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, pairwise, |
| 11615 | mac_addr, cookie, callback); |
| 11616 | #else |
| 11617 | ret = __wlan_hdd_cfg80211_get_key(wiphy, ndev, key_index, mac_addr, |
| 11618 | callback); |
| 11619 | #endif |
| 11620 | vos_ssr_unprotect(__func__); |
| 11621 | |
| 11622 | return ret; |
| 11623 | } |
| 11624 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11625 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11626 | * FUNCTION: __wlan_hdd_cfg80211_del_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11627 | * This function is used to delete the key information |
| 11628 | */ |
| 11629 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11630 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11631 | struct net_device *ndev, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11632 | u8 key_index, |
| 11633 | bool pairwise, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11634 | const u8 *mac_addr |
| 11635 | ) |
| 11636 | #else |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11637 | static int __wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11638 | struct net_device *ndev, |
| 11639 | u8 key_index, |
| 11640 | const u8 *mac_addr |
| 11641 | ) |
| 11642 | #endif |
| 11643 | { |
| 11644 | int status = 0; |
| 11645 | |
| 11646 | //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] | 11647 | //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] | 11648 | //it is observed that this is invalidating peer |
| 11649 | //key index whenever re-key is done. This is affecting data link. |
| 11650 | //It should be ok to ignore del_key. |
| 11651 | #if 0 |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11652 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
| 11653 | v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11654 | u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 11655 | tCsrRoamSetKey setKey; |
| 11656 | v_U32_t roamId= 0xFF; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11657 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11658 | ENTER(); |
| 11659 | |
| 11660 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device_mode = %d\n", |
| 11661 | __func__,pAdapter->device_mode); |
| 11662 | |
| 11663 | if (CSR_MAX_NUM_KEY <= key_index) |
| 11664 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11665 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11666 | key_index); |
| 11667 | |
| 11668 | return -EINVAL; |
| 11669 | } |
| 11670 | |
| 11671 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 11672 | setKey.keyId = key_index; |
| 11673 | |
| 11674 | if (mac_addr) |
| 11675 | vos_mem_copy(setKey.peerMac, mac_addr,WNI_CFG_BSSID_LEN); |
| 11676 | else |
| 11677 | vos_mem_copy(setKey.peerMac, groupmacaddr, WNI_CFG_BSSID_LEN); |
| 11678 | |
| 11679 | setKey.encType = eCSR_ENCRYPT_TYPE_NONE; |
| 11680 | |
| 11681 | if ((pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11682 | || (pAdapter->device_mode == WLAN_HDD_P2P_GO) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11683 | ) |
| 11684 | { |
| 11685 | |
| 11686 | hdd_hostapd_state_t *pHostapdState = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11687 | WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 11688 | if( pHostapdState->bssState == BSS_START) |
| 11689 | { |
| 11690 | status = WLANSAP_SetKeySta( pVosContext, &setKey); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11691 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11692 | if ( status != eHAL_STATUS_SUCCESS ) |
| 11693 | { |
| 11694 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 11695 | "[%4d] WLANSAP_SetKeySta returned ERROR status= %d", |
| 11696 | __LINE__, status ); |
| 11697 | } |
| 11698 | } |
| 11699 | } |
| 11700 | else if ( (pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11701 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11702 | ) |
| 11703 | { |
| 11704 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11705 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11706 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_SETTING_KEY; |
| 11707 | |
| 11708 | hddLog(VOS_TRACE_LEVEL_INFO_MED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11709 | "%s: delete key for peerMac %2x:%2x:%2x:%2x:%2x:%2x", |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11710 | __func__, setKey.peerMac[0], setKey.peerMac[1], |
| 11711 | setKey.peerMac[2], setKey.peerMac[3], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11712 | setKey.peerMac[4], setKey.peerMac[5]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11713 | if(pAdapter->sessionCtx.station.conn_info.connState == |
| 11714 | eConnectionState_Associated) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11715 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11716 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11717 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11718 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11719 | if ( 0 != status ) |
| 11720 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11721 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11722 | "%s: sme_RoamSetKey failure, returned %d", |
| 11723 | __func__, status); |
| 11724 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 11725 | return -EINVAL; |
| 11726 | } |
| 11727 | } |
| 11728 | } |
| 11729 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 11730 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11731 | return status; |
| 11732 | } |
| 11733 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 11734 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11735 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 11736 | struct net_device *ndev, |
| 11737 | u8 key_index, |
| 11738 | bool pairwise, |
| 11739 | const u8 *mac_addr |
| 11740 | ) |
| 11741 | #else |
| 11742 | static int wlan_hdd_cfg80211_del_key( struct wiphy *wiphy, |
| 11743 | struct net_device *ndev, |
| 11744 | u8 key_index, |
| 11745 | const u8 *mac_addr |
| 11746 | ) |
| 11747 | #endif |
| 11748 | { |
| 11749 | int ret; |
| 11750 | |
| 11751 | vos_ssr_protect(__func__); |
| 11752 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11753 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, pairwise, |
| 11754 | mac_addr); |
| 11755 | #else |
| 11756 | ret = __wlan_hdd_cfg80211_del_key(wiphy, ndev, key_index, mac_addr); |
| 11757 | #endif |
| 11758 | vos_ssr_unprotect(__func__); |
| 11759 | |
| 11760 | return ret; |
| 11761 | } |
| 11762 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11763 | /* |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11764 | * FUNCTION: __wlan_hdd_cfg80211_set_default_key |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11765 | * This function is used to set the default tx key index |
| 11766 | */ |
| 11767 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11768 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11769 | struct net_device *ndev, |
| 11770 | u8 key_index, |
| 11771 | bool unicast, bool multicast) |
| 11772 | #else |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11773 | static int __wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11774 | struct net_device *ndev, |
| 11775 | u8 key_index) |
| 11776 | #endif |
| 11777 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11778 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11779 | int status; |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11780 | hdd_wext_state_t *pWextState; |
| 11781 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11782 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11783 | |
| 11784 | ENTER(); |
| 11785 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11786 | if ((NULL == pAdapter)) |
| 11787 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 11788 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11789 | "invalid adapter"); |
| 11790 | return -EINVAL; |
| 11791 | } |
| 11792 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 11793 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 11794 | TRACE_CODE_HDD_CFG80211_SET_DEFAULT_KEY, |
| 11795 | pAdapter->sessionId, key_index)); |
| 11796 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11797 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 11798 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 11799 | |
| 11800 | if ((NULL == pWextState) || (NULL == pHddStaCtx)) |
| 11801 | { |
| 11802 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 11803 | "invalid Wext state or HDD context"); |
| 11804 | return -EINVAL; |
| 11805 | } |
| 11806 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11807 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d key_index = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11808 | __func__,pAdapter->device_mode, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11809 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11810 | if (CSR_MAX_NUM_KEY <= key_index) |
| 11811 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11812 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid key index %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11813 | key_index); |
| 11814 | |
| 11815 | return -EINVAL; |
| 11816 | } |
| 11817 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11818 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 11819 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11820 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11821 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 11822 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 11823 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11824 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11825 | if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11826 | || (pAdapter->device_mode == WLAN_HDD_P2P_CLIENT) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11827 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11828 | { |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11829 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 11830 | pHddStaCtx->conn_info.ucEncryptionType) && |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11831 | (eCSR_ENCRYPT_TYPE_AES != |
Arif Hussain | 6943f52 | 2013-11-04 20:10:10 -0800 | [diff] [blame] | 11832 | pHddStaCtx->conn_info.ucEncryptionType) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11833 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11834 | { |
| 11835 | /* if default key index is not same as previous one, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11836 | * then update the default key index */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11837 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11838 | tCsrRoamSetKey setKey; |
| 11839 | v_U32_t roamId= 0xFF; |
| 11840 | tCsrKeys *Keys = &pWextState->roamProfile.Keys; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11841 | |
| 11842 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: default tx key index %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11843 | __func__, key_index); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11844 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11845 | Keys->defaultIndex = (u8)key_index; |
| 11846 | vos_mem_zero(&setKey,sizeof(tCsrRoamSetKey)); |
| 11847 | setKey.keyId = key_index; |
| 11848 | setKey.keyLength = Keys->KeyLength[key_index]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11849 | |
| 11850 | vos_mem_copy(&setKey.Key[0], |
| 11851 | &Keys->KeyMaterial[key_index][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11852 | Keys->KeyLength[key_index]); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11853 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11854 | setKey.keyDirection = eSIR_TX_RX; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11855 | |
| 11856 | vos_mem_copy(setKey.peerMac, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11857 | &pHddStaCtx->conn_info.bssId[0], |
| 11858 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11859 | |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 11860 | if (Keys->KeyLength[key_index] == CSR_WEP40_KEY_LEN && |
| 11861 | pWextState->roamProfile.EncryptionType.encryptionType[0] == |
| 11862 | eCSR_ENCRYPT_TYPE_WEP104) |
| 11863 | { |
| 11864 | /*In the case of dynamic wep supplicant hardcodes DWEP type to eCSR_ENCRYPT_TYPE_WEP104 |
| 11865 | even though ap is configured for WEP-40 encryption. In this canse the key length |
| 11866 | is 5 but the encryption type is 104 hence checking the key langht(5) and encryption |
| 11867 | type(104) and switching encryption type to 40*/ |
| 11868 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 11869 | eCSR_ENCRYPT_TYPE_WEP40; |
| 11870 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 11871 | eCSR_ENCRYPT_TYPE_WEP40; |
| 11872 | } |
| 11873 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11874 | setKey.encType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11875 | pWextState->roamProfile.EncryptionType.encryptionType[0]; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11876 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11877 | /* issue set key request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11878 | status = sme_RoamSetKey( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11879 | pAdapter->sessionId, &setKey, &roamId ); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11880 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11881 | if ( 0 != status ) |
| 11882 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11883 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 11884 | "%s: sme_RoamSetKey failed, returned %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11885 | status); |
| 11886 | return -EINVAL; |
| 11887 | } |
| 11888 | } |
| 11889 | } |
| 11890 | |
| 11891 | /* In SoftAp mode setting key direction for default mode */ |
| 11892 | else if ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) |
| 11893 | { |
| 11894 | if ( (eCSR_ENCRYPT_TYPE_TKIP != |
| 11895 | pWextState->roamProfile.EncryptionType.encryptionType[0]) && |
| 11896 | (eCSR_ENCRYPT_TYPE_AES != |
| 11897 | pWextState->roamProfile.EncryptionType.encryptionType[0]) |
| 11898 | ) |
| 11899 | { |
| 11900 | /* Saving key direction for default key index to TX default */ |
| 11901 | hdd_ap_ctx_t *pAPCtx = WLAN_HDD_GET_AP_CTX_PTR(pAdapter); |
| 11902 | pAPCtx->wepKey[key_index].keyDirection = eSIR_TX_DEFAULT; |
| 11903 | } |
| 11904 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 11905 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11906 | return status; |
| 11907 | } |
| 11908 | |
Mahesh A Saptasagar | 1a51bc0 | 2014-06-02 18:28:08 +0530 | [diff] [blame] | 11909 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11910 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 11911 | struct net_device *ndev, |
| 11912 | u8 key_index, |
| 11913 | bool unicast, bool multicast) |
| 11914 | #else |
| 11915 | static int wlan_hdd_cfg80211_set_default_key( struct wiphy *wiphy, |
| 11916 | struct net_device *ndev, |
| 11917 | u8 key_index) |
| 11918 | #endif |
| 11919 | { |
| 11920 | int ret; |
| 11921 | vos_ssr_protect(__func__); |
| 11922 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 11923 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index, unicast, |
| 11924 | multicast); |
| 11925 | #else |
| 11926 | ret = __wlan_hdd_cfg80211_set_default_key(wiphy, ndev, key_index); |
| 11927 | #endif |
| 11928 | vos_ssr_unprotect(__func__); |
| 11929 | |
| 11930 | return ret; |
| 11931 | } |
| 11932 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11933 | /* |
| 11934 | * FUNCTION: wlan_hdd_cfg80211_inform_bss |
| 11935 | * This function is used to inform the BSS details to nl80211 interface. |
| 11936 | */ |
| 11937 | static struct cfg80211_bss* wlan_hdd_cfg80211_inform_bss( |
| 11938 | hdd_adapter_t *pAdapter, tCsrRoamConnectedProfile *roamProfile) |
| 11939 | { |
| 11940 | struct net_device *dev = pAdapter->dev; |
| 11941 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 11942 | struct wiphy *wiphy = wdev->wiphy; |
| 11943 | tSirBssDescription *pBssDesc = roamProfile->pBssDesc; |
| 11944 | int chan_no; |
| 11945 | int ie_length; |
| 11946 | const char *ie; |
| 11947 | unsigned int freq; |
| 11948 | struct ieee80211_channel *chan; |
| 11949 | int rssi = 0; |
| 11950 | struct cfg80211_bss *bss = NULL; |
| 11951 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11952 | if( NULL == pBssDesc ) |
| 11953 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11954 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pBssDesc is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11955 | return bss; |
| 11956 | } |
| 11957 | |
| 11958 | chan_no = pBssDesc->channelId; |
| 11959 | ie_length = GET_IE_LEN_IN_BSS_DESC( pBssDesc->length ); |
| 11960 | ie = ((ie_length != 0) ? (const char *)&pBssDesc->ieFields: NULL); |
| 11961 | |
| 11962 | if( NULL == ie ) |
| 11963 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 11964 | 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] | 11965 | return bss; |
| 11966 | } |
| 11967 | |
| 11968 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
| 11969 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ)) |
| 11970 | { |
| 11971 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 11972 | } |
| 11973 | else |
| 11974 | { |
| 11975 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 11976 | } |
| 11977 | #else |
| 11978 | freq = ieee80211_channel_to_frequency(chan_no); |
| 11979 | #endif |
| 11980 | |
| 11981 | chan = __ieee80211_get_channel(wiphy, freq); |
| 11982 | |
Santhosh Kumar Padma | a45fdb1 | 2014-04-15 15:54:38 +0530 | [diff] [blame] | 11983 | if (!chan) { |
| 11984 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
| 11985 | return NULL; |
| 11986 | } |
| 11987 | |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 11988 | rssi = (VOS_MIN ((pBssDesc->rssi + pBssDesc->sinr), 0))*100; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11989 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 11990 | return cfg80211_inform_bss(wiphy, chan, |
| 11991 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 11992 | CFG80211_BSS_FTYPE_UNKNOWN, |
| 11993 | #endif |
| 11994 | pBssDesc->bssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 11995 | le64_to_cpu(*(__le64 *)pBssDesc->timeStamp), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11996 | pBssDesc->capabilityInfo, |
| 11997 | pBssDesc->beaconInterval, ie, ie_length, |
Abhishek Singh | aee4394 | 2014-06-16 18:55:47 +0530 | [diff] [blame] | 11998 | rssi, GFP_KERNEL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 11999 | } |
| 12000 | |
| 12001 | |
| 12002 | |
| 12003 | /* |
| 12004 | * FUNCTION: wlan_hdd_cfg80211_inform_bss_frame |
| 12005 | * This function is used to inform the BSS details to nl80211 interface. |
| 12006 | */ |
| 12007 | struct cfg80211_bss* |
| 12008 | wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, |
| 12009 | tSirBssDescription *bss_desc |
| 12010 | ) |
| 12011 | { |
| 12012 | /* |
| 12013 | cfg80211_inform_bss() is not updating ie field of bss entry, if entry |
| 12014 | already exists in bss data base of cfg80211 for that particular BSS ID. |
| 12015 | Using cfg80211_inform_bss_frame to update the bss entry instead of |
| 12016 | cfg80211_inform_bss, But this call expects mgmt packet as input. As of |
| 12017 | now there is no possibility to get the mgmt(probe response) frame from PE, |
| 12018 | converting bss_desc to ieee80211_mgmt(probe response) and passing to |
| 12019 | cfg80211_inform_bss_frame. |
| 12020 | */ |
| 12021 | struct net_device *dev = pAdapter->dev; |
| 12022 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 12023 | struct wiphy *wiphy = wdev->wiphy; |
| 12024 | int chan_no = bss_desc->channelId; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 12025 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 12026 | qcom_ie_age *qie_age = NULL; |
| 12027 | int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age); |
| 12028 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12029 | 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] | 12030 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12031 | const char *ie = |
| 12032 | ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); |
| 12033 | unsigned int freq; |
| 12034 | struct ieee80211_channel *chan; |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 12035 | struct ieee80211_mgmt *mgmt = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12036 | struct cfg80211_bss *bss_status = NULL; |
| 12037 | size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; |
| 12038 | int rssi = 0; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12039 | hdd_context_t *pHddCtx; |
| 12040 | int status; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12041 | #ifdef WLAN_OPEN_SOURCE |
| 12042 | struct timespec ts; |
| 12043 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12044 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 12045 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12046 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12047 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12048 | if (0 != status) |
| 12049 | { |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 12050 | return NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12051 | } |
| 12052 | |
Abhishek Singh | 1e2bfa3 | 2014-01-02 15:44:15 +0530 | [diff] [blame] | 12053 | mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12054 | if (!mgmt) |
| 12055 | { |
| 12056 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12057 | "%s: memory allocation failed ", __func__); |
| 12058 | return NULL; |
| 12059 | } |
Madan Mohan Koyyalamudi | 2e5c914 | 2012-11-02 13:17:48 -0700 | [diff] [blame] | 12060 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12061 | memcpy(mgmt->bssid, bss_desc->bssId, ETH_ALEN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12062 | |
| 12063 | #ifdef WLAN_OPEN_SOURCE |
| 12064 | /* Android does not want the timestamp from the frame. |
| 12065 | Instead it wants a monotonic increasing value */ |
| 12066 | get_monotonic_boottime(&ts); |
| 12067 | mgmt->u.probe_resp.timestamp = |
| 12068 | ((u64)ts.tv_sec * 1000000) + (ts.tv_nsec / 1000); |
| 12069 | #else |
| 12070 | /* keep old behavior for non-open source (for now) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12071 | memcpy(&mgmt->u.probe_resp.timestamp, bss_desc->timeStamp, |
| 12072 | sizeof (bss_desc->timeStamp)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12073 | |
| 12074 | #endif |
| 12075 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12076 | mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval; |
| 12077 | mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo; |
Madan Mohan Koyyalamudi | 86f629e | 2012-11-09 16:27:29 -0800 | [diff] [blame] | 12078 | |
| 12079 | #ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS |
| 12080 | /* GPS Requirement: need age ie per entry. Using vendor specific. */ |
| 12081 | /* Assuming this is the last IE, copy at the end */ |
| 12082 | ie_length -=sizeof(qcom_ie_age); |
| 12083 | qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length); |
| 12084 | qie_age->element_id = QCOM_VENDOR_IE_ID; |
| 12085 | qie_age->len = QCOM_VENDOR_IE_AGE_LEN; |
| 12086 | qie_age->oui_1 = QCOM_OUI1; |
| 12087 | qie_age->oui_2 = QCOM_OUI2; |
| 12088 | qie_age->oui_3 = QCOM_OUI3; |
| 12089 | qie_age->type = QCOM_VENDOR_IE_AGE_TYPE; |
| 12090 | qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime; |
| 12091 | #endif |
| 12092 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12093 | memcpy(mgmt->u.probe_resp.variable, ie, ie_length); |
Gopichand Nakkala | d908ec8 | 2013-05-16 19:32:19 +0530 | [diff] [blame] | 12094 | if (bss_desc->fProbeRsp) |
| 12095 | { |
| 12096 | mgmt->frame_control |= |
| 12097 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); |
| 12098 | } |
| 12099 | else |
| 12100 | { |
| 12101 | mgmt->frame_control |= |
| 12102 | (u16)(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
| 12103 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12104 | |
| 12105 | #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,38)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12106 | if (chan_no <= ARRAY_SIZE(hdd_channels_2_4_GHZ) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12107 | (wiphy->bands[IEEE80211_BAND_2GHZ] != NULL)) |
| 12108 | { |
| 12109 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_2GHZ); |
| 12110 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12111 | else if ((chan_no > ARRAY_SIZE(hdd_channels_2_4_GHZ)) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12112 | (wiphy->bands[IEEE80211_BAND_5GHZ] != NULL)) |
| 12113 | |
| 12114 | { |
| 12115 | freq = ieee80211_channel_to_frequency(chan_no, IEEE80211_BAND_5GHZ); |
| 12116 | } |
| 12117 | else |
| 12118 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 12119 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s Invalid chan_no:%d", |
| 12120 | __func__, chan_no); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12121 | kfree(mgmt); |
| 12122 | return NULL; |
| 12123 | } |
| 12124 | #else |
| 12125 | freq = ieee80211_channel_to_frequency(chan_no); |
| 12126 | #endif |
| 12127 | chan = __ieee80211_get_channel(wiphy, freq); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 12128 | /*when the band is changed on the fly using the GUI, three things are done |
| 12129 | * 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) |
| 12130 | * as part of the scan abort, message willbe queued to PE and we proceed with flushing and changinh the band. |
| 12131 | * pe will stop the scanning further and report back the results what ever it had till now by calling the call back function. |
| 12132 | * if the time between update band and scandone call back is sufficent enough the band change reflects in SME, SME validates the channels |
| 12133 | * and discards the channels correponding to previous band and calls back with zero bss results. |
| 12134 | * 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 |
| 12135 | * all the channels correponding to previous band.this is due to race condition.but those channels are invalid to the new band and so |
| 12136 | * this function __ieee80211_get_channel will return NULL.Each time we report scan result with this pointer null warning kernel trace is printed. |
| 12137 | * if the scan results contain large number of APs continuosly kernel warning trace is printed and it will lead to apps watch dog bark. |
| 12138 | * So drop the bss and continue to next bss. |
| 12139 | */ |
| 12140 | if(chan == NULL) |
| 12141 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 12142 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s chan pointer is NULL", __func__); |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 12143 | kfree(mgmt); |
Leela V Kiran Kumar Reddy | 90032de | 2013-01-24 18:33:30 -0800 | [diff] [blame] | 12144 | return NULL; |
| 12145 | } |
Hanumantha Reddy Pothula | 904bcef | 2015-06-19 11:56:29 +0530 | [diff] [blame] | 12146 | /*To keep the rssi icon of the connected AP in the scan window |
| 12147 | *and the rssi icon of the wireless networks in sync |
| 12148 | * */ |
| 12149 | if (( eConnectionState_Associated == |
| 12150 | pAdapter->sessionCtx.station.conn_info.connState ) && |
| 12151 | ( VOS_TRUE == vos_mem_compare(bss_desc->bssId, |
| 12152 | pAdapter->sessionCtx.station.conn_info.bssId, |
| 12153 | WNI_CFG_BSSID_LEN)) && |
| 12154 | (pHddCtx->hdd_wlan_suspended == FALSE)) |
| 12155 | { |
| 12156 | /* supplicant takes the signal strength in terms of mBm(100*dBm) */ |
| 12157 | rssi = (pAdapter->rssi * 100); |
| 12158 | } |
| 12159 | else |
| 12160 | { |
| 12161 | rssi = (VOS_MIN ((bss_desc->rssi + bss_desc->sinr), 0))*100; |
| 12162 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12163 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 12164 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: BSSID:" MAC_ADDRESS_STR " Channel:%d" |
Sushant Kaushik | 0b34342 | 2015-05-25 17:15:55 +0530 | [diff] [blame] | 12165 | " RSSI:%d", __func__, MAC_ADDR_ARRAY(mgmt->bssid), |
| 12166 | vos_freq_to_chan(chan->center_freq), (int)(rssi/100)); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 12167 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12168 | bss_status = cfg80211_inform_bss_frame(wiphy, chan, mgmt, |
| 12169 | frame_len, rssi, GFP_KERNEL); |
| 12170 | kfree(mgmt); |
| 12171 | return bss_status; |
| 12172 | } |
| 12173 | |
| 12174 | /* |
| 12175 | * FUNCTION: wlan_hdd_cfg80211_update_bss_db |
| 12176 | * This function is used to update the BSS data base of CFG8011 |
| 12177 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12178 | 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] | 12179 | tCsrRoamInfo *pRoamInfo |
| 12180 | ) |
| 12181 | { |
| 12182 | tCsrRoamConnectedProfile roamProfile; |
| 12183 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 12184 | struct cfg80211_bss *bss = NULL; |
| 12185 | |
| 12186 | ENTER(); |
| 12187 | |
| 12188 | memset(&roamProfile, 0, sizeof(tCsrRoamConnectedProfile)); |
| 12189 | sme_RoamGetConnectProfile(hHal, pAdapter->sessionId, &roamProfile); |
| 12190 | |
| 12191 | if (NULL != roamProfile.pBssDesc) |
| 12192 | { |
Girish Gowli | f4b6802 | 2014-08-28 23:18:57 +0530 | [diff] [blame] | 12193 | bss = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 12194 | roamProfile.pBssDesc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12195 | |
| 12196 | if (NULL == bss) |
| 12197 | { |
| 12198 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: cfg80211_inform_bss return NULL", |
| 12199 | __func__); |
| 12200 | } |
| 12201 | |
| 12202 | sme_RoamFreeConnectProfile(hHal, &roamProfile); |
| 12203 | } |
| 12204 | else |
| 12205 | { |
| 12206 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: roamProfile.pBssDesc is NULL", |
| 12207 | __func__); |
| 12208 | } |
| 12209 | return bss; |
| 12210 | } |
| 12211 | |
| 12212 | /* |
| 12213 | * FUNCTION: wlan_hdd_cfg80211_update_bss |
| 12214 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12215 | static int wlan_hdd_cfg80211_update_bss( struct wiphy *wiphy, |
| 12216 | hdd_adapter_t *pAdapter |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12217 | ) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12218 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12219 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12220 | tCsrScanResultInfo *pScanResult; |
| 12221 | eHalStatus status = 0; |
| 12222 | tScanResultHandle pResult; |
| 12223 | struct cfg80211_bss *bss_status = NULL; |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12224 | hdd_context_t *pHddCtx; |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 12225 | bool is_p2p_scan = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12226 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12227 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 12228 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12229 | TRACE_CODE_HDD_CFG80211_UPDATE_BSS, |
| 12230 | NO_SESSION, pAdapter->sessionId)); |
| 12231 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12232 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 12233 | |
| 12234 | if (pHddCtx->isLogpInProgress) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12235 | { |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12236 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 12237 | "%s:LOGP in Progress. Ignore!!!",__func__); |
| 12238 | return -EAGAIN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12239 | } |
| 12240 | |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12241 | |
| 12242 | /*bss_update is not allowed during wlan driver loading or unloading*/ |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 12243 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Wilson Yang | f80a054 | 2013-10-07 13:02:37 -0700 | [diff] [blame] | 12244 | { |
| 12245 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12246 | "%s:Loading_unloading in Progress. Ignore!!!",__func__); |
| 12247 | return VOS_STATUS_E_PERM; |
| 12248 | } |
| 12249 | |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 12250 | if (pAdapter->request != NULL) |
| 12251 | { |
| 12252 | if ((pAdapter->request->n_ssids == 1) |
| 12253 | && (pAdapter->request->ssids != NULL) |
| 12254 | && vos_mem_compare(&pAdapter->request->ssids[0], "DIRECT-", 7)) |
| 12255 | is_p2p_scan = true; |
| 12256 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12257 | /* |
| 12258 | * start getting scan results and populate cgf80211 BSS database |
| 12259 | */ |
| 12260 | status = sme_ScanGetResult(hHal, pAdapter->sessionId, NULL, &pResult); |
| 12261 | |
| 12262 | /* no scan results */ |
| 12263 | if (NULL == pResult) |
| 12264 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 12265 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: No scan result Status %d", |
| 12266 | __func__, status); |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 12267 | wlan_hdd_get_frame_logs(pAdapter, |
| 12268 | WLAN_HDD_GET_FRAME_LOG_CMD_SEND_AND_CLEAR); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12269 | return status; |
| 12270 | } |
| 12271 | |
| 12272 | pScanResult = sme_ScanResultGetFirst(hHal, pResult); |
| 12273 | |
| 12274 | while (pScanResult) |
| 12275 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12276 | /* |
| 12277 | * cfg80211_inform_bss() is not updating ie field of bss entry, if |
| 12278 | * entry already exists in bss data base of cfg80211 for that |
| 12279 | * particular BSS ID. Using cfg80211_inform_bss_frame to update the |
| 12280 | * bss entry instead of cfg80211_inform_bss, But this call expects |
| 12281 | * mgmt packet as input. As of now there is no possibility to get |
| 12282 | * the mgmt(probe response) frame from PE, converting bss_desc to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12283 | * ieee80211_mgmt(probe response) and passing to c |
| 12284 | * fg80211_inform_bss_frame. |
| 12285 | * */ |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 12286 | if(is_p2p_scan && (pScanResult->ssId.ssId != NULL) && |
| 12287 | !vos_mem_compare( pScanResult->ssId.ssId, "DIRECT-", 7) ) |
| 12288 | { |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 12289 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 12290 | continue; //Skip the non p2p bss entries |
| 12291 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12292 | bss_status = wlan_hdd_cfg80211_inform_bss_frame(pAdapter, |
| 12293 | &pScanResult->BssDescriptor); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12294 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12295 | |
| 12296 | if (NULL == bss_status) |
| 12297 | { |
| 12298 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12299 | "%s: NULL returned by cfg80211_inform_bss", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12300 | } |
| 12301 | else |
| 12302 | { |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 12303 | cfg80211_put_bss( |
| 12304 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) |
| 12305 | wiphy, |
| 12306 | #endif |
| 12307 | bss_status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12308 | } |
| 12309 | |
| 12310 | pScanResult = sme_ScanResultGetNext(hHal, pResult); |
| 12311 | } |
| 12312 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12313 | sme_ScanResultPurge(hHal, pResult); |
Deepthi Gowri | 10d0ae1 | 2015-05-25 14:39:50 +0530 | [diff] [blame] | 12314 | is_p2p_scan = false; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12315 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12316 | } |
| 12317 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12318 | void |
| 12319 | hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel) |
| 12320 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12321 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 12322 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(macAddr)); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12323 | } /****** end hddPrintMacAddr() ******/ |
| 12324 | |
| 12325 | void |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 12326 | hddPrintPmkId(tANI_U8 *pmkId, tANI_U8 logLevel) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12327 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12328 | VOS_TRACE(VOS_MODULE_ID_HDD, logLevel, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12329 | "%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] | 12330 | pmkId[0], pmkId[1], pmkId[2], pmkId[3], pmkId[4], |
| 12331 | pmkId[5], pmkId[6], pmkId[7], pmkId[8], pmkId[9], pmkId[10], |
| 12332 | pmkId[11], pmkId[12], pmkId[13], pmkId[14], pmkId[15]); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12333 | } /****** end hddPrintPmkId() ******/ |
| 12334 | |
| 12335 | //hddPrintMacAddr(tCsrBssid macAddr, tANI_U8 logLevel); |
| 12336 | //hddPrintMacAddr(macAddr, VOS_TRACE_LEVEL_FATAL); |
| 12337 | |
| 12338 | //void sirDumpBuf(tpAniSirGlobal pMac, tANI_U8 modId, tANI_U32 level, tANI_U8 *buf, tANI_U32 size); |
| 12339 | //sirDumpBuf(pMac, VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, pmkid, 16); |
| 12340 | |
| 12341 | #define dump_bssid(bssid) \ |
| 12342 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12343 | hddLog(VOS_TRACE_LEVEL_INFO, "BSSID (MAC) address:\t"); \ |
| 12344 | hddPrintMacAddr(bssid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12345 | } |
| 12346 | |
| 12347 | #define dump_pmkid(pMac, pmkid) \ |
| 12348 | { \ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12349 | hddLog(VOS_TRACE_LEVEL_INFO, "PMKSA-ID:\t"); \ |
| 12350 | hddPrintPmkId(pmkid, VOS_TRACE_LEVEL_INFO);\ |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12351 | } |
| 12352 | |
Madan Mohan Koyyalamudi | 1b4afb0 | 2012-10-22 15:25:16 -0700 | [diff] [blame] | 12353 | #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] | 12354 | /* |
| 12355 | * FUNCTION: wlan_hdd_cfg80211_pmksa_candidate_notify |
| 12356 | * This function is used to notify the supplicant of a new PMKSA candidate. |
| 12357 | */ |
| 12358 | int wlan_hdd_cfg80211_pmksa_candidate_notify( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12359 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12360 | int index, bool preauth ) |
| 12361 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12362 | #ifdef FEATURE_WLAN_OKC |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12363 | struct net_device *dev = pAdapter->dev; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 12364 | hdd_context_t *pHddCtx = (hdd_context_t*)pAdapter->pHddCtx; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12365 | |
| 12366 | ENTER(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12367 | 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] | 12368 | |
| 12369 | if( NULL == pRoamInfo ) |
| 12370 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12371 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: pRoamInfo is NULL", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12372 | return -EINVAL; |
| 12373 | } |
| 12374 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 12375 | if (eANI_BOOLEAN_TRUE == hdd_is_okc_mode_enabled(pHddCtx)) |
| 12376 | { |
| 12377 | dump_bssid(pRoamInfo->bssid); |
| 12378 | cfg80211_pmksa_candidate_notify(dev, index, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12379 | pRoamInfo->bssid, preauth, GFP_KERNEL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 12380 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12381 | #endif /* FEATURE_WLAN_OKC */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12382 | return 0; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 12383 | } |
| 12384 | #endif //FEATURE_WLAN_LFR |
| 12385 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 12386 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 12387 | /* |
| 12388 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth |
| 12389 | * 802.11r/LFR metrics reporting function to report preauth initiation |
| 12390 | * |
| 12391 | */ |
| 12392 | #define MAX_LFR_METRICS_EVENT_LENGTH 100 |
| 12393 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth(hdd_adapter_t *pAdapter, |
| 12394 | tCsrRoamInfo *pRoamInfo) |
| 12395 | { |
| 12396 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 12397 | union iwreq_data wrqu; |
| 12398 | |
| 12399 | ENTER(); |
| 12400 | |
| 12401 | if (NULL == pAdapter) |
| 12402 | { |
| 12403 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 12404 | return VOS_STATUS_E_FAILURE; |
| 12405 | } |
| 12406 | |
| 12407 | /* create the event */ |
| 12408 | memset(&wrqu, 0, sizeof(wrqu)); |
| 12409 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 12410 | |
| 12411 | wrqu.data.pointer = metrics_notification; |
| 12412 | wrqu.data.length = scnprintf(metrics_notification, |
| 12413 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_INIT " |
| 12414 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 12415 | |
| 12416 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 12417 | |
| 12418 | EXIT(); |
| 12419 | |
| 12420 | return VOS_STATUS_SUCCESS; |
| 12421 | } |
| 12422 | |
| 12423 | /* |
| 12424 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_preauth_status |
| 12425 | * 802.11r/LFR metrics reporting function to report preauth completion |
| 12426 | * or failure |
| 12427 | */ |
| 12428 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_preauth_status( |
| 12429 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, bool preauth_status) |
| 12430 | { |
| 12431 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 12432 | union iwreq_data wrqu; |
| 12433 | |
| 12434 | ENTER(); |
| 12435 | |
| 12436 | if (NULL == pAdapter) |
| 12437 | { |
| 12438 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 12439 | return VOS_STATUS_E_FAILURE; |
| 12440 | } |
| 12441 | |
| 12442 | /* create the event */ |
| 12443 | memset(&wrqu, 0, sizeof(wrqu)); |
| 12444 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 12445 | |
| 12446 | scnprintf(metrics_notification, sizeof(metrics_notification), |
| 12447 | "QCOM: LFR_PREAUTH_STATUS "MAC_ADDRESS_STR, |
| 12448 | MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 12449 | |
| 12450 | if (1 == preauth_status) |
| 12451 | strncat(metrics_notification, " TRUE", 5); |
| 12452 | else |
| 12453 | strncat(metrics_notification, " FALSE", 6); |
| 12454 | |
| 12455 | wrqu.data.pointer = metrics_notification; |
| 12456 | wrqu.data.length = strlen(metrics_notification); |
| 12457 | |
| 12458 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 12459 | |
| 12460 | EXIT(); |
| 12461 | |
| 12462 | return VOS_STATUS_SUCCESS; |
| 12463 | } |
| 12464 | |
| 12465 | /* |
| 12466 | * FUNCTION: wlan_hdd_cfg80211_roam_metrics_handover |
| 12467 | * 802.11r/LFR metrics reporting function to report handover initiation |
| 12468 | * |
| 12469 | */ |
| 12470 | VOS_STATUS wlan_hdd_cfg80211_roam_metrics_handover(hdd_adapter_t * pAdapter, |
| 12471 | tCsrRoamInfo *pRoamInfo) |
| 12472 | { |
| 12473 | unsigned char metrics_notification[MAX_LFR_METRICS_EVENT_LENGTH + 1]; |
| 12474 | union iwreq_data wrqu; |
| 12475 | |
| 12476 | ENTER(); |
| 12477 | |
| 12478 | if (NULL == pAdapter) |
| 12479 | { |
| 12480 | hddLog(LOGE, "%s: pAdapter is NULL!", __func__); |
| 12481 | return VOS_STATUS_E_FAILURE; |
| 12482 | } |
| 12483 | |
| 12484 | /* create the event */ |
| 12485 | memset(&wrqu, 0, sizeof(wrqu)); |
| 12486 | memset(metrics_notification, 0, sizeof(metrics_notification)); |
| 12487 | |
| 12488 | wrqu.data.pointer = metrics_notification; |
| 12489 | wrqu.data.length = scnprintf(metrics_notification, |
| 12490 | sizeof(metrics_notification), "QCOM: LFR_PREAUTH_HANDOVER " |
| 12491 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pRoamInfo->bssid)); |
| 12492 | |
| 12493 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, metrics_notification); |
| 12494 | |
| 12495 | EXIT(); |
| 12496 | |
| 12497 | return VOS_STATUS_SUCCESS; |
| 12498 | } |
| 12499 | #endif |
| 12500 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12501 | /* |
| 12502 | * FUNCTION: hdd_cfg80211_scan_done_callback |
| 12503 | * scanning callback function, called after finishing scan |
| 12504 | * |
| 12505 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12506 | static eHalStatus hdd_cfg80211_scan_done_callback(tHalHandle halHandle, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12507 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 12508 | { |
| 12509 | struct net_device *dev = (struct net_device *) pContext; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12510 | //struct wireless_dev *wdev = dev->ieee80211_ptr; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12511 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12512 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12513 | struct cfg80211_scan_request *req = NULL; |
| 12514 | int ret = 0; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12515 | bool aborted = false; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12516 | long waitRet = 0; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 12517 | tANI_U8 i; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12518 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12519 | |
| 12520 | ENTER(); |
| 12521 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12522 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Siddharth Bhal | 5c2e02d | 2015-05-05 17:35:29 +0530 | [diff] [blame] | 12523 | if (NULL == pHddCtx) { |
| 12524 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is Null")); |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 12525 | goto allow_suspend; |
| 12526 | } |
| 12527 | |
| 12528 | pScanInfo = &pHddCtx->scan_info; |
| 12529 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12530 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12531 | "%s called with halHandle = %p, pContext = %p," |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12532 | "scanID = %d, returned status = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12533 | __func__, halHandle, pContext, (int) scanId, (int) status); |
| 12534 | |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 12535 | pScanInfo->mScanPendingCounter = 0; |
| 12536 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12537 | //Block on scan req completion variable. Can't wait forever though. |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12538 | waitRet = wait_for_completion_interruptible_timeout( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12539 | &pScanInfo->scan_req_completion_event, |
| 12540 | msecs_to_jiffies(WLAN_WAIT_TIME_SCAN_REQ)); |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12541 | if (waitRet <= 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12542 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 12543 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12544 | "%s wait on scan_req_completion_event failed %ld",__func__, waitRet); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12545 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12546 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12547 | } |
| 12548 | |
Yue Ma | ef60827 | 2013-04-08 23:09:17 -0700 | [diff] [blame] | 12549 | if (pScanInfo->mScanPending != VOS_TRUE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12550 | { |
| 12551 | VOS_ASSERT(pScanInfo->mScanPending); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12552 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12553 | } |
| 12554 | |
| 12555 | /* Check the scanId */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12556 | if (pScanInfo->scanId != scanId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12557 | { |
| 12558 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12559 | "%s called with mismatched scanId pScanInfo->scanId = %d " |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12560 | "scanId = %d", __func__, (int) pScanInfo->scanId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12561 | (int) scanId); |
| 12562 | } |
| 12563 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12564 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12565 | pAdapter); |
| 12566 | |
| 12567 | if (0 > ret) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12568 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12569 | |
| 12570 | |
| 12571 | /* If any client wait scan result through WEXT |
| 12572 | * send scan done event to client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 12573 | if (pHddCtx->scan_info.waitScanResult) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12574 | { |
| 12575 | /* The other scan request waiting for current scan finish |
| 12576 | * Send event to notify current scan finished */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 12577 | if(WEXT_SCAN_PENDING_DELAY == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12578 | { |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 12579 | vos_event_set(&pHddCtx->scan_info.scan_finished_event); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12580 | } |
| 12581 | /* Send notify to WEXT client */ |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 12582 | else if(WEXT_SCAN_PENDING_PIGGYBACK == pHddCtx->scan_info.scan_pending_option) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12583 | { |
| 12584 | struct net_device *dev = pAdapter->dev; |
| 12585 | union iwreq_data wrqu; |
| 12586 | int we_event; |
| 12587 | char *msg; |
| 12588 | |
| 12589 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 12590 | we_event = SIOCGIWSCAN; |
| 12591 | msg = NULL; |
| 12592 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 12593 | } |
| 12594 | } |
Madan Mohan Koyyalamudi | 2a1ba77 | 2012-10-11 14:59:06 -0700 | [diff] [blame] | 12595 | pHddCtx->scan_info.waitScanResult = FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12596 | |
| 12597 | /* Get the Scan Req */ |
| 12598 | req = pAdapter->request; |
| 12599 | |
| 12600 | if (!req) |
| 12601 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 12602 | hddLog(VOS_TRACE_LEVEL_ERROR, "request is became NULL"); |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 12603 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12604 | goto allow_suspend; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12605 | } |
| 12606 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12607 | pAdapter->request = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12608 | /* Scan is no longer pending */ |
| 12609 | pScanInfo->mScanPending = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12610 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 12611 | /* last_scan_timestamp is used to decide if new scan |
| 12612 | * is needed or not on station interface. If last station |
| 12613 | * scan time and new station scan time is less then |
| 12614 | * last_scan_timestamp ; driver will return cached scan. |
| 12615 | */ |
| 12616 | if (req->no_cck == FALSE && status == eCSR_SCAN_SUCCESS) // no_cck will be set during p2p find |
| 12617 | { |
| 12618 | pScanInfo->last_scan_timestamp = vos_timer_get_system_time(); |
| 12619 | |
| 12620 | if ( req->n_channels ) |
| 12621 | { |
| 12622 | for (i = 0; i < req->n_channels ; i++ ) |
| 12623 | { |
| 12624 | pHddCtx->scan_info.last_scan_channelList[i] = req->channels[i]->hw_value; |
| 12625 | } |
| 12626 | /* store no of channel scanned */ |
| 12627 | pHddCtx->scan_info.last_scan_numChannels= req->n_channels; |
| 12628 | } |
| 12629 | |
| 12630 | } |
| 12631 | |
Madan Mohan Koyyalamudi | b764bf8 | 2012-10-11 16:38:51 -0700 | [diff] [blame] | 12632 | /* |
| 12633 | * cfg80211_scan_done informing NL80211 about completion |
| 12634 | * of scanning |
| 12635 | */ |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 12636 | if (status == eCSR_SCAN_ABORT || status == eCSR_SCAN_FAILURE) |
| 12637 | { |
| 12638 | aborted = true; |
| 12639 | } |
| 12640 | cfg80211_scan_done(req, aborted); |
Madan Mohan Koyyalamudi | f4e8100 | 2012-11-13 10:46:38 -0800 | [diff] [blame] | 12641 | complete(&pScanInfo->abortscan_event_var); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12642 | |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 12643 | if ((pHddCtx->cfg_ini->enableMacSpoofing == MAC_ADDR_SPOOFING_FW_HOST_ENABLE |
| 12644 | ) && (pHddCtx->spoofMacAddr.isEnabled |
| 12645 | || pHddCtx->spoofMacAddr.isReqDeferred)) { |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 12646 | /* Generate new random mac addr for next scan */ |
| 12647 | hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr"); |
| 12648 | hdd_processSpoofMacAddrRequest(pHddCtx); |
| 12649 | } |
| 12650 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12651 | allow_suspend: |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 12652 | /* release the wake lock at the end of the scan*/ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 12653 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 12654 | |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 12655 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 12656 | * immediatly after the driver gets connect request(i.e after scan) |
| 12657 | * from supplicant, this result in app's is suspending and not able |
| 12658 | * to process the connect request to AP */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 12659 | hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Madan Mohan Koyyalamudi | 10d83a9 | 2012-09-28 15:47:05 -0700 | [diff] [blame] | 12660 | |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 12661 | #ifdef FEATURE_WLAN_TDLS |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 12662 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
Gopichand Nakkala | 638ebc7 | 2013-03-21 18:04:02 -0700 | [diff] [blame] | 12663 | #endif |
| 12664 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12665 | EXIT(); |
| 12666 | return 0; |
| 12667 | } |
| 12668 | |
| 12669 | /* |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12670 | * FUNCTION: hdd_isConnectionInProgress |
| 12671 | * Go through each adapter and check if Connection is in progress |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12672 | * |
| 12673 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 12674 | v_BOOL_t hdd_isConnectionInProgress( hdd_context_t *pHddCtx) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12675 | { |
| 12676 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 12677 | hdd_station_ctx_t *pHddStaCtx = NULL; |
| 12678 | hdd_adapter_t *pAdapter = NULL; |
| 12679 | VOS_STATUS status = 0; |
| 12680 | v_U8_t staId = 0; |
| 12681 | v_U8_t *staMac = NULL; |
| 12682 | |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 12683 | if (TRUE == pHddCtx->btCoexModeSet) |
| 12684 | { |
| 12685 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12686 | FL("BTCoex Mode operation in progress")); |
| 12687 | return VOS_TRUE; |
c_hpothu | 9b781ba | 2013-12-30 20:57:45 +0530 | [diff] [blame] | 12688 | } |
| 12689 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12690 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 12691 | |
| 12692 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 12693 | { |
| 12694 | pAdapter = pAdapterNode->pAdapter; |
| 12695 | |
| 12696 | if( pAdapter ) |
| 12697 | { |
| 12698 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12699 | "%s: Adapter with device mode %s (%d) exists", |
| 12700 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12701 | pAdapter->device_mode); |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 12702 | if (((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12703 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 12704 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) && |
| 12705 | (eConnectionState_Connecting == |
| 12706 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 12707 | { |
| 12708 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12709 | "%s: %p(%d) Connection is in progress", __func__, |
| 12710 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 12711 | return VOS_TRUE; |
| 12712 | } |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 12713 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Padma, Santhosh Kumar | 3b9657d | 2015-02-04 19:37:32 +0530 | [diff] [blame] | 12714 | smeNeighborMiddleOfRoaming(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 12715 | { |
| 12716 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12717 | "%s: %p(%d) Reassociation is in progress", __func__, |
| 12718 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId); |
| 12719 | return VOS_TRUE; |
| 12720 | } |
| 12721 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12722 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 12723 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12724 | { |
| 12725 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12726 | if ((eConnectionState_Associated == pHddStaCtx->conn_info.connState) && |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12727 | (VOS_FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12728 | { |
| 12729 | staMac = (v_U8_t *) &(pAdapter->macAddressCurrent.bytes[0]); |
| 12730 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12731 | "%s: client " MAC_ADDRESS_STR |
| 12732 | " is in the middle of WPS/EAPOL exchange.", __func__, |
| 12733 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12734 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12735 | } |
| 12736 | } |
| 12737 | else if ((WLAN_HDD_SOFTAP == pAdapter->device_mode) || |
| 12738 | (WLAN_HDD_P2P_GO == pAdapter->device_mode)) |
| 12739 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 12740 | v_CONTEXT_t pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 12741 | ptSapContext pSapCtx = NULL; |
| 12742 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 12743 | if(pSapCtx == NULL){ |
| 12744 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 12745 | FL("psapCtx is NULL")); |
| 12746 | return VOS_FALSE; |
| 12747 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12748 | for (staId = 0; staId < WLAN_MAX_STA_COUNT; staId++) |
| 12749 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 12750 | if ((pSapCtx->aStaInfo[staId].isUsed) && |
| 12751 | (WLANTL_STA_CONNECTED == pSapCtx->aStaInfo[staId].tlSTAState)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12752 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 12753 | staMac = (v_U8_t *) &(pSapCtx->aStaInfo[staId].macAddrSTA.bytes[0]); |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12754 | |
| 12755 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 12756 | "%s: client " MAC_ADDRESS_STR " of SoftAP/P2P-GO is in the " |
| 12757 | "middle of WPS/EAPOL exchange.", __func__, |
| 12758 | MAC_ADDR_ARRAY(staMac)); |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12759 | return VOS_TRUE; |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12760 | } |
| 12761 | } |
| 12762 | } |
| 12763 | } |
| 12764 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 12765 | pAdapterNode = pNext; |
| 12766 | } |
Rashmi Ramanna | b142903 | 2014-04-26 14:59:09 +0530 | [diff] [blame] | 12767 | return VOS_FALSE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12768 | } |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12769 | |
| 12770 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12771 | * FUNCTION: __wlan_hdd_cfg80211_scan |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12772 | * this scan respond to scan trigger and update cfg80211 scan database |
| 12773 | * later, scan dump command can be used to recieve scan results |
| 12774 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 12775 | int __wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 12776 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 12777 | struct net_device *dev, |
| 12778 | #endif |
| 12779 | struct cfg80211_scan_request *request) |
| 12780 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 12781 | hdd_adapter_t *pAdapter = NULL; |
| 12782 | hdd_context_t *pHddCtx = NULL; |
| 12783 | hdd_wext_state_t *pwextBuf = NULL; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12784 | hdd_config_t *cfg_param = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12785 | tCsrScanRequest scanRequest; |
| 12786 | tANI_U8 *channelList = NULL, i; |
| 12787 | v_U32_t scanId = 0; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12788 | int status; |
| 12789 | hdd_scaninfo_t *pScanInfo = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12790 | v_U8_t* pP2pIe = NULL; |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 12791 | int ret = 0; |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 12792 | v_U8_t *pWpsIe=NULL; |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 12793 | bool is_p2p_scan = false; |
Hanumantha Reddy Pothula | 2e282d1 | 2015-06-19 14:01:26 +0530 | [diff] [blame] | 12794 | v_S7_t rssi=0; |
| 12795 | hdd_station_ctx_t *pHddStaCtx=NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12796 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 12797 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) |
| 12798 | struct net_device *dev = NULL; |
| 12799 | if (NULL == request) |
| 12800 | { |
| 12801 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12802 | "%s: scan req param null", __func__); |
| 12803 | return -EINVAL; |
| 12804 | } |
| 12805 | dev = request->wdev->netdev; |
| 12806 | #endif |
| 12807 | |
| 12808 | pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 12809 | pHddCtx = WLAN_HDD_GET_CTX( pAdapter ); |
| 12810 | pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 12811 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12812 | ENTER(); |
| 12813 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12814 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", |
| 12815 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12816 | pAdapter->device_mode); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 12817 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12818 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12819 | if (0 != status) |
| 12820 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12821 | return status; |
| 12822 | } |
| 12823 | |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 12824 | if (NULL == pwextBuf) |
| 12825 | { |
| 12826 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: invalid WEXT state\n", |
| 12827 | __func__); |
| 12828 | return -EIO; |
| 12829 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 12830 | cfg_param = pHddCtx->cfg_ini; |
| 12831 | pScanInfo = &pHddCtx->scan_info; |
| 12832 | |
Hanumantha Reddy Pothula | 2e282d1 | 2015-06-19 14:01:26 +0530 | [diff] [blame] | 12833 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 12834 | if ( (pHddStaCtx != NULL) && (TRUE == hdd_connIsConnected(pHddStaCtx))) |
| 12835 | { |
| 12836 | wlan_hdd_get_roam_rssi(pAdapter, &rssi); |
| 12837 | hddLog(VOS_TRACE_LEVEL_INFO, FL("rssi: %d"), rssi); |
| 12838 | } |
| 12839 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12840 | #ifdef WLAN_BTAMP_FEATURE |
| 12841 | //Scan not supported when AMP traffic is on. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12842 | if (VOS_TRUE == WLANBAP_AmpSessionOn()) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12843 | { |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 12844 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12845 | "%s: No scanning when AMP is on", __func__); |
| 12846 | return -EOPNOTSUPP; |
| 12847 | } |
| 12848 | #endif |
| 12849 | //Scan on any other interface is not supported. |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12850 | if (pAdapter->device_mode == WLAN_HDD_SOFTAP) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12851 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12852 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 12853 | "%s: Not scanning on device_mode = %s (%d)", |
| 12854 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 12855 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12856 | return -EOPNOTSUPP; |
| 12857 | } |
| 12858 | |
| 12859 | if (TRUE == pScanInfo->mScanPending) |
| 12860 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 12861 | if ( MAX_PENDING_LOG > pScanInfo->mScanPendingCounter++ ) |
| 12862 | { |
| 12863 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: mScanPending is TRUE", __func__); |
| 12864 | } |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12865 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12866 | } |
| 12867 | |
Hanumantha Reddy Pothula | 4b6be06 | 2015-08-18 14:06:24 +0530 | [diff] [blame] | 12868 | // Don't allow scan if PNO scan is going on. |
| 12869 | if (pHddCtx->isPnoEnable) |
| 12870 | { |
| 12871 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 12872 | FL("pno scan in progress")); |
| 12873 | return -EBUSY; |
| 12874 | } |
| 12875 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12876 | //Don't Allow Scan and return busy if Remain On |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12877 | //Channel and action frame is pending |
| 12878 | //Otherwise Cancel Remain On Channel and allow Scan |
| 12879 | //If no action frame pending |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 12880 | if (0 != wlan_hdd_check_remain_on_channel(pAdapter)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12881 | { |
Kiet Lam | ac06e2c | 2013-10-23 16:25:07 +0530 | [diff] [blame] | 12882 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Remain On Channel Pending", __func__); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 12883 | return -EBUSY; |
| 12884 | } |
| 12885 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12886 | if (mutex_lock_interruptible(&pHddCtx->tmInfo.tmOperationLock)) |
| 12887 | { |
| 12888 | VOS_TRACE(VOS_MODULE_ID_HDD,VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 12889 | "%s: Acquire lock fail", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12890 | return -EAGAIN; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12891 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12892 | if (TRUE == pHddCtx->tmInfo.tmAction.enterImps) |
| 12893 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 12894 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12895 | "%s: MAX TM Level Scan not allowed", __func__); |
| 12896 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12897 | return -EBUSY; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12898 | } |
| 12899 | mutex_unlock(&pHddCtx->tmInfo.tmOperationLock); |
| 12900 | |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12901 | /* Check if scan is allowed at this point of time. |
| 12902 | */ |
Padma, Santhosh Kumar | 98f271d | 2014-12-31 17:23:31 +0530 | [diff] [blame] | 12903 | if (hdd_isConnectionInProgress(pHddCtx)) |
Madan Mohan Koyyalamudi | cfd5374 | 2013-01-11 15:29:03 -0800 | [diff] [blame] | 12904 | { |
| 12905 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Scan not allowed", __func__); |
| 12906 | return -EBUSY; |
| 12907 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 12908 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12909 | vos_mem_zero( &scanRequest, sizeof(scanRequest)); |
| 12910 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 12911 | /* Even though supplicant doesn't provide any SSIDs, n_ssids is set to 1. |
| 12912 | * Becasue of this, driver is assuming that this is not wildcard scan and so |
| 12913 | * is not aging out the scan results. |
| 12914 | */ |
| 12915 | if (request->ssids && '\0' == request->ssids->ssid[0]) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12916 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 12917 | request->n_ssids = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12918 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 12919 | |
| 12920 | if ((request->ssids) && (0 < request->n_ssids)) |
| 12921 | { |
| 12922 | tCsrSSIDInfo *SsidInfo; |
| 12923 | int j; |
| 12924 | scanRequest.SSIDs.numOfSSIDs = request->n_ssids; |
| 12925 | /* Allocate num_ssid tCsrSSIDInfo structure */ |
| 12926 | SsidInfo = scanRequest.SSIDs.SSIDList = |
| 12927 | ( tCsrSSIDInfo *)vos_mem_malloc( |
| 12928 | request->n_ssids*sizeof(tCsrSSIDInfo)); |
| 12929 | |
| 12930 | if(NULL == scanRequest.SSIDs.SSIDList) |
| 12931 | { |
| 12932 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12933 | "%s: memory alloc failed SSIDInfo buffer", __func__); |
| 12934 | return -ENOMEM; |
| 12935 | } |
| 12936 | |
| 12937 | /* copy all the ssid's and their length */ |
| 12938 | for(j = 0; j < request->n_ssids; j++, SsidInfo++) |
| 12939 | { |
| 12940 | /* get the ssid length */ |
| 12941 | SsidInfo->SSID.length = request->ssids[j].ssid_len; |
| 12942 | vos_mem_copy(SsidInfo->SSID.ssId, &request->ssids[j].ssid[0], |
| 12943 | SsidInfo->SSID.length); |
| 12944 | SsidInfo->SSID.ssId[SsidInfo->SSID.length] = '\0'; |
| 12945 | hddLog(VOS_TRACE_LEVEL_INFO, "SSID number %d: %s", |
| 12946 | j, SsidInfo->SSID.ssId); |
| 12947 | } |
| 12948 | /* set the scan type to active */ |
| 12949 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
| 12950 | } |
| 12951 | else if(WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12952 | { |
Siddharth Bhal | 0c162d0 | 2014-05-06 19:50:42 +0530 | [diff] [blame] | 12953 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 12954 | TRACE_CODE_HDD_CFG80211_SCAN, |
| 12955 | pAdapter->sessionId, 0)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12956 | /* set the scan type to active */ |
| 12957 | scanRequest.scanType = eSIR_ACTIVE_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12958 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 12959 | else |
| 12960 | { |
| 12961 | /*Set the scan type to default type, in this case it is ACTIVE*/ |
| 12962 | scanRequest.scanType = pScanInfo->scan_mode; |
| 12963 | } |
| 12964 | scanRequest.minChnTime = cfg_param->nActiveMinChnTime; |
| 12965 | scanRequest.maxChnTime = cfg_param->nActiveMaxChnTime; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12966 | |
| 12967 | /* set BSSType to default type */ |
| 12968 | scanRequest.BSSType = eCSR_BSS_TYPE_ANY; |
| 12969 | |
| 12970 | /*TODO: scan the requested channels only*/ |
| 12971 | |
| 12972 | /*Right now scanning all the channels */ |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 12973 | if (MAX_CHANNEL < request->n_channels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 12974 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 12975 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 12976 | "No of Scan Channels exceeded limit: %d", request->n_channels); |
| 12977 | request->n_channels = MAX_CHANNEL; |
| 12978 | } |
| 12979 | |
| 12980 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 12981 | "No of Scan Channels: %d", request->n_channels); |
| 12982 | |
| 12983 | |
| 12984 | if( request->n_channels ) |
| 12985 | { |
| 12986 | char chList [(request->n_channels*5)+1]; |
| 12987 | int len; |
| 12988 | channelList = vos_mem_malloc( request->n_channels ); |
| 12989 | if( NULL == channelList ) |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 12990 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 12991 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 12992 | "%s: memory alloc failed channelList", __func__); |
| 12993 | status = -ENOMEM; |
| 12994 | goto free_mem; |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 12995 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 12996 | |
| 12997 | for( i = 0, len = 0; i < request->n_channels ; i++ ) |
| 12998 | { |
| 12999 | channelList[i] = request->channels[i]->hw_value; |
| 13000 | len += snprintf(chList+len, 5, "%d ", channelList[i]); |
| 13001 | } |
| 13002 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13003 | hddLog(VOS_TRACE_LEVEL_INFO, |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13004 | "Channel-List: %s ", chList); |
| 13005 | } |
c_hpothu | 5351230 | 2014-04-15 18:49:53 +0530 | [diff] [blame] | 13006 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13007 | scanRequest.ChannelInfo.numOfChannels = request->n_channels; |
| 13008 | scanRequest.ChannelInfo.ChannelList = channelList; |
| 13009 | |
| 13010 | /* set requestType to full scan */ |
| 13011 | scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; |
| 13012 | |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13013 | /* if there is back to back scan happening in driver with in |
| 13014 | * nDeferScanTimeInterval interval driver should defer new scan request |
| 13015 | * and should provide last cached scan results instead of new channel list. |
| 13016 | * This rule is not applicable if scan is p2p scan. |
| 13017 | * This condition will work only in case when last request no of channels |
| 13018 | * and channels are exactly same as new request. |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13019 | * This should be done only in connected state |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 13020 | * Scan shouldn't be defered for WPS scan case. |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13021 | */ |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13022 | |
Sushant Kaushik | 8659217 | 2015-04-27 16:35:03 +0530 | [diff] [blame] | 13023 | pWpsIe = wlan_hdd_get_wps_ie_ptr((v_U8_t*)request->ie,request->ie_len); |
| 13024 | /* if wps ie is NULL , then only defer scan */ |
| 13025 | if ( pWpsIe == NULL && |
| 13026 | (VOS_STATUS_SUCCESS == hdd_is_any_session_connected(pHddCtx))) |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13027 | { |
| 13028 | if ( pScanInfo->last_scan_timestamp !=0 && |
| 13029 | ((vos_timer_get_system_time() - pScanInfo->last_scan_timestamp ) < pHddCtx->cfg_ini->nDeferScanTimeInterval)) |
| 13030 | { |
| 13031 | if ( request->no_cck == FALSE && scanRequest.ChannelInfo.numOfChannels != 1 && |
| 13032 | (pScanInfo->last_scan_numChannels == scanRequest.ChannelInfo.numOfChannels) && |
| 13033 | vos_mem_compare(pScanInfo->last_scan_channelList, |
| 13034 | channelList, pScanInfo->last_scan_numChannels)) |
| 13035 | { |
| 13036 | hddLog(VOS_TRACE_LEVEL_WARN, |
| 13037 | " New and old station scan time differ is less then %u", |
| 13038 | pHddCtx->cfg_ini->nDeferScanTimeInterval); |
| 13039 | |
| 13040 | ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13041 | pAdapter); |
| 13042 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13043 | hddLog(VOS_TRACE_LEVEL_WARN, |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 13044 | "Return old cached scan as all channels and no of channels are same"); |
| 13045 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13046 | if (0 > ret) |
| 13047 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13048 | |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13049 | cfg80211_scan_done(request, eCSR_SCAN_SUCCESS); |
Masti, Narayanraddi | de03eb0 | 2015-02-06 11:23:50 +0530 | [diff] [blame] | 13050 | |
| 13051 | status = eHAL_STATUS_SUCCESS; |
| 13052 | goto free_mem; |
Agarwal Ashish | 57e8437 | 2014-12-05 18:26:53 +0530 | [diff] [blame] | 13053 | } |
| 13054 | } |
Agarwal Ashish | bd3e10b | 2014-11-24 19:19:46 +0530 | [diff] [blame] | 13055 | } |
| 13056 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13057 | /* Flush the scan results(only p2p beacons) for STA scan and P2P |
| 13058 | * search (Flush on both full scan and social scan but not on single |
| 13059 | * channel scan).P2P search happens on 3 social channels (1, 6, 11) |
| 13060 | */ |
| 13061 | |
| 13062 | /* Supplicant does single channel scan after 8-way handshake |
| 13063 | * and in that case driver shoudnt flush scan results. If |
| 13064 | * driver flushes the scan results here and unfortunately if |
| 13065 | * the AP doesnt respond to our probe req then association |
| 13066 | * fails which is not desired |
| 13067 | */ |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 13068 | if ((request->n_ssids == 1) |
| 13069 | && (request->ssids != NULL) |
| 13070 | && vos_mem_compare(&request->ssids[0], "DIRECT-", 7)) |
| 13071 | is_p2p_scan = true; |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13072 | |
Deepthi Gowri | d5c5c2b | 2015-06-11 17:00:46 +0530 | [diff] [blame] | 13073 | if( is_p2p_scan || |
| 13074 | (request->n_channels != WLAN_HDD_P2P_SINGLE_CHANNEL_SCAN) ) |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13075 | { |
| 13076 | hddLog(VOS_TRACE_LEVEL_DEBUG, "Flushing P2P Results"); |
| 13077 | sme_ScanFlushP2PResult( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13078 | pAdapter->sessionId ); |
| 13079 | } |
| 13080 | |
| 13081 | if( request->ie_len ) |
| 13082 | { |
| 13083 | /* save this for future association (join requires this) */ |
| 13084 | /*TODO: Array needs to be converted to dynamic allocation, |
| 13085 | * as multiple ie.s can be sent in cfg80211_scan_request structure |
| 13086 | * CR 597966 |
| 13087 | */ |
| 13088 | memset( &pScanInfo->scanAddIE, 0, sizeof(pScanInfo->scanAddIE) ); |
| 13089 | memcpy( pScanInfo->scanAddIE.addIEdata, request->ie, request->ie_len); |
| 13090 | pScanInfo->scanAddIE.length = request->ie_len; |
| 13091 | |
| 13092 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 13093 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || |
| 13094 | (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13095 | { |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 13096 | if (request->ie_len <= SIR_MAC_MAX_ADD_IE_LENGTH) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13097 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13098 | pwextBuf->roamProfile.nAddIEScanLength = request->ie_len; |
| 13099 | memcpy( pwextBuf->roamProfile.addIEScan, |
| 13100 | request->ie, request->ie_len); |
| 13101 | } |
| 13102 | else |
| 13103 | { |
| 13104 | hddLog(VOS_TRACE_LEVEL_ERROR, "Scan Ie length is invalid:" |
| 13105 | "%zu", request->ie_len); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13106 | } |
| 13107 | |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13108 | } |
| 13109 | scanRequest.uIEFieldLen = pScanInfo->scanAddIE.length; |
| 13110 | scanRequest.pIEField = pScanInfo->scanAddIE.addIEdata; |
| 13111 | |
| 13112 | pP2pIe = wlan_hdd_get_p2p_ie_ptr((v_U8_t*)request->ie, |
| 13113 | request->ie_len); |
| 13114 | if (pP2pIe != NULL) |
| 13115 | { |
| 13116 | #ifdef WLAN_FEATURE_P2P_DEBUG |
| 13117 | if (((globalP2PConnectionStatus == P2P_GO_NEG_COMPLETED) || |
| 13118 | (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS)) && |
| 13119 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13120 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13121 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_1; |
| 13122 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 13123 | "Go nego completed to Connection is started"); |
| 13124 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 13125 | "for 8way Handshake"); |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13126 | } |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13127 | else if((globalP2PConnectionStatus == P2P_CLIENT_DISCONNECTED_STATE) && |
| 13128 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13129 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13130 | globalP2PConnectionStatus = P2P_CLIENT_CONNECTING_STATE_2; |
| 13131 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P State] Changing state from " |
| 13132 | "Disconnected state to Connection is started"); |
| 13133 | hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P]P2P Scanning is started " |
| 13134 | "for 4way Handshake"); |
| 13135 | } |
| 13136 | #endif |
| 13137 | |
| 13138 | /* no_cck will be set during p2p find to disable 11b rates */ |
| 13139 | if(TRUE == request->no_cck) |
| 13140 | { |
| 13141 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13142 | "%s: This is a P2P Search", __func__); |
| 13143 | scanRequest.p2pSearch = 1; |
| 13144 | |
| 13145 | if( request->n_channels == WLAN_HDD_P2P_SOCIAL_CHANNELS ) |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13146 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13147 | /* set requestType to P2P Discovery */ |
| 13148 | scanRequest.requestType = eCSR_SCAN_P2P_DISCOVERY; |
| 13149 | } |
| 13150 | |
| 13151 | /* |
| 13152 | Skip Dfs Channel in case of P2P Search |
| 13153 | if it is set in ini file |
| 13154 | */ |
| 13155 | if(cfg_param->skipDfsChnlInP2pSearch) |
| 13156 | { |
| 13157 | scanRequest.skipDfsChnlInP2pSearch = 1; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13158 | } |
| 13159 | else |
| 13160 | { |
Padma, Santhosh Kumar | 787bd5c | 2014-05-15 20:09:31 +0530 | [diff] [blame] | 13161 | scanRequest.skipDfsChnlInP2pSearch = 0; |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13162 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13163 | |
Agarwal Ashish | 4f61613 | 2013-12-30 23:32:50 +0530 | [diff] [blame] | 13164 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13165 | } |
| 13166 | } |
| 13167 | |
| 13168 | INIT_COMPLETION(pScanInfo->scan_req_completion_event); |
| 13169 | |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 13170 | #ifdef FEATURE_WLAN_TDLS |
| 13171 | /* if tdls disagree scan right now, return immediately. |
| 13172 | tdls will schedule the scan when scan is allowed. (return SUCCESS) |
| 13173 | or will reject the scan if any TDLS is in progress. (return -EBUSY) |
| 13174 | */ |
| 13175 | status = wlan_hdd_tdls_scan_callback (pAdapter, |
| 13176 | wiphy, |
| 13177 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 13178 | dev, |
| 13179 | #endif |
| 13180 | request); |
| 13181 | if(status <= 0) |
| 13182 | { |
| 13183 | if(!status) |
| 13184 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS in progress." |
| 13185 | "scan rejected %d", __func__, status); |
| 13186 | else |
| 13187 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: TDLS teardown is ongoing %d", |
| 13188 | __func__, status); |
| 13189 | |
| 13190 | return status; |
| 13191 | } |
| 13192 | #endif |
| 13193 | |
Madan Mohan Koyyalamudi | 9f5a10c | 2012-09-28 14:46:16 -0700 | [diff] [blame] | 13194 | /* acquire the wakelock to avoid the apps suspend during the scan. To |
| 13195 | * address the following issues. |
| 13196 | * 1) Disconnected scenario: we are not allowing the suspend as WLAN is not in |
| 13197 | * BMPS/IMPS this result in android trying to suspend aggressively and backing off |
| 13198 | * for long time, this result in apps running at full power for long time. |
| 13199 | * 2) Connected scenario: If we allow the suspend during the scan, RIVA will |
| 13200 | * be stuck in full power because of resume BMPS |
| 13201 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 13202 | hdd_prevent_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13203 | |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13204 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, |
| 13205 | "requestType %d, scanType %d, minChnTime %d, maxChnTime %d," |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 13206 | "p2pSearch %d, skipDfsChnlInP2pSearch %d", |
| 13207 | scanRequest.requestType, scanRequest.scanType, |
| 13208 | scanRequest.minChnTime, scanRequest.maxChnTime, |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13209 | scanRequest.p2pSearch, scanRequest.skipDfsChnlInP2pSearch); |
| 13210 | |
Hanumantha Reddy Pothula | ca1d1cc | 2015-10-26 15:37:35 +0530 | [diff] [blame] | 13211 | if (pHddCtx->spoofMacAddr.isEnabled && |
| 13212 | pHddCtx->cfg_ini->enableMacSpoofing == 1) |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 13213 | { |
| 13214 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13215 | "%s: MAC Spoofing enabled for current scan", __func__); |
| 13216 | /* Updating SelfSta Mac Addr in TL which will be used to get staidx |
| 13217 | * to fill TxBds for probe request during current scan |
| 13218 | */ |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 13219 | status = WLANTL_updateSpoofMacAddr(pHddCtx->pvosContext, |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 13220 | &pHddCtx->spoofMacAddr.randomMacAddr, &pAdapter->macAddressCurrent); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 13221 | |
| 13222 | if(status != VOS_STATUS_SUCCESS) |
| 13223 | { |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 13224 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 13225 | status = -EFAULT; |
Ganesh Kondabattini | 6d3b490 | 2015-05-12 23:19:22 +0530 | [diff] [blame] | 13226 | #ifdef FEATURE_WLAN_TDLS |
| 13227 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 13228 | #endif |
Padma, Santhosh Kumar | 7923614 | 2015-02-09 18:19:33 +0530 | [diff] [blame] | 13229 | goto free_mem; |
| 13230 | } |
Siddharth Bhal | 7697221 | 2014-10-15 16:22:51 +0530 | [diff] [blame] | 13231 | } |
Mahesh A Saptasagar | 51dc36c | 2015-06-16 12:07:15 +0530 | [diff] [blame] | 13232 | 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] | 13233 | status = sme_ScanRequest( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13234 | pAdapter->sessionId, &scanRequest, &scanId, |
| 13235 | &hdd_cfg80211_scan_done_callback, dev ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13236 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13237 | if (eHAL_STATUS_SUCCESS != status) |
| 13238 | { |
| 13239 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13240 | "%s: sme_ScanRequest returned error %d", __func__, status); |
| 13241 | complete(&pScanInfo->scan_req_completion_event); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 13242 | if(eHAL_STATUS_RESOURCES == status) |
| 13243 | { |
Nirav Shah | 20ac06f | 2013-12-12 18:14:06 +0530 | [diff] [blame] | 13244 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: HO is in progress." |
| 13245 | "So defer the scan by informing busy",__func__); |
Madan Mohan Koyyalamudi | 3b230fe | 2012-10-18 14:46:32 -0700 | [diff] [blame] | 13246 | status = -EBUSY; |
| 13247 | } else { |
| 13248 | status = -EIO; |
| 13249 | } |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 13250 | hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_SCAN); |
Pradeep Reddy POTTETI | c7822df | 2015-02-19 20:15:41 +0530 | [diff] [blame] | 13251 | |
| 13252 | #ifdef FEATURE_WLAN_TDLS |
| 13253 | wlan_hdd_tdls_scan_done_callback(pAdapter); |
| 13254 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13255 | goto free_mem; |
| 13256 | } |
| 13257 | |
| 13258 | pScanInfo->mScanPending = TRUE; |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 13259 | pScanInfo->sessionId = pAdapter->sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13260 | pAdapter->request = request; |
| 13261 | pScanInfo->scanId = scanId; |
| 13262 | |
| 13263 | complete(&pScanInfo->scan_req_completion_event); |
| 13264 | |
| 13265 | free_mem: |
| 13266 | if( scanRequest.SSIDs.SSIDList ) |
| 13267 | { |
| 13268 | vos_mem_free(scanRequest.SSIDs.SSIDList); |
| 13269 | } |
| 13270 | |
| 13271 | if( channelList ) |
| 13272 | vos_mem_free( channelList ); |
| 13273 | |
| 13274 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13275 | return status; |
| 13276 | } |
| 13277 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 13278 | int wlan_hdd_cfg80211_scan( struct wiphy *wiphy, |
| 13279 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 13280 | struct net_device *dev, |
| 13281 | #endif |
| 13282 | struct cfg80211_scan_request *request) |
| 13283 | { |
| 13284 | int ret; |
| 13285 | |
| 13286 | vos_ssr_protect(__func__); |
| 13287 | ret = __wlan_hdd_cfg80211_scan(wiphy, |
| 13288 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
| 13289 | dev, |
| 13290 | #endif |
| 13291 | request); |
| 13292 | vos_ssr_unprotect(__func__); |
| 13293 | |
| 13294 | return ret; |
| 13295 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13296 | |
| 13297 | void hdd_select_cbmode( hdd_adapter_t *pAdapter,v_U8_t operationChannel) |
| 13298 | { |
| 13299 | v_U8_t iniDot11Mode = |
| 13300 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->dot11Mode; |
| 13301 | eHddDot11Mode hddDot11Mode = iniDot11Mode; |
| 13302 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 13303 | hddLog(LOG1, FL("Channel Bonding Mode Selected is %u"), |
| 13304 | iniDot11Mode); |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13305 | switch ( iniDot11Mode ) |
| 13306 | { |
| 13307 | case eHDD_DOT11_MODE_AUTO: |
| 13308 | case eHDD_DOT11_MODE_11ac: |
| 13309 | case eHDD_DOT11_MODE_11ac_ONLY: |
| 13310 | #ifdef WLAN_FEATURE_11AC |
Abhishek Singh | 4b1d235 | 2014-08-01 21:59:28 +0530 | [diff] [blame] | 13311 | if ( sme_IsFeatureSupportedByDriver(DOT11AC) && |
| 13312 | sme_IsFeatureSupportedByFW(DOT11AC) ) |
| 13313 | hddDot11Mode = eHDD_DOT11_MODE_11ac; |
| 13314 | else |
| 13315 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13316 | #else |
| 13317 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 13318 | #endif |
| 13319 | break; |
| 13320 | case eHDD_DOT11_MODE_11n: |
| 13321 | case eHDD_DOT11_MODE_11n_ONLY: |
| 13322 | hddDot11Mode = eHDD_DOT11_MODE_11n; |
| 13323 | break; |
| 13324 | default: |
| 13325 | hddDot11Mode = iniDot11Mode; |
| 13326 | break; |
| 13327 | } |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 13328 | #ifdef WLAN_FEATURE_AP_HT40_24G |
| 13329 | if (operationChannel > SIR_11B_CHANNEL_END) |
| 13330 | #endif |
| 13331 | { |
| 13332 | /* This call decides required channel bonding mode */ |
| 13333 | sme_SelectCBMode((WLAN_HDD_GET_CTX(pAdapter)->hHal), |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13334 | hdd_cfg_xlate_to_csr_phy_mode(hddDot11Mode), |
| 13335 | operationChannel); |
Hardik Kantilal Patel | 086e0a3 | 2014-11-20 14:56:26 +0530 | [diff] [blame] | 13336 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13337 | } |
| 13338 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13339 | /* |
| 13340 | * FUNCTION: wlan_hdd_cfg80211_connect_start |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13341 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13342 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13343 | int wlan_hdd_cfg80211_connect_start( hdd_adapter_t *pAdapter, |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 13344 | const u8 *ssid, size_t ssid_len, const u8 *bssid, |
| 13345 | const u8 *bssid_hint, u8 operatingChannel) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13346 | { |
| 13347 | int status = 0; |
| 13348 | hdd_wext_state_t *pWextState; |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 13349 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13350 | v_U32_t roamId; |
| 13351 | tCsrRoamProfile *pRoamProfile; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13352 | eCsrAuthType RSNAuthType; |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 13353 | const u8 *pValidBssid = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13354 | |
| 13355 | ENTER(); |
| 13356 | |
| 13357 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 13358 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 13359 | |
| 13360 | status = wlan_hdd_validate_context(pHddCtx); |
| 13361 | if (status) |
| 13362 | { |
Yue Ma | e36e355 | 2014-03-05 17:06:20 -0800 | [diff] [blame] | 13363 | return status; |
| 13364 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13365 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13366 | if (SIR_MAC_MAX_SSID_LENGTH < ssid_len) |
| 13367 | { |
| 13368 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: wrong SSID len", __func__); |
| 13369 | return -EINVAL; |
| 13370 | } |
| 13371 | |
| 13372 | pRoamProfile = &pWextState->roamProfile; |
| 13373 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13374 | if (pRoamProfile) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13375 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 13376 | hdd_station_ctx_t *pHddStaCtx; |
| 13377 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13378 | |
Siddharth Bhal | da0d162 | 2015-04-24 15:47:49 +0530 | [diff] [blame] | 13379 | wlan_hdd_get_frame_logs(pAdapter, WLAN_HDD_GET_FRAME_LOG_CMD_CLEAR); |
| 13380 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13381 | if (HDD_WMM_USER_MODE_NO_QOS == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13382 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->WmmMode) |
| 13383 | { |
| 13384 | /*QoS not enabled in cfg file*/ |
| 13385 | pRoamProfile->uapsd_mask = 0; |
| 13386 | } |
| 13387 | else |
| 13388 | { |
| 13389 | /*QoS enabled, update uapsd mask from cfg file*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13390 | pRoamProfile->uapsd_mask = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13391 | (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini->UapsdMask; |
| 13392 | } |
| 13393 | |
| 13394 | pRoamProfile->SSIDs.numOfSSIDs = 1; |
| 13395 | pRoamProfile->SSIDs.SSIDList->SSID.length = ssid_len; |
| 13396 | vos_mem_zero(pRoamProfile->SSIDs.SSIDList->SSID.ssId, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13397 | sizeof(pRoamProfile->SSIDs.SSIDList->SSID.ssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13398 | vos_mem_copy((void *)(pRoamProfile->SSIDs.SSIDList->SSID.ssId), |
| 13399 | ssid, ssid_len); |
| 13400 | |
| 13401 | if (bssid) |
| 13402 | { |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 13403 | pValidBssid = bssid; |
| 13404 | } |
| 13405 | else if (bssid_hint) |
| 13406 | { |
| 13407 | pValidBssid = bssid_hint; |
| 13408 | } |
| 13409 | if (pValidBssid) |
| 13410 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13411 | pRoamProfile->BSSIDs.numOfBSSIDs = 1; |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 13412 | vos_mem_copy((void *)(pRoamProfile->BSSIDs.bssid), pValidBssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13413 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13414 | /* Save BSSID in seperate variable as well, as RoamProfile |
| 13415 | BSSID is getting zeroed out in the association process. And in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13416 | case of join failure we should send valid BSSID to supplicant |
| 13417 | */ |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 13418 | vos_mem_copy((void *)(pWextState->req_bssId), pValidBssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13419 | WNI_CFG_BSSID_LEN); |
| 13420 | } |
Dhanashri Atre | 51981c6 | 2013-06-13 11:47:57 -0700 | [diff] [blame] | 13421 | else |
| 13422 | { |
| 13423 | vos_mem_zero((void *)(pRoamProfile->BSSIDs.bssid),WNI_CFG_BSSID_LEN); |
| 13424 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13425 | |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 13426 | hddLog(LOG1, FL("Connect to SSID: %s opertating Channel: %u"), |
| 13427 | pRoamProfile->SSIDs.SSIDList->SSID.ssId, operatingChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13428 | if ((IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion) || |
| 13429 | (IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion)) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13430 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13431 | /*set gen ie*/ |
| 13432 | hdd_SetGENIEToCsr(pAdapter, &RSNAuthType); |
| 13433 | /*set auth*/ |
| 13434 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 13435 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13436 | #ifdef FEATURE_WLAN_WAPI |
| 13437 | if (pAdapter->wapi_info.nWapiMode) |
| 13438 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13439 | hddLog(LOG1, "%s: Setting WAPI AUTH Type and Encryption Mode values", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13440 | switch (pAdapter->wapi_info.wapiAuthMode) |
| 13441 | { |
| 13442 | case WAPI_AUTH_MODE_PSK: |
| 13443 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13444 | hddLog(LOG1, "%s: WAPI AUTH TYPE: PSK: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13445 | pAdapter->wapi_info.wapiAuthMode); |
| 13446 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 13447 | break; |
| 13448 | } |
| 13449 | case WAPI_AUTH_MODE_CERT: |
| 13450 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13451 | hddLog(LOG1, "%s: WAPI AUTH TYPE: CERT: %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13452 | pAdapter->wapi_info.wapiAuthMode); |
| 13453 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 13454 | break; |
| 13455 | } |
| 13456 | } // End of switch |
| 13457 | if ( pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 13458 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) |
| 13459 | { |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 13460 | hddLog(LOG1, "%s: WAPI PAIRWISE/GROUP ENCRYPTION: WPI", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13461 | pRoamProfile->AuthType.numEntries = 1; |
| 13462 | pRoamProfile->EncryptionType.numEntries = 1; |
| 13463 | pRoamProfile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 13464 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 13465 | pRoamProfile->mcEncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_WPI; |
| 13466 | } |
| 13467 | } |
| 13468 | #endif /* FEATURE_WLAN_WAPI */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13469 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13470 | /* Initializing gtkOffloadReqParams */ |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13471 | if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || |
| 13472 | (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
| 13473 | { |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 13474 | memset(&pHddStaCtx->gtkOffloadReqParams, 0, |
| 13475 | sizeof (tSirGtkOffloadParams)); |
| 13476 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_DISABLE; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 13477 | } |
| 13478 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13479 | pRoamProfile->csrPersona = pAdapter->device_mode; |
| 13480 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 13481 | if( operatingChannel ) |
| 13482 | { |
| 13483 | pRoamProfile->ChannelInfo.ChannelList = &operatingChannel; |
| 13484 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 13485 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 13486 | else |
| 13487 | { |
| 13488 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 13489 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 13490 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 13491 | if ( (WLAN_HDD_IBSS == pAdapter->device_mode) && operatingChannel) |
| 13492 | { |
| 13493 | hdd_select_cbmode(pAdapter,operatingChannel); |
| 13494 | } |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 13495 | |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 13496 | /* |
| 13497 | * Change conn_state to connecting before sme_RoamConnect(), |
| 13498 | * because sme_RoamConnect() has a direct path to call |
| 13499 | * hdd_smeRoamCallback(), which will change the conn_state |
| 13500 | * If direct path, conn_state will be accordingly changed |
| 13501 | * to NotConnected or Associated by either |
| 13502 | * hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() |
| 13503 | * in sme_RoamCallback() |
| 13504 | * if sme_RomConnect is to be queued, |
| 13505 | * Connecting state will remain until it is completed. |
| 13506 | * If connection state is not changed, |
| 13507 | * connection state will remain in eConnectionState_NotConnected state. |
| 13508 | * In hdd_AssociationCompletionHandler, "hddDisconInProgress" is set to true |
| 13509 | * if conn state is eConnectionState_NotConnected. |
| 13510 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 13511 | * informed of connect result indication which is an issue. |
| 13512 | */ |
| 13513 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 13514 | if (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 13515 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 13516 | { |
| 13517 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 13518 | FL("Set HDD connState to eConnectionState_Connecting")); |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 13519 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 13520 | eConnectionState_Connecting); |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 13521 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13522 | status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13523 | pAdapter->sessionId, pRoamProfile, &roamId); |
| 13524 | |
Gopichand Nakkala | a3c8fb6 | 2013-06-21 15:36:42 +0530 | [diff] [blame] | 13525 | if ((eHAL_STATUS_SUCCESS != status) && |
| 13526 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode || |
| 13527 | WLAN_HDD_P2P_CLIENT == pAdapter->device_mode)) |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 13528 | |
| 13529 | { |
Agarwal Ashish | 40f9b87 | 2015-09-01 16:17:35 +0530 | [diff] [blame] | 13530 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13531 | FL("sme_RoamConnect (session %d) failed with status %d. -> NotConnected"), |
| 13532 | pAdapter->sessionId, status); |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 13533 | /* change back to NotAssociated */ |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 13534 | hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
Madan Mohan Koyyalamudi | 42dcd16 | 2012-12-03 16:34:04 -0800 | [diff] [blame] | 13535 | eConnectionState_NotConnected); |
Madan Mohan Koyyalamudi | d5acbf5 | 2012-11-28 01:45:08 +0530 | [diff] [blame] | 13536 | } |
Madan Mohan Koyyalamudi | df86c42 | 2012-12-04 17:03:44 -0800 | [diff] [blame] | 13537 | |
| 13538 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 13539 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 13540 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13541 | } |
| 13542 | else |
| 13543 | { |
| 13544 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid Roam profile", __func__); |
| 13545 | return -EINVAL; |
| 13546 | } |
Madan Mohan Koyyalamudi | fd4e1da | 2012-11-09 17:50:19 -0800 | [diff] [blame] | 13547 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13548 | return status; |
| 13549 | } |
| 13550 | |
| 13551 | /* |
| 13552 | * FUNCTION: wlan_hdd_set_cfg80211_auth_type |
| 13553 | * This function is used to set the authentication type (OPEN/SHARED). |
| 13554 | * |
| 13555 | */ |
| 13556 | static int wlan_hdd_cfg80211_set_auth_type(hdd_adapter_t *pAdapter, |
| 13557 | enum nl80211_auth_type auth_type) |
| 13558 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13559 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13560 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13561 | |
| 13562 | ENTER(); |
| 13563 | |
| 13564 | /*set authentication type*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13565 | switch (auth_type) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13566 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13567 | case NL80211_AUTHTYPE_AUTOMATIC: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13568 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 13569 | "%s: set authentication type to AUTOSWITCH", __func__); |
| 13570 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_AUTOSWITCH; |
| 13571 | break; |
| 13572 | |
| 13573 | case NL80211_AUTHTYPE_OPEN_SYSTEM: |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 13574 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 13575 | case NL80211_AUTHTYPE_FT: |
| 13576 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13577 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13578 | "%s: set authentication type to OPEN", __func__); |
| 13579 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 13580 | break; |
| 13581 | |
| 13582 | case NL80211_AUTHTYPE_SHARED_KEY: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13583 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13584 | "%s: set authentication type to SHARED", __func__); |
| 13585 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_SHARED_KEY; |
| 13586 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13587 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13588 | case NL80211_AUTHTYPE_NETWORK_EAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13589 | hddLog(VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13590 | "%s: set authentication type to CCKM WPA", __func__); |
| 13591 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_CCKM_WPA;//eCSR_AUTH_TYPE_CCKM_RSN needs to be handled as well if required. |
| 13592 | break; |
| 13593 | #endif |
| 13594 | |
| 13595 | |
| 13596 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13597 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 13598 | "%s: Unsupported authentication type %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13599 | auth_type); |
| 13600 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_UNKNOWN; |
| 13601 | return -EINVAL; |
| 13602 | } |
| 13603 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13604 | pWextState->roamProfile.AuthType.authType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13605 | pHddStaCtx->conn_info.authType; |
| 13606 | return 0; |
| 13607 | } |
| 13608 | |
| 13609 | /* |
| 13610 | * FUNCTION: wlan_hdd_set_akm_suite |
| 13611 | * This function is used to set the key mgmt type(PSK/8021x). |
| 13612 | * |
| 13613 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13614 | static int wlan_hdd_set_akm_suite( hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13615 | u32 key_mgmt |
| 13616 | ) |
| 13617 | { |
| 13618 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 13619 | ENTER(); |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 13620 | /* Should be in ieee802_11_defs.h */ |
| 13621 | #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05 |
| 13622 | #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13623 | /*set key mgmt type*/ |
| 13624 | switch(key_mgmt) |
| 13625 | { |
| 13626 | case WLAN_AKM_SUITE_PSK: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 13627 | case WLAN_AKM_SUITE_PSK_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 13628 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 13629 | case WLAN_AKM_SUITE_FT_PSK: |
| 13630 | #endif |
| 13631 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to PSK", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13632 | __func__); |
| 13633 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
| 13634 | break; |
| 13635 | |
| 13636 | case WLAN_AKM_SUITE_8021X: |
Abhishek Singh | ae40803 | 2014-09-25 17:22:04 +0530 | [diff] [blame] | 13637 | case WLAN_AKM_SUITE_8021X_SHA256: |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 13638 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 13639 | case WLAN_AKM_SUITE_FT_8021X: |
| 13640 | #endif |
| 13641 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to 8021x", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13642 | __func__); |
| 13643 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 13644 | break; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13645 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13646 | #define WLAN_AKM_SUITE_CCKM 0x00409600 /* Should be in ieee802_11_defs.h */ |
| 13647 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 13648 | case WLAN_AKM_SUITE_CCKM: |
| 13649 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to CCKM", |
| 13650 | __func__); |
| 13651 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
| 13652 | break; |
| 13653 | #endif |
Leela Venkata Kiran Kumar Reddy Chirala | e208a83 | 2014-04-27 22:34:25 -0700 | [diff] [blame] | 13654 | #ifndef WLAN_AKM_SUITE_OSEN |
| 13655 | #define WLAN_AKM_SUITE_OSEN 0x506f9a01 /* Should be in ieee802_11_defs.h */ |
| 13656 | case WLAN_AKM_SUITE_OSEN: |
| 13657 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting key mgmt type to OSEN", |
| 13658 | __func__); |
| 13659 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_802_1X; |
| 13660 | break; |
| 13661 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13662 | |
| 13663 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13664 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported key mgmt type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13665 | __func__, key_mgmt); |
| 13666 | return -EINVAL; |
| 13667 | |
| 13668 | } |
| 13669 | return 0; |
| 13670 | } |
| 13671 | |
| 13672 | /* |
| 13673 | * FUNCTION: wlan_hdd_cfg80211_set_cipher |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13674 | * This function is used to set the encryption type |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13675 | * (NONE/WEP40/WEP104/TKIP/CCMP). |
| 13676 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13677 | static int wlan_hdd_cfg80211_set_cipher( hdd_adapter_t *pAdapter, |
| 13678 | u32 cipher, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13679 | bool ucast |
| 13680 | ) |
| 13681 | { |
| 13682 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13683 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13684 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 13685 | |
| 13686 | ENTER(); |
| 13687 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13688 | if (!cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13689 | { |
Ratheesh S P | 36dbc93 | 2015-08-07 14:28:57 +0530 | [diff] [blame] | 13690 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: received cipher %d - considering none", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13691 | __func__, cipher); |
| 13692 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 13693 | } |
| 13694 | else |
| 13695 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13696 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13697 | /*set encryption method*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13698 | switch (cipher) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13699 | { |
| 13700 | case IW_AUTH_CIPHER_NONE: |
| 13701 | encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 13702 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13703 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13704 | case WLAN_CIPHER_SUITE_WEP40: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13705 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13706 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13707 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13708 | case WLAN_CIPHER_SUITE_WEP104: |
Gopichand Nakkala | 2914956 | 2013-05-10 21:43:41 +0530 | [diff] [blame] | 13709 | encryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13710 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13711 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13712 | case WLAN_CIPHER_SUITE_TKIP: |
| 13713 | encryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 13714 | break; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13715 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13716 | case WLAN_CIPHER_SUITE_CCMP: |
| 13717 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 13718 | break; |
| 13719 | #ifdef FEATURE_WLAN_WAPI |
| 13720 | case WLAN_CIPHER_SUITE_SMS4: |
| 13721 | encryptionType = eCSR_ENCRYPT_TYPE_WPI; |
| 13722 | break; |
| 13723 | #endif |
| 13724 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 13725 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13726 | case WLAN_CIPHER_SUITE_KRK: |
| 13727 | encryptionType = eCSR_ENCRYPT_TYPE_KRK; |
| 13728 | break; |
| 13729 | #endif |
| 13730 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13731 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Unsupported cipher type %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13732 | __func__, cipher); |
| 13733 | return -EOPNOTSUPP; |
| 13734 | } |
| 13735 | } |
| 13736 | |
| 13737 | if (ucast) |
| 13738 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13739 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting unicast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13740 | __func__, encryptionType); |
| 13741 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 13742 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13743 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13744 | encryptionType; |
| 13745 | } |
| 13746 | else |
| 13747 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13748 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: setting mcast cipher type to %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13749 | __func__, encryptionType); |
| 13750 | pHddStaCtx->conn_info.mcEncryptionType = encryptionType; |
| 13751 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 13752 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = encryptionType; |
| 13753 | } |
| 13754 | |
| 13755 | return 0; |
| 13756 | } |
| 13757 | |
| 13758 | |
| 13759 | /* |
| 13760 | * FUNCTION: wlan_hdd_cfg80211_set_ie |
| 13761 | * This function is used to parse WPA/RSN IE's. |
| 13762 | */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13763 | int wlan_hdd_cfg80211_set_ie( hdd_adapter_t *pAdapter, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13764 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 13765 | const u8 *ie, |
| 13766 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13767 | u8 *ie, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13768 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13769 | size_t ie_len |
| 13770 | ) |
| 13771 | { |
| 13772 | 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] | 13773 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 13774 | const u8 *genie = ie; |
| 13775 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13776 | u8 *genie = ie; |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13777 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13778 | v_U16_t remLen = ie_len; |
| 13779 | #ifdef FEATURE_WLAN_WAPI |
| 13780 | v_U32_t akmsuite[MAX_NUM_AKM_SUITES]; |
| 13781 | u16 *tmp; |
| 13782 | v_U16_t akmsuiteCount; |
| 13783 | int *akmlist; |
| 13784 | #endif |
| 13785 | ENTER(); |
| 13786 | |
| 13787 | /* clear previous assocAddIE */ |
| 13788 | pWextState->assocAddIE.length = 0; |
| 13789 | pWextState->roamProfile.bWPSAssociation = VOS_FALSE; |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 13790 | pWextState->roamProfile.bOSENAssociation = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13791 | |
| 13792 | while (remLen >= 2) |
| 13793 | { |
| 13794 | v_U16_t eLen = 0; |
| 13795 | v_U8_t elementId; |
| 13796 | elementId = *genie++; |
| 13797 | eLen = *genie++; |
| 13798 | remLen -= 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13799 | |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 13800 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: IE[0x%X], LEN[%d]", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13801 | __func__, elementId, eLen); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13802 | |
| 13803 | switch ( elementId ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13804 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13805 | case DOT11F_EID_WPA: |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 13806 | 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] | 13807 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13808 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13809 | "%s: Invalid WPA IE", __func__); |
| 13810 | return -EINVAL; |
| 13811 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13812 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2\x04", 4)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13813 | { |
| 13814 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13815 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPS IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13816 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13817 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 13818 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13819 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 13820 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE. " |
| 13821 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13822 | VOS_ASSERT(0); |
| 13823 | return -ENOMEM; |
| 13824 | } |
| 13825 | // WSC IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 13826 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 13827 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13828 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13829 | pWextState->roamProfile.bWPSAssociation = VOS_TRUE; |
| 13830 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 13831 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 13832 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13833 | else if (0 == memcmp(&genie[0], "\x00\x50\xf2", 3)) |
| 13834 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13835 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WPA IE (len %d)",__func__, eLen + 2); |
| 13836 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 13837 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2) /*ie_len*/); |
| 13838 | pWextState->roamProfile.pWPAReqIE = pWextState->WPARSNIE; |
| 13839 | pWextState->roamProfile.nWPAReqIELength = eLen + 2;//ie_len; |
| 13840 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13841 | else if ( (0 == memcmp(&genie[0], P2P_OUI_TYPE, |
Kiet Lam | 8da9899 | 2013-11-21 15:59:07 +0530 | [diff] [blame] | 13842 | P2P_OUI_TYPE_SIZE))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13843 | { |
| 13844 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13845 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set P2P IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13846 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13847 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 13848 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13849 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 13850 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 13851 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13852 | VOS_ASSERT(0); |
| 13853 | return -ENOMEM; |
| 13854 | } |
| 13855 | // P2P IE is saved to Additional IE ; it should be accumulated to handle WPS IE + P2P IE |
| 13856 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 13857 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13859 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 13860 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 13861 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13862 | #ifdef WLAN_FEATURE_WFD |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13863 | else if ( (0 == memcmp(&genie[0], WFD_OUI_TYPE, |
| 13864 | WFD_OUI_TYPE_SIZE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13865 | /*Consider WFD IE, only for P2P Client */ |
| 13866 | && (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) ) |
| 13867 | { |
| 13868 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13869 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set WFD IE(len %d)", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13870 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13871 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 13872 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13873 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 13874 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 13875 | "Need bigger buffer space"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 13876 | VOS_ASSERT(0); |
| 13877 | return -ENOMEM; |
| 13878 | } |
| 13879 | // WFD IE is saved to Additional IE ; it should be accumulated to handle |
| 13880 | // WPS IE + P2P IE + WFD IE |
| 13881 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 13882 | pWextState->assocAddIE.length += eLen + 2; |
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 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 13885 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 13886 | } |
| 13887 | #endif |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 13888 | /* Appending HS 2.0 Indication Element in Assiciation Request */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13889 | else if ( (0 == memcmp(&genie[0], HS20_OUI_TYPE, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 13890 | HS20_OUI_TYPE_SIZE)) ) |
| 13891 | { |
| 13892 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 13893 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set HS20 IE(len %d)", |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 13894 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 13895 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 13896 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 13897 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 13898 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 13899 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 13900 | VOS_ASSERT(0); |
| 13901 | return -ENOMEM; |
| 13902 | } |
| 13903 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 13904 | pWextState->assocAddIE.length += eLen + 2; |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 13905 | |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 13906 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 13907 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 13908 | } |
Leela Venkata Kiran Kumar Reddy Chirala | f257bef | 2014-04-11 18:48:12 -0700 | [diff] [blame] | 13909 | /* Appending OSEN Information Element in Assiciation Request */ |
| 13910 | else if ( (0 == memcmp(&genie[0], OSEN_OUI_TYPE, |
| 13911 | OSEN_OUI_TYPE_SIZE)) ) |
| 13912 | { |
| 13913 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
| 13914 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set OSEN IE(len %d)", |
| 13915 | __func__, eLen + 2); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 13916 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 13917 | 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] | 13918 | { |
| 13919 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 13920 | "Need bigger buffer space"); |
| 13921 | VOS_ASSERT(0); |
| 13922 | return -ENOMEM; |
| 13923 | } |
| 13924 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 13925 | pWextState->assocAddIE.length += eLen + 2; |
| 13926 | |
| 13927 | pWextState->roamProfile.bOSENAssociation = VOS_TRUE; |
| 13928 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 13929 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 13930 | } |
| 13931 | |
Abhishek Singh | 4322e62 | 2015-06-10 15:42:54 +0530 | [diff] [blame] | 13932 | /* Update only for WPA IE */ |
| 13933 | if (!memcmp(genie, WPA_OUI_TYPE, WPA_OUI_TYPE_SIZE) && |
| 13934 | (WLAN_HDD_IBSS == pAdapter->device_mode)) { |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 13935 | |
| 13936 | /* populating as ADDIE in beacon frames */ |
| 13937 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 13938 | 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] | 13939 | NULL, eANI_BOOLEAN_FALSE)== eHAL_STATUS_SUCCESS) |
| 13940 | { |
| 13941 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13942 | WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, 1,NULL, |
| 13943 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 13944 | { |
| 13945 | hddLog(LOGE, |
| 13946 | "Coldn't pass " |
| 13947 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG to CCM"); |
| 13948 | } |
| 13949 | }/* ccmCfgSetStr(,WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, , )*/ |
| 13950 | else |
| 13951 | hddLog(LOGE, |
| 13952 | "Could not pass on " |
| 13953 | "WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA to CCM"); |
| 13954 | |
| 13955 | /* IBSS mode doesn't contain params->proberesp_ies still |
| 13956 | beaconIE's need to be populated in probe response frames */ |
| 13957 | if ( (NULL != (genie - 2)) && (0 != eLen + 2) ) |
| 13958 | { |
| 13959 | u16 rem_probe_resp_ie_len = eLen + 2; |
| 13960 | u8 probe_rsp_ie_len[3] = {0}; |
| 13961 | u8 counter = 0; |
| 13962 | |
| 13963 | /* Check Probe Resp Length if it is greater then 255 then |
| 13964 | Store Probe Rsp IEs into WNI_CFG_PROBE_RSP_ADDNIE_DATA1 |
| 13965 | & WNI_CFG_PROBE_RSP_ADDNIE_DATA2 CFG Variable As We are |
| 13966 | not able Store More then 255 bytes into One Variable */ |
| 13967 | |
| 13968 | while ((rem_probe_resp_ie_len > 0) && (counter < 3)) |
| 13969 | { |
| 13970 | if (rem_probe_resp_ie_len > MAX_CFG_STRING_LEN) |
| 13971 | { |
| 13972 | probe_rsp_ie_len[counter++] = MAX_CFG_STRING_LEN; |
| 13973 | rem_probe_resp_ie_len -= MAX_CFG_STRING_LEN; |
| 13974 | } |
| 13975 | else |
| 13976 | { |
| 13977 | probe_rsp_ie_len[counter++] = rem_probe_resp_ie_len; |
| 13978 | rem_probe_resp_ie_len = 0; |
| 13979 | } |
| 13980 | } |
| 13981 | |
| 13982 | rem_probe_resp_ie_len = 0; |
| 13983 | |
| 13984 | if (probe_rsp_ie_len[0] > 0) |
| 13985 | { |
| 13986 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 13987 | WNI_CFG_PROBE_RSP_ADDNIE_DATA1, |
| 13988 | (tANI_U8*)(genie - 2), |
| 13989 | probe_rsp_ie_len[0], NULL, |
| 13990 | eANI_BOOLEAN_FALSE) |
| 13991 | == eHAL_STATUS_FAILURE) |
| 13992 | { |
| 13993 | hddLog(LOGE, |
| 13994 | "Could not pass" |
| 13995 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA1 to CCM"); |
| 13996 | } |
| 13997 | rem_probe_resp_ie_len += probe_rsp_ie_len[0]; |
| 13998 | } |
| 13999 | |
| 14000 | if (probe_rsp_ie_len[1] > 0) |
| 14001 | { |
| 14002 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14003 | WNI_CFG_PROBE_RSP_ADDNIE_DATA2, |
| 14004 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 14005 | probe_rsp_ie_len[1], NULL, |
| 14006 | eANI_BOOLEAN_FALSE) |
| 14007 | == eHAL_STATUS_FAILURE) |
| 14008 | { |
| 14009 | hddLog(LOGE, |
| 14010 | "Could not pass" |
| 14011 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA2 to CCM"); |
| 14012 | } |
| 14013 | rem_probe_resp_ie_len += probe_rsp_ie_len[1]; |
| 14014 | } |
| 14015 | |
| 14016 | if (probe_rsp_ie_len[2] > 0) |
| 14017 | { |
| 14018 | if (ccmCfgSetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14019 | WNI_CFG_PROBE_RSP_ADDNIE_DATA3, |
| 14020 | (tANI_U8*)(genie - (2 + rem_probe_resp_ie_len)), |
| 14021 | probe_rsp_ie_len[2], NULL, |
| 14022 | eANI_BOOLEAN_FALSE) |
| 14023 | == eHAL_STATUS_FAILURE) |
| 14024 | { |
| 14025 | hddLog(LOGE, |
| 14026 | "Could not pass" |
| 14027 | "on WNI_CFG_PROBE_RSP_ADDNIE_DATA3 to CCM"); |
| 14028 | } |
| 14029 | rem_probe_resp_ie_len += probe_rsp_ie_len[2]; |
| 14030 | } |
| 14031 | |
| 14032 | if (ccmCfgSetInt(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14033 | WNI_CFG_PROBE_RSP_ADDNIE_FLAG, 1,NULL, |
| 14034 | eANI_BOOLEAN_FALSE) == eHAL_STATUS_FAILURE) |
| 14035 | { |
| 14036 | hddLog(LOGE, |
| 14037 | "Could not pass" |
| 14038 | "on WNI_CFG_PROBE_RSP_ADDNIE_FLAG to CCM"); |
| 14039 | } |
| 14040 | } |
Praveen Kumar Sirisilla | 7d68b7b | 2013-09-22 14:01:42 -0700 | [diff] [blame] | 14041 | } /* end of if (WLAN_HDD_IBSS == pAdapter->device_mode) */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14042 | break; |
| 14043 | case DOT11F_EID_RSN: |
| 14044 | hddLog (VOS_TRACE_LEVEL_INFO, "%s Set RSN IE(len %d)",__func__, eLen + 2); |
| 14045 | memset( pWextState->WPARSNIE, 0, MAX_WPA_RSN_IE_LEN ); |
| 14046 | memcpy( pWextState->WPARSNIE, genie - 2, (eLen + 2)/*ie_len*/); |
| 14047 | pWextState->roamProfile.pRSNReqIE = pWextState->WPARSNIE; |
| 14048 | pWextState->roamProfile.nRSNReqIELength = eLen + 2; //ie_len; |
| 14049 | break; |
Abhishek Singh | 15d9560 | 2015-03-24 15:52:57 +0530 | [diff] [blame] | 14050 | |
| 14051 | /* Appending Extended Capabilities with Interworking bit set |
| 14052 | * in Assoc Req. |
| 14053 | * |
| 14054 | * In assoc req this EXT Cap will only be taken into account if |
| 14055 | * interworkingService bit is set to 1. Currently |
| 14056 | * driver is only interested in interworkingService capability |
| 14057 | * from supplicant. If in future any other EXT Cap info is |
| 14058 | * required from supplicat, it needs to be handled while |
| 14059 | * sending Assoc Req in LIM. |
| 14060 | */ |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14061 | case DOT11F_EID_EXTCAP: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14062 | { |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14063 | v_U16_t curAddIELen = pWextState->assocAddIE.length; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14064 | 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] | 14065 | __func__, eLen + 2); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14066 | |
Ganesh Kondabattini | 7500fb3 | 2015-04-10 14:50:32 +0530 | [diff] [blame] | 14067 | if( SIR_MAC_MAX_ADD_IE_LENGTH < (pWextState->assocAddIE.length + eLen) ) |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14068 | { |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 14069 | hddLog(VOS_TRACE_LEVEL_FATAL, "Cannot accommodate assocAddIE " |
| 14070 | "Need bigger buffer space"); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14071 | VOS_ASSERT(0); |
| 14072 | return -ENOMEM; |
| 14073 | } |
| 14074 | memcpy( pWextState->assocAddIE.addIEdata + curAddIELen, genie - 2, eLen + 2); |
| 14075 | pWextState->assocAddIE.length += eLen + 2; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14076 | |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14077 | pWextState->roamProfile.pAddIEAssoc = pWextState->assocAddIE.addIEdata; |
| 14078 | pWextState->roamProfile.nAddIEAssocLength = pWextState->assocAddIE.length; |
| 14079 | break; |
| 14080 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14081 | #ifdef FEATURE_WLAN_WAPI |
| 14082 | case WLAN_EID_WAPI: |
| 14083 | pAdapter->wapi_info.nWapiMode = 1; //Setting WAPI Mode to ON=1 |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 14084 | hddLog(VOS_TRACE_LEVEL_INFO, "WAPI MODE IS %u", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14085 | pAdapter->wapi_info.nWapiMode); |
| 14086 | tmp = (u16 *)ie; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14087 | tmp = tmp + 2; // Skip element Id and Len, Version |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14088 | akmsuiteCount = WPA_GET_LE16(tmp); |
| 14089 | tmp = tmp + 1; |
| 14090 | akmlist = (int *)(tmp); |
| 14091 | if(akmsuiteCount <= MAX_NUM_AKM_SUITES) |
| 14092 | { |
| 14093 | memcpy(akmsuite, akmlist, (4*akmsuiteCount)); |
| 14094 | } |
| 14095 | else |
| 14096 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14097 | hddLog(VOS_TRACE_LEVEL_FATAL, "Invalid akmSuite count"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14098 | VOS_ASSERT(0); |
| 14099 | return -EINVAL; |
| 14100 | } |
| 14101 | |
| 14102 | if (WAPI_PSK_AKM_SUITE == akmsuite[0]) |
| 14103 | { |
| 14104 | 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] | 14105 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14106 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_PSK; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14107 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14108 | if (WAPI_CERT_AKM_SUITE == akmsuite[0]) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14109 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14110 | 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] | 14111 | __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14112 | pAdapter->wapi_info.wapiAuthMode = WAPI_AUTH_MODE_CERT; |
| 14113 | } |
| 14114 | break; |
| 14115 | #endif |
| 14116 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14117 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14118 | "%s Set UNKNOWN IE %X", __func__, elementId); |
Madan Mohan Koyyalamudi | ef3b66e | 2012-10-11 14:29:42 -0700 | [diff] [blame] | 14119 | /* when Unknown IE is received we should break and continue |
| 14120 | * to the next IE in the buffer instead we were returning |
| 14121 | * so changing this to break */ |
| 14122 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14123 | } |
| 14124 | genie += eLen; |
| 14125 | remLen -= eLen; |
| 14126 | } |
| 14127 | EXIT(); |
| 14128 | return 0; |
| 14129 | } |
| 14130 | |
| 14131 | /* |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 14132 | * FUNCTION: hdd_isWPAIEPresent |
| 14133 | * Parse the received IE to find the WPA IE |
| 14134 | * |
| 14135 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14136 | static bool hdd_isWPAIEPresent( |
| 14137 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) |
| 14138 | const u8 *ie, |
| 14139 | #else |
| 14140 | u8 *ie, |
| 14141 | #endif |
| 14142 | u8 ie_len) |
Gopichand Nakkala | 18f0c26 | 2013-05-07 23:25:08 +0530 | [diff] [blame] | 14143 | { |
| 14144 | v_U8_t eLen = 0; |
| 14145 | v_U16_t remLen = ie_len; |
| 14146 | v_U8_t elementId = 0; |
| 14147 | |
| 14148 | while (remLen >= 2) |
| 14149 | { |
| 14150 | elementId = *ie++; |
| 14151 | eLen = *ie++; |
| 14152 | remLen -= 2; |
| 14153 | if (eLen > remLen) |
| 14154 | { |
| 14155 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14156 | "%s: IE length is wrong %d", __func__, eLen); |
| 14157 | return FALSE; |
| 14158 | } |
| 14159 | if ((elementId == DOT11F_EID_WPA) && (remLen > 5)) |
| 14160 | { |
| 14161 | /* OUI - 0x00 0X50 0XF2 |
| 14162 | WPA Information Element - 0x01 |
| 14163 | WPA version - 0x01*/ |
| 14164 | if (0 == memcmp(&ie[0], "\x00\x50\xf2\x01\x01", 5)) |
| 14165 | return TRUE; |
| 14166 | } |
| 14167 | ie += eLen; |
| 14168 | remLen -= eLen; |
| 14169 | } |
| 14170 | return FALSE; |
| 14171 | } |
| 14172 | |
| 14173 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14174 | * FUNCTION: wlan_hdd_cfg80211_set_privacy |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14175 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14176 | * parameters during connect operation. |
| 14177 | */ |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14178 | int wlan_hdd_cfg80211_set_privacy(hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14179 | struct cfg80211_connect_params *req |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14180 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14181 | { |
| 14182 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14183 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14184 | ENTER(); |
| 14185 | |
| 14186 | /*set wpa version*/ |
| 14187 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
| 14188 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14189 | if (req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14190 | { |
Gopichand Nakkala | 781ded4 | 2013-06-28 12:10:45 +0530 | [diff] [blame] | 14191 | if (NL80211_WPA_VERSION_1 == req->crypto.wpa_versions) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14192 | { |
| 14193 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 14194 | } |
| 14195 | else if (NL80211_WPA_VERSION_2 == req->crypto.wpa_versions) |
| 14196 | { |
| 14197 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 14198 | } |
| 14199 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14200 | |
| 14201 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: set wpa version to %d", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14202 | pWextState->wpaVersion); |
| 14203 | |
| 14204 | /*set authentication type*/ |
| 14205 | status = wlan_hdd_cfg80211_set_auth_type(pAdapter, req->auth_type); |
| 14206 | |
| 14207 | if (0 > status) |
| 14208 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14209 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14210 | "%s: failed to set authentication type ", __func__); |
| 14211 | return status; |
| 14212 | } |
| 14213 | |
| 14214 | /*set key mgmt type*/ |
| 14215 | if (req->crypto.n_akm_suites) |
| 14216 | { |
| 14217 | status = wlan_hdd_set_akm_suite(pAdapter, req->crypto.akm_suites[0]); |
| 14218 | if (0 > status) |
| 14219 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14220 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set akm suite", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14221 | __func__); |
| 14222 | return status; |
| 14223 | } |
| 14224 | } |
| 14225 | |
| 14226 | /*set pairwise cipher type*/ |
| 14227 | if (req->crypto.n_ciphers_pairwise) |
| 14228 | { |
| 14229 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, |
| 14230 | req->crypto.ciphers_pairwise[0], true); |
| 14231 | if (0 > status) |
| 14232 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14233 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14234 | "%s: failed to set unicast cipher type", __func__); |
| 14235 | return status; |
| 14236 | } |
| 14237 | } |
| 14238 | else |
| 14239 | { |
| 14240 | /*Reset previous cipher suite to none*/ |
| 14241 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, 0, true); |
| 14242 | if (0 > status) |
| 14243 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14244 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14245 | "%s: failed to set unicast cipher type", __func__); |
| 14246 | return status; |
| 14247 | } |
| 14248 | } |
| 14249 | |
| 14250 | /*set group cipher type*/ |
| 14251 | status = wlan_hdd_cfg80211_set_cipher(pAdapter, req->crypto.cipher_group, |
| 14252 | false); |
| 14253 | |
| 14254 | if (0 > status) |
| 14255 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14256 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set mcast cipher type", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14257 | __func__); |
| 14258 | return status; |
| 14259 | } |
| 14260 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 14261 | #ifdef WLAN_FEATURE_11W |
| 14262 | pWextState->roamProfile.MFPEnabled = (req->mfp == NL80211_MFP_REQUIRED); |
| 14263 | #endif |
| 14264 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14265 | /*parse WPA/RSN IE, and set the correspoing fileds in Roam profile*/ |
| 14266 | if (req->ie_len) |
| 14267 | { |
| 14268 | status = wlan_hdd_cfg80211_set_ie(pAdapter, req->ie, req->ie_len); |
| 14269 | if ( 0 > status) |
| 14270 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14271 | 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] | 14272 | __func__); |
| 14273 | return status; |
| 14274 | } |
| 14275 | } |
| 14276 | |
| 14277 | /*incase of WEP set default key information*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14278 | if (req->key && req->key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14279 | { |
| 14280 | if ( (WLAN_CIPHER_SUITE_WEP40 == req->crypto.ciphers_pairwise[0]) |
| 14281 | || (WLAN_CIPHER_SUITE_WEP104 == req->crypto.ciphers_pairwise[0]) |
| 14282 | ) |
| 14283 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14284 | if ( IW_AUTH_KEY_MGMT_802_1X |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14285 | == (pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X )) |
| 14286 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14287 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Dynamic WEP not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14288 | __func__); |
| 14289 | return -EOPNOTSUPP; |
| 14290 | } |
| 14291 | else |
| 14292 | { |
| 14293 | u8 key_len = req->key_len; |
| 14294 | u8 key_idx = req->key_idx; |
| 14295 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14296 | if ((eCSR_SECURITY_WEP_KEYSIZE_MAX_BYTES >= key_len) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14297 | && (CSR_MAX_NUM_KEY > key_idx) |
| 14298 | ) |
| 14299 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14300 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14301 | "%s: setting default wep key, key_idx = %hu key_len %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14302 | __func__, key_idx, key_len); |
| 14303 | vos_mem_copy( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14304 | &pWextState->roamProfile.Keys.KeyMaterial[key_idx][0], |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14305 | req->key, key_len); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14306 | pWextState->roamProfile.Keys.KeyLength[key_idx] = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14307 | (u8)key_len; |
| 14308 | pWextState->roamProfile.Keys.defaultIndex = (u8)key_idx; |
| 14309 | } |
| 14310 | } |
| 14311 | } |
| 14312 | } |
| 14313 | |
| 14314 | return status; |
| 14315 | } |
| 14316 | |
| 14317 | /* |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14318 | * FUNCTION: wlan_hdd_try_disconnect |
| 14319 | * This function is used to disconnect from previous |
| 14320 | * connection |
| 14321 | */ |
| 14322 | static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter ) |
| 14323 | { |
| 14324 | long ret = 0; |
| 14325 | hdd_station_ctx_t *pHddStaCtx; |
| 14326 | eMib_dot11DesiredBssType connectedBssType; |
| 14327 | |
| 14328 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14329 | |
| 14330 | hdd_connGetConnectedBssType(pHddStaCtx,&connectedBssType ); |
| 14331 | |
| 14332 | if((eMib_dot11DesiredBssType_independent == connectedBssType) || |
| 14333 | (eConnectionState_Associated == pHddStaCtx->conn_info.connState) || |
| 14334 | (eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) |
| 14335 | { |
Abhishek Singh | f796258 | 2015-10-23 10:54:06 +0530 | [diff] [blame] | 14336 | hdd_connSetConnectionState(pHddStaCtx, |
| 14337 | eConnectionState_Disconnecting); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14338 | /* Issue disconnect to CSR */ |
| 14339 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 14340 | if( eHAL_STATUS_SUCCESS == |
| 14341 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14342 | pAdapter->sessionId, |
| 14343 | eCSR_DISCONNECT_REASON_UNSPECIFIED ) ) |
| 14344 | { |
| 14345 | ret = wait_for_completion_interruptible_timeout( |
| 14346 | &pAdapter->disconnect_comp_var, |
| 14347 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 14348 | if (0 >= ret) |
| 14349 | { |
| 14350 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 14351 | return -EALREADY; |
| 14352 | } |
| 14353 | } |
| 14354 | } |
| 14355 | else if(eConnectionState_Disconnecting == pHddStaCtx->conn_info.connState) |
| 14356 | { |
| 14357 | ret = wait_for_completion_interruptible_timeout( |
| 14358 | &pAdapter->disconnect_comp_var, |
| 14359 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
| 14360 | if (0 >= ret) |
| 14361 | { |
| 14362 | hddLog(LOGE, FL("Failed to receive disconnect event")); |
| 14363 | return -EALREADY; |
| 14364 | } |
| 14365 | } |
| 14366 | |
| 14367 | return 0; |
| 14368 | } |
| 14369 | |
| 14370 | /* |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 14371 | * FUNCTION: __wlan_hdd_cfg80211_connect |
| 14372 | * This function is used to start the association process |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14373 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 14374 | static int __wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14375 | struct net_device *ndev, |
| 14376 | struct cfg80211_connect_params *req |
| 14377 | ) |
| 14378 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14379 | int status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14380 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14381 | VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL; |
Sushant Kaushik | ba6764e | 2014-06-30 19:52:09 +0530 | [diff] [blame] | 14382 | hdd_context_t *pHddCtx = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14383 | |
| 14384 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14385 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14386 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14387 | TRACE_CODE_HDD_CFG80211_CONNECT, |
| 14388 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14389 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 14390 | "%s: device_mode = %s (%d)", __func__, |
| 14391 | hdd_device_modetoString(pAdapter->device_mode), |
| 14392 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14393 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14394 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 14395 | if (!pHddCtx) |
| 14396 | { |
| 14397 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 14398 | "%s: HDD context is null", __func__); |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 14399 | return -EINVAL; |
Rajesh Chauhan | a0516c6 | 2014-01-30 16:11:18 -0800 | [diff] [blame] | 14400 | } |
| 14401 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14402 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14403 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14404 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14405 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14406 | } |
| 14407 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 14408 | if (vos_max_concurrent_connections_reached()) { |
| 14409 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 14410 | return -ECONNREFUSED; |
| 14411 | } |
| 14412 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14413 | #ifdef WLAN_BTAMP_FEATURE |
| 14414 | //Infra connect not supported when AMP traffic is on. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14415 | if( VOS_TRUE == WLANBAP_AmpSessionOn() ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14416 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14417 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14418 | "%s: No connection when AMP is on", __func__); |
Madan Mohan Koyyalamudi | cae253a | 2012-11-06 19:10:35 -0800 | [diff] [blame] | 14419 | return -ECONNREFUSED; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14420 | } |
| 14421 | #endif |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14422 | |
| 14423 | //If Device Mode is Station Concurrent Sessions Exit BMps |
| 14424 | //P2P Mode will be taken care in Open/close adapter |
| 14425 | if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) && |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 14426 | (vos_concurrent_open_sessions_running())) { |
| 14427 | exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, |
| 14428 | WLAN_HDD_INFRA_STATION); |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14429 | } |
| 14430 | |
| 14431 | /*Try disconnecting if already in connected state*/ |
| 14432 | status = wlan_hdd_try_disconnect(pAdapter); |
| 14433 | if ( 0 > status) |
| 14434 | { |
| 14435 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 14436 | " connection")); |
| 14437 | return -EALREADY; |
| 14438 | } |
| 14439 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14440 | /*initialise security parameters*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14441 | status = wlan_hdd_cfg80211_set_privacy(pAdapter, req); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14442 | |
| 14443 | if ( 0 > status) |
| 14444 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14445 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security params", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14446 | __func__); |
| 14447 | return status; |
| 14448 | } |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 14449 | if ( req->channel ) |
| 14450 | { |
| 14451 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
| 14452 | req->ssid_len, req->bssid, |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 14453 | req->bssid_hint, |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 14454 | req->channel->hw_value); |
| 14455 | } |
| 14456 | else |
| 14457 | { |
| 14458 | status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid, |
Hanumantha Reddy Pothula | 64081b7 | 2015-09-11 15:47:32 +0530 | [diff] [blame] | 14459 | req->ssid_len, req->bssid, |
| 14460 | req->bssid_hint, 0); |
Mohit Khanna | 765234a | 2012-09-11 15:08:35 -0700 | [diff] [blame] | 14461 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14462 | |
Sushant Kaushik | d708398 | 2015-03-18 14:33:24 +0530 | [diff] [blame] | 14463 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14464 | { |
| 14465 | //ReEnable BMPS if disabled |
| 14466 | if((VOS_STATUS_SUCCESS == exitbmpsStatus) && |
| 14467 | (NULL != pHddCtx)) |
| 14468 | { |
Gopichand Nakkala | a2fe5b0 | 2013-06-06 16:32:28 +0530 | [diff] [blame] | 14469 | if (pHddCtx->hdd_wlan_suspended) |
| 14470 | { |
| 14471 | hdd_set_pwrparams(pHddCtx); |
| 14472 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14473 | //ReEnable Bmps and Imps back |
| 14474 | hdd_enable_bmps_imps(pHddCtx); |
| 14475 | } |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 14476 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("connect failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14477 | return status; |
| 14478 | } |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14479 | pHddCtx->isAmpAllowed = VOS_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14480 | EXIT(); |
| 14481 | return status; |
| 14482 | } |
| 14483 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 14484 | static int wlan_hdd_cfg80211_connect( struct wiphy *wiphy, |
| 14485 | struct net_device *ndev, |
| 14486 | struct cfg80211_connect_params *req) |
| 14487 | { |
| 14488 | int ret; |
| 14489 | vos_ssr_protect(__func__); |
| 14490 | ret = __wlan_hdd_cfg80211_connect(wiphy, ndev, req); |
| 14491 | vos_ssr_unprotect(__func__); |
| 14492 | |
| 14493 | return ret; |
| 14494 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14495 | |
| 14496 | /* |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14497 | * FUNCTION: wlan_hdd_disconnect |
| 14498 | * This function is used to issue a disconnect request to SME |
| 14499 | */ |
| 14500 | int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason ) |
| 14501 | { |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 14502 | int status, result = 0; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14503 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14504 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 14505 | long ret; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14506 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14507 | ENTER(); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14508 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14509 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14510 | if (0 != status) |
| 14511 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14512 | return status; |
| 14513 | } |
Abhishek Singh | 07e4a89 | 2015-11-23 11:29:57 +0530 | [diff] [blame] | 14514 | /* Indicate sme of disconnect so that in progress connection or preauth |
| 14515 | * can be aborted |
| 14516 | */ |
| 14517 | sme_abortConnection(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Sushant Kaushik | b4834d2 | 2015-07-15 15:29:05 +0530 | [diff] [blame] | 14518 | pAdapter->sessionId); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14519 | pHddCtx->isAmpAllowed = VOS_TRUE; |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 14520 | |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 14521 | /* Need to apply spin lock before decreasing active sessions |
| 14522 | * as there can be chance for double decrement if context switch |
| 14523 | * Calls hdd_DisConnectHandler. |
| 14524 | */ |
| 14525 | |
| 14526 | spin_lock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 14527 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 14528 | { |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 14529 | wlan_hdd_decr_active_session(pHddCtx, pAdapter->device_mode); |
| 14530 | } |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 14531 | hdd_connSetConnectionState( pHddStaCtx, eConnectionState_Disconnecting ); |
| 14532 | spin_unlock_bh(&pAdapter->lock_for_active_session); |
Agarwal Ashish | c65b5ca | 2014-07-28 21:02:57 +0530 | [diff] [blame] | 14533 | |
Abhishek Singh | f4669da | 2014-05-26 15:07:49 +0530 | [diff] [blame] | 14534 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Agarwal Ashish | 47d1811 | 2014-08-04 19:55:07 +0530 | [diff] [blame] | 14535 | FL( "Set HDD connState to eConnectionState_Disconnecting" )); |
| 14536 | |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14537 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14538 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 14539 | /* |
| 14540 | * stop tx queues before deleting STA/BSS context from the firmware. |
| 14541 | * tx has to be disabled because the firmware can get busy dropping |
| 14542 | * the tx frames after BSS/STA has been deleted and will not send |
| 14543 | * back a response resulting in WDI timeout |
| 14544 | */ |
Padma, Santhosh Kumar | 9dacb5c | 2014-12-17 19:22:56 +0530 | [diff] [blame] | 14545 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Disabling queues")); |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 14546 | netif_tx_disable(pAdapter->dev); |
| 14547 | netif_carrier_off(pAdapter->dev); |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 14548 | |
Mihir Shete | 182a0b2 | 2014-08-18 16:08:48 +0530 | [diff] [blame] | 14549 | /*issue disconnect*/ |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14550 | status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14551 | pAdapter->sessionId, reason); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 14552 | if(eHAL_STATUS_CMD_NOT_QUEUED == status) |
| 14553 | { |
| 14554 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 14555 | FL("status = %d, already disconnected"), |
| 14556 | (int)status ); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14557 | |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 14558 | } |
| 14559 | else if ( 0 != status ) |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14560 | { |
| 14561 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14562 | "%s csrRoamDisconnect failure, returned %d", |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14563 | __func__, (int)status ); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 14564 | result = -EINVAL; |
| 14565 | goto disconnected; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14566 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 14567 | ret = wait_for_completion_interruptible_timeout( |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14568 | &pAdapter->disconnect_comp_var, |
| 14569 | msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT)); |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 14570 | if (!ret && ( eHAL_STATUS_CMD_NOT_QUEUED != status )) |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14571 | { |
| 14572 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 14573 | "%s: Failed to disconnect, timed out", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 14574 | result = -ETIMEDOUT; |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 14575 | } |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 14576 | else if (ret == -ERESTARTSYS) |
Mahesh A Saptasagar | 05a357e | 2014-02-26 16:28:06 +0530 | [diff] [blame] | 14577 | { |
| 14578 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 14579 | "%s: Failed to disconnect, wait interrupted", __func__); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 14580 | result = -ERESTARTSYS; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 14581 | } |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 14582 | disconnected: |
Abhishek Singh | dc2bfd4 | 2014-06-19 17:59:05 +0530 | [diff] [blame] | 14583 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 14584 | FL("Set HDD connState to eConnectionState_NotConnected")); |
| 14585 | pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; |
| 14586 | |
Abhishek Singh | 087de60 | 2015-10-21 17:18:55 +0530 | [diff] [blame] | 14587 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) |
| 14588 | /* Sending disconnect event to userspace for kernel version < 3.11 |
| 14589 | * is handled by __cfg80211_disconnect call to __cfg80211_disconnected |
| 14590 | */ |
| 14591 | hddLog(LOG1, FL("Send disconnected event to userspace")); |
| 14592 | cfg80211_disconnected(pAdapter->dev, WLAN_REASON_UNSPECIFIED, |
| 14593 | NULL, 0, GFP_KERNEL); |
| 14594 | #endif |
| 14595 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14596 | EXIT(); |
Abhishek Singh | 6ab864d | 2014-11-27 12:10:10 +0530 | [diff] [blame] | 14597 | return result; |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14598 | } |
| 14599 | |
| 14600 | |
| 14601 | /* |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 14602 | * FUNCTION: __wlan_hdd_cfg80211_disconnect |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14603 | * This function is used to issue a disconnect request to SME |
| 14604 | */ |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 14605 | static int __wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14606 | struct net_device *dev, |
| 14607 | u16 reason |
| 14608 | ) |
| 14609 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14610 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14611 | int status; |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 14612 | tCsrRoamProfile *pRoamProfile; |
| 14613 | hdd_station_ctx_t *pHddStaCtx; |
| 14614 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 14615 | #ifdef FEATURE_WLAN_TDLS |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 14616 | tANI_U8 staIdx; |
| 14617 | #endif |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14618 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14619 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14620 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 14621 | if (!pAdapter) { |
| 14622 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 14623 | return -EINVAL; |
| 14624 | } |
| 14625 | |
| 14626 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14627 | if (!pHddStaCtx) { |
| 14628 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD STA context is NULL")); |
| 14629 | return -EINVAL; |
| 14630 | } |
| 14631 | |
| 14632 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 14633 | status = wlan_hdd_validate_context(pHddCtx); |
| 14634 | if (0 != status) |
| 14635 | { |
| 14636 | return status; |
| 14637 | } |
| 14638 | |
| 14639 | pRoamProfile = &(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile; |
| 14640 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14641 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14642 | TRACE_CODE_HDD_CFG80211_DISCONNECT, |
| 14643 | pAdapter->sessionId, reason)); |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 14644 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s(%d)", |
| 14645 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 14646 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14647 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14648 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d", |
| 14649 | __func__, reason); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14650 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14651 | if (NULL != pRoamProfile) |
| 14652 | { |
| 14653 | /*issue disconnect request to SME, if station is in connected state*/ |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 14654 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated) || |
| 14655 | (pHddStaCtx->conn_info.connState == eConnectionState_Connecting)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14656 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14657 | eCsrRoamDisconnectReason reasonCode = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14658 | eCSR_DISCONNECT_REASON_UNSPECIFIED; |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 14659 | hdd_scaninfo_t *pScanInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14660 | switch(reason) |
| 14661 | { |
| 14662 | case WLAN_REASON_MIC_FAILURE: |
| 14663 | reasonCode = eCSR_DISCONNECT_REASON_MIC_ERROR; |
| 14664 | break; |
| 14665 | |
| 14666 | case WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY: |
| 14667 | case WLAN_REASON_DISASSOC_AP_BUSY: |
| 14668 | case WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA: |
| 14669 | reasonCode = eCSR_DISCONNECT_REASON_DISASSOC; |
| 14670 | break; |
| 14671 | |
| 14672 | case WLAN_REASON_PREV_AUTH_NOT_VALID: |
| 14673 | case WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA: |
Abhishek Singh | c3269a5 | 2014-05-21 17:22:24 +0530 | [diff] [blame] | 14674 | case WLAN_REASON_DEAUTH_LEAVING: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14675 | reasonCode = eCSR_DISCONNECT_REASON_DEAUTH; |
| 14676 | break; |
| 14677 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14678 | default: |
| 14679 | reasonCode = eCSR_DISCONNECT_REASON_UNSPECIFIED; |
| 14680 | break; |
| 14681 | } |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 14682 | pScanInfo = &pHddCtx->scan_info; |
| 14683 | if (pScanInfo->mScanPending) |
| 14684 | { |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 14685 | hddLog(VOS_TRACE_LEVEL_INFO, "Disconnect is in progress, " |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 14686 | "Aborting Scan"); |
Kaushik, Sushant | 4975a57 | 2014-10-21 16:07:48 +0530 | [diff] [blame] | 14687 | hdd_abort_mac_scan(pHddCtx, pScanInfo->sessionId, |
Srinivas, Dasari | 138af4f | 2014-02-07 11:13:45 +0530 | [diff] [blame] | 14688 | eCSR_SCAN_ABORT_DEFAULT); |
Gopichand Nakkala | aa35378 | 2013-05-17 20:36:22 +0530 | [diff] [blame] | 14689 | } |
Agarwal Ashish | c089cec | 2015-08-10 13:10:04 +0530 | [diff] [blame] | 14690 | wlan_hdd_cancel_existing_remain_on_channel(pAdapter); |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 14691 | #ifdef FEATURE_WLAN_TDLS |
| 14692 | /* First clean up the tdls peers if any */ |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14693 | for (staIdx = 0 ; staIdx < HDD_MAX_NUM_TDLS_STA; staIdx++) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 14694 | { |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14695 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == pAdapter->sessionId) && |
| 14696 | (pHddCtx->tdlsConnInfo[staIdx].staId)) |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 14697 | { |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 14698 | uint8 *mac; |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14699 | mac = pHddCtx->tdlsConnInfo[staIdx].peerMac.bytes; |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 14700 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14701 | "%s: call sme_DeleteTdlsPeerSta staId %d sessionId %d " MAC_ADDRESS_STR, |
Gopichand Nakkala | 4327a15 | 2013-03-04 23:22:42 -0800 | [diff] [blame] | 14702 | __func__, pHddCtx->tdlsConnInfo[staIdx].staId, pAdapter->sessionId, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 14703 | MAC_ADDR_ARRAY(mac)); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 14704 | status = sme_DeleteTdlsPeerSta( |
| 14705 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 14706 | pAdapter->sessionId, |
| 14707 | mac); |
| 14708 | if (status != eHAL_STATUS_SUCCESS) { |
| 14709 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 14710 | return -EPERM; |
| 14711 | } |
Gopichand Nakkala | 2a0a157 | 2013-02-10 21:39:16 -0800 | [diff] [blame] | 14712 | } |
| 14713 | } |
| 14714 | #endif |
Arun Kumar Khandavalli | 94a2bb0 | 2013-12-28 19:17:25 +0530 | [diff] [blame] | 14715 | hddLog(LOG1, FL("Disconnecting with reasoncode:%u"), reasonCode); |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14716 | status = wlan_hdd_disconnect(pAdapter, reasonCode); |
| 14717 | if ( 0 != status ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14718 | { |
| 14719 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14720 | "%s wlan_hdd_disconnect failure, returned %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14721 | __func__, (int)status ); |
| 14722 | return -EINVAL; |
| 14723 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14724 | } |
Mahesh A Saptasagar | 280fd5a | 2013-12-05 15:38:31 +0530 | [diff] [blame] | 14725 | else |
| 14726 | { |
| 14727 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: unexpected cfg disconnect API" |
| 14728 | "called while in %d state", __func__, |
| 14729 | pHddStaCtx->conn_info.connState); |
| 14730 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14731 | } |
| 14732 | else |
| 14733 | { |
| 14734 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid roam profile", __func__); |
| 14735 | } |
| 14736 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14737 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14738 | return status; |
| 14739 | } |
| 14740 | |
Mahesh A Saptasagar | fafb7fe | 2014-05-16 13:19:37 +0530 | [diff] [blame] | 14741 | static int wlan_hdd_cfg80211_disconnect( struct wiphy *wiphy, |
| 14742 | struct net_device *dev, |
| 14743 | u16 reason |
| 14744 | ) |
| 14745 | { |
| 14746 | int ret; |
| 14747 | vos_ssr_protect(__func__); |
| 14748 | ret = __wlan_hdd_cfg80211_disconnect(wiphy, dev, reason); |
| 14749 | vos_ssr_unprotect(__func__); |
| 14750 | |
| 14751 | return ret; |
| 14752 | } |
Gopichand Nakkala | 78a6c81 | 2013-05-13 16:39:49 +0530 | [diff] [blame] | 14753 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14754 | /* |
| 14755 | * FUNCTION: wlan_hdd_cfg80211_set_privacy_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14756 | * This function is used to initialize the security |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14757 | * settings in IBSS mode. |
| 14758 | */ |
| 14759 | static int wlan_hdd_cfg80211_set_privacy_ibss( |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14760 | hdd_adapter_t *pAdapter, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14761 | struct cfg80211_ibss_params *params |
| 14762 | ) |
| 14763 | { |
| 14764 | int status = 0; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14765 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14766 | eCsrEncryptionType encryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 14767 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14768 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14769 | ENTER(); |
| 14770 | |
| 14771 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_DISABLED; |
Ravi Joshi | b58ca0d | 2013-10-29 09:50:23 -0700 | [diff] [blame] | 14772 | vos_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14773 | |
| 14774 | if (params->ie_len && ( NULL != params->ie) ) |
| 14775 | { |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 14776 | if (wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 14777 | params->ie_len, WLAN_EID_RSN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14778 | { |
| 14779 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA2; |
| 14780 | encryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 14781 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 14782 | else if ( hdd_isWPAIEPresent (params->ie, params->ie_len )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14783 | { |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 14784 | tDot11fIEWPA dot11WPAIE; |
| 14785 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 14786 | u8 *ie; |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 14787 | |
Wilson Yang | 0025634 | 2013-10-10 23:13:38 -0700 | [diff] [blame] | 14788 | memset(&dot11WPAIE, 0, sizeof(dot11WPAIE)); |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 14789 | ie = wlan_hdd_cfg80211_get_ie_ptr (params->ie, |
| 14790 | params->ie_len, DOT11F_EID_WPA); |
| 14791 | if ( NULL != ie ) |
| 14792 | { |
| 14793 | pWextState->wpaVersion = IW_AUTH_WPA_VERSION_WPA; |
| 14794 | // Unpack the WPA IE |
| 14795 | //Skip past the EID byte and length byte - and four byte WiFi OUI |
| 14796 | dot11fUnpackIeWPA((tpAniSirGlobal) halHandle, |
| 14797 | &ie[2+4], |
| 14798 | ie[1] - 4, |
| 14799 | &dot11WPAIE); |
| 14800 | /*Extract the multicast cipher, the encType for unicast |
| 14801 | cipher for wpa-none is none*/ |
| 14802 | encryptionType = |
| 14803 | hdd_TranslateWPAToCsrEncryptionType(dot11WPAIE.multicast_cipher); |
| 14804 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14805 | } |
Shailender Karmuchi | 67edd31 | 2013-06-18 16:30:48 -0700 | [diff] [blame] | 14806 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14807 | status = wlan_hdd_cfg80211_set_ie(pAdapter, params->ie, params->ie_len); |
| 14808 | |
| 14809 | if (0 > status) |
| 14810 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14811 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to parse WPA/RSN IE", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14812 | __func__); |
| 14813 | return status; |
| 14814 | } |
| 14815 | } |
| 14816 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14817 | pWextState->roamProfile.AuthType.authType[0] = |
| 14818 | pHddStaCtx->conn_info.authType = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14819 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 14820 | |
| 14821 | if (params->privacy) |
| 14822 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14823 | /* Security enabled IBSS, At this time there is no information available |
| 14824 | * about the security paramters, so initialise the encryption type to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14825 | * eCSR_ENCRYPT_TYPE_WEP40_STATICKEY. |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14826 | * The correct security parameters will be updated later in |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14827 | * wlan_hdd_cfg80211_add_key */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14828 | /* Hal expects encryption type to be set inorder |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14829 | *enable privacy bit in beacons */ |
| 14830 | |
| 14831 | encryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 14832 | } |
Shailender Karmuchi | 642e981 | 2013-05-30 14:34:49 -0700 | [diff] [blame] | 14833 | VOS_TRACE (VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, |
| 14834 | "encryptionType=%d", encryptionType); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14835 | pHddStaCtx->conn_info.ucEncryptionType = encryptionType; |
| 14836 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 14837 | pWextState->roamProfile.EncryptionType.encryptionType[0] = encryptionType; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14838 | return status; |
| 14839 | } |
| 14840 | |
| 14841 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14842 | * FUNCTION: __wlan_hdd_cfg80211_join_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14843 | * This function is used to create/join an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14844 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 14845 | static int __wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14846 | struct net_device *dev, |
| 14847 | struct cfg80211_ibss_params *params |
| 14848 | ) |
| 14849 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14850 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14851 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 14852 | tCsrRoamProfile *pRoamProfile; |
| 14853 | int status; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14854 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 14855 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14856 | tSirMacAddr bssid; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14857 | |
| 14858 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 14859 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 14860 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 14861 | TRACE_CODE_HDD_CFG80211_JOIN_IBSS, |
| 14862 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14863 | hddLog(VOS_TRACE_LEVEL_INFO, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 14864 | "%s: device_mode = %s (%d)", __func__, |
| 14865 | hdd_device_modetoString(pAdapter->device_mode), |
| 14866 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14867 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14868 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14869 | if (0 != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14870 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 14871 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14872 | } |
| 14873 | |
| 14874 | if (NULL == pWextState) |
| 14875 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14876 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14877 | __func__); |
| 14878 | return -EIO; |
| 14879 | } |
| 14880 | |
Agarwal Ashish | 51325b5 | 2014-06-16 16:50:49 +0530 | [diff] [blame] | 14881 | if (vos_max_concurrent_connections_reached()) { |
| 14882 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 14883 | return -ECONNREFUSED; |
| 14884 | } |
| 14885 | |
Vinay Krishna Eranna | 2104232 | 2014-01-08 19:21:39 +0530 | [diff] [blame] | 14886 | /*Try disconnecting if already in connected state*/ |
| 14887 | status = wlan_hdd_try_disconnect(pAdapter); |
| 14888 | if ( 0 > status) |
| 14889 | { |
| 14890 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing" |
| 14891 | " IBSS connection")); |
| 14892 | return -EALREADY; |
| 14893 | } |
| 14894 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14895 | pRoamProfile = &pWextState->roamProfile; |
| 14896 | |
| 14897 | if ( eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType ) |
| 14898 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14899 | hddLog (VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 14900 | "%s Interface type is not set to IBSS", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14901 | return -EINVAL; |
| 14902 | } |
| 14903 | |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 14904 | /* BSSID is provided by upper layers hence no need to AUTO generate */ |
| 14905 | if (NULL != params->bssid) { |
| 14906 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 14907 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) { |
| 14908 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 14909 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 14910 | return -EIO; |
| 14911 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14912 | 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] | 14913 | } |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 14914 | else if(pHddCtx->cfg_ini->isCoalesingInIBSSAllowed == 0) |
| 14915 | { |
| 14916 | if (ccmCfgSetInt(pHddCtx->hHal, WNI_CFG_IBSS_AUTO_BSSID, 0, |
| 14917 | NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE) |
| 14918 | { |
| 14919 | hddLog (VOS_TRACE_LEVEL_ERROR, |
| 14920 | "%s:ccmCfgStInt faild for WNI_CFG_IBSS_AUTO_BSSID", __func__); |
| 14921 | return -EIO; |
| 14922 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14923 | |
| 14924 | vos_mem_copy((v_U8_t *)bssid, |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 14925 | (v_U8_t *)&pHddCtx->cfg_ini->IbssBssid.bytes[0], |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 14926 | sizeof(bssid)); |
krunal soni | e9002db | 2013-11-25 14:24:17 -0800 | [diff] [blame] | 14927 | } |
Praveen Kumar Sirisilla | d123d14 | 2013-09-24 16:50:13 -0700 | [diff] [blame] | 14928 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14929 | /* Set Channel */ |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 14930 | if (NULL != |
| 14931 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 14932 | params->chandef.chan) |
| 14933 | #else |
| 14934 | params->channel) |
| 14935 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14936 | { |
| 14937 | u8 channelNum; |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14938 | v_U32_t numChans = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 14939 | v_U8_t validChan[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
| 14940 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 14941 | int indx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14942 | |
| 14943 | /* Get channel number */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14944 | channelNum = |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 14945 | ieee80211_frequency_to_channel( |
| 14946 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0)) |
| 14947 | params->chandef.chan->center_freq); |
| 14948 | #else |
| 14949 | params->channel->center_freq); |
| 14950 | #endif |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14951 | |
| 14952 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 14953 | validChan, &numChans)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14954 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14955 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: No valid channel list", |
| 14956 | __func__); |
| 14957 | return -EOPNOTSUPP; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14958 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14959 | |
| 14960 | for (indx = 0; indx < numChans; indx++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14961 | { |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14962 | if (channelNum == validChan[indx]) |
| 14963 | { |
| 14964 | break; |
| 14965 | } |
| 14966 | } |
| 14967 | if (indx >= numChans) |
| 14968 | { |
| 14969 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Not valid Channel %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14970 | __func__, channelNum); |
| 14971 | return -EINVAL; |
| 14972 | } |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14973 | /* Set the Operational Channel */ |
| 14974 | hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: set channel %d", __func__, |
| 14975 | channelNum); |
| 14976 | pRoamProfile->ChannelInfo.numOfChannels = 1; |
| 14977 | pHddStaCtx->conn_info.operationChannel = channelNum; |
| 14978 | pRoamProfile->ChannelInfo.ChannelList = |
| 14979 | &pHddStaCtx->conn_info.operationChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14980 | } |
| 14981 | |
| 14982 | /* Initialize security parameters */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14983 | status = wlan_hdd_cfg80211_set_privacy_ibss(pAdapter, params); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14984 | if (status < 0) |
| 14985 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14986 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: failed to set security parameters", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14987 | __func__); |
| 14988 | return status; |
| 14989 | } |
| 14990 | |
| 14991 | /* Issue connect start */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 14992 | status = wlan_hdd_cfg80211_connect_start(pAdapter, params->ssid, |
Abhishek Singh | 4d92468 | 2015-11-17 15:23:06 +0530 | [diff] [blame] | 14993 | params->ssid_len, (const u8 *)&bssid, NULL, |
Shailender Karmuchi | 15cd067 | 2013-05-15 19:50:04 -0700 | [diff] [blame] | 14994 | pHddStaCtx->conn_info.operationChannel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14995 | |
| 14996 | if (0 > status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14997 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 14998 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 14999 | EXIT(); |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 15000 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15001 | } |
| 15002 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15003 | static int wlan_hdd_cfg80211_join_ibss( struct wiphy *wiphy, |
| 15004 | struct net_device *dev, |
| 15005 | struct cfg80211_ibss_params *params |
| 15006 | ) |
| 15007 | { |
| 15008 | int ret = 0; |
| 15009 | |
| 15010 | vos_ssr_protect(__func__); |
| 15011 | ret = __wlan_hdd_cfg80211_join_ibss(wiphy, dev, params); |
| 15012 | vos_ssr_unprotect(__func__); |
| 15013 | |
| 15014 | return ret; |
| 15015 | } |
| 15016 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15017 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15018 | * FUNCTION: __wlan_hdd_cfg80211_leave_ibss |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15019 | * This function is used to leave an IBSS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15020 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15021 | static int __wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15022 | struct net_device *dev |
| 15023 | ) |
| 15024 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15025 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15026 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 15027 | tCsrRoamProfile *pRoamProfile; |
| 15028 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15029 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15030 | |
| 15031 | ENTER(); |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 15032 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15033 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15034 | TRACE_CODE_HDD_CFG80211_LEAVE_IBSS, |
| 15035 | pAdapter->sessionId, eCSR_DISCONNECT_REASON_IBSS_LEAVE)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15036 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15037 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15038 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15039 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15040 | } |
| 15041 | |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 15042 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %s (%d)", __func__, |
| 15043 | hdd_device_modetoString(pAdapter->device_mode), |
| 15044 | pAdapter->device_mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15045 | if (NULL == pWextState) |
| 15046 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 15047 | hddLog (VOS_TRACE_LEVEL_ERROR, "%s ERROR: Data Storage Corruption", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15048 | __func__); |
| 15049 | return -EIO; |
| 15050 | } |
| 15051 | |
| 15052 | pRoamProfile = &pWextState->roamProfile; |
| 15053 | |
| 15054 | /* Issue disconnect only if interface type is set to IBSS */ |
| 15055 | if (eCSR_BSS_TYPE_START_IBSS != pRoamProfile->BSSType) |
| 15056 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15057 | 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] | 15058 | __func__); |
| 15059 | return -EINVAL; |
| 15060 | } |
| 15061 | |
| 15062 | /* Issue Disconnect request */ |
| 15063 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
| 15064 | sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 15065 | eCSR_DISCONNECT_REASON_IBSS_LEAVE); |
| 15066 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15067 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15068 | return 0; |
| 15069 | } |
| 15070 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15071 | static int wlan_hdd_cfg80211_leave_ibss( struct wiphy *wiphy, |
| 15072 | struct net_device *dev |
| 15073 | ) |
| 15074 | { |
| 15075 | int ret = 0; |
| 15076 | |
| 15077 | vos_ssr_protect(__func__); |
| 15078 | ret = __wlan_hdd_cfg80211_leave_ibss(wiphy, dev); |
| 15079 | vos_ssr_unprotect(__func__); |
| 15080 | |
| 15081 | return ret; |
| 15082 | } |
| 15083 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15084 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15085 | * FUNCTION: __wlan_hdd_cfg80211_set_wiphy_params |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15086 | * This function is used to set the phy parameters |
| 15087 | * (RTS Threshold/FRAG Threshold/Retry Count etc ...) |
| 15088 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15089 | static int __wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15090 | u32 changed) |
| 15091 | { |
| 15092 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 15093 | tHalHandle hHal = pHddCtx->hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15094 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15095 | |
| 15096 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15097 | |
| 15098 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15099 | TRACE_CODE_HDD_CFG80211_SET_WIPHY_PARAMS, |
| 15100 | NO_SESSION, wiphy->rts_threshold)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15101 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15102 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15103 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15104 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15105 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15106 | } |
| 15107 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15108 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) |
| 15109 | { |
| 15110 | u16 rts_threshold = (wiphy->rts_threshold == -1) ? |
| 15111 | WNI_CFG_RTS_THRESHOLD_STAMAX : |
| 15112 | wiphy->rts_threshold; |
| 15113 | |
| 15114 | if ((WNI_CFG_RTS_THRESHOLD_STAMIN > rts_threshold) || |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15115 | (WNI_CFG_RTS_THRESHOLD_STAMAX < rts_threshold)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15116 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15117 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15118 | "%s: Invalid RTS Threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15119 | __func__, rts_threshold); |
| 15120 | return -EINVAL; |
| 15121 | } |
| 15122 | |
| 15123 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_RTS_THRESHOLD, |
| 15124 | rts_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15125 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15126 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15127 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15128 | "%s: ccmCfgSetInt failed for rts_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15129 | __func__, rts_threshold); |
| 15130 | return -EIO; |
| 15131 | } |
| 15132 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15133 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set rts threshold %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15134 | rts_threshold); |
| 15135 | } |
| 15136 | |
| 15137 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD) |
| 15138 | { |
| 15139 | u16 frag_threshold = (wiphy->frag_threshold == -1) ? |
| 15140 | WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX : |
| 15141 | wiphy->frag_threshold; |
| 15142 | |
| 15143 | if ((WNI_CFG_FRAGMENTATION_THRESHOLD_STAMIN > frag_threshold)|| |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15144 | (WNI_CFG_FRAGMENTATION_THRESHOLD_STAMAX < frag_threshold) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15145 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15146 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15147 | "%s: Invalid frag_threshold value %hu", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15148 | frag_threshold); |
| 15149 | return -EINVAL; |
| 15150 | } |
| 15151 | |
| 15152 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_FRAGMENTATION_THRESHOLD, |
| 15153 | frag_threshold, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15154 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15155 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15156 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15157 | "%s: ccmCfgSetInt failed for frag_threshold value %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15158 | __func__, frag_threshold); |
| 15159 | return -EIO; |
| 15160 | } |
| 15161 | |
| 15162 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set frag threshold %hu", __func__, |
| 15163 | frag_threshold); |
| 15164 | } |
| 15165 | |
| 15166 | if ((changed & WIPHY_PARAM_RETRY_SHORT) |
| 15167 | || (changed & WIPHY_PARAM_RETRY_LONG)) |
| 15168 | { |
| 15169 | u8 retry_value = (changed & WIPHY_PARAM_RETRY_SHORT) ? |
| 15170 | wiphy->retry_short : |
| 15171 | wiphy->retry_long; |
| 15172 | |
| 15173 | if ((WNI_CFG_LONG_RETRY_LIMIT_STAMIN > retry_value) || |
| 15174 | (WNI_CFG_LONG_RETRY_LIMIT_STAMAX < retry_value)) |
| 15175 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15176 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15177 | __func__, retry_value); |
| 15178 | return -EINVAL; |
| 15179 | } |
| 15180 | |
| 15181 | if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 15182 | { |
| 15183 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_LONG_RETRY_LIMIT, |
| 15184 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15185 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15186 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15187 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15188 | "%s: ccmCfgSetInt failed for long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15189 | __func__, retry_value); |
| 15190 | return -EIO; |
| 15191 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15192 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set long retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15193 | __func__, retry_value); |
| 15194 | } |
| 15195 | else if (changed & WIPHY_PARAM_RETRY_SHORT) |
| 15196 | { |
| 15197 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_SHORT_RETRY_LIMIT, |
| 15198 | retry_value, ccmCfgSetCallback, |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15199 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15200 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15201 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15202 | "%s: ccmCfgSetInt failed for short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15203 | __func__, retry_value); |
| 15204 | return -EIO; |
| 15205 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15206 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set short retry count %hu", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15207 | __func__, retry_value); |
| 15208 | } |
| 15209 | } |
| 15210 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15211 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15212 | return 0; |
| 15213 | } |
| 15214 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15215 | static int wlan_hdd_cfg80211_set_wiphy_params(struct wiphy *wiphy, |
| 15216 | u32 changed) |
| 15217 | { |
| 15218 | int ret; |
| 15219 | |
| 15220 | vos_ssr_protect(__func__); |
| 15221 | ret = __wlan_hdd_cfg80211_set_wiphy_params(wiphy, changed); |
| 15222 | vos_ssr_unprotect(__func__); |
| 15223 | |
| 15224 | return ret; |
| 15225 | } |
| 15226 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15227 | /* |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15228 | * FUNCTION: __wlan_hdd_cfg80211_set_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15229 | * This function is used to set the txpower |
| 15230 | */ |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15231 | static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 15232 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15233 | struct wireless_dev *wdev, |
| 15234 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15235 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15236 | enum tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15237 | #else |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15238 | enum nl80211_tx_power_setting type, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15239 | #endif |
| 15240 | int dbm) |
| 15241 | { |
| 15242 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15243 | tHalHandle hHal = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15244 | tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
| 15245 | tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15246 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15247 | |
| 15248 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15249 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15250 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15251 | TRACE_CODE_HDD_CFG80211_SET_TXPOWER, |
| 15252 | NO_SESSION, type )); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15253 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15254 | if (0 != status) |
| 15255 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15256 | return status; |
| 15257 | } |
| 15258 | |
| 15259 | hHal = pHddCtx->hHal; |
| 15260 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15261 | if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL, |
| 15262 | dbm, ccmCfgSetCallback, |
| 15263 | eANI_BOOLEAN_TRUE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15264 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15265 | hddLog(VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15266 | "%s: ccmCfgSetInt failed for tx power %hu", __func__, dbm); |
| 15267 | return -EIO; |
| 15268 | } |
| 15269 | |
| 15270 | hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__, |
| 15271 | dbm); |
| 15272 | |
| 15273 | switch(type) |
| 15274 | { |
| 15275 | case NL80211_TX_POWER_AUTOMATIC: /*automatically determine transmit power*/ |
| 15276 | /* Fall through */ |
| 15277 | case NL80211_TX_POWER_LIMITED: /*limit TX power by the mBm parameter*/ |
| 15278 | if( sme_SetMaxTxPower(hHal, bssid, selfMac, dbm) != eHAL_STATUS_SUCCESS ) |
| 15279 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15280 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Setting maximum tx power failed", |
| 15281 | __func__); |
| 15282 | return -EIO; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15283 | } |
| 15284 | break; |
| 15285 | case NL80211_TX_POWER_FIXED: /*fix TX power to the mBm parameter*/ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15286 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: NL80211_TX_POWER_FIXED not supported", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15287 | __func__); |
| 15288 | return -EOPNOTSUPP; |
| 15289 | break; |
| 15290 | default: |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15291 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid power setting type %d", |
| 15292 | __func__, type); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15293 | return -EIO; |
| 15294 | } |
| 15295 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15296 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15297 | return 0; |
| 15298 | } |
| 15299 | |
Mahesh A Saptasagar | 179d225 | 2014-06-02 21:32:21 +0530 | [diff] [blame] | 15300 | static int wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy, |
| 15301 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15302 | struct wireless_dev *wdev, |
| 15303 | #endif |
| 15304 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 15305 | enum tx_power_setting type, |
| 15306 | #else |
| 15307 | enum nl80211_tx_power_setting type, |
| 15308 | #endif |
| 15309 | int dbm) |
| 15310 | { |
| 15311 | int ret; |
| 15312 | vos_ssr_protect(__func__); |
| 15313 | ret = __wlan_hdd_cfg80211_set_txpower(wiphy, |
| 15314 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15315 | wdev, |
| 15316 | #endif |
| 15317 | #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,35) |
| 15318 | type, |
| 15319 | #else |
| 15320 | type, |
| 15321 | #endif |
| 15322 | dbm); |
| 15323 | vos_ssr_unprotect(__func__); |
| 15324 | |
| 15325 | return ret; |
| 15326 | } |
| 15327 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15328 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15329 | * FUNCTION: __wlan_hdd_cfg80211_get_txpower |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15330 | * This function is used to read the txpower |
| 15331 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15332 | static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
Yue Ma | f49ba87 | 2013-08-19 12:04:25 -0700 | [diff] [blame] | 15333 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15334 | struct wireless_dev *wdev, |
| 15335 | #endif |
| 15336 | int *dbm) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15337 | { |
| 15338 | |
| 15339 | hdd_adapter_t *pAdapter; |
| 15340 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15341 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15342 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15343 | ENTER(); |
| 15344 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15345 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15346 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15347 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15348 | *dbm = 0; |
| 15349 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15350 | } |
| 15351 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15352 | pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 15353 | if (NULL == pAdapter) |
| 15354 | { |
| 15355 | hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Not in station context " ,__func__); |
| 15356 | return -ENOENT; |
| 15357 | } |
| 15358 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 15359 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15360 | TRACE_CODE_HDD_CFG80211_GET_TXPOWER, |
| 15361 | pAdapter->sessionId, pAdapter->device_mode)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15362 | wlan_hdd_get_classAstats(pAdapter); |
| 15363 | *dbm = pAdapter->hdd_stats.ClassA_stat.max_pwr; |
| 15364 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15365 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15366 | return 0; |
| 15367 | } |
| 15368 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15369 | static int wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy, |
| 15370 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15371 | struct wireless_dev *wdev, |
| 15372 | #endif |
| 15373 | int *dbm) |
| 15374 | { |
| 15375 | int ret; |
| 15376 | |
| 15377 | vos_ssr_protect(__func__); |
| 15378 | ret = __wlan_hdd_cfg80211_get_txpower(wiphy, |
| 15379 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,0) |
| 15380 | wdev, |
| 15381 | #endif |
| 15382 | dbm); |
| 15383 | vos_ssr_unprotect(__func__); |
| 15384 | |
| 15385 | return ret; |
| 15386 | } |
| 15387 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15388 | 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] | 15389 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 15390 | const u8* mac, |
| 15391 | #else |
| 15392 | u8* mac, |
| 15393 | #endif |
| 15394 | struct station_info *sinfo) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15395 | { |
| 15396 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev ); |
| 15397 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 15398 | int ssidlen = pHddStaCtx->conn_info.SSID.SSID.length; |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 15399 | tANI_U32 rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15400 | |
| 15401 | hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy); |
| 15402 | hdd_config_t *pCfg = pHddCtx->cfg_ini; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15403 | |
| 15404 | tANI_U8 OperationalRates[CSR_DOT11_SUPPORTED_RATES_MAX]; |
| 15405 | tANI_U32 ORLeng = CSR_DOT11_SUPPORTED_RATES_MAX; |
| 15406 | tANI_U8 ExtendedRates[CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX]; |
| 15407 | tANI_U32 ERLeng = CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX; |
| 15408 | tANI_U8 MCSRates[SIZE_OF_BASIC_MCS_SET]; |
| 15409 | tANI_U32 MCSLeng = SIZE_OF_BASIC_MCS_SET; |
| 15410 | tANI_U16 maxRate = 0; |
| 15411 | tANI_U16 myRate; |
| 15412 | tANI_U16 currentRate = 0; |
| 15413 | tANI_U8 maxSpeedMCS = 0; |
| 15414 | tANI_U8 maxMCSIdx = 0; |
| 15415 | tANI_U8 rateFlag = 1; |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15416 | tANI_U8 i, j, rssidx, mode=0; |
Madan Mohan Koyyalamudi | c75be96 | 2012-10-18 19:19:03 -0700 | [diff] [blame] | 15417 | tANI_U16 temp; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15418 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15419 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15420 | #ifdef WLAN_FEATURE_11AC |
| 15421 | tANI_U32 vht_mcs_map; |
| 15422 | eDataRate11ACMaxMcs vhtMaxMcs; |
| 15423 | #endif /* WLAN_FEATURE_11AC */ |
| 15424 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15425 | ENTER(); |
| 15426 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15427 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 15428 | (0 == ssidlen)) |
| 15429 | { |
| 15430 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: Not associated or" |
| 15431 | " Invalid ssidlen, %d", __func__, ssidlen); |
| 15432 | /*To keep GUI happy*/ |
| 15433 | return 0; |
| 15434 | } |
| 15435 | |
Mukul Sharma | 811205f | 2014-07-09 21:07:30 +0530 | [diff] [blame] | 15436 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 15437 | { |
| 15438 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 15439 | "%s: Roaming in progress, so unable to proceed this request", __func__); |
| 15440 | return 0; |
| 15441 | } |
| 15442 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15443 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15444 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15445 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15446 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 15447 | } |
| 15448 | |
Hanumantha Reddy Pothula | dce6674 | 2015-08-25 18:08:44 +0530 | [diff] [blame] | 15449 | wlan_hdd_get_station_stats(pAdapter); |
| 15450 | rate_flags = pAdapter->hdd_stats.ClassA_stat.tx_rate_flags; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15451 | |
Kiet Lam | 3b17fc8 | 2013-09-27 05:24:08 +0530 | [diff] [blame] | 15452 | wlan_hdd_get_rssi(pAdapter, &sinfo->signal); |
| 15453 | sinfo->filled |= STATION_INFO_SIGNAL; |
| 15454 | |
c_hpothu | 09f1954 | 2014-05-30 21:53:31 +0530 | [diff] [blame] | 15455 | /*overwrite rate_flags if MAX link-speed need to be reported*/ |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 15456 | if ((eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) || |
| 15457 | (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed && |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15458 | sinfo->signal >= pCfg->linkSpeedRssiLow)) |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 15459 | { |
| 15460 | rate_flags = pAdapter->maxRateFlags; |
| 15461 | } |
c_hpothu | 44ff4e0 | 2014-05-08 00:13:57 +0530 | [diff] [blame] | 15462 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15463 | //convert to the UI units of 100kbps |
| 15464 | myRate = pAdapter->hdd_stats.ClassA_stat.tx_rate * 5; |
| 15465 | |
| 15466 | #ifdef LINKSPEED_DEBUG_ENABLED |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15467 | 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] | 15468 | sinfo->signal, |
| 15469 | pCfg->reportMaxLinkSpeed, |
| 15470 | myRate, |
| 15471 | (int) pCfg->linkSpeedRssiHigh, |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 15472 | (int) pCfg->linkSpeedRssiMid, |
| 15473 | (int) pCfg->linkSpeedRssiLow, |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15474 | (int) rate_flags, |
| 15475 | (int) pAdapter->hdd_stats.ClassA_stat.mcs_index); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15476 | #endif //LINKSPEED_DEBUG_ENABLED |
| 15477 | |
| 15478 | if (eHDD_LINK_SPEED_REPORT_ACTUAL != pCfg->reportMaxLinkSpeed) |
| 15479 | { |
| 15480 | // we do not want to necessarily report the current speed |
| 15481 | if (eHDD_LINK_SPEED_REPORT_MAX == pCfg->reportMaxLinkSpeed) |
| 15482 | { |
| 15483 | // report the max possible speed |
| 15484 | rssidx = 0; |
| 15485 | } |
| 15486 | else if (eHDD_LINK_SPEED_REPORT_MAX_SCALED == pCfg->reportMaxLinkSpeed) |
| 15487 | { |
| 15488 | // report the max possible speed with RSSI scaling |
| 15489 | if (sinfo->signal >= pCfg->linkSpeedRssiHigh) |
| 15490 | { |
| 15491 | // report the max possible speed |
| 15492 | rssidx = 0; |
| 15493 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 15494 | else if (sinfo->signal >= pCfg->linkSpeedRssiMid) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15495 | { |
| 15496 | // report middle speed |
| 15497 | rssidx = 1; |
| 15498 | } |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 15499 | else if (sinfo->signal >= pCfg->linkSpeedRssiLow) |
| 15500 | { |
| 15501 | // report middle speed |
| 15502 | rssidx = 2; |
| 15503 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15504 | else |
| 15505 | { |
| 15506 | // report actual speed |
Madan Mohan Koyyalamudi | 8df78d5 | 2012-11-02 12:30:06 -0700 | [diff] [blame] | 15507 | rssidx = 3; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15508 | } |
| 15509 | } |
| 15510 | else |
| 15511 | { |
| 15512 | // unknown, treat as eHDD_LINK_SPEED_REPORT_MAX |
| 15513 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 15514 | "%s: Invalid value for reportMaxLinkSpeed: %u", |
| 15515 | __func__, pCfg->reportMaxLinkSpeed); |
| 15516 | rssidx = 0; |
| 15517 | } |
| 15518 | |
| 15519 | maxRate = 0; |
| 15520 | |
| 15521 | /* Get Basic Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 15522 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_OPERATIONAL_RATE_SET, |
| 15523 | OperationalRates, &ORLeng)) |
| 15524 | { |
| 15525 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 15526 | /*To keep GUI happy*/ |
| 15527 | return 0; |
| 15528 | } |
| 15529 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15530 | for (i = 0; i < ORLeng; i++) |
| 15531 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15532 | 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] | 15533 | { |
| 15534 | /* Validate Rate Set */ |
| 15535 | if (supported_data_rate[j].beacon_rate_index == (OperationalRates[i] & 0x7F)) |
| 15536 | { |
| 15537 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 15538 | break; |
| 15539 | } |
| 15540 | } |
| 15541 | /* Update MAX rate */ |
| 15542 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 15543 | } |
| 15544 | |
| 15545 | /* Get Extended Rate Set */ |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 15546 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 15547 | ExtendedRates, &ERLeng)) |
| 15548 | { |
| 15549 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 15550 | /*To keep GUI happy*/ |
| 15551 | return 0; |
| 15552 | } |
| 15553 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15554 | for (i = 0; i < ERLeng; i++) |
| 15555 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15556 | 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] | 15557 | { |
| 15558 | if (supported_data_rate[j].beacon_rate_index == (ExtendedRates[i] & 0x7F)) |
| 15559 | { |
| 15560 | currentRate = supported_data_rate[j].supported_rate[rssidx]; |
| 15561 | break; |
| 15562 | } |
| 15563 | } |
| 15564 | /* Update MAX rate */ |
| 15565 | maxRate = (currentRate > maxRate)?currentRate:maxRate; |
| 15566 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15567 | |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 15568 | /* Get MCS Rate Set -- |
Kaushik, Sushant | dc304d8 | 2014-01-22 10:58:37 +0530 | [diff] [blame] | 15569 | Only if we are always reporting max speed (or) |
Kiet Lam | b69f8dc | 2013-11-15 15:34:27 +0530 | [diff] [blame] | 15570 | if we have good rssi */ |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15571 | if ((3 != rssidx) && !(rate_flags & eHAL_TX_RATE_LEGACY)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15572 | { |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15573 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 15574 | mode = 2; |
| 15575 | else if (rate_flags & (eHAL_TX_RATE_VHT40 | eHAL_TX_RATE_HT40)) |
| 15576 | mode = 1; |
| 15577 | else |
| 15578 | mode = 0; |
| 15579 | |
Gopichand Nakkala | 05ab132 | 2013-02-15 11:28:38 +0530 | [diff] [blame] | 15580 | if (0 != ccmCfgGetStr(WLAN_HDD_GET_HAL_CTX(pAdapter), WNI_CFG_CURRENT_MCS_SET, |
| 15581 | MCSRates, &MCSLeng)) |
| 15582 | { |
| 15583 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: ccm api returned failure", __func__); |
| 15584 | /*To keep GUI happy*/ |
| 15585 | return 0; |
| 15586 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15587 | rateFlag = 0; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15588 | #ifdef WLAN_FEATURE_11AC |
| 15589 | /* VHT80 rate has seperate rate table */ |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15590 | 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] | 15591 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15592 | 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] | 15593 | vhtMaxMcs = (eDataRate11ACMaxMcs)(vht_mcs_map & DATA_RATE_11AC_MCS_MASK ); |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15594 | if (rate_flags & eHAL_TX_RATE_SGI) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15595 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15596 | rateFlag |= 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15597 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15598 | if (DATA_RATE_11AC_MAX_MCS_7 == vhtMaxMcs) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15599 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15600 | maxMCSIdx = 7; |
| 15601 | } |
| 15602 | else if (DATA_RATE_11AC_MAX_MCS_8 == vhtMaxMcs) |
| 15603 | { |
| 15604 | maxMCSIdx = 8; |
| 15605 | } |
| 15606 | else if (DATA_RATE_11AC_MAX_MCS_9 == vhtMaxMcs) |
| 15607 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15608 | //VHT20 is supporting 0~8 |
| 15609 | if (rate_flags & eHAL_TX_RATE_VHT20) |
| 15610 | maxMCSIdx = 8; |
| 15611 | else |
| 15612 | maxMCSIdx = 9; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15613 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15614 | |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15615 | if (0 != rssidx)/*check for scaled */ |
| 15616 | { |
| 15617 | //get middle rate MCS index if rssi=1/2 |
| 15618 | for (i=0; i <= maxMCSIdx; i++) |
| 15619 | { |
| 15620 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 15621 | { |
| 15622 | maxMCSIdx = i; |
| 15623 | break; |
| 15624 | } |
| 15625 | } |
| 15626 | } |
| 15627 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15628 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 15629 | { |
| 15630 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT80_rate[rateFlag]; |
| 15631 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT80_rate[rateFlag]; |
| 15632 | } |
| 15633 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
| 15634 | { |
| 15635 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT40_rate[rateFlag]; |
| 15636 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT40_rate[rateFlag]; |
| 15637 | } |
| 15638 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 15639 | { |
| 15640 | currentRate = supported_vht_mcs_rate[pAdapter->hdd_stats.ClassA_stat.mcs_index].supported_VHT20_rate[rateFlag]; |
| 15641 | maxRate = supported_vht_mcs_rate[maxMCSIdx].supported_VHT20_rate[rateFlag]; |
| 15642 | } |
| 15643 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15644 | maxSpeedMCS = 1; |
| 15645 | if (currentRate > maxRate) |
| 15646 | { |
| 15647 | maxRate = currentRate; |
| 15648 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15649 | |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15650 | } |
| 15651 | else |
| 15652 | #endif /* WLAN_FEATURE_11AC */ |
| 15653 | { |
| 15654 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 15655 | { |
| 15656 | rateFlag |= 1; |
| 15657 | } |
| 15658 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 15659 | { |
| 15660 | rateFlag |= 2; |
| 15661 | } |
| 15662 | |
Girish Gowli | 01abcee | 2014-07-31 20:18:55 +0530 | [diff] [blame] | 15663 | temp = sizeof(supported_mcs_rate) / sizeof(supported_mcs_rate[0]); |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15664 | if (rssidx == 1 || rssidx == 2) |
| 15665 | { |
| 15666 | //get middle rate MCS index if rssi=1/2 |
| 15667 | for (i=0; i <= 7; i++) |
| 15668 | { |
| 15669 | if (sinfo->signal <= rssiMcsTbl[mode][i]) |
| 15670 | { |
| 15671 | temp = i+1; |
| 15672 | break; |
| 15673 | } |
| 15674 | } |
| 15675 | } |
c_hpothu | 79aab32 | 2014-07-14 21:11:01 +0530 | [diff] [blame] | 15676 | |
| 15677 | for (i = 0; i < MCSLeng; i++) |
| 15678 | { |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15679 | for (j = 0; j < temp; j++) |
| 15680 | { |
| 15681 | if (supported_mcs_rate[j].beacon_rate_index == MCSRates[i]) |
| 15682 | { |
| 15683 | currentRate = supported_mcs_rate[j].supported_rate[rateFlag]; |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 15684 | maxMCSIdx = supported_mcs_rate[j].beacon_rate_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15685 | break; |
| 15686 | } |
| 15687 | } |
| 15688 | if ((j < temp) && (currentRate > maxRate)) |
| 15689 | { |
| 15690 | maxRate = currentRate; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15691 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15692 | } |
Hanumantha Reddy Pothula | fa62374 | 2015-06-16 14:08:24 +0530 | [diff] [blame] | 15693 | maxSpeedMCS = 1; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15694 | } |
| 15695 | } |
| 15696 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15697 | else if (!(rate_flags & eHAL_TX_RATE_LEGACY)) |
| 15698 | { |
| 15699 | maxRate = myRate; |
| 15700 | maxSpeedMCS = 1; |
| 15701 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 15702 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15703 | // 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] | 15704 | if ((maxRate < myRate) || (0 == maxRate)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15705 | { |
| 15706 | maxRate = myRate; |
| 15707 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 15708 | { |
| 15709 | maxSpeedMCS = 0; |
| 15710 | } |
| 15711 | else |
| 15712 | { |
| 15713 | maxSpeedMCS = 1; |
| 15714 | maxMCSIdx = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
| 15715 | } |
| 15716 | } |
| 15717 | |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15718 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15719 | { |
| 15720 | sinfo->txrate.legacy = maxRate; |
| 15721 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 15722 | pr_info("Reporting legacy rate %d\n", sinfo->txrate.legacy); |
| 15723 | #endif //LINKSPEED_DEBUG_ENABLED |
| 15724 | } |
| 15725 | else |
| 15726 | { |
| 15727 | sinfo->txrate.mcs = maxMCSIdx; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15728 | #ifdef WLAN_FEATURE_11AC |
| 15729 | sinfo->txrate.nss = 1; |
| 15730 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 15731 | { |
| 15732 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15733 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15734 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15735 | else if (rate_flags & eHAL_TX_RATE_VHT40) |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15736 | { |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15737 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 15738 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 15739 | } |
| 15740 | else if (rate_flags & eHAL_TX_RATE_VHT20) |
| 15741 | { |
| 15742 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 15743 | } |
| 15744 | #endif /* WLAN_FEATURE_11AC */ |
| 15745 | if (rate_flags & (eHAL_TX_RATE_HT20 | eHAL_TX_RATE_HT40)) |
| 15746 | { |
| 15747 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 15748 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 15749 | { |
| 15750 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 15751 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15752 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15753 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 15754 | { |
| 15755 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 15756 | } |
Gopichand Nakkala | 4c70537 | 2013-04-24 13:20:33 +0530 | [diff] [blame] | 15757 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15758 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 15759 | pr_info("Reporting MCS rate %d flags %x\n", |
| 15760 | sinfo->txrate.mcs, |
| 15761 | sinfo->txrate.flags ); |
| 15762 | #endif //LINKSPEED_DEBUG_ENABLED |
| 15763 | } |
| 15764 | } |
| 15765 | else |
| 15766 | { |
| 15767 | // report current rate instead of max rate |
| 15768 | |
| 15769 | if (rate_flags & eHAL_TX_RATE_LEGACY) |
| 15770 | { |
| 15771 | //provide to the UI in units of 100kbps |
| 15772 | sinfo->txrate.legacy = myRate; |
| 15773 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 15774 | pr_info("Reporting actual legacy rate %d\n", sinfo->txrate.legacy); |
| 15775 | #endif //LINKSPEED_DEBUG_ENABLED |
| 15776 | } |
| 15777 | else |
| 15778 | { |
| 15779 | //must be MCS |
| 15780 | sinfo->txrate.mcs = pAdapter->hdd_stats.ClassA_stat.mcs_index; |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15781 | #ifdef WLAN_FEATURE_11AC |
| 15782 | sinfo->txrate.nss = 1; |
| 15783 | if (rate_flags & eHAL_TX_RATE_VHT80) |
| 15784 | { |
| 15785 | sinfo->txrate.flags |= RATE_INFO_FLAGS_VHT_MCS; |
| 15786 | } |
| 15787 | else |
| 15788 | #endif /* WLAN_FEATURE_11AC */ |
| 15789 | { |
| 15790 | sinfo->txrate.flags |= RATE_INFO_FLAGS_MCS; |
| 15791 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15792 | if (rate_flags & eHAL_TX_RATE_SGI) |
| 15793 | { |
| 15794 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
| 15795 | } |
| 15796 | if (rate_flags & eHAL_TX_RATE_HT40) |
| 15797 | { |
| 15798 | sinfo->txrate.flags |= RATE_INFO_FLAGS_40_MHZ_WIDTH; |
| 15799 | } |
Leo Chang | 6f8870f | 2013-03-26 18:11:36 -0700 | [diff] [blame] | 15800 | #ifdef WLAN_FEATURE_11AC |
| 15801 | else if (rate_flags & eHAL_TX_RATE_VHT80) |
| 15802 | { |
| 15803 | sinfo->txrate.flags |= RATE_INFO_FLAGS_80_MHZ_WIDTH; |
| 15804 | } |
| 15805 | #endif /* WLAN_FEATURE_11AC */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15806 | #ifdef LINKSPEED_DEBUG_ENABLED |
| 15807 | pr_info("Reporting actual MCS rate %d flags %x\n", |
| 15808 | sinfo->txrate.mcs, |
| 15809 | sinfo->txrate.flags ); |
| 15810 | #endif //LINKSPEED_DEBUG_ENABLED |
| 15811 | } |
| 15812 | } |
| 15813 | sinfo->filled |= STATION_INFO_TX_BITRATE; |
| 15814 | |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 15815 | sinfo->tx_packets = |
| 15816 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[0] + |
| 15817 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[1] + |
| 15818 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[2] + |
| 15819 | pAdapter->hdd_stats.summary_stat.tx_frm_cnt[3]; |
| 15820 | |
| 15821 | sinfo->tx_retries = |
| 15822 | pAdapter->hdd_stats.summary_stat.retry_cnt[0] + |
| 15823 | pAdapter->hdd_stats.summary_stat.retry_cnt[1] + |
| 15824 | pAdapter->hdd_stats.summary_stat.retry_cnt[2] + |
| 15825 | pAdapter->hdd_stats.summary_stat.retry_cnt[3]; |
| 15826 | |
| 15827 | sinfo->tx_failed = |
| 15828 | pAdapter->hdd_stats.summary_stat.fail_cnt[0] + |
| 15829 | pAdapter->hdd_stats.summary_stat.fail_cnt[1] + |
| 15830 | pAdapter->hdd_stats.summary_stat.fail_cnt[2] + |
| 15831 | pAdapter->hdd_stats.summary_stat.fail_cnt[3]; |
| 15832 | |
| 15833 | sinfo->filled |= |
| 15834 | STATION_INFO_TX_PACKETS | |
| 15835 | STATION_INFO_TX_RETRIES | |
| 15836 | STATION_INFO_TX_FAILED; |
| 15837 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15838 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15839 | TRACE_CODE_HDD_CFG80211_GET_STA, |
| 15840 | pAdapter->sessionId, maxRate)); |
Madan Mohan Koyyalamudi | 4d4d281 | 2012-09-24 14:08:29 -0700 | [diff] [blame] | 15841 | EXIT(); |
| 15842 | return 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15843 | } |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 15844 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 15845 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 15846 | const u8* mac, struct station_info *sinfo) |
| 15847 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15848 | static int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 15849 | u8* mac, struct station_info *sinfo) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 15850 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15851 | { |
| 15852 | int ret; |
| 15853 | |
| 15854 | vos_ssr_protect(__func__); |
| 15855 | ret = __wlan_hdd_cfg80211_get_station(wiphy, dev, mac, sinfo); |
| 15856 | vos_ssr_unprotect(__func__); |
| 15857 | |
| 15858 | return ret; |
| 15859 | } |
| 15860 | |
| 15861 | static int __wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
Sameer Thalappil | c9f26e9 | 2013-06-07 10:11:06 -0700 | [diff] [blame] | 15862 | struct net_device *dev, bool mode, int timeout) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15863 | { |
| 15864 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 15865 | hdd_context_t *pHddCtx; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15866 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15867 | int status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15868 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15869 | ENTER(); |
| 15870 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15871 | if (NULL == pAdapter) |
| 15872 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 15873 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15874 | return -ENODEV; |
| 15875 | } |
| 15876 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 15877 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 15878 | TRACE_CODE_HDD_CFG80211_SET_POWER_MGMT, |
| 15879 | pAdapter->sessionId, timeout)); |
| 15880 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 15881 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15882 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15883 | if (0 != status) |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15884 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 15885 | return status; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15886 | } |
| 15887 | |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 15888 | if ((DRIVER_POWER_MODE_AUTO == !mode) && |
| 15889 | (TRUE == pHddCtx->hdd_wlan_suspended) && |
| 15890 | (pHddCtx->cfg_ini->fhostArpOffload) && |
| 15891 | (eConnectionState_Associated == |
| 15892 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState)) |
| 15893 | { |
Amar Singhal | d53568e | 2013-09-26 11:03:45 -0700 | [diff] [blame] | 15894 | |
| 15895 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 15896 | "offload: in cfg80211_set_power_mgmt, calling arp offload"); |
Gopichand Nakkala | b03e808 | 2013-05-30 18:09:25 +0530 | [diff] [blame] | 15897 | vos_status = hdd_conf_arp_offload(pAdapter, TRUE); |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 15898 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 15899 | { |
| 15900 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 15901 | "%s:Failed to enable ARPOFFLOAD Feature %d", |
Gopichand Nakkala | 20c4c04 | 2013-04-19 22:08:55 +0530 | [diff] [blame] | 15902 | __func__, vos_status); |
| 15903 | } |
| 15904 | } |
| 15905 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15906 | /**The get power cmd from the supplicant gets updated by the nl only |
| 15907 | *on successful execution of the function call |
| 15908 | *we are oppositely mapped w.r.t mode in the driver |
| 15909 | **/ |
| 15910 | vos_status = wlan_hdd_enter_bmps(pAdapter, !mode); |
| 15911 | |
| 15912 | if (VOS_STATUS_E_FAILURE == vos_status) |
| 15913 | { |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 15914 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 15915 | "%s: failed to enter bmps mode", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15916 | return -EINVAL; |
| 15917 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 15918 | EXIT(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15919 | return 0; |
| 15920 | } |
| 15921 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15922 | static int wlan_hdd_cfg80211_set_power_mgmt(struct wiphy *wiphy, |
| 15923 | struct net_device *dev, bool mode, int timeout) |
| 15924 | { |
| 15925 | int ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15926 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 15927 | vos_ssr_protect(__func__); |
| 15928 | ret = __wlan_hdd_cfg80211_set_power_mgmt(wiphy, dev, mode, timeout); |
| 15929 | vos_ssr_unprotect(__func__); |
| 15930 | |
| 15931 | return ret; |
| 15932 | } |
Sushant Kaushik | 084f659 | 2015-09-10 13:11:56 +0530 | [diff] [blame] | 15933 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15934 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15935 | static int __wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
| 15936 | struct net_device *netdev, |
| 15937 | u8 key_index) |
| 15938 | { |
| 15939 | ENTER(); |
| 15940 | return 0; |
| 15941 | } |
| 15942 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15943 | static int wlan_hdd_set_default_mgmt_key(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15944 | struct net_device *netdev, |
| 15945 | u8 key_index) |
| 15946 | { |
| 15947 | int ret; |
| 15948 | vos_ssr_protect(__func__); |
| 15949 | ret = __wlan_hdd_set_default_mgmt_key(wiphy, netdev, key_index); |
| 15950 | vos_ssr_unprotect(__func__); |
| 15951 | return ret; |
| 15952 | } |
| 15953 | #endif //LINUX_VERSION_CODE |
| 15954 | |
| 15955 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 15956 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 15957 | struct net_device *dev, |
| 15958 | struct ieee80211_txq_params *params) |
| 15959 | { |
| 15960 | ENTER(); |
| 15961 | return 0; |
| 15962 | } |
| 15963 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 15964 | static int __wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 15965 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15966 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 15967 | ENTER(); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15968 | return 0; |
| 15969 | } |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 15970 | #endif //LINUX_VERSION_CODE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15971 | |
| 15972 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) |
| 15973 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15974 | struct net_device *dev, |
| 15975 | struct ieee80211_txq_params *params) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15976 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15977 | int ret; |
| 15978 | |
| 15979 | vos_ssr_protect(__func__); |
| 15980 | ret = __wlan_hdd_set_txq_params(wiphy, dev, params); |
| 15981 | vos_ssr_unprotect(__func__); |
| 15982 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15983 | } |
| 15984 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 15985 | static int wlan_hdd_set_txq_params(struct wiphy *wiphy, |
| 15986 | struct ieee80211_txq_params *params) |
| 15987 | { |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15988 | int ret; |
| 15989 | |
| 15990 | vos_ssr_protect(__func__); |
| 15991 | ret = __wlan_hdd_set_txq_params(wiphy, params); |
| 15992 | vos_ssr_unprotect(__func__); |
| 15993 | return ret; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15994 | } |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 15995 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 15996 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 15997 | static int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 15998 | struct net_device *dev, |
| 15999 | struct tagCsrDelStaParams *pDelStaParams) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16000 | { |
| 16001 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16002 | hdd_context_t *pHddCtx; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16003 | VOS_STATUS vos_status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16004 | int status; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16005 | v_U8_t staId; |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16006 | v_CONTEXT_t pVosContext = NULL; |
| 16007 | ptSapContext pSapCtx = NULL; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16008 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16009 | ENTER(); |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16010 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16011 | if ( NULL == pAdapter ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16012 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16013 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16014 | return -EINVAL; |
| 16015 | } |
| 16016 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16017 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16018 | TRACE_CODE_HDD_CFG80211_DEL_STA, |
| 16019 | pAdapter->sessionId, pAdapter->device_mode)); |
| 16020 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16021 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16022 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16023 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16024 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16025 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16026 | } |
| 16027 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16028 | if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16029 | || (WLAN_HDD_P2P_GO == pAdapter->device_mode) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16030 | ) |
| 16031 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16032 | pVosContext = ( WLAN_HDD_GET_CTX(pAdapter))->pvosContext; |
| 16033 | pSapCtx = VOS_GET_SAP_CB(pVosContext); |
| 16034 | if(pSapCtx == NULL){ |
| 16035 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16036 | FL("psapCtx is NULL")); |
| 16037 | return -ENOENT; |
| 16038 | } |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16039 | if (vos_is_macaddr_broadcast((v_MACADDR_t *)pDelStaParams->peerMacAddr)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16040 | { |
| 16041 | v_U16_t i; |
| 16042 | for(i = 0; i < WLAN_MAX_STA_COUNT; i++) |
| 16043 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16044 | if ((pSapCtx->aStaInfo[i].isUsed) && |
| 16045 | (!pSapCtx->aStaInfo[i].isDeauthInProgress)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16046 | { |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16047 | vos_mem_copy(pDelStaParams->peerMacAddr, |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16048 | pSapCtx->aStaInfo[i].macAddrSTA.bytes, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16049 | ETHER_ADDR_LEN); |
| 16050 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16051 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 16052 | "%s: Delete STA with MAC::" |
| 16053 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16054 | __func__, |
| 16055 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
| 16056 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Rajesh Chauhan | 18488fc | 2013-08-22 10:15:03 -0700 | [diff] [blame] | 16057 | if (VOS_IS_STATUS_SUCCESS(vos_status)) |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16058 | pSapCtx->aStaInfo[i].isDeauthInProgress = TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16059 | } |
| 16060 | } |
| 16061 | } |
| 16062 | else |
| 16063 | { |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16064 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16065 | vos_status = hdd_softap_GetStaId(pAdapter, |
| 16066 | (v_MACADDR_t *)pDelStaParams->peerMacAddr, &staId); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16067 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 16068 | { |
| 16069 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 16070 | "%s: Skip this DEL STA as this is not used::" |
| 16071 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16072 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16073 | return -ENOENT; |
| 16074 | } |
| 16075 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16076 | if( pSapCtx->aStaInfo[staId].isDeauthInProgress == TRUE) |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16077 | { |
| 16078 | hddLog(VOS_TRACE_LEVEL_INFO, |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 16079 | "%s: Skip this DEL STA as deauth is in progress::" |
| 16080 | MAC_ADDRESS_STR, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16081 | __func__, MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16082 | return -ENOENT; |
| 16083 | } |
| 16084 | |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16085 | pSapCtx->aStaInfo[staId].isDeauthInProgress = TRUE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16086 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16087 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 16088 | "%s: Delete STA with MAC::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 16089 | MAC_ADDRESS_STR, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16090 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16091 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16092 | |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16093 | vos_status = hdd_softap_sta_deauth(pAdapter, pDelStaParams); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16094 | if (!VOS_IS_STATUS_SUCCESS(vos_status)) |
| 16095 | { |
Sachin Ahuja | bcb0b7e | 2014-11-07 13:01:24 +0530 | [diff] [blame] | 16096 | pSapCtx->aStaInfo[staId].isDeauthInProgress = FALSE; |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16097 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 16098 | "%s: STA removal failed for ::" |
Arif Hussain | 24bafea | 2013-11-15 15:10:03 -0800 | [diff] [blame] | 16099 | MAC_ADDRESS_STR, |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16100 | __func__, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16101 | MAC_ADDR_ARRAY(pDelStaParams->peerMacAddr)); |
Madan Mohan Koyyalamudi | cd78499 | 2013-01-11 15:30:36 -0800 | [diff] [blame] | 16102 | return -ENOENT; |
| 16103 | } |
| 16104 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16105 | } |
| 16106 | } |
| 16107 | |
| 16108 | EXIT(); |
| 16109 | |
| 16110 | return 0; |
| 16111 | } |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 16112 | |
| 16113 | #ifdef CFG80211_DEL_STA_V2 |
| 16114 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 16115 | struct net_device *dev, |
| 16116 | struct station_del_parameters *param) |
| 16117 | #else |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16118 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 16119 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 16120 | struct net_device *dev, const u8 *mac) |
| 16121 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16122 | static int wlan_hdd_cfg80211_del_station(struct wiphy *wiphy, |
| 16123 | struct net_device *dev, u8 *mac) |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 16124 | #endif |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16125 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16126 | { |
| 16127 | int ret; |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16128 | struct tagCsrDelStaParams delStaParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16129 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16130 | vos_ssr_protect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16131 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 16132 | #ifdef CFG80211_DEL_STA_V2 |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16133 | if (NULL == param) { |
| 16134 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid argumet passed", __func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 16135 | vos_ssr_unprotect(__func__); |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16136 | return -EINVAL; |
| 16137 | } |
| 16138 | |
| 16139 | WLANSAP_PopulateDelStaParams(param->mac, param->reason_code, |
| 16140 | param->subtype, &delStaParams); |
| 16141 | |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 16142 | #else |
Sushant Kaushik | 4cd28f6 | 2014-12-26 14:23:50 +0530 | [diff] [blame] | 16143 | WLANSAP_PopulateDelStaParams(mac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16144 | (SIR_MAC_MGMT_DEAUTH >> 4), &delStaParams); |
Naresh Jayaram | 69e3f28 | 2014-10-14 12:29:12 +0530 | [diff] [blame] | 16145 | #endif |
Hanumantha Reddy Pothula | bfd06f7 | 2014-10-31 14:03:37 +0530 | [diff] [blame] | 16146 | ret = __wlan_hdd_cfg80211_del_station(wiphy, dev, &delStaParams); |
| 16147 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16148 | vos_ssr_unprotect(__func__); |
| 16149 | |
| 16150 | return ret; |
| 16151 | } |
| 16152 | |
| 16153 | static int __wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16154 | struct net_device *dev, |
| 16155 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 16156 | const u8 *mac, |
| 16157 | #else |
| 16158 | u8 *mac, |
| 16159 | #endif |
| 16160 | struct station_parameters *params) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 16161 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16162 | hdd_adapter_t *pAdapter; |
| 16163 | hdd_context_t *pHddCtx; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 16164 | int status = -EPERM; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 16165 | #ifdef FEATURE_WLAN_TDLS |
| 16166 | u32 mask, set; |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16167 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 16168 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16169 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16170 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16171 | if (NULL == pAdapter) |
| 16172 | { |
| 16173 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16174 | "%s: Adapter is NULL",__func__); |
| 16175 | return -EINVAL; |
| 16176 | } |
| 16177 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16178 | status = wlan_hdd_validate_context(pHddCtx); |
| 16179 | if (0 != status) |
| 16180 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16181 | return status; |
| 16182 | } |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 16183 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16184 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16185 | TRACE_CODE_HDD_CFG80211_ADD_STA, |
| 16186 | pAdapter->sessionId, params->listen_interval)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16187 | mask = params->sta_flags_mask; |
| 16188 | |
| 16189 | set = params->sta_flags_set; |
| 16190 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 16191 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 16192 | "%s: mask 0x%x set 0x%x " MAC_ADDRESS_STR, |
| 16193 | __func__, mask, set, MAC_ADDR_ARRAY(mac)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16194 | |
| 16195 | if (mask & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
| 16196 | if (set & BIT(NL80211_STA_FLAG_TDLS_PEER)) { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 16197 | status = wlan_hdd_tdls_add_station(wiphy, dev, mac, 0, NULL); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 16198 | } |
| 16199 | } |
| 16200 | #endif |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16201 | EXIT(); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 16202 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 16203 | } |
| 16204 | |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16205 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 16206 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 16207 | struct net_device *dev, const u8 *mac, |
| 16208 | struct station_parameters *params) |
| 16209 | #else |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16210 | static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, |
| 16211 | struct net_device *dev, u8 *mac, struct station_parameters *params) |
Anand N Sunkad | b3ab97d | 2015-07-29 09:58:13 +0530 | [diff] [blame] | 16212 | #endif |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16213 | { |
| 16214 | int ret; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16215 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16216 | vos_ssr_protect(__func__); |
| 16217 | ret = __wlan_hdd_cfg80211_add_station(wiphy, dev, mac, params); |
| 16218 | vos_ssr_unprotect(__func__); |
| 16219 | |
| 16220 | return ret; |
| 16221 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16222 | #ifdef FEATURE_WLAN_LFR |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16223 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16224 | 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] | 16225 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16226 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16227 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16228 | tHalHandle halHandle; |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16229 | eHalStatus result; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16230 | int status; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16231 | hdd_context_t *pHddCtx; |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16232 | tPmkidCacheInfo pmk_id; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 16233 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16234 | ENTER(); |
| 16235 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16236 | // Validate pAdapter |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16237 | if ( NULL == pAdapter ) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16238 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16239 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16240 | return -EINVAL; |
| 16241 | } |
| 16242 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16243 | if (!pmksa) { |
| 16244 | hddLog(LOGE, FL("pmksa is NULL")); |
| 16245 | return -EINVAL; |
| 16246 | } |
| 16247 | |
| 16248 | if (!pmksa->bssid || !pmksa->pmkid) { |
| 16249 | hddLog(LOGE, FL("pmksa->bssid(%p) or pmksa->pmkid(%p) is NULL"), |
| 16250 | pmksa->bssid, pmksa->pmkid); |
| 16251 | return -EINVAL; |
| 16252 | } |
| 16253 | |
| 16254 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: set PMKSA for " MAC_ADDRESS_STR, |
| 16255 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 16256 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16257 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16258 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16259 | if (0 != status) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16260 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 16261 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16262 | } |
| 16263 | |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16264 | // Retrieve halHandle |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16265 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16266 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16267 | vos_mem_copy(pmk_id.BSSID, pmksa->bssid, ETHER_ADDR_LEN); |
| 16268 | vos_mem_copy(pmk_id.PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16269 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16270 | /* Add to the PMKSA ID Cache in CSR */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 16271 | result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16272 | &pmk_id, 1, FALSE); |
| 16273 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16274 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16275 | TRACE_CODE_HDD_CFG80211_SET_PMKSA, |
| 16276 | pAdapter->sessionId, result)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16277 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16278 | EXIT(); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16279 | return HAL_STATUS_SUCCESS(result) ? 0 : -EINVAL; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16280 | } |
| 16281 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16282 | static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 16283 | struct cfg80211_pmksa *pmksa) |
| 16284 | { |
| 16285 | int ret; |
| 16286 | |
| 16287 | vos_ssr_protect(__func__); |
| 16288 | ret = __wlan_hdd_cfg80211_set_pmksa(wiphy, dev, pmksa); |
| 16289 | vos_ssr_unprotect(__func__); |
| 16290 | |
| 16291 | return ret; |
| 16292 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16293 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16294 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16295 | 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] | 16296 | struct cfg80211_pmksa *pmksa) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16297 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16298 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16299 | tHalHandle halHandle; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16300 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 16301 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16302 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16303 | ENTER(); |
| 16304 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16305 | /* Validate pAdapter */ |
| 16306 | if (NULL == pAdapter) |
| 16307 | { |
| 16308 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__); |
| 16309 | return -EINVAL; |
| 16310 | } |
| 16311 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16312 | if (!pmksa) { |
| 16313 | hddLog(LOGE, FL("pmksa is NULL")); |
| 16314 | return -EINVAL; |
| 16315 | } |
| 16316 | |
| 16317 | if (!pmksa->bssid) { |
| 16318 | hddLog(LOGE, FL("pmksa->bssid is NULL")); |
| 16319 | return -EINVAL; |
| 16320 | } |
| 16321 | |
Kiet Lam | 98c46a1 | 2014-10-31 15:34:57 -0700 | [diff] [blame] | 16322 | hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: deleting PMKSA for " MAC_ADDRESS_STR, |
| 16323 | __func__, MAC_ADDR_ARRAY(pmksa->bssid)); |
| 16324 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16325 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16326 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16327 | if (0 != status) |
| 16328 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16329 | return status; |
| 16330 | } |
| 16331 | |
| 16332 | /*Retrieve halHandle*/ |
| 16333 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16334 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16335 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16336 | TRACE_CODE_HDD_CFG80211_DEL_PMKSA, |
| 16337 | pAdapter->sessionId, 0)); |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16338 | /* Delete the PMKID CSR cache */ |
| 16339 | if (eHAL_STATUS_SUCCESS != |
| 16340 | sme_RoamDelPMKIDfromCache(halHandle, |
| 16341 | pAdapter->sessionId, pmksa->bssid, FALSE)) { |
| 16342 | hddLog(LOGE, FL("Failed to delete PMKSA for "MAC_ADDRESS_STR), |
| 16343 | MAC_ADDR_ARRAY(pmksa->bssid)); |
| 16344 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16345 | } |
| 16346 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16347 | EXIT(); |
| 16348 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16349 | } |
| 16350 | |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16351 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16352 | static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, |
| 16353 | struct cfg80211_pmksa *pmksa) |
| 16354 | { |
| 16355 | int ret; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16356 | |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16357 | vos_ssr_protect(__func__); |
| 16358 | ret = __wlan_hdd_cfg80211_del_pmksa(wiphy, dev, pmksa); |
| 16359 | vos_ssr_unprotect(__func__); |
| 16360 | |
| 16361 | return ret; |
| 16362 | |
| 16363 | } |
| 16364 | |
| 16365 | 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] | 16366 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16367 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16368 | tHalHandle halHandle; |
| 16369 | hdd_context_t *pHddCtx; |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 16370 | int status = 0; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16371 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16372 | ENTER(); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16373 | |
| 16374 | /* Validate pAdapter */ |
| 16375 | if (NULL == pAdapter) |
| 16376 | { |
| 16377 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 16378 | "%s: Invalid Adapter" ,__func__); |
| 16379 | return -EINVAL; |
| 16380 | } |
| 16381 | |
| 16382 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16383 | status = wlan_hdd_validate_context(pHddCtx); |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16384 | if (0 != status) |
| 16385 | { |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16386 | return status; |
| 16387 | } |
| 16388 | |
| 16389 | /*Retrieve halHandle*/ |
| 16390 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16391 | |
Kanchanapally, Vidyullatha | 2633ace | 2014-09-25 15:16:50 +0530 | [diff] [blame] | 16392 | /* Flush the PMKID cache in CSR */ |
| 16393 | if (eHAL_STATUS_SUCCESS != |
| 16394 | sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, NULL, TRUE)) { |
| 16395 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Cannot flush PMKIDCache")); |
| 16396 | status = -EINVAL; |
Wilson Yang | 6507c4e | 2013-10-01 20:11:19 -0700 | [diff] [blame] | 16397 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16398 | EXIT(); |
Wilson Yang | ef657d3 | 2014-01-15 19:19:23 -0800 | [diff] [blame] | 16399 | return status; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16400 | } |
Mahesh A Saptasagar | f7418d7 | 2014-06-02 14:48:54 +0530 | [diff] [blame] | 16401 | |
| 16402 | static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device *dev) |
| 16403 | { |
| 16404 | int ret; |
| 16405 | |
| 16406 | vos_ssr_protect(__func__); |
| 16407 | ret = __wlan_hdd_cfg80211_flush_pmksa(wiphy, dev); |
| 16408 | vos_ssr_unprotect(__func__); |
| 16409 | |
| 16410 | return ret; |
| 16411 | } |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16412 | #endif |
| 16413 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16414 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16415 | static int __wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 16416 | struct net_device *dev, |
| 16417 | struct cfg80211_update_ft_ies_params *ftie) |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16418 | { |
| 16419 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16420 | hdd_station_ctx_t *pHddStaCtx; |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16421 | hdd_context_t *pHddCtx; |
| 16422 | int ret = 0; |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16423 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16424 | ENTER(); |
| 16425 | |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16426 | if (NULL == pAdapter) |
| 16427 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16428 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Adapter is NULL", __func__); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16429 | return -ENODEV; |
| 16430 | } |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16431 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16432 | ret = wlan_hdd_validate_context(pHddCtx); |
| 16433 | if (0 != ret) |
| 16434 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 16435 | return ret; |
| 16436 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16437 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 16438 | if (NULL == pHddStaCtx) |
| 16439 | { |
| 16440 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: STA Context is NULL", __func__); |
| 16441 | return -EINVAL; |
| 16442 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16443 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 16444 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16445 | TRACE_CODE_HDD_CFG80211_UPDATE_FT_IES, |
| 16446 | pAdapter->sessionId, pHddStaCtx->conn_info.connState)); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16447 | // Added for debug on reception of Re-assoc Req. |
| 16448 | if (eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
| 16449 | { |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16450 | 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] | 16451 | ftie->ie_len); |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16452 | hddLog(LOGE, FL("Should be Re-assoc Req IEs")); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16453 | } |
| 16454 | |
| 16455 | #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 16456 | hddLog(LOGE, FL("%s called with Ie of length = %zu"), __func__, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16457 | ftie->ie_len); |
| 16458 | #endif |
| 16459 | |
| 16460 | // Pass the received FT IEs to SME |
Gopichand Nakkala | 356fb10 | 2013-03-06 12:34:04 +0530 | [diff] [blame] | 16461 | sme_SetFTIEs( WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, |
| 16462 | (const u8 *)ftie->ie, |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16463 | ftie->ie_len); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16464 | |
| 16465 | EXIT(); |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16466 | return 0; |
| 16467 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 16468 | |
| 16469 | static int wlan_hdd_cfg80211_update_ft_ies(struct wiphy *wiphy, |
| 16470 | struct net_device *dev, |
| 16471 | struct cfg80211_update_ft_ies_params *ftie) |
| 16472 | { |
| 16473 | int ret; |
| 16474 | |
| 16475 | vos_ssr_protect(__func__); |
| 16476 | ret = __wlan_hdd_cfg80211_update_ft_ies(wiphy, dev, ftie); |
| 16477 | vos_ssr_unprotect(__func__); |
| 16478 | |
| 16479 | return ret; |
| 16480 | } |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 16481 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 16482 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16483 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 16484 | |
| 16485 | void hdd_cfg80211_sched_scan_done_callback(void *callbackContext, |
| 16486 | tSirPrefNetworkFoundInd *pPrefNetworkFoundInd) |
| 16487 | { |
| 16488 | int ret; |
| 16489 | hdd_adapter_t* pAdapter = (hdd_adapter_t*)callbackContext; |
| 16490 | hdd_context_t *pHddCtx; |
| 16491 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16492 | ENTER(); |
| 16493 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16494 | if (NULL == pAdapter) |
| 16495 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 16496 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16497 | "%s: HDD adapter is Null", __func__); |
| 16498 | return ; |
| 16499 | } |
| 16500 | |
| 16501 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16502 | if (NULL == pHddCtx) |
| 16503 | { |
| 16504 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16505 | "%s: HDD context is Null!!!", __func__); |
| 16506 | return ; |
| 16507 | } |
| 16508 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16509 | spin_lock(&pHddCtx->schedScan_lock); |
| 16510 | if (TRUE == pHddCtx->isWiphySuspended) |
| 16511 | { |
| 16512 | pHddCtx->isSchedScanUpdatePending = TRUE; |
| 16513 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16514 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 16515 | "%s: Update cfg80211 scan database after it resume", __func__); |
| 16516 | return ; |
| 16517 | } |
| 16518 | spin_unlock(&pHddCtx->schedScan_lock); |
| 16519 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16520 | ret = wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter); |
| 16521 | |
| 16522 | if (0 > ret) |
| 16523 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | fb49cdd | 2015-10-16 18:41:59 +0530 | [diff] [blame] | 16524 | else |
| 16525 | { |
| 16526 | /* Acquire wakelock to handle the case where APP's tries to suspend |
| 16527 | * immediatly after the driver gets connect request(i.e after pno) |
| 16528 | * from supplicant, this result in app's is suspending and not able |
| 16529 | * to process the connect request to AP */ |
| 16530 | hdd_prevent_suspend_timeout(1000, WIFI_POWER_EVENT_WAKELOCK_SCAN); |
| 16531 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16532 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16533 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16534 | "%s: cfg80211 scan result database updated", __func__); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16535 | } |
| 16536 | |
| 16537 | /* |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16538 | * FUNCTION: wlan_hdd_is_pno_allowed |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 16539 | * Disallow pno if any session is active |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16540 | */ |
| 16541 | static eHalStatus wlan_hdd_is_pno_allowed(hdd_adapter_t *pAdapter) |
| 16542 | { |
| 16543 | hdd_adapter_list_node_t *pAdapterNode = NULL, *pNext = NULL; |
| 16544 | hdd_adapter_t *pTempAdapter = NULL; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16545 | hdd_station_ctx_t *pStaCtx; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16546 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16547 | int status = 0; |
| 16548 | status = hdd_get_front_adapter(pHddCtx, &pAdapterNode); |
| 16549 | |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 16550 | /* The current firmware design does not allow PNO during any |
| 16551 | * active sessions. Hence, determine the active sessions |
| 16552 | * and return a failure. |
| 16553 | */ |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16554 | while ((NULL != pAdapterNode) && (VOS_STATUS_SUCCESS == status)) |
| 16555 | { |
| 16556 | pTempAdapter = pAdapterNode->pAdapter; |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16557 | pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pTempAdapter); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16558 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16559 | if (((WLAN_HDD_INFRA_STATION == pTempAdapter->device_mode) |
| 16560 | && (eConnectionState_NotConnected != pStaCtx->conn_info.connState)) |
| 16561 | || (WLAN_HDD_P2P_CLIENT == pTempAdapter->device_mode) |
| 16562 | || (WLAN_HDD_P2P_GO == pTempAdapter->device_mode) |
| 16563 | || (WLAN_HDD_SOFTAP == pTempAdapter->device_mode) |
Siddharth Bhal | 63a19a7 | 2014-11-07 14:31:56 +0530 | [diff] [blame] | 16564 | || (WLAN_HDD_TM_LEVEL_4 == pHddCtx->tmInfo.currentTmLevel) |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16565 | ) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16566 | { |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16567 | return eHAL_STATUS_FAILURE; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16568 | } |
| 16569 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 16570 | pAdapterNode = pNext; |
| 16571 | } |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16572 | return eHAL_STATUS_SUCCESS; |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16573 | } |
| 16574 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16575 | void hdd_cfg80211_sched_scan_start_status_cb(void *callbackContext, VOS_STATUS status) |
| 16576 | { |
| 16577 | hdd_adapter_t *pAdapter = callbackContext; |
| 16578 | hdd_context_t *pHddCtx; |
| 16579 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16580 | ENTER(); |
| 16581 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16582 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) |
| 16583 | { |
| 16584 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16585 | FL("Invalid adapter or adapter has invalid magic")); |
| 16586 | return; |
| 16587 | } |
| 16588 | |
| 16589 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 16590 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
| 16591 | { |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16592 | return; |
| 16593 | } |
| 16594 | |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 16595 | if (VOS_STATUS_SUCCESS != status) |
| 16596 | { |
| 16597 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16598 | FL("PNO enable response status = %d"), status); |
c_hpothu | b53c45d | 2014-08-18 16:53:14 +0530 | [diff] [blame] | 16599 | pHddCtx->isPnoEnable = FALSE; |
| 16600 | } |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16601 | |
| 16602 | pAdapter->pno_req_status = (status == VOS_STATUS_SUCCESS) ? 0 : -EBUSY; |
| 16603 | complete(&pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16604 | EXIT(); |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16605 | } |
| 16606 | |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16607 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 16608 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_start |
| 16609 | * Function to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16610 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 16611 | static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16612 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 16613 | { |
| 16614 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16615 | tSirPNOScanReq pnoRequest = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16616 | hdd_context_t *pHddCtx; |
| 16617 | tHalHandle hHal; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 16618 | v_U32_t i, indx, num_ch, tempInterval, j; |
Sushant Kaushik | d62d978 | 2014-02-19 15:39:40 +0530 | [diff] [blame] | 16619 | u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
| 16620 | u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0}; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16621 | v_U32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 16622 | eHalStatus status = eHAL_STATUS_FAILURE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16623 | int ret = 0; |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 16624 | hdd_config_t *pConfig = NULL; |
| 16625 | v_U32_t num_ignore_dfs_ch = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16626 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16627 | ENTER(); |
| 16628 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16629 | if (NULL == pAdapter) |
| 16630 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 16631 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16632 | "%s: HDD adapter is Null", __func__); |
| 16633 | return -ENODEV; |
| 16634 | } |
| 16635 | |
| 16636 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16637 | ret = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16638 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16639 | if (0 != ret) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16640 | { |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16641 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16642 | } |
| 16643 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 16644 | pConfig = pHddCtx->cfg_ini; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16645 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 16646 | if (NULL == hHal) |
| 16647 | { |
| 16648 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16649 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16650 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16651 | } |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 16652 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 16653 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_START, |
| 16654 | pAdapter->sessionId, pAdapter->device_mode)); |
Sushant Kaushik | 2fe8993 | 2014-09-03 10:58:09 +0530 | [diff] [blame] | 16655 | sme_ScanFlushResult(hHal, pAdapter->sessionId); |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 16656 | ret = wlan_hdd_scan_abort(pAdapter); |
Girish Gowli | 4bf7a63 | 2014-06-12 13:42:11 +0530 | [diff] [blame] | 16657 | if (ret < 0) |
Mahesh A Saptasagar | 2395ee6 | 2014-05-21 19:12:21 +0530 | [diff] [blame] | 16658 | { |
| 16659 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16660 | "%s: aborting the existing scan is unsuccessfull", __func__); |
| 16661 | return -EBUSY; |
| 16662 | } |
| 16663 | |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16664 | if (eHAL_STATUS_SUCCESS != wlan_hdd_is_pno_allowed(pAdapter)) |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16665 | { |
Vinay Krishna Eranna | cbf75f4 | 2014-02-26 17:35:20 +0530 | [diff] [blame] | 16666 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Vinay Krishna Eranna | 23ffd18 | 2013-12-26 19:16:55 +0530 | [diff] [blame] | 16667 | FL("Cannot handle sched_scan")); |
Mahesh A Saptasagar | 0f7b037 | 2013-11-28 23:23:07 +0530 | [diff] [blame] | 16668 | return -EBUSY; |
| 16669 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16670 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 16671 | if (TRUE == pHddCtx->isPnoEnable) |
| 16672 | { |
| 16673 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 16674 | FL("already PNO is enabled")); |
| 16675 | return -EBUSY; |
| 16676 | } |
c_hpothu | 225aa7c | 2014-10-22 17:45:13 +0530 | [diff] [blame] | 16677 | |
| 16678 | if (VOS_STATUS_SUCCESS != wlan_hdd_cancel_remain_on_channel(pHddCtx)) |
| 16679 | { |
| 16680 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16681 | "%s: abort ROC failed ", __func__); |
| 16682 | return -EBUSY; |
| 16683 | } |
| 16684 | |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 16685 | pHddCtx->isPnoEnable = TRUE; |
| 16686 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16687 | pnoRequest.enable = 1; /*Enable PNO */ |
| 16688 | pnoRequest.ucNetworksCount = request->n_match_sets; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16689 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16690 | if (( !pnoRequest.ucNetworksCount ) || |
| 16691 | ( pnoRequest.ucNetworksCount > SIR_PNO_MAX_SUPP_NETWORKS )) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16692 | { |
| 16693 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 16694 | "%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] | 16695 | __func__, pnoRequest.ucNetworksCount, |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 16696 | SIR_PNO_MAX_SUPP_NETWORKS); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16697 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16698 | goto error; |
| 16699 | } |
| 16700 | |
| 16701 | if ( SIR_PNO_MAX_NETW_CHANNELS_EX < request->n_channels ) |
| 16702 | { |
| 16703 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16704 | "%s: Incorrect number of channels %d", |
| 16705 | __func__, request->n_channels); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16706 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16707 | goto error; |
| 16708 | } |
| 16709 | |
| 16710 | /* Framework provides one set of channels(all) |
| 16711 | * common for all saved profile */ |
| 16712 | if (0 != ccmCfgGetStr(hHal, WNI_CFG_VALID_CHANNEL_LIST, |
| 16713 | channels_allowed, &num_channels_allowed)) |
| 16714 | { |
| 16715 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16716 | "%s: failed to get valid channel list", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16717 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16718 | goto error; |
| 16719 | } |
| 16720 | /* Checking each channel against allowed channel list */ |
| 16721 | num_ch = 0; |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16722 | if (request->n_channels) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16723 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16724 | char chList [(request->n_channels*5)+1]; |
| 16725 | int len; |
| 16726 | for (i = 0, len = 0; i < request->n_channels; i++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16727 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16728 | for (indx = 0; indx < num_channels_allowed; indx++) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16729 | { |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16730 | if (request->channels[i]->hw_value == channels_allowed[indx]) |
| 16731 | { |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 16732 | if ((!pConfig->enableDFSPnoChnlScan) && |
| 16733 | (NV_CHANNEL_DFS == vos_nv_getChannelEnabledState(channels_allowed[indx]))) |
| 16734 | { |
| 16735 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16736 | "%s : Dropping DFS channel : %d", |
| 16737 | __func__,channels_allowed[indx]); |
| 16738 | num_ignore_dfs_ch++; |
| 16739 | break; |
| 16740 | } |
| 16741 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16742 | valid_ch[num_ch++] = request->channels[i]->hw_value; |
| 16743 | len += snprintf(chList+len, 5, "%d ", |
| 16744 | request->channels[i]->hw_value); |
| 16745 | break ; |
| 16746 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16747 | } |
| 16748 | } |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16749 | hddLog(VOS_TRACE_LEVEL_INFO,"Channel-List: %s ", chList); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16750 | |
Sachin Ahuja | 697ba3f | 2014-11-12 18:57:11 +0530 | [diff] [blame] | 16751 | /*If all channels are DFS and dropped, then ignore the PNO request*/ |
| 16752 | if (num_ignore_dfs_ch == request->n_channels) |
| 16753 | { |
| 16754 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16755 | "%s : All requested channels are DFS channels", __func__); |
| 16756 | ret = -EINVAL; |
| 16757 | goto error; |
| 16758 | } |
| 16759 | } |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16760 | |
| 16761 | pnoRequest.aNetworks = |
| 16762 | vos_mem_malloc(sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 16763 | if (pnoRequest.aNetworks == NULL) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16764 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16765 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16766 | FL("failed to allocate memory aNetworks %u"), |
| 16767 | (uint32)sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 16768 | goto error; |
| 16769 | } |
| 16770 | vos_mem_zero(pnoRequest.aNetworks, |
| 16771 | sizeof(tSirNetworkType)*pnoRequest.ucNetworksCount); |
| 16772 | |
| 16773 | /* Filling per profile params */ |
| 16774 | for (i = 0; i < pnoRequest.ucNetworksCount; i++) |
| 16775 | { |
| 16776 | pnoRequest.aNetworks[i].ssId.length = |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16777 | request->match_sets[i].ssid.ssid_len; |
| 16778 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16779 | if (( 0 == pnoRequest.aNetworks[i].ssId.length ) || |
| 16780 | ( pnoRequest.aNetworks[i].ssId.length > 32 ) ) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16781 | { |
| 16782 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16783 | "%s: SSID Len %d is not correct for network %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16784 | __func__, pnoRequest.aNetworks[i].ssId.length, i); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16785 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16786 | goto error; |
| 16787 | } |
| 16788 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16789 | memcpy(pnoRequest.aNetworks[i].ssId.ssId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16790 | request->match_sets[i].ssid.ssid, |
| 16791 | request->match_sets[i].ssid.ssid_len); |
Sushant Kaushik | 1e406c3 | 2014-05-09 15:57:52 +0530 | [diff] [blame] | 16792 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16793 | "%s: SSID of network %d is %s ", __func__, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16794 | i, pnoRequest.aNetworks[i].ssId.ssId); |
| 16795 | pnoRequest.aNetworks[i].authentication = 0; /*eAUTH_TYPE_ANY*/ |
| 16796 | pnoRequest.aNetworks[i].encryption = 0; /*eED_ANY*/ |
| 16797 | pnoRequest.aNetworks[i].bcastNetwType = 0; /*eBCAST_UNKNOWN*/ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16798 | |
| 16799 | /*Copying list of valid channel into request */ |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16800 | memcpy(pnoRequest.aNetworks[i].aChannels, valid_ch, num_ch); |
| 16801 | pnoRequest.aNetworks[i].ucChannelCount = num_ch; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16802 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16803 | pnoRequest.aNetworks[i].rssiThreshold = 0; //Default value |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16804 | } |
| 16805 | |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 16806 | for (i = 0; i < request->n_ssids; i++) |
| 16807 | { |
| 16808 | j = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16809 | while (j < pnoRequest.ucNetworksCount) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 16810 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16811 | if ((pnoRequest.aNetworks[j].ssId.length == |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 16812 | request->ssids[i].ssid_len) && |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16813 | (0 == memcmp(pnoRequest.aNetworks[j].ssId.ssId, |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 16814 | request->ssids[i].ssid, |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16815 | pnoRequest.aNetworks[j].ssId.length))) |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 16816 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16817 | pnoRequest.aNetworks[j].bcastNetwType = eBCAST_HIDDEN; |
Mahesh A Saptasagar | 7bd6ad4 | 2014-07-21 18:56:33 +0530 | [diff] [blame] | 16818 | break; |
| 16819 | } |
| 16820 | j++; |
| 16821 | } |
| 16822 | } |
| 16823 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16824 | "Number of hidden networks being Configured = %d", |
| 16825 | request->n_ssids); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 16826 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Jeff Johnson | 59a121e | 2013-11-30 09:46:08 -0800 | [diff] [blame] | 16827 | "request->ie_len = %zu", request->ie_len); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16828 | |
| 16829 | pnoRequest.p24GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 16830 | if (pnoRequest.p24GProbeTemplate == NULL) |
| 16831 | { |
| 16832 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16833 | FL("failed to allocate memory p24GProbeTemplate %u"), |
| 16834 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 16835 | goto error; |
| 16836 | } |
| 16837 | |
| 16838 | pnoRequest.p5GProbeTemplate = vos_mem_malloc(SIR_PNO_MAX_PB_REQ_SIZE); |
| 16839 | if (pnoRequest.p5GProbeTemplate == NULL) |
| 16840 | { |
| 16841 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 16842 | FL("failed to allocate memory p5GProbeTemplate %u"), |
| 16843 | SIR_PNO_MAX_PB_REQ_SIZE); |
| 16844 | goto error; |
| 16845 | } |
| 16846 | |
| 16847 | vos_mem_zero(pnoRequest.p24GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 16848 | vos_mem_zero(pnoRequest.p5GProbeTemplate, SIR_PNO_MAX_PB_REQ_SIZE); |
| 16849 | |
Hanumantha Reddy Pothula | 06e87b2 | 2015-03-02 18:02:23 +0530 | [diff] [blame] | 16850 | if ((0 < request->ie_len) && (request->ie_len <= SIR_PNO_MAX_PB_REQ_SIZE) && |
| 16851 | (NULL != request->ie)) |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 16852 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16853 | pnoRequest.us24GProbeTemplateLen = request->ie_len; |
| 16854 | memcpy(pnoRequest.p24GProbeTemplate, request->ie, |
| 16855 | pnoRequest.us24GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 16856 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16857 | pnoRequest.us5GProbeTemplateLen = request->ie_len; |
| 16858 | memcpy(pnoRequest.p5GProbeTemplate, request->ie, |
| 16859 | pnoRequest.us5GProbeTemplateLen); |
Madan Mohan Koyyalamudi | a7765d5 | 2013-09-18 16:49:56 +0530 | [diff] [blame] | 16860 | } |
| 16861 | |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 16862 | /* Driver gets only one time interval which is hardcoded in |
| 16863 | * supplicant for 10000ms. Taking power consumption into account 6 timers |
| 16864 | * will be used, Timervalue is increased exponentially i.e 10,20,40, |
| 16865 | * 80,160,320 secs. And number of scan cycle for each timer |
| 16866 | * is configurable through INI param gPNOScanTimerRepeatValue. |
| 16867 | * If it is set to 0 only one timer will be used and PNO scan cycle |
| 16868 | * will be repeated after each interval specified by supplicant |
| 16869 | * till PNO is disabled. |
| 16870 | */ |
| 16871 | if (0 == pHddCtx->cfg_ini->configPNOScanTimerRepeatValue) |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16872 | pnoRequest.scanTimers.ucScanTimersCount = HDD_PNO_SCAN_TIMERS_SET_ONE; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 16873 | else |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16874 | pnoRequest.scanTimers.ucScanTimersCount = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 16875 | HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; |
| 16876 | |
| 16877 | tempInterval = (request->interval)/1000; |
| 16878 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16879 | "Base scan interval = %d PNOScanTimerRepeatValue = %d", |
| 16880 | tempInterval, pHddCtx->cfg_ini->configPNOScanTimerRepeatValue); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16881 | for ( i = 0; i < pnoRequest.scanTimers.ucScanTimersCount; i++) |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 16882 | { |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16883 | pnoRequest.scanTimers.aTimerValues[i].uTimerRepeat = |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 16884 | pHddCtx->cfg_ini->configPNOScanTimerRepeatValue; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16885 | pnoRequest.scanTimers.aTimerValues[i].uTimerValue = tempInterval; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 16886 | tempInterval *= 2; |
| 16887 | } |
| 16888 | //Repeat last timer until pno disabled. |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16889 | pnoRequest.scanTimers.aTimerValues[i-1].uTimerRepeat = 0; |
Madan Mohan Koyyalamudi | 1d16f46 | 2013-08-27 16:25:34 +0530 | [diff] [blame] | 16890 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16891 | pnoRequest.modePNO = SIR_PNO_MODE_IMMEDIATE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16892 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16893 | INIT_COMPLETION(pAdapter->pno_comp_var); |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16894 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 16895 | pnoRequest.callbackContext = pAdapter; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16896 | pAdapter->pno_req_status = 0; |
| 16897 | |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16898 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16899 | "SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d", |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16900 | pAdapter->sessionId, pnoRequest.enable, pnoRequest.modePNO, |
| 16901 | pnoRequest.scanTimers.ucScanTimersCount); |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16902 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16903 | status = sme_SetPreferredNetworkList(WLAN_HDD_GET_HAL_CTX(pAdapter), |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16904 | &pnoRequest, pAdapter->sessionId, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16905 | hdd_cfg80211_sched_scan_done_callback, pAdapter); |
| 16906 | if (eHAL_STATUS_SUCCESS != status) |
| 16907 | { |
| 16908 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Nirav Shah | 80830bf | 2013-12-31 16:35:12 +0530 | [diff] [blame] | 16909 | "%s: Failed to enable PNO", __func__); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16910 | ret = -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16911 | goto error; |
| 16912 | } |
| 16913 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16914 | ret = wait_for_completion_timeout( |
| 16915 | &pAdapter->pno_comp_var, |
| 16916 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 16917 | if (0 >= ret) |
| 16918 | { |
| 16919 | // Did not receive the response for PNO enable in time. |
| 16920 | // Assuming the PNO enable was success. |
| 16921 | // Returning error from here, because we timeout, results |
| 16922 | // in side effect of Wifi (Wifi Setting) not to work. |
| 16923 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 16924 | FL("Timed out waiting for PNO to be Enabled")); |
| 16925 | ret = 0; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16926 | } |
| 16927 | |
| 16928 | ret = pAdapter->pno_req_status; |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 16929 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 16930 | |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16931 | error: |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 16932 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 16933 | FL("PNO scanRequest offloaded ret = %d"), ret); |
c_hpothu | 37f2131 | 2014-04-09 21:49:54 +0530 | [diff] [blame] | 16934 | pHddCtx->isPnoEnable = FALSE; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16935 | if (pnoRequest.aNetworks) |
| 16936 | vos_mem_free(pnoRequest.aNetworks); |
| 16937 | if (pnoRequest.p24GProbeTemplate) |
| 16938 | vos_mem_free(pnoRequest.p24GProbeTemplate); |
| 16939 | if (pnoRequest.p5GProbeTemplate) |
| 16940 | vos_mem_free(pnoRequest.p5GProbeTemplate); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 16941 | |
| 16942 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16943 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16944 | } |
| 16945 | |
| 16946 | /* |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 16947 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_start |
| 16948 | * NL interface to enable PNO |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16949 | */ |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 16950 | static int wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, |
| 16951 | struct net_device *dev, struct cfg80211_sched_scan_request *request) |
| 16952 | { |
| 16953 | int ret; |
| 16954 | |
| 16955 | vos_ssr_protect(__func__); |
| 16956 | ret = __wlan_hdd_cfg80211_sched_scan_start(wiphy, dev, request); |
| 16957 | vos_ssr_unprotect(__func__); |
| 16958 | |
| 16959 | return ret; |
| 16960 | } |
| 16961 | |
| 16962 | /* |
| 16963 | * FUNCTION: __wlan_hdd_cfg80211_sched_scan_stop |
| 16964 | * Function to disable PNO |
| 16965 | */ |
| 16966 | static int __wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16967 | struct net_device *dev) |
| 16968 | { |
| 16969 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 16970 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 16971 | hdd_context_t *pHddCtx; |
| 16972 | tHalHandle hHal; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 16973 | tSirPNOScanReq pnoRequest = {0}; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16974 | int ret = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16975 | |
| 16976 | ENTER(); |
| 16977 | |
| 16978 | if (NULL == pAdapter) |
| 16979 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 16980 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16981 | "%s: HDD adapter is Null", __func__); |
| 16982 | return -ENODEV; |
| 16983 | } |
| 16984 | |
| 16985 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16986 | |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16987 | if (NULL == pHddCtx) |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 16988 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 16989 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 16990 | "%s: HDD context is Null", __func__); |
| 16991 | return -ENODEV; |
| 16992 | } |
| 16993 | |
| 16994 | /* The return 0 is intentional when isLogpInProgress and |
| 16995 | * isLoadUnloadInProgress. We did observe a crash due to a return of |
| 16996 | * failure in sched_scan_stop , especially for a case where the unload |
| 16997 | * of the happens at the same time. The function __cfg80211_stop_sched_scan |
| 16998 | * was clearing rdev->sched_scan_req only when the sched_scan_stop returns |
| 16999 | * success. If it returns a failure , then its next invocation due to the |
| 17000 | * clean up of the second interface will have the dev pointer corresponding |
| 17001 | * to the first one leading to a crash. |
| 17002 | */ |
| 17003 | if (pHddCtx->isLogpInProgress) |
| 17004 | { |
| 17005 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17006 | "%s: LOGP in Progress. Ignore!!!", __func__); |
Mahesh A Saptasagar | 0c11d82 | 2015-10-08 19:54:08 +0530 | [diff] [blame] | 17007 | pHddCtx->isPnoEnable = FALSE; |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17008 | return ret; |
| 17009 | } |
| 17010 | |
Mihir Shete | 1815629 | 2014-03-11 15:38:30 +0530 | [diff] [blame] | 17011 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17012 | { |
| 17013 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17014 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 17015 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17016 | } |
| 17017 | |
| 17018 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 17019 | if (NULL == hHal) |
| 17020 | { |
| 17021 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17022 | "%s: HAL context is Null!!!", __func__); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 17023 | return -EINVAL; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17024 | } |
| 17025 | |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17026 | pnoRequest.enable = 0; /* Disable PNO */ |
| 17027 | pnoRequest.ucNetworksCount = 0; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17028 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 17029 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17030 | TRACE_CODE_HDD_CFG80211_SCHED_SCAN_STOP, |
| 17031 | pAdapter->sessionId, pAdapter->device_mode)); |
Hanumantha Reddy Pothula | 0e408dc | 2015-11-23 12:04:53 +0530 | [diff] [blame] | 17032 | |
| 17033 | INIT_COMPLETION(pAdapter->pno_comp_var); |
| 17034 | pnoRequest.statusCallback = hdd_cfg80211_sched_scan_start_status_cb; |
| 17035 | pnoRequest.callbackContext = pAdapter; |
| 17036 | pAdapter->pno_req_status = 0; |
Hanumantha Reddy Pothula | d769f3e | 2015-02-19 17:00:02 +0530 | [diff] [blame] | 17037 | status = sme_SetPreferredNetworkList(hHal, &pnoRequest, |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17038 | pAdapter->sessionId, |
| 17039 | NULL, pAdapter); |
| 17040 | if (eHAL_STATUS_SUCCESS != status) |
| 17041 | { |
| 17042 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17043 | "Failed to disabled PNO"); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17044 | ret = -EINVAL; |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17045 | goto error; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17046 | } |
Hanumantha Reddy Pothula | 0e408dc | 2015-11-23 12:04:53 +0530 | [diff] [blame] | 17047 | ret = wait_for_completion_timeout( |
| 17048 | &pAdapter->pno_comp_var, |
| 17049 | msecs_to_jiffies(WLAN_WAIT_TIME_PNO)); |
| 17050 | if (0 >= ret) |
| 17051 | { |
| 17052 | // Did not receive the response for PNO disable in time. |
| 17053 | // Assuming the PNO disable was success. |
| 17054 | // Returning error from here, because we timeout, results |
| 17055 | // in side effect of Wifi (Wifi Setting) not to work. |
| 17056 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17057 | FL("Timed out waiting for PNO to be disabled")); |
| 17058 | ret = 0; |
| 17059 | } |
| 17060 | |
| 17061 | ret = pAdapter->pno_req_status; |
| 17062 | pHddCtx->isPnoEnable = (ret == 0) ? FALSE : TRUE; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17063 | |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17064 | error: |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 17065 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Vinay Krishna Eranna | f0e523b | 2014-03-01 21:00:16 +0530 | [diff] [blame] | 17066 | FL("PNO scan disabled ret = %d"), ret); |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17067 | |
| 17068 | EXIT(); |
Kamath Vinayak | ba5313f | 2013-08-22 15:52:39 +0530 | [diff] [blame] | 17069 | return ret; |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17070 | } |
| 17071 | |
Mahesh A Saptasagar | 6cc3856 | 2014-05-23 21:22:17 +0530 | [diff] [blame] | 17072 | /* |
| 17073 | * FUNCTION: wlan_hdd_cfg80211_sched_scan_stop |
| 17074 | * NL interface to disable PNO |
| 17075 | */ |
| 17076 | static int wlan_hdd_cfg80211_sched_scan_stop(struct wiphy *wiphy, |
| 17077 | struct net_device *dev) |
| 17078 | { |
| 17079 | int ret; |
| 17080 | |
| 17081 | vos_ssr_protect(__func__); |
| 17082 | ret = __wlan_hdd_cfg80211_sched_scan_stop(wiphy, dev); |
| 17083 | vos_ssr_unprotect(__func__); |
| 17084 | |
| 17085 | return ret; |
| 17086 | } |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 17087 | #endif /*FEATURE_WLAN_SCAN_PNO*/ |
| 17088 | |
| 17089 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17090 | #ifdef FEATURE_WLAN_TDLS |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 17091 | #if TDLS_MGMT_VERSION2 |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17092 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17093 | struct net_device *dev, |
| 17094 | u8 *peer, u8 action_code, |
| 17095 | u8 dialog_token, |
| 17096 | u16 status_code, u32 peer_capability, |
| 17097 | const u8 *buf, size_t len) |
| 17098 | #else /* TDLS_MGMT_VERSION2 */ |
| 17099 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS) |
| 17100 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17101 | struct net_device *dev, |
| 17102 | const u8 *peer, u8 action_code, |
| 17103 | u8 dialog_token, u16 status_code, |
| 17104 | u32 peer_capability, bool initiator, |
| 17105 | const u8 *buf, size_t len) |
| 17106 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) |
| 17107 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17108 | struct net_device *dev, |
| 17109 | const u8 *peer, u8 action_code, |
| 17110 | u8 dialog_token, u16 status_code, |
| 17111 | u32 peer_capability, const u8 *buf, |
| 17112 | size_t len) |
| 17113 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 17114 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17115 | struct net_device *dev, |
| 17116 | u8 *peer, u8 action_code, |
| 17117 | u8 dialog_token, |
| 17118 | u16 status_code, u32 peer_capability, |
| 17119 | const u8 *buf, size_t len) |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 17120 | #else |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17121 | static int __wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17122 | struct net_device *dev, |
| 17123 | u8 *peer, u8 action_code, |
| 17124 | u8 dialog_token, |
| 17125 | u16 status_code, const u8 *buf, |
| 17126 | size_t len) |
| 17127 | #endif |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 17128 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17129 | { |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17130 | hdd_adapter_t *pAdapter; |
| 17131 | hdd_context_t *pHddCtx; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17132 | VOS_STATUS status; |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 17133 | int max_sta_failed = 0; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17134 | int responder; |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 17135 | long rc; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17136 | int ret; |
Masti, Narayanraddi | 3b68193 | 2015-10-08 19:22:25 +0530 | [diff] [blame] | 17137 | hddTdlsPeer_t *pTdlsPeer; |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17138 | #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] | 17139 | u32 peer_capability = 0; |
| 17140 | #endif |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 17141 | tANI_U16 numCurrTdlsPeers; |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17142 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17143 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17144 | pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 17145 | if (NULL == pAdapter) |
| 17146 | { |
| 17147 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17148 | "%s: Adapter is NULL",__func__); |
| 17149 | return -EINVAL; |
| 17150 | } |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17151 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17152 | TRACE_CODE_HDD_CFG80211_TDLS_MGMT, |
| 17153 | pAdapter->sessionId, action_code)); |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17154 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17155 | pHddCtx = wiphy_priv(wiphy); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17156 | if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17157 | { |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 17158 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17159 | "Invalid arguments"); |
| 17160 | return -EINVAL; |
| 17161 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17162 | |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 17163 | if (pHddCtx->isLogpInProgress) |
| 17164 | { |
| 17165 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17166 | "%s:LOGP in Progress. Ignore!!!", __func__); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17167 | wlan_hdd_tdls_set_link_status(pAdapter, |
| 17168 | peer, |
| 17169 | eTDLS_LINK_IDLE, |
| 17170 | eTDLS_LINK_UNSPECIFIED); |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 17171 | return -EBUSY; |
| 17172 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17173 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 17174 | if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) |
| 17175 | { |
| 17176 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17177 | "%s: Unloading/Loading in Progress. Ignore!!!", __func__); |
| 17178 | return -EAGAIN; |
| 17179 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17180 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17181 | if (eTDLS_SUPPORT_NOT_ENABLED == pHddCtx->tdls_mode) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17182 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 17183 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17184 | "%s: TDLS mode is disabled OR not enabled in FW." |
| 17185 | MAC_ADDRESS_STR " action %d declined.", |
| 17186 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17187 | return -ENOTSUPP; |
| 17188 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17189 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17190 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 17191 | |
| 17192 | if( NULL == pHddStaCtx ) |
| 17193 | { |
| 17194 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17195 | "%s: HDD station context NULL ",__func__); |
| 17196 | return -EINVAL; |
| 17197 | } |
| 17198 | |
| 17199 | /* STA should be connected and authenticated |
| 17200 | * before sending any TDLS frames |
| 17201 | */ |
| 17202 | if ((eConnectionState_Associated != pHddStaCtx->conn_info.connState) || |
| 17203 | (FALSE == pHddStaCtx->conn_info.uIsAuthenticated)) |
| 17204 | { |
| 17205 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17206 | "STA is not connected or unauthenticated. " |
| 17207 | "connState %u, uIsAuthenticated %u", |
| 17208 | pHddStaCtx->conn_info.connState, |
| 17209 | pHddStaCtx->conn_info.uIsAuthenticated); |
| 17210 | return -EAGAIN; |
| 17211 | } |
| 17212 | |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17213 | /* other than teardown frame, other mgmt frames are not sent if disabled */ |
| 17214 | if (SIR_MAC_TDLS_TEARDOWN != action_code) |
| 17215 | { |
| 17216 | /* if tdls_mode is disabled to respond to peer's request */ |
| 17217 | if (eTDLS_SUPPORT_DISABLED == pHddCtx->tdls_mode) |
| 17218 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 17219 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17220 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 17221 | " TDLS mode is disabled. action %d declined.", |
| 17222 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17223 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17224 | return -ENOTSUPP; |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17225 | } |
Agarwal Ashish | 4b87f92 | 2014-06-18 03:03:21 +0530 | [diff] [blame] | 17226 | |
| 17227 | if (vos_max_concurrent_connections_reached()) |
| 17228 | { |
| 17229 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Reached max concurrent connections")); |
| 17230 | return -EINVAL; |
| 17231 | } |
Hoonki Lee | 2751190 | 2013-03-14 18:19:06 -0700 | [diff] [blame] | 17232 | } |
| 17233 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17234 | if (WLAN_IS_TDLS_SETUP_ACTION(action_code)) |
| 17235 | { |
Pradeep Reddy POTTETI | 9db32f0 | 2015-01-29 15:22:54 +0530 | [diff] [blame] | 17236 | if (NULL != wlan_hdd_tdls_is_progress(pHddCtx, peer, TRUE, TRUE)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17237 | { |
| 17238 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17239 | "%s: " MAC_ADDRESS_STR |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 17240 | " TDLS setup is ongoing. action %d declined.", |
| 17241 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
| 17242 | return -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17243 | } |
| 17244 | } |
| 17245 | |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17246 | if (SIR_MAC_TDLS_SETUP_REQ == action_code || |
| 17247 | SIR_MAC_TDLS_SETUP_RSP == action_code ) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17248 | { |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 17249 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 17250 | if (HDD_MAX_NUM_TDLS_STA <= numCurrTdlsPeers) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17251 | { |
| 17252 | /* supplicant still sends tdls_mgmt(SETUP_REQ) even after |
| 17253 | we return error code at 'add_station()'. Hence we have this |
| 17254 | check again in addtion to add_station(). |
| 17255 | Anyway, there is no hard to double-check. */ |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17256 | if (SIR_MAC_TDLS_SETUP_REQ == action_code) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17257 | { |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17258 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17259 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 17260 | " TDLS Max peer already connected. action (%d) declined. Num of peers (%d), Max allowed (%d).", |
| 17261 | __func__, MAC_ADDR_ARRAY(peer), action_code, |
| 17262 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Sunil Dutt | 388ac8f | 2013-11-28 18:06:52 +0530 | [diff] [blame] | 17263 | return -EINVAL; |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17264 | } |
| 17265 | else |
| 17266 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17267 | /* maximum reached. tweak to send error code to peer and return |
| 17268 | error code to supplicant */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17269 | status_code = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17270 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17271 | "%s: " MAC_ADDRESS_STR |
Rajesh Chauhan | a34c6e6 | 2014-03-25 16:37:58 +0530 | [diff] [blame] | 17272 | " TDLS Max peer already connected, send response status (%d). Num of peers (%d), Max allowed (%d).", |
| 17273 | __func__, MAC_ADDR_ARRAY(peer), status_code, |
| 17274 | numCurrTdlsPeers, HDD_MAX_NUM_TDLS_STA); |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 17275 | max_sta_failed = -EPERM; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17276 | /* fall through to send setup resp with failure status |
| 17277 | code */ |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17278 | } |
| 17279 | } |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17280 | else |
| 17281 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17282 | mutex_lock(&pHddCtx->tdls_lock); |
| 17283 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 17284 | if (pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17285 | { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17286 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17287 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 34d1b06 | 2013-03-19 15:28:33 -0700 | [diff] [blame] | 17288 | "%s:" MAC_ADDRESS_STR " already connected. action %d declined.", |
| 17289 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17290 | return -EPERM; |
| 17291 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17292 | mutex_unlock(&pHddCtx->tdls_lock); |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17293 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 17294 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17295 | |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 17296 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 17297 | "%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] | 17298 | "tdls_mgmt", MAC_ADDR_ARRAY(peer), |
| 17299 | action_code, dialog_token, status_code, len); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17300 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17301 | /*Except teardown responder will not be used so just make 0*/ |
| 17302 | responder = 0; |
Hoonki Lee | 11f7dda | 2013-02-14 16:55:44 -0800 | [diff] [blame] | 17303 | if (SIR_MAC_TDLS_TEARDOWN == action_code) |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17304 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 17305 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17306 | mutex_lock(&pHddCtx->tdls_lock); |
| 17307 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 17308 | |
| 17309 | if(pTdlsPeer && TDLS_IS_CONNECTED(pTdlsPeer)) |
| 17310 | responder = pTdlsPeer->is_responder; |
| 17311 | else |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17312 | { |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 17313 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arun Kumar Khandavalli | 9fb625e | 2014-03-17 16:07:40 +0530 | [diff] [blame] | 17314 | "%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] | 17315 | __func__, MAC_ADDR_ARRAY(peer), (NULL == pTdlsPeer) ? -1 : pTdlsPeer->link_status, |
| 17316 | dialog_token, status_code, len); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17317 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | 97a65fd | 2013-04-16 16:59:38 -0700 | [diff] [blame] | 17318 | return -EPERM; |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17319 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17320 | mutex_unlock(&pHddCtx->tdls_lock); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17321 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17322 | |
Masti, Narayanraddi | 3b68193 | 2015-10-08 19:22:25 +0530 | [diff] [blame] | 17323 | /* Discard TDLS setup if peer is removed by user app */ |
| 17324 | if ((pHddCtx->cfg_ini->fTDLSExternalControl) && |
| 17325 | ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 17326 | (SIR_MAC_TDLS_SETUP_CNF == action_code) || |
| 17327 | (SIR_MAC_TDLS_DIS_REQ == action_code))) { |
| 17328 | |
| 17329 | mutex_lock(&pHddCtx->tdls_lock); |
| 17330 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 17331 | if (pTdlsPeer && (FALSE == pTdlsPeer->isForcedPeer)) { |
| 17332 | mutex_unlock(&pHddCtx->tdls_lock); |
| 17333 | hddLog(LOGE, FL("TDLS External Control enabled, but peer " |
| 17334 | MAC_ADDRESS_STR " is not forced, so reject the action code %d"), |
| 17335 | MAC_ADDR_ARRAY(peer), action_code); |
| 17336 | return -EINVAL; |
| 17337 | } |
| 17338 | mutex_unlock(&pHddCtx->tdls_lock); |
| 17339 | } |
| 17340 | |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 17341 | /* For explicit trigger of DIS_REQ come out of BMPS for |
| 17342 | successfully receiving DIS_RSP from peer. */ |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17343 | if ((SIR_MAC_TDLS_SETUP_RSP == action_code) || |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 17344 | (SIR_MAC_TDLS_DIS_RSP == action_code) || |
| 17345 | (SIR_MAC_TDLS_DIS_REQ == action_code)) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17346 | { |
| 17347 | if (TRUE == sme_IsPmcBmps(WLAN_HDD_GET_HAL_CTX(pAdapter))) |
| 17348 | { |
Masti, Narayanraddi | 34e0e56 | 2015-03-05 18:23:03 +0530 | [diff] [blame] | 17349 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Gopichand Nakkala | 2f1ff15 | 2013-07-01 11:27:43 +0530 | [diff] [blame] | 17350 | "%s: Sending frame action_code %u.Disable BMPS", __func__, action_code); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17351 | status = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION); |
| 17352 | if (status != VOS_STATUS_SUCCESS) { |
| 17353 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set BMPS/IMPS")); |
| 17354 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17355 | } |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17356 | if (SIR_MAC_TDLS_DIS_REQ != action_code) { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17357 | if (0 != wlan_hdd_tdls_set_cap(pAdapter, peer, eTDLS_CAP_SUPPORTED)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17358 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS capabilities")); |
| 17359 | } |
| 17360 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17361 | } |
| 17362 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 17363 | /* make sure doesn't call send_mgmt() while it is pending */ |
| 17364 | if (TDLS_CTX_MAGIC == pAdapter->mgmtTxCompletionStatus) |
| 17365 | { |
| 17366 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Arif Hussain | 6d2a332 | 2013-11-17 19:50:10 -0800 | [diff] [blame] | 17367 | "%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] | 17368 | __func__, MAC_ADDR_ARRAY(peer), action_code); |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17369 | ret = -EBUSY; |
| 17370 | goto tx_failed; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 17371 | } |
| 17372 | |
| 17373 | pAdapter->mgmtTxCompletionStatus = TDLS_CTX_MAGIC; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17374 | INIT_COMPLETION(pAdapter->tdls_mgmt_comp); |
| 17375 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17376 | status = sme_SendTdlsMgmtFrame(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 17377 | pAdapter->sessionId, peer, action_code, dialog_token, |
| 17378 | status_code, peer_capability, (tANI_U8 *)buf, len, |
| 17379 | responder); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17380 | |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17381 | if (VOS_STATUS_SUCCESS != status) |
| 17382 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17383 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17384 | "%s: sme_SendTdlsMgmtFrame failed!", __func__); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 17385 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17386 | ret = -EINVAL; |
| 17387 | goto tx_failed; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17388 | } |
| 17389 | |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17390 | if ((SIR_MAC_TDLS_DIS_REQ == action_code) || |
| 17391 | (SIR_MAC_TDLS_DIS_RSP == action_code)) |
| 17392 | { |
| 17393 | /* for DIS_REQ/DIS_RSP, supplicant don't consider the return status. |
| 17394 | * So we no need to wait for tdls_mgmt_comp for sending ack status. |
| 17395 | */ |
| 17396 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17397 | "%s: tx done for frm %u", __func__, action_code); |
| 17398 | return 0; |
| 17399 | } |
| 17400 | |
| 17401 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17402 | "%s: Wait for tdls_mgmt_comp. Timeout %u ms", __func__, |
| 17403 | WAIT_TIME_TDLS_MGMT); |
| 17404 | |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 17405 | rc = wait_for_completion_interruptible_timeout(&pAdapter->tdls_mgmt_comp, |
| 17406 | msecs_to_jiffies(WAIT_TIME_TDLS_MGMT)); |
| 17407 | |
| 17408 | if ((rc <= 0) || (TRUE != pAdapter->mgmtTxCompletionStatus)) |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17409 | { |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 17410 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Jeff Johnson | 0299d0a | 2013-10-30 12:37:43 -0700 | [diff] [blame] | 17411 | "%s: Mgmt Tx Completion failed status %ld TxCompletion %u", |
Hoonki Lee | d37cbb3 | 2013-04-20 00:31:14 -0700 | [diff] [blame] | 17412 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 17413 | pAdapter->mgmtTxCompletionStatus = FALSE; |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 17414 | |
| 17415 | if (pHddCtx->isLogpInProgress) |
| 17416 | { |
| 17417 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17418 | "%s: LOGP in Progress. Ignore!!!", __func__); |
| 17419 | return -EAGAIN; |
| 17420 | } |
Abhishek Singh | 837adf2 | 2015-10-01 17:37:37 +0530 | [diff] [blame] | 17421 | if (rc <= 0) |
| 17422 | vos_fatal_event_logs_req(WLAN_LOG_TYPE_FATAL, |
| 17423 | WLAN_LOG_INDICATOR_HOST_DRIVER, |
| 17424 | WLAN_LOG_REASON_HDD_TIME_OUT, |
| 17425 | TRUE, TRUE); |
Yue Ma | 4f55ef3 | 2014-01-23 16:45:33 -0800 | [diff] [blame] | 17426 | |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17427 | ret = -EINVAL; |
| 17428 | goto tx_failed; |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17429 | } |
Ganesh Kondabattini | 8d0d35b | 2015-08-20 15:39:09 +0530 | [diff] [blame] | 17430 | else |
| 17431 | { |
| 17432 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17433 | "%s: Mgmt Tx Completion status %ld TxCompletion %u", |
| 17434 | __func__, rc, pAdapter->mgmtTxCompletionStatus); |
| 17435 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17436 | |
Gopichand Nakkala | 0592280 | 2013-03-14 12:23:19 -0700 | [diff] [blame] | 17437 | if (max_sta_failed) |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17438 | { |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17439 | ret = max_sta_failed; |
| 17440 | goto tx_failed; |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17441 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17442 | |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17443 | if (SIR_MAC_TDLS_SETUP_RSP == action_code) |
| 17444 | { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17445 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, TRUE)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17446 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 17447 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17448 | } |
| 17449 | else if (SIR_MAC_TDLS_SETUP_CNF == action_code) |
| 17450 | { |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17451 | if (0 != wlan_hdd_tdls_set_responder(pAdapter, peer, FALSE)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17452 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set TDLS responder: Setup Response")); |
| 17453 | } |
Hoonki Lee | a34dd89 | 2013-02-05 22:56:02 -0800 | [diff] [blame] | 17454 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17455 | |
| 17456 | return 0; |
Ganesh Kondabattini | 862aec9 | 2015-01-22 20:58:46 +0530 | [diff] [blame] | 17457 | |
| 17458 | tx_failed: |
| 17459 | /* add_station will be called before sending TDLS_SETUP_REQ and |
| 17460 | * TDLS_SETUP_RSP and as part of add_station driver will enable |
| 17461 | * BMPS. NL80211_TDLS_DISABLE_LINK will be called if the tx of |
| 17462 | * TDLS_SETUP_REQ or TDLS_SETUP_RSP fails. BMPS will be enabled |
| 17463 | * as part of processing NL80211_TDLS_DISABLE_LINK. So need to |
| 17464 | * enable BMPS for TDLS_SETUP_REQ and TDLS_SETUP_RSP if tx fails. |
| 17465 | */ |
| 17466 | |
| 17467 | if ((SIR_MAC_TDLS_SETUP_REQ == action_code) || |
| 17468 | (SIR_MAC_TDLS_SETUP_RSP == action_code)) |
| 17469 | wlan_hdd_tdls_check_bmps(pAdapter); |
| 17470 | return ret; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17471 | } |
| 17472 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17473 | #if TDLS_MGMT_VERSION2 |
| 17474 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 17475 | u8 *peer, u8 action_code, u8 dialog_token, |
| 17476 | u16 status_code, u32 peer_capability, |
| 17477 | const u8 *buf, size_t len) |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17478 | #else /* TDLS_MGMT_VERSION2 */ |
| 17479 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) |
| 17480 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17481 | struct net_device *dev, |
| 17482 | const u8 *peer, u8 action_code, |
| 17483 | u8 dialog_token, u16 status_code, |
| 17484 | u32 peer_capability, bool initiator, |
| 17485 | const u8 *buf, size_t len) |
| 17486 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 17487 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17488 | struct net_device *dev, |
| 17489 | const u8 *peer, u8 action_code, |
| 17490 | u8 dialog_token, u16 status_code, |
| 17491 | u32 peer_capability, const u8 *buf, |
| 17492 | size_t len) |
| 17493 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 17494 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, |
| 17495 | struct net_device *dev, |
| 17496 | u8 *peer, u8 action_code, |
| 17497 | u8 dialog_token, |
| 17498 | u16 status_code, u32 peer_capability, |
| 17499 | const u8 *buf, size_t len) |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17500 | #else |
| 17501 | static int wlan_hdd_cfg80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 17502 | u8 *peer, u8 action_code, u8 dialog_token, |
| 17503 | u16 status_code, const u8 *buf, size_t len) |
| 17504 | #endif |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17505 | #endif |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17506 | { |
| 17507 | int ret; |
| 17508 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17509 | vos_ssr_protect(__func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17510 | #if TDLS_MGMT_VERSION2 |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17511 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 17512 | dialog_token, status_code, |
| 17513 | peer_capability, buf, len); |
| 17514 | #else /* TDLS_MGMT_VERSION2 */ |
| 17515 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0)) || defined(WITH_BACKPORTS) |
| 17516 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 17517 | dialog_token, status_code, |
| 17518 | peer_capability, initiator, |
| 17519 | buf, len); |
| 17520 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0)) |
| 17521 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 17522 | dialog_token, status_code, |
| 17523 | peer_capability, buf, len); |
| 17524 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 17525 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 17526 | dialog_token, status_code, |
| 17527 | peer_capability, buf, len); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17528 | #else |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17529 | ret = __wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, action_code, |
| 17530 | dialog_token, status_code, buf, len); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17531 | #endif |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17532 | #endif |
| 17533 | vos_ssr_unprotect(__func__); |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17534 | |
Anand N Sunkad | 9f80b74 | 2015-07-30 20:05:51 +0530 | [diff] [blame] | 17535 | return ret; |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 17536 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17537 | |
| 17538 | int wlan_hdd_tdls_extctrl_config_peer(hdd_adapter_t *pAdapter, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17539 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 17540 | const u8 *peer, |
| 17541 | #else |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17542 | u8 *peer, |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17543 | #endif |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17544 | tdls_req_params_t *tdls_peer_params, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17545 | cfg80211_exttdls_callback callback) |
| 17546 | { |
| 17547 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17548 | hddTdlsPeer_t *pTdlsPeer = NULL; |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17549 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 17550 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17551 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17552 | " %s : NL80211_TDLS_SETUP for " MAC_ADDRESS_STR, |
| 17553 | __func__, MAC_ADDR_ARRAY(peer)); |
| 17554 | |
| 17555 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 17556 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 17557 | |
| 17558 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17559 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 17560 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 17561 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17562 | return -ENOTSUPP; |
| 17563 | } |
| 17564 | |
| 17565 | /* To cater the requirement of establishing the TDLS link |
| 17566 | * irrespective of the data traffic , get an entry of TDLS peer. |
| 17567 | */ |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 17568 | mutex_lock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17569 | pTdlsPeer = wlan_hdd_tdls_get_peer(pAdapter, peer); |
| 17570 | if (pTdlsPeer == NULL) { |
| 17571 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17572 | "%s: peer " MAC_ADDRESS_STR " not existing", |
| 17573 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6dbcdbb | 2015-05-13 10:28:06 +0530 | [diff] [blame] | 17574 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17575 | return -EINVAL; |
| 17576 | } |
| 17577 | |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 17578 | /* check FW TDLS Off Channel capability */ |
| 17579 | if ((TRUE == sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL)) && |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 17580 | (TRUE == pHddCtx->cfg_ini->fEnableTDLSOffChannel) && |
Pradeep Reddy POTTETI | 60ad240 | 2015-02-26 16:48:21 +0530 | [diff] [blame] | 17581 | (NULL != tdls_peer_params)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17582 | { |
| 17583 | pTdlsPeer->peerParams.channel = tdls_peer_params->channel; |
| 17584 | pTdlsPeer->peerParams.global_operating_class = |
| 17585 | tdls_peer_params->global_operating_class; |
| 17586 | pTdlsPeer->peerParams.max_latency_ms = tdls_peer_params->max_latency_ms; |
| 17587 | pTdlsPeer->peerParams.min_bandwidth_kbps = |
| 17588 | tdls_peer_params->min_bandwidth_kbps; |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 17589 | /* check configured channel is valid, non dfs and |
| 17590 | * not current operating channel */ |
| 17591 | if ((sme_IsTdlsOffChannelValid(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 17592 | tdls_peer_params->channel)) && |
| 17593 | (pHddStaCtx) && |
| 17594 | (tdls_peer_params->channel != |
| 17595 | pHddStaCtx->conn_info.operationChannel)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17596 | { |
| 17597 | pTdlsPeer->isOffChannelConfigured = TRUE; |
| 17598 | } |
| 17599 | else |
| 17600 | { |
| 17601 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 17602 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17603 | "%s: Configured Tdls Off Channel is not valid", __func__); |
| 17604 | |
| 17605 | } |
| 17606 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 17607 | "%s: tdls_off_channel %d isOffChannelConfigured %d " |
| 17608 | "current operating channel %d", |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17609 | __func__, pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | e30ed25 | 2015-02-18 14:27:55 +0530 | [diff] [blame] | 17610 | pTdlsPeer->isOffChannelConfigured, |
| 17611 | (pHddStaCtx ? pHddStaCtx->conn_info.operationChannel : 0)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17612 | } |
| 17613 | else |
| 17614 | { |
| 17615 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Pradeep Reddy POTTETI | 0cb99bc | 2015-06-08 12:59:09 +0530 | [diff] [blame] | 17616 | "%s: TDLS off channel FW capability %d, " |
| 17617 | "host capab %d or Invalid TDLS Peer Params", __func__, |
| 17618 | sme_IsFeatureSupportedByFW(TDLS_OFF_CHANNEL), |
| 17619 | pHddCtx->cfg_ini->fEnableTDLSOffChannel); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17620 | } |
| 17621 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17622 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, TRUE) ) { |
| 17623 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17624 | mutex_unlock(&pHddCtx->tdls_lock); |
| 17625 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17626 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17627 | " %s TDLS Add Force Peer Failed", |
| 17628 | __func__); |
| 17629 | return -EINVAL; |
| 17630 | } |
| 17631 | /*EXT TDLS*/ |
| 17632 | |
| 17633 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, callback) ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17634 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17635 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17636 | " %s TDLS set callback Failed", |
| 17637 | __func__); |
| 17638 | return -EINVAL; |
| 17639 | } |
| 17640 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17641 | mutex_unlock(&pHddCtx->tdls_lock); |
| 17642 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17643 | return(0); |
| 17644 | |
| 17645 | } |
| 17646 | |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 17647 | int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter, |
| 17648 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 17649 | const u8 *peer |
| 17650 | #else |
| 17651 | u8 *peer |
| 17652 | #endif |
| 17653 | ) |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17654 | { |
| 17655 | |
| 17656 | hddTdlsPeer_t *pTdlsPeer; |
| 17657 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 17658 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17659 | " %s : NL80211_TDLS_TEARDOWN for " MAC_ADDRESS_STR, |
| 17660 | __func__, MAC_ADDR_ARRAY(peer)); |
| 17661 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 17662 | if (0 != wlan_hdd_validate_context(pHddCtx)) { |
| 17663 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD context is NULL")); |
| 17664 | return -EINVAL; |
| 17665 | } |
| 17666 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17667 | if ( (FALSE == pHddCtx->cfg_ini->fTDLSExternalControl) || |
| 17668 | (FALSE == pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger) ) { |
| 17669 | |
| 17670 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17671 | " %s TDLS External control (%d) and Implicit Trigger (%d) not enabled ", |
| 17672 | __func__, pHddCtx->cfg_ini->fTDLSExternalControl, |
| 17673 | pHddCtx->cfg_ini->fEnableTDLSImplicitTrigger); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17674 | return -ENOTSUPP; |
| 17675 | } |
| 17676 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17677 | mutex_lock(&pHddCtx->tdls_lock); |
| 17678 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17679 | |
| 17680 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17681 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17682 | hddLog(VOS_TRACE_LEVEL_INFO, "%s: " MAC_ADDRESS_STR |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 17683 | " peer not existing", |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17684 | __func__, MAC_ADDR_ARRAY(peer)); |
| 17685 | return -EINVAL; |
| 17686 | } |
| 17687 | else { |
| 17688 | wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer, |
| 17689 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17690 | /* if channel switch is configured, reset |
| 17691 | the channel for this peer */ |
| 17692 | if (TRUE == pTdlsPeer->isOffChannelConfigured) |
| 17693 | { |
| 17694 | pTdlsPeer->peerParams.channel = 0; |
| 17695 | pTdlsPeer->isOffChannelConfigured = FALSE; |
| 17696 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17697 | } |
| 17698 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17699 | if ( 0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, FALSE) ) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17700 | mutex_unlock(&pHddCtx->tdls_lock); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17701 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to set force peer")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17702 | return -EINVAL; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17703 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17704 | |
| 17705 | /*EXT TDLS*/ |
| 17706 | |
| 17707 | if ( 0 != wlan_hdd_set_callback(pTdlsPeer, NULL )) { |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17708 | mutex_unlock(&pHddCtx->tdls_lock); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17709 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17710 | " %s TDLS set callback Failed", |
| 17711 | __func__); |
| 17712 | return -EINVAL; |
| 17713 | } |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17714 | |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17715 | mutex_unlock(&pHddCtx->tdls_lock); |
| 17716 | |
| 17717 | return(0); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17718 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 17719 | 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] | 17720 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 17721 | const u8 *peer, |
| 17722 | #else |
| 17723 | u8 *peer, |
| 17724 | #endif |
| 17725 | enum nl80211_tdls_operation oper) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17726 | { |
| 17727 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 17728 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17729 | int status; |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 17730 | hddTdlsPeer_t *pTdlsPeer; |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 17731 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 17732 | ENTER(); |
| 17733 | |
Chandrasekaran, Manishekar | 41b8e1f | 2015-03-10 13:30:28 +0530 | [diff] [blame] | 17734 | if (!pAdapter) { |
| 17735 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("HDD adpater is NULL")); |
| 17736 | return -EINVAL; |
| 17737 | } |
| 17738 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 17739 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 17740 | TRACE_CODE_HDD_CFG80211_TDLS_OPER, |
| 17741 | pAdapter->sessionId, oper)); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17742 | if ( NULL == peer ) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17743 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 17744 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chilam Ng | c4244af | 2013-04-01 15:37:32 -0700 | [diff] [blame] | 17745 | "%s: Invalid arguments", __func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17746 | return -EINVAL; |
| 17747 | } |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 17748 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17749 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17750 | if (0 != status) |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 17751 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 17752 | return status; |
Sameer Thalappil | 75ea31a | 2013-02-21 19:38:16 -0800 | [diff] [blame] | 17753 | } |
| 17754 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17755 | |
| 17756 | if( FALSE == pHddCtx->cfg_ini->fEnableTDLSSupport || |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 17757 | FALSE == sme_IsFeatureSupportedByFW(TDLS)) |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17758 | { |
Hoonki Lee | 1090c6a | 2013-01-16 17:40:54 -0800 | [diff] [blame] | 17759 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17760 | "TDLS Disabled in INI (%d) OR not enabled in FW (%d) " |
| 17761 | "Cannot process TDLS commands", |
| 17762 | pHddCtx->cfg_ini->fEnableTDLSSupport, |
| 17763 | sme_IsFeatureSupportedByFW(TDLS)); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17764 | return -ENOTSUPP; |
| 17765 | } |
| 17766 | |
| 17767 | switch (oper) { |
| 17768 | case NL80211_TDLS_ENABLE_LINK: |
| 17769 | { |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17770 | VOS_STATUS status; |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 17771 | long ret; |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 17772 | tCsrTdlsLinkEstablishParams tdlsLinkEstablishParams; |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 17773 | WLAN_STADescType staDesc; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17774 | tANI_U16 numCurrTdlsPeers = 0; |
| 17775 | hddTdlsPeer_t *connPeer = NULL; |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 17776 | tANI_U8 suppChannelLen = 0; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 17777 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 17778 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17779 | " %s : NL80211_TDLS_ENABLE_LINK for " MAC_ADDRESS_STR, |
| 17780 | __func__, MAC_ADDR_ARRAY(peer)); |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17781 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 17782 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, TRUE); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 17783 | memset(&staDesc, 0, sizeof(staDesc)); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 17784 | if ( NULL == pTdlsPeer ) { |
| 17785 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 17786 | " (oper %d) not exsting. ignored", |
| 17787 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 17788 | return -EINVAL; |
| 17789 | } |
| 17790 | |
| 17791 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17792 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 17793 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 17794 | "NL80211_TDLS_ENABLE_LINK"); |
| 17795 | |
Gopichand Nakkala | 2f4a282 | 2013-04-17 11:22:01 -0700 | [diff] [blame] | 17796 | if (!TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
| 17797 | { |
| 17798 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Staion Index %u " |
| 17799 | MAC_ADDRESS_STR " failed", |
| 17800 | __func__, pTdlsPeer->staId, MAC_ADDR_ARRAY(peer)); |
| 17801 | return -EINVAL; |
| 17802 | } |
| 17803 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 17804 | /* before starting tdls connection, set tdls |
| 17805 | * off channel established status to default value */ |
| 17806 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17807 | /* TDLS Off Channel, Disable tdls channel switch, |
| 17808 | when there are more than one tdls link */ |
| 17809 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
Pradeep Reddy POTTETI | a9991b6 | 2015-03-26 18:03:19 +0530 | [diff] [blame] | 17810 | if (numCurrTdlsPeers == 2) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17811 | { |
| 17812 | /* get connected peer and send disable tdls off chan */ |
| 17813 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 17814 | if ((connPeer) && |
| 17815 | (connPeer->isOffChannelSupported == TRUE) && |
| 17816 | (connPeer->isOffChannelConfigured == TRUE)) |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17817 | { |
| 17818 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17819 | "%s: More then one peer connected, Disable " |
| 17820 | "TDLS channel switch", __func__); |
| 17821 | |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 17822 | connPeer->isOffChannelEstablished = FALSE; |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17823 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17824 | ret = sme_SendTdlsChanSwitchReq( |
| 17825 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17826 | pAdapter->sessionId, |
| 17827 | connPeer->peerMac, |
| 17828 | connPeer->peerParams.channel, |
| 17829 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 17830 | TDLS_CHANNEL_SWITCH_DISABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17831 | if (ret != VOS_STATUS_SUCCESS) { |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 17832 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 17833 | FL("Failed to send TDLS switch channel request")); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17834 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17835 | } |
| 17836 | else |
| 17837 | { |
| 17838 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17839 | "%s: No TDLS Connected Peer or " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 17840 | "isOffChannelSupported %d " |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17841 | "isOffChannelConfigured %d", |
| 17842 | __func__, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 17843 | (connPeer ? (connPeer->isOffChannelSupported) |
| 17844 | : -1), |
| 17845 | (connPeer ? (connPeer->isOffChannelConfigured) |
| 17846 | : -1)); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17847 | } |
| 17848 | } |
| 17849 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 17850 | if (eTDLS_LINK_CONNECTED != pTdlsPeer->link_status) |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 17851 | { |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 17852 | if (IS_ADVANCE_TDLS_ENABLE) { |
Gopichand Nakkala | 24be531 | 2013-07-02 16:47:12 +0530 | [diff] [blame] | 17853 | |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 17854 | if (0 != wlan_hdd_tdls_get_link_establish_params( |
| 17855 | pAdapter, peer,&tdlsLinkEstablishParams)) { |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17856 | 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] | 17857 | return -EINVAL; |
| 17858 | } |
| 17859 | INIT_COMPLETION(pAdapter->tdls_link_establish_req_comp); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 17860 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17861 | ret = sme_SendTdlsLinkEstablishParams( |
| 17862 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 17863 | pAdapter->sessionId, peer, |
| 17864 | &tdlsLinkEstablishParams); |
| 17865 | if (ret != VOS_STATUS_SUCCESS) { |
| 17866 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send link establishment params")); |
| 17867 | } |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 17868 | /* Send TDLS peer UAPSD capabilities to the firmware and |
| 17869 | * register with the TL on after the response for this operation |
| 17870 | * is received . |
| 17871 | */ |
| 17872 | ret = wait_for_completion_interruptible_timeout( |
| 17873 | &pAdapter->tdls_link_establish_req_comp, |
| 17874 | msecs_to_jiffies(WAIT_TIME_TDLS_LINK_ESTABLISH_REQ)); |
| 17875 | if (ret <= 0) |
| 17876 | { |
| 17877 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 17878 | FL("Link Establish Request Failed Status %ld"), |
| 17879 | ret); |
Madan Mohan Koyyalamudi | ce41987 | 2013-09-13 19:36:52 +0530 | [diff] [blame] | 17880 | return -EINVAL; |
| 17881 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 17882 | } |
Masti, Narayanraddi | 6b93b47 | 2015-09-04 17:48:11 +0530 | [diff] [blame] | 17883 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 17884 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 17885 | eTDLS_LINK_CONNECTED, |
| 17886 | eTDLS_LINK_SUCCESS); |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 17887 | staDesc.ucSTAId = pTdlsPeer->staId; |
| 17888 | staDesc.ucQosEnabled = tdlsLinkEstablishParams.qos; |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17889 | ret = WLANTL_UpdateTdlsSTAClient( |
| 17890 | pHddCtx->pvosContext, |
| 17891 | &staDesc); |
| 17892 | if (ret != VOS_STATUS_SUCCESS) { |
| 17893 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to update TDLS STA params")); |
| 17894 | } |
Agarwal Ashish | 16020c4 | 2014-12-29 22:01:11 +0530 | [diff] [blame] | 17895 | |
Gopichand Nakkala | 471708b | 2013-06-04 20:03:01 +0530 | [diff] [blame] | 17896 | /* Mark TDLS client Authenticated .*/ |
| 17897 | status = WLANTL_ChangeSTAState( pHddCtx->pvosContext, |
| 17898 | pTdlsPeer->staId, |
| 17899 | WLANTL_STA_AUTHENTICATED); |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 17900 | if (VOS_STATUS_SUCCESS == status) |
| 17901 | { |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17902 | if (pTdlsPeer->is_responder == 0) |
| 17903 | { |
| 17904 | v_U8_t staId = (v_U8_t)pTdlsPeer->staId; |
Ganesh Kondabattini | cbfdc39 | 2015-09-11 19:12:59 +0530 | [diff] [blame] | 17905 | tdlsConnInfo_t *tdlsInfo; |
| 17906 | |
| 17907 | tdlsInfo = wlan_hdd_get_conn_info(pHddCtx, staId); |
| 17908 | |
| 17909 | /* Initialize initiator wait callback */ |
| 17910 | vos_timer_init( |
| 17911 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 17912 | VOS_TIMER_TYPE_SW, |
| 17913 | wlan_hdd_tdls_initiator_wait_cb, |
| 17914 | tdlsInfo); |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17915 | |
| 17916 | wlan_hdd_tdls_timer_restart(pAdapter, |
| 17917 | &pTdlsPeer->initiatorWaitTimeoutTimer, |
| 17918 | WAIT_TIME_TDLS_INITIATOR); |
| 17919 | /* suspend initiator TX until it receives direct packet from the |
| 17920 | reponder or WAIT_TIME_TDLS_INITIATOR timer expires */ |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17921 | ret = WLANTL_SuspendDataTx( |
| 17922 | (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 17923 | &staId, NULL); |
| 17924 | if (ret != VOS_STATUS_SUCCESS) { |
| 17925 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to suspend data tx")); |
| 17926 | } |
Hoonki Lee | 1462135 | 2013-04-16 17:51:19 -0700 | [diff] [blame] | 17927 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17928 | |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 17929 | if ((TRUE == pTdlsPeer->isOffChannelSupported) && |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 17930 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 17931 | { |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 17932 | suppChannelLen = |
| 17933 | tdlsLinkEstablishParams.supportedChannelsLen; |
| 17934 | |
| 17935 | if ((suppChannelLen > 0) && |
| 17936 | (suppChannelLen <= SIR_MAC_MAX_SUPP_CHANNELS)) |
| 17937 | { |
| 17938 | tANI_U8 suppPeerChannel = 0; |
| 17939 | int i = 0; |
| 17940 | for (i = 0U; i < suppChannelLen; i++) |
| 17941 | { |
| 17942 | suppPeerChannel = |
| 17943 | tdlsLinkEstablishParams.supportedChannels[i]; |
| 17944 | |
| 17945 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 17946 | if (suppPeerChannel == |
| 17947 | pTdlsPeer->peerParams.channel) |
| 17948 | { |
| 17949 | pTdlsPeer->isOffChannelSupported = TRUE; |
| 17950 | break; |
| 17951 | } |
| 17952 | } |
| 17953 | } |
| 17954 | else |
| 17955 | { |
| 17956 | pTdlsPeer->isOffChannelSupported = FALSE; |
| 17957 | } |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 17958 | } |
| 17959 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17960 | "%s: TDLS channel switch request for channel " |
| 17961 | "%d isOffChannelConfigured %d suppChannelLen " |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 17962 | "%d isOffChannelSupported %d", __func__, |
| 17963 | pTdlsPeer->peerParams.channel, |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 17964 | pTdlsPeer->isOffChannelConfigured, |
Pradeep Reddy POTTETI | fdaf38b | 2015-05-13 13:01:22 +0530 | [diff] [blame] | 17965 | suppChannelLen, |
| 17966 | pTdlsPeer->isOffChannelSupported); |
Pradeep Reddy POTTETI | fcac790 | 2015-04-16 12:25:17 +0530 | [diff] [blame] | 17967 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17968 | /* TDLS Off Channel, Enable tdls channel switch, |
| 17969 | when their is only one tdls link and it supports */ |
| 17970 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 17971 | if ((numCurrTdlsPeers == 1) && |
| 17972 | (TRUE == pTdlsPeer->isOffChannelSupported) && |
| 17973 | (TRUE == pTdlsPeer->isOffChannelConfigured)) |
| 17974 | { |
| 17975 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 17976 | "%s: Send TDLS channel switch request for channel %d", |
| 17977 | __func__, pTdlsPeer->peerParams.channel); |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 17978 | |
| 17979 | pTdlsPeer->isOffChannelEstablished = TRUE; |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17980 | ret = sme_SendTdlsChanSwitchReq(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 17981 | pAdapter->sessionId, |
| 17982 | pTdlsPeer->peerMac, |
| 17983 | pTdlsPeer->peerParams.channel, |
| 17984 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 17985 | TDLS_CHANNEL_SWITCH_ENABLE); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 17986 | if (ret != VOS_STATUS_SUCCESS) { |
| 17987 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("TDLS offchannel: Failed to send TDLS switch channel req")); |
| 17988 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 17989 | } |
| 17990 | else |
| 17991 | { |
| 17992 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 17993 | "%s: TDLS channel switch request not sent" |
| 17994 | " numCurrTdlsPeers %d " |
| 17995 | "isOffChannelSupported %d " |
| 17996 | "isOffChannelConfigured %d", |
| 17997 | __func__, numCurrTdlsPeers, |
| 17998 | pTdlsPeer->isOffChannelSupported, |
| 17999 | pTdlsPeer->isOffChannelConfigured); |
| 18000 | } |
| 18001 | |
Gopichand Nakkala | ccd3a38 | 2013-03-19 13:56:10 -0700 | [diff] [blame] | 18002 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18003 | wlan_hdd_tdls_check_bmps(pAdapter); |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 18004 | |
| 18005 | /* Update TL about the UAPSD masks , to route the packets to firmware */ |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 18006 | if ((TRUE == pHddCtx->cfg_ini->fEnableTDLSBufferSta) |
| 18007 | || pHddCtx->cfg_ini->fTDLSUapsdMask ) |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 18008 | { |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 18009 | int ac; |
| 18010 | uint8 ucAc[4] = { WLANTL_AC_VO, |
| 18011 | WLANTL_AC_VI, |
| 18012 | WLANTL_AC_BK, |
| 18013 | WLANTL_AC_BE }; |
| 18014 | uint8 tlTid[4] = { 7, 5, 2, 3 } ; |
| 18015 | for(ac=0; ac < 4; ac++) |
| 18016 | { |
| 18017 | status = WLANTL_EnableUAPSDForAC( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext, |
| 18018 | pTdlsPeer->staId, ucAc[ac], |
| 18019 | tlTid[ac], tlTid[ac], 0, 0, |
| 18020 | WLANTL_BI_DIR ); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18021 | if (status != VOS_STATUS_SUCCESS) { |
| 18022 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to enable UAPSD for AC")); |
| 18023 | } |
Gopichand Nakkala | 574f6d1 | 2013-06-27 19:38:43 +0530 | [diff] [blame] | 18024 | } |
Gopichand Nakkala | 79ff85d | 2013-05-27 17:05:29 +0530 | [diff] [blame] | 18025 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18026 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18027 | } |
| 18028 | break; |
| 18029 | case NL80211_TDLS_DISABLE_LINK: |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18030 | { |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18031 | tANI_U16 numCurrTdlsPeers = 0; |
| 18032 | hddTdlsPeer_t *connPeer = NULL; |
| 18033 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18034 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18035 | " %s : NL80211_TDLS_DISABLE_LINK for " MAC_ADDRESS_STR, |
| 18036 | __func__, MAC_ADDR_ARRAY(peer)); |
| 18037 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18038 | mutex_lock(&pHddCtx->tdls_lock); |
| 18039 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18040 | |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18041 | |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18042 | if ( NULL == pTdlsPeer ) { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18043 | mutex_unlock(&pHddCtx->tdls_lock); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18044 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 18045 | " (oper %d) not exsting. ignored", |
| 18046 | __func__, MAC_ADDR_ARRAY(peer), (int)oper); |
| 18047 | return -EINVAL; |
| 18048 | } |
| 18049 | |
| 18050 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18051 | "%s: " MAC_ADDRESS_STR " link_status %d (%s) ", "tdls_oper", |
| 18052 | MAC_ADDR_ARRAY(peer), pTdlsPeer->link_status, |
| 18053 | "NL80211_TDLS_DISABLE_LINK"); |
| 18054 | |
Hoonki Lee | 5305c3a | 2013-04-29 23:28:59 -0700 | [diff] [blame] | 18055 | if(TDLS_STA_INDEX_VALID(pTdlsPeer->staId)) |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18056 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 18057 | long status; |
| 18058 | |
Pradeep Reddy POTTETI | f3148e8 | 2015-04-16 12:10:33 +0530 | [diff] [blame] | 18059 | /* set tdls off channel status to false for this peer */ |
| 18060 | pTdlsPeer->isOffChannelEstablished = FALSE; |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 18061 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
| 18062 | eTDLS_LINK_TEARING, |
| 18063 | (pTdlsPeer->link_status == eTDLS_LINK_TEARING)? |
| 18064 | eTDLS_LINK_UNSPECIFIED: |
| 18065 | eTDLS_LINK_DROPPED_BY_REMOTE); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18066 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18067 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 18068 | INIT_COMPLETION(pAdapter->tdls_del_station_comp); |
| 18069 | |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18070 | status = sme_DeleteTdlsPeerSta( |
| 18071 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 18072 | pAdapter->sessionId, peer ); |
| 18073 | if (status != VOS_STATUS_SUCCESS) { |
| 18074 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to delete TDLS peer STA")); |
| 18075 | } |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 18076 | |
| 18077 | status = wait_for_completion_interruptible_timeout(&pAdapter->tdls_del_station_comp, |
| 18078 | msecs_to_jiffies(WAIT_TIME_TDLS_DEL_STA)); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18079 | |
| 18080 | mutex_lock(&pHddCtx->tdls_lock); |
| 18081 | pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer, FALSE); |
| 18082 | if ( NULL == pTdlsPeer ) { |
| 18083 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18084 | hddLog(VOS_TRACE_LEVEL_ERROR, "%s: " MAC_ADDRESS_STR |
| 18085 | " peer was freed in other context", |
| 18086 | __func__, MAC_ADDR_ARRAY(peer)); |
| 18087 | return -EINVAL; |
| 18088 | } |
| 18089 | |
Atul Mittal | 271a765 | 2014-09-12 13:18:22 +0530 | [diff] [blame] | 18090 | wlan_hdd_tdls_set_peer_link_status(pTdlsPeer, |
Atul Mittal | 454664b | 2014-10-10 11:03:46 +0530 | [diff] [blame] | 18091 | eTDLS_LINK_IDLE, |
| 18092 | eTDLS_LINK_UNSPECIFIED); |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18093 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18094 | |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 18095 | if (status <= 0) |
| 18096 | { |
Gopichand Nakkala | e7cbc5d | 2013-03-27 21:09:23 -0700 | [diff] [blame] | 18097 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18098 | "%s: Del station failed status %ld", |
| 18099 | __func__, status); |
| 18100 | return -EPERM; |
| 18101 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18102 | |
| 18103 | /* TDLS Off Channel, Enable tdls channel switch, |
| 18104 | when their is only one tdls link and it supports */ |
| 18105 | numCurrTdlsPeers = wlan_hdd_tdlsConnectedPeers(pAdapter); |
| 18106 | if (numCurrTdlsPeers == 1) |
| 18107 | { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18108 | tSirMacAddr peerMac; |
| 18109 | int channel; |
Masti, Narayanraddi | 3818aea | 2015-10-17 15:20:28 +0530 | [diff] [blame] | 18110 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18111 | mutex_lock(&pHddCtx->tdls_lock); |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18112 | connPeer = wlan_hdd_tdls_get_connected_peer(pAdapter); |
Masti, Narayanraddi | 3818aea | 2015-10-17 15:20:28 +0530 | [diff] [blame] | 18113 | |
| 18114 | if (connPeer == NULL) { |
| 18115 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18116 | hddLog(VOS_TRACE_LEVEL_ERROR, |
| 18117 | "%s connPeer is NULL", __func__); |
| 18118 | return -EINVAL; |
| 18119 | } |
| 18120 | |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18121 | vos_mem_copy(peerMac, connPeer->peerMac, sizeof(tSirMacAddr)); |
| 18122 | channel = connPeer->peerParams.channel; |
| 18123 | |
| 18124 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18125 | "%s: TDLS channel switch " |
| 18126 | "isOffChannelSupported %d " |
| 18127 | "isOffChannelConfigured %d " |
| 18128 | "isOffChannelEstablished %d", |
| 18129 | __func__, |
| 18130 | (connPeer ? connPeer->isOffChannelSupported : -1), |
| 18131 | (connPeer ? connPeer->isOffChannelConfigured : -1), |
| 18132 | (connPeer ? connPeer->isOffChannelEstablished : -1)); |
| 18133 | |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18134 | if ((connPeer) && |
| 18135 | (connPeer->isOffChannelSupported == TRUE) && |
| 18136 | (connPeer->isOffChannelConfigured == TRUE)) |
| 18137 | { |
Pradeep Reddy POTTETI | 16d8333 | 2015-03-26 18:28:13 +0530 | [diff] [blame] | 18138 | connPeer->isOffChannelEstablished = TRUE; |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18139 | mutex_unlock(&pHddCtx->tdls_lock); |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18140 | status = sme_SendTdlsChanSwitchReq( |
| 18141 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 18142 | pAdapter->sessionId, |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18143 | peerMac, |
| 18144 | channel, |
Chandrasekaran, Manishekar | 0de84dc | 2015-03-10 15:12:34 +0530 | [diff] [blame] | 18145 | TDLS_OFF_CHANNEL_BW_OFFSET, |
| 18146 | TDLS_CHANNEL_SWITCH_ENABLE); |
| 18147 | if (status != VOS_STATUS_SUCCESS) { |
| 18148 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to send TDLS switch channel req")); |
| 18149 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18150 | } |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18151 | else |
| 18152 | mutex_unlock(&pHddCtx->tdls_lock); |
| 18153 | } |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18154 | else |
| 18155 | { |
| 18156 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18157 | "%s: TDLS channel switch request not sent " |
| 18158 | "numCurrTdlsPeers %d ", |
| 18159 | __func__, numCurrTdlsPeers); |
| 18160 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18161 | } |
| 18162 | else |
| 18163 | { |
Masti, Narayanraddi | 8208f06 | 2015-10-15 13:16:17 +0530 | [diff] [blame] | 18164 | mutex_unlock(&pHddCtx->tdls_lock); |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18165 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18166 | "%s: TDLS Peer Station doesn't exist.", __func__); |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18167 | } |
Lee Hoonki | c1262f2 | 2013-01-24 21:59:00 -0800 | [diff] [blame] | 18168 | } |
Gopichand Nakkala | c87400e | 2013-03-13 18:51:00 -0700 | [diff] [blame] | 18169 | break; |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18170 | case NL80211_TDLS_TEARDOWN: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18171 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18172 | status = wlan_hdd_tdls_extctrl_deconfig_peer(pAdapter, peer); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18173 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18174 | if (0 != status) |
| 18175 | { |
| 18176 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18177 | FL("Error in TDLS Teardown")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18178 | return status; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18179 | } |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18180 | break; |
| 18181 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18182 | case NL80211_TDLS_SETUP: |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18183 | { |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18184 | status = wlan_hdd_tdls_extctrl_config_peer(pAdapter, |
| 18185 | peer, |
Pradeep Reddy POTTETI | e309c15 | 2015-02-06 13:21:07 +0530 | [diff] [blame] | 18186 | NULL, |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18187 | NULL); |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18188 | |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18189 | if (0 != status) |
| 18190 | { |
| 18191 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18192 | FL("Error in TDLS Setup")); |
Atul Mittal | 115287b | 2014-07-08 13:26:33 +0530 | [diff] [blame] | 18193 | return status; |
Naresh Jayaram | 937abdf | 2013-11-26 19:50:25 +0530 | [diff] [blame] | 18194 | } |
Naresh Jayaram | db4514b | 2013-11-25 18:08:10 +0530 | [diff] [blame] | 18195 | break; |
Sunil Dutt | 41de4e2 | 2013-11-14 18:09:02 +0530 | [diff] [blame] | 18196 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18197 | case NL80211_TDLS_DISCOVERY_REQ: |
| 18198 | /* We don't support in-driver setup/teardown/discovery */ |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 18199 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
Agarwal Ashish | a7ef41d | 2015-06-25 18:00:26 +0530 | [diff] [blame] | 18200 | "%s: Driver doesn't support in-driver setup/teardown/discovery " |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 18201 | ,__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18202 | return -ENOTSUPP; |
| 18203 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 18204 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18205 | "%s: unsupported event",__func__); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18206 | return -ENOTSUPP; |
| 18207 | } |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18208 | |
| 18209 | EXIT(); |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18210 | return 0; |
| 18211 | } |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 18212 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18213 | 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] | 18214 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,0)) |
| 18215 | const u8 *peer, |
| 18216 | #else |
| 18217 | u8 *peer, |
| 18218 | #endif |
| 18219 | enum nl80211_tdls_operation oper) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18220 | { |
| 18221 | int ret; |
| 18222 | |
| 18223 | vos_ssr_protect(__func__); |
| 18224 | ret = __wlan_hdd_cfg80211_tdls_oper(wiphy, dev, peer, oper); |
| 18225 | vos_ssr_unprotect(__func__); |
| 18226 | |
| 18227 | return ret; |
| 18228 | } |
| 18229 | |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 18230 | int wlan_hdd_cfg80211_send_tdls_discover_req(struct wiphy *wiphy, |
| 18231 | struct net_device *dev, u8 *peer) |
| 18232 | { |
Arif Hussain | a7c8e41 | 2013-11-20 11:06:42 -0800 | [diff] [blame] | 18233 | hddLog(VOS_TRACE_LEVEL_INFO, |
| 18234 | "tdls send discover req: "MAC_ADDRESS_STR, |
| 18235 | MAC_ADDR_ARRAY(peer)); |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 18236 | |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 18237 | #if TDLS_MGMT_VERSION2 |
| 18238 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 18239 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 18240 | #else |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18241 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,17,0)) |
| 18242 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 18243 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, 0, NULL, 0); |
| 18244 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,16,0)) |
| 18245 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 18246 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 18247 | #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,15,0)) |
| 18248 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 18249 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, 0, NULL, 0); |
| 18250 | #else |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 18251 | return wlan_hdd_cfg80211_tdls_mgmt(wiphy, dev, peer, |
| 18252 | WLAN_TDLS_DISCOVERY_REQUEST, 1, 0, NULL, 0); |
Sunil Dutt Undekari | eacac6f | 2014-03-21 14:08:53 +0530 | [diff] [blame] | 18253 | #endif |
Anand N Sunkad | 9bfc262 | 2015-07-30 15:18:54 +0530 | [diff] [blame] | 18254 | #endif /* KERNEL_VERSION */ |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 18255 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 18256 | #endif |
| 18257 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18258 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 18259 | /* |
| 18260 | * FUNCTION: wlan_hdd_cfg80211_update_replayCounterCallback |
| 18261 | * Callback rountine called upon receiving response for |
| 18262 | * get offload info |
| 18263 | */ |
| 18264 | void wlan_hdd_cfg80211_update_replayCounterCallback(void *callbackContext, |
| 18265 | tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp) |
| 18266 | { |
| 18267 | |
| 18268 | hdd_adapter_t *pAdapter = (hdd_adapter_t *)callbackContext; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18269 | tANI_U8 tempReplayCounter[8]; |
| 18270 | hdd_station_ctx_t *pHddStaCtx; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18271 | |
| 18272 | ENTER(); |
| 18273 | |
| 18274 | if (NULL == pAdapter) |
| 18275 | { |
Agarwal Ashish | 971c288 | 2013-10-30 20:11:12 +0530 | [diff] [blame] | 18276 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18277 | "%s: HDD adapter is Null", __func__); |
| 18278 | return ; |
| 18279 | } |
| 18280 | |
| 18281 | if (NULL == pGtkOffloadGetInfoRsp) |
| 18282 | { |
| 18283 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18284 | "%s: pGtkOffloadGetInfoRsp is Null", __func__); |
| 18285 | return ; |
| 18286 | } |
| 18287 | |
| 18288 | if (VOS_STATUS_SUCCESS != pGtkOffloadGetInfoRsp->ulStatus) |
| 18289 | { |
| 18290 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18291 | "%s: wlan Failed to get replay counter value", |
| 18292 | __func__); |
| 18293 | return ; |
| 18294 | } |
| 18295 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18296 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 18297 | /* Update replay counter */ |
| 18298 | pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter = |
| 18299 | pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 18300 | |
| 18301 | { |
| 18302 | /* changing from little to big endian since supplicant |
| 18303 | * works on big endian format |
| 18304 | */ |
| 18305 | int i; |
| 18306 | tANI_U8 *p = (tANI_U8 *)&pGtkOffloadGetInfoRsp->ullKeyReplayCounter; |
| 18307 | |
| 18308 | for (i = 0; i < 8; i++) |
| 18309 | { |
| 18310 | tempReplayCounter[7-i] = (tANI_U8)p[i]; |
| 18311 | } |
| 18312 | } |
| 18313 | |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18314 | /* Update replay counter to NL */ |
| 18315 | cfg80211_gtk_rekey_notify(pAdapter->dev, pGtkOffloadGetInfoRsp->bssId, |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18316 | tempReplayCounter, GFP_KERNEL); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18317 | } |
| 18318 | |
| 18319 | /* |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18320 | * FUNCTION: __wlan_hdd_cfg80211_set_rekey_data |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18321 | * This function is used to offload GTK rekeying job to the firmware. |
| 18322 | */ |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18323 | 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] | 18324 | struct cfg80211_gtk_rekey_data *data) |
| 18325 | { |
| 18326 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 18327 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 18328 | hdd_station_ctx_t *pHddStaCtx; |
| 18329 | tHalHandle hHal; |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18330 | int result; |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18331 | tSirGtkOffloadParams hddGtkOffloadReqParams; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18332 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 18333 | |
| 18334 | ENTER(); |
| 18335 | |
| 18336 | if (NULL == pAdapter) |
| 18337 | { |
Kaushik, Sushant | b1ed0f4 | 2014-07-01 18:26:31 +0530 | [diff] [blame] | 18338 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18339 | "%s: HDD adapter is Null", __func__); |
| 18340 | return -ENODEV; |
| 18341 | } |
| 18342 | |
Sushant Kaushik | 4b7cb30 | 2014-01-06 17:45:01 +0530 | [diff] [blame] | 18343 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18344 | TRACE_CODE_HDD_CFG80211_SET_REKEY_DATA, |
| 18345 | pAdapter->sessionId, pAdapter->device_mode)); |
| 18346 | |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18347 | result = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18348 | if (0 != result) |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18349 | { |
Gopichand Nakkala | f502e2b | 2013-05-24 18:34:25 +0530 | [diff] [blame] | 18350 | return result; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18351 | } |
| 18352 | |
| 18353 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 18354 | hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 18355 | if (NULL == hHal) |
| 18356 | { |
| 18357 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18358 | "%s: HAL context is Null!!!", __func__); |
| 18359 | return -EAGAIN; |
| 18360 | } |
| 18361 | |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18362 | pHddStaCtx->gtkOffloadReqParams.ulFlags = GTK_OFFLOAD_ENABLE; |
| 18363 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKCK, data->kck, NL80211_KCK_LEN); |
| 18364 | memcpy(pHddStaCtx->gtkOffloadReqParams.aKEK, data->kek, NL80211_KEK_LEN); |
| 18365 | memcpy(pHddStaCtx->gtkOffloadReqParams.bssId, &pHddStaCtx->conn_info.bssId, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18366 | WNI_CFG_BSSID_LEN); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18367 | { |
| 18368 | /* changing from big to little endian since driver |
| 18369 | * works on little endian format |
| 18370 | */ |
| 18371 | tANI_U8 *p = |
| 18372 | (tANI_U8 *)&pHddStaCtx->gtkOffloadReqParams.ullKeyReplayCounter; |
| 18373 | int i; |
| 18374 | |
| 18375 | for (i = 0; i < 8; i++) |
| 18376 | { |
| 18377 | p[7-i] = data->replay_ctr[i]; |
| 18378 | } |
| 18379 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18380 | |
| 18381 | if (TRUE == pHddCtx->hdd_wlan_suspended) |
| 18382 | { |
| 18383 | /* if wlan is suspended, enable GTK offload directly from here */ |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18384 | memcpy(&hddGtkOffloadReqParams, &pHddStaCtx->gtkOffloadReqParams, |
| 18385 | sizeof (tSirGtkOffloadParams)); |
| 18386 | status = sme_SetGTKOffload(hHal, &hddGtkOffloadReqParams, |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18387 | pAdapter->sessionId); |
| 18388 | |
| 18389 | if (eHAL_STATUS_SUCCESS != status) |
| 18390 | { |
| 18391 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18392 | "%s: sme_SetGTKOffload failed, returned %d", |
| 18393 | __func__, status); |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 18394 | |
| 18395 | /* Need to clear any trace of key value in the memory. |
| 18396 | * Thus zero out the memory even though it is local |
| 18397 | * variable. |
| 18398 | */ |
| 18399 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 18400 | sizeof(hddGtkOffloadReqParams)); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18401 | return status; |
| 18402 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18403 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18404 | "%s: sme_SetGTKOffload successfull", __func__); |
| 18405 | } |
| 18406 | else |
| 18407 | { |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18408 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18409 | "%s: wlan not suspended GTKOffload request is stored", |
| 18410 | __func__); |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18411 | } |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18412 | |
Vinay Krishna Eranna | 6f22c1f | 2014-10-13 16:03:06 +0530 | [diff] [blame] | 18413 | /* Need to clear any trace of key value in the memory. |
| 18414 | * Thus zero out the memory even though it is local |
| 18415 | * variable. |
| 18416 | */ |
| 18417 | vos_mem_zero(&hddGtkOffloadReqParams, |
| 18418 | sizeof(hddGtkOffloadReqParams)); |
| 18419 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18420 | EXIT(); |
Gopichand Nakkala | d36ee62 | 2013-05-07 14:13:27 +0530 | [diff] [blame] | 18421 | return eHAL_STATUS_SUCCESS; |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18422 | } |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 18423 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18424 | int wlan_hdd_cfg80211_set_rekey_data(struct wiphy *wiphy, struct net_device *dev, |
| 18425 | struct cfg80211_gtk_rekey_data *data) |
| 18426 | { |
| 18427 | int ret; |
| 18428 | |
| 18429 | vos_ssr_protect(__func__); |
| 18430 | ret = __wlan_hdd_cfg80211_set_rekey_data(wiphy, dev, data); |
| 18431 | vos_ssr_unprotect(__func__); |
| 18432 | |
| 18433 | return ret; |
| 18434 | } |
| 18435 | #endif /*WLAN_FEATURE_GTK_OFFLOAD*/ |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18436 | /* |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18437 | * FUNCTION: __wlan_hdd_cfg80211_set_mac_acl |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18438 | * This function is used to set access control policy |
| 18439 | */ |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18440 | static int __wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 18441 | struct net_device *dev, |
| 18442 | const struct cfg80211_acl_data *params) |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18443 | { |
| 18444 | int i; |
| 18445 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 18446 | hdd_hostapd_state_t *pHostapdState; |
| 18447 | tsap_Config_t *pConfig; |
| 18448 | v_CONTEXT_t pVosContext = NULL; |
| 18449 | hdd_context_t *pHddCtx; |
| 18450 | int status; |
| 18451 | |
| 18452 | ENTER(); |
| 18453 | |
| 18454 | if (NULL == pAdapter) |
| 18455 | { |
| 18456 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 18457 | "%s: HDD adapter is Null", __func__); |
| 18458 | return -ENODEV; |
| 18459 | } |
| 18460 | |
| 18461 | if (NULL == params) |
| 18462 | { |
| 18463 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 18464 | "%s: params is Null", __func__); |
| 18465 | return -EINVAL; |
| 18466 | } |
| 18467 | |
| 18468 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 18469 | status = wlan_hdd_validate_context(pHddCtx); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18470 | if (0 != status) |
| 18471 | { |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18472 | return status; |
| 18473 | } |
| 18474 | |
| 18475 | pVosContext = pHddCtx->pvosContext; |
| 18476 | pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter); |
| 18477 | |
| 18478 | if (NULL == pHostapdState) |
| 18479 | { |
| 18480 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 18481 | "%s: pHostapdState is Null", __func__); |
| 18482 | return -EINVAL; |
| 18483 | } |
| 18484 | |
| 18485 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"acl policy: = %d" |
| 18486 | "no acl entries = %d", params->acl_policy, params->n_acl_entries); |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 18487 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18488 | TRACE_CODE_HDD_CFG80211_SET_MAC_ACL, |
| 18489 | pAdapter->sessionId, pAdapter->device_mode)); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18490 | |
| 18491 | if (WLAN_HDD_SOFTAP == pAdapter->device_mode) |
| 18492 | { |
| 18493 | pConfig = &pAdapter->sessionCtx.ap.sapConfig; |
| 18494 | |
| 18495 | /* default value */ |
| 18496 | pConfig->num_accept_mac = 0; |
| 18497 | pConfig->num_deny_mac = 0; |
| 18498 | |
| 18499 | /** |
| 18500 | * access control policy |
| 18501 | * @NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED: Deny stations which are |
| 18502 | * listed in hostapd.deny file. |
| 18503 | * @NL80211_ACL_POLICY_DENY_UNLESS_LISTED: Allow stations which are |
| 18504 | * listed in hostapd.accept file. |
| 18505 | */ |
| 18506 | if (NL80211_ACL_POLICY_DENY_UNLESS_LISTED == params->acl_policy) |
| 18507 | { |
| 18508 | pConfig->SapMacaddr_acl = eSAP_DENY_UNLESS_ACCEPTED; |
| 18509 | } |
| 18510 | else if (NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED == params->acl_policy) |
| 18511 | { |
| 18512 | pConfig->SapMacaddr_acl = eSAP_ACCEPT_UNLESS_DENIED; |
| 18513 | } |
| 18514 | else |
| 18515 | { |
| 18516 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18517 | "%s:Acl Policy : %d is not supported", |
| 18518 | __func__, params->acl_policy); |
| 18519 | return -ENOTSUPP; |
| 18520 | } |
| 18521 | |
| 18522 | if (eSAP_DENY_UNLESS_ACCEPTED == pConfig->SapMacaddr_acl) |
| 18523 | { |
| 18524 | pConfig->num_accept_mac = params->n_acl_entries; |
| 18525 | for (i = 0; i < params->n_acl_entries; i++) |
| 18526 | { |
| 18527 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18528 | "** Add ACL MAC entry %i in WhiletList :" |
| 18529 | MAC_ADDRESS_STR, i, |
| 18530 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 18531 | |
| 18532 | vos_mem_copy(&pConfig->accept_mac[i], params->mac_addrs[i].addr, |
| 18533 | sizeof(qcmacaddr)); |
| 18534 | } |
| 18535 | } |
| 18536 | else if (eSAP_ACCEPT_UNLESS_DENIED == pConfig->SapMacaddr_acl) |
| 18537 | { |
| 18538 | pConfig->num_deny_mac = params->n_acl_entries; |
| 18539 | for (i = 0; i < params->n_acl_entries; i++) |
| 18540 | { |
| 18541 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18542 | "** Add ACL MAC entry %i in BlackList :" |
| 18543 | MAC_ADDRESS_STR, i, |
| 18544 | MAC_ADDR_ARRAY(params->mac_addrs[i].addr)); |
| 18545 | |
| 18546 | vos_mem_copy(&pConfig->deny_mac[i], params->mac_addrs[i].addr, |
| 18547 | sizeof(qcmacaddr)); |
| 18548 | } |
| 18549 | } |
| 18550 | |
| 18551 | if (VOS_STATUS_SUCCESS != WLANSAP_SetMacACL(pVosContext, pConfig)) |
| 18552 | { |
| 18553 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18554 | "%s: SAP Set Mac Acl fail", __func__); |
| 18555 | return -EINVAL; |
| 18556 | } |
| 18557 | } |
| 18558 | else |
| 18559 | { |
| 18560 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Sushant Kaushik | 8bc7df2 | 2014-04-09 17:55:29 +0530 | [diff] [blame] | 18561 | "%s: Invalid device_mode = %s (%d)", |
| 18562 | __func__, hdd_device_modetoString(pAdapter->device_mode), |
| 18563 | pAdapter->device_mode); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18564 | return -EINVAL; |
| 18565 | } |
| 18566 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18567 | EXIT(); |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 18568 | return 0; |
| 18569 | } |
| 18570 | |
Mahesh A Saptasagar | d68eb28 | 2014-12-17 14:20:19 +0530 | [diff] [blame] | 18571 | static int wlan_hdd_cfg80211_set_mac_acl(struct wiphy *wiphy, |
| 18572 | struct net_device *dev, |
| 18573 | const struct cfg80211_acl_data *params) |
| 18574 | { |
| 18575 | int ret; |
| 18576 | vos_ssr_protect(__func__); |
| 18577 | ret = __wlan_hdd_cfg80211_set_mac_acl(wiphy, dev, params); |
| 18578 | vos_ssr_unprotect(__func__); |
| 18579 | |
| 18580 | return ret; |
| 18581 | } |
| 18582 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18583 | #ifdef WLAN_NL80211_TESTMODE |
| 18584 | #ifdef FEATURE_WLAN_LPHB |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18585 | void wlan_hdd_cfg80211_lphb_ind_handler |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18586 | ( |
| 18587 | void *pAdapter, |
| 18588 | void *indCont |
| 18589 | ) |
| 18590 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18591 | tSirLPHBInd *lphbInd; |
| 18592 | struct sk_buff *skb; |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 18593 | hdd_context_t *pHddCtxt; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18594 | |
| 18595 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18596 | "LPHB indication arrived"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18597 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 18598 | if (pAdapter == NULL) |
| 18599 | { |
| 18600 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18601 | "%s: pAdapter is NULL\n",__func__); |
| 18602 | return; |
| 18603 | } |
| 18604 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18605 | if (NULL == indCont) |
| 18606 | { |
| 18607 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18608 | "LPHB IND, invalid argument"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18609 | return; |
| 18610 | } |
| 18611 | |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 18612 | pHddCtxt = (hdd_context_t *)pAdapter; |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18613 | lphbInd = (tSirLPHBInd *)indCont; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18614 | skb = cfg80211_testmode_alloc_event_skb( |
c_hpothu | 73f35e6 | 2014-04-18 13:40:08 +0530 | [diff] [blame] | 18615 | pHddCtxt->wiphy, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18616 | sizeof(tSirLPHBInd), |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18617 | GFP_ATOMIC); |
| 18618 | if (!skb) |
| 18619 | { |
| 18620 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18621 | "LPHB timeout, NL buffer alloc fail"); |
| 18622 | return; |
| 18623 | } |
| 18624 | |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 18625 | 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] | 18626 | { |
| 18627 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18628 | "WLAN_HDD_TM_ATTR_CMD put fail"); |
| 18629 | goto nla_put_failure; |
| 18630 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 18631 | if(nla_put_u32(skb, WLAN_HDD_TM_ATTR_TYPE, lphbInd->protocolType)) |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18632 | { |
| 18633 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18634 | "WLAN_HDD_TM_ATTR_TYPE put fail"); |
| 18635 | goto nla_put_failure; |
| 18636 | } |
Leo Chang | ac3ba77 | 2013-10-07 09:47:04 -0700 | [diff] [blame] | 18637 | if(nla_put(skb, WLAN_HDD_TM_ATTR_DATA, |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18638 | sizeof(tSirLPHBInd), lphbInd)) |
| 18639 | { |
| 18640 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18641 | "WLAN_HDD_TM_ATTR_DATA put fail"); |
| 18642 | goto nla_put_failure; |
| 18643 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18644 | cfg80211_testmode_event(skb, GFP_ATOMIC); |
| 18645 | return; |
| 18646 | |
| 18647 | nla_put_failure: |
| 18648 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18649 | "NLA Put fail"); |
| 18650 | kfree_skb(skb); |
| 18651 | |
| 18652 | return; |
| 18653 | } |
| 18654 | #endif /* FEATURE_WLAN_LPHB */ |
| 18655 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18656 | 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] | 18657 | { |
| 18658 | struct nlattr *tb[WLAN_HDD_TM_ATTR_MAX + 1]; |
| 18659 | int err = 0; |
| 18660 | #ifdef FEATURE_WLAN_LPHB |
| 18661 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18662 | eHalStatus smeStatus; |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18663 | |
| 18664 | ENTER(); |
| 18665 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 18666 | err = wlan_hdd_validate_context(pHddCtx); |
| 18667 | if (0 != err) |
| 18668 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 18669 | return err; |
| 18670 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18671 | #endif /* FEATURE_WLAN_LPHB */ |
| 18672 | |
| 18673 | err = nla_parse(tb, WLAN_HDD_TM_ATTR_MAX, data, len, wlan_hdd_tm_policy); |
| 18674 | if (err) |
| 18675 | { |
| 18676 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18677 | "%s Testmode INV ATTR", __func__); |
| 18678 | return err; |
| 18679 | } |
| 18680 | |
| 18681 | if (!tb[WLAN_HDD_TM_ATTR_CMD]) |
| 18682 | { |
| 18683 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18684 | "%s Testmode INV CMD", __func__); |
| 18685 | return -EINVAL; |
| 18686 | } |
| 18687 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 18688 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18689 | TRACE_CODE_HDD_CFG80211_TESTMODE, |
| 18690 | NO_SESSION, nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD]))); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18691 | switch (nla_get_u32(tb[WLAN_HDD_TM_ATTR_CMD])) |
| 18692 | { |
| 18693 | #ifdef FEATURE_WLAN_LPHB |
| 18694 | /* Low Power Heartbeat configuration request */ |
| 18695 | case WLAN_HDD_TM_CMD_WLAN_HB: |
| 18696 | { |
| 18697 | int buf_len; |
| 18698 | void *buf; |
| 18699 | tSirLPHBReq *hb_params = NULL; |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 18700 | tSirLPHBReq *hb_params_temp = NULL; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18701 | |
| 18702 | if (!tb[WLAN_HDD_TM_ATTR_DATA]) |
| 18703 | { |
| 18704 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18705 | "%s Testmode INV DATA", __func__); |
| 18706 | return -EINVAL; |
| 18707 | } |
| 18708 | |
| 18709 | buf = nla_data(tb[WLAN_HDD_TM_ATTR_DATA]); |
| 18710 | buf_len = nla_len(tb[WLAN_HDD_TM_ATTR_DATA]); |
Amar Singhal | 0585270 | 2014-02-04 14:40:00 -0800 | [diff] [blame] | 18711 | |
| 18712 | hb_params_temp =(tSirLPHBReq *)buf; |
| 18713 | if ((hb_params_temp->cmd == LPHB_SET_TCP_PARAMS_INDID) && |
| 18714 | (hb_params_temp->params.lphbTcpParamReq.timePeriodSec == 0)) |
| 18715 | return -EINVAL; |
| 18716 | |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18717 | hb_params = (tSirLPHBReq *)vos_mem_malloc(sizeof(tSirLPHBReq)); |
| 18718 | if (NULL == hb_params) |
| 18719 | { |
| 18720 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18721 | "%s Request Buffer Alloc Fail", __func__); |
| 18722 | return -EINVAL; |
| 18723 | } |
| 18724 | |
| 18725 | vos_mem_copy(hb_params, buf, buf_len); |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18726 | smeStatus = sme_LPHBConfigReq((tHalHandle)(pHddCtx->hHal), |
| 18727 | hb_params, |
| 18728 | wlan_hdd_cfg80211_lphb_ind_handler); |
| 18729 | if (eHAL_STATUS_SUCCESS != smeStatus) |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18730 | { |
Leo Chang | d9df8aa | 2013-09-26 13:32:26 -0700 | [diff] [blame] | 18731 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18732 | "LPHB Config Fail, disable"); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18733 | vos_mem_free(hb_params); |
| 18734 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18735 | return 0; |
| 18736 | } |
| 18737 | #endif /* FEATURE_WLAN_LPHB */ |
| 18738 | default: |
c_hpothu | 6ff1c3c | 2013-10-01 19:01:57 +0530 | [diff] [blame] | 18739 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
| 18740 | "%s: unsupported event",__func__); |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18741 | return -EOPNOTSUPP; |
| 18742 | } |
| 18743 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18744 | EXIT(); |
| 18745 | return err; |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18746 | } |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18747 | |
Anand N Sunkad | e9adb1b | 2015-07-29 09:56:45 +0530 | [diff] [blame] | 18748 | static int wlan_hdd_cfg80211_testmode(struct wiphy *wiphy, |
| 18749 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)) |
| 18750 | struct wireless_dev *wdev, |
| 18751 | #endif |
| 18752 | void *data, int len) |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18753 | { |
| 18754 | int ret; |
| 18755 | |
| 18756 | vos_ssr_protect(__func__); |
| 18757 | ret = __wlan_hdd_cfg80211_testmode(wiphy, data, len); |
| 18758 | vos_ssr_unprotect(__func__); |
| 18759 | |
| 18760 | return ret; |
| 18761 | } |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 18762 | #endif /* CONFIG_NL80211_TESTMODE */ |
| 18763 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18764 | static int __wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 18765 | struct net_device *dev, |
| 18766 | int idx, struct survey_info *survey) |
| 18767 | { |
| 18768 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 18769 | hdd_context_t *pHddCtx; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 18770 | hdd_station_ctx_t *pHddStaCtx; |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 18771 | tHalHandle halHandle; |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 18772 | v_U32_t channel = 0, freq = 0; /* Initialization Required */ |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 18773 | v_S7_t snr,rssi; |
| 18774 | int status, i, j, filled = 0; |
| 18775 | |
| 18776 | ENTER(); |
| 18777 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 18778 | if (NULL == pAdapter) |
| 18779 | { |
| 18780 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 18781 | "%s: HDD adapter is Null", __func__); |
| 18782 | return -ENODEV; |
| 18783 | } |
| 18784 | |
| 18785 | if (NULL == wiphy) |
| 18786 | { |
| 18787 | VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, |
| 18788 | "%s: wiphy is Null", __func__); |
| 18789 | return -ENODEV; |
| 18790 | } |
| 18791 | |
| 18792 | pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 18793 | status = wlan_hdd_validate_context(pHddCtx); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 18794 | if (0 != status) |
| 18795 | { |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 18796 | return status; |
| 18797 | } |
| 18798 | |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 18799 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 18800 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 18801 | if (0 == pHddCtx->cfg_ini->fEnableSNRMonitoring || |
Mihir Shete | d9072e0 | 2013-08-21 17:02:29 +0530 | [diff] [blame] | 18802 | 0 != pAdapter->survey_idx || |
| 18803 | eConnectionState_Associated != pHddStaCtx->conn_info.connState) |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 18804 | { |
| 18805 | /* The survey dump ops when implemented completely is expected to |
| 18806 | * return a survey of all channels and the ops is called by the |
| 18807 | * kernel with incremental values of the argument 'idx' till it |
| 18808 | * returns -ENONET. But we can only support the survey for the |
| 18809 | * operating channel for now. survey_idx is used to track |
| 18810 | * that the ops is called only once and then return -ENONET for |
| 18811 | * the next iteration |
| 18812 | */ |
| 18813 | pAdapter->survey_idx = 0; |
| 18814 | return -ENONET; |
| 18815 | } |
| 18816 | |
Mukul Sharma | 9d5233b | 2015-06-11 20:28:20 +0530 | [diff] [blame] | 18817 | if (VOS_TRUE == pHddStaCtx->hdd_ReassocScenario) |
| 18818 | { |
| 18819 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18820 | "%s: Roaming in progress, hence return ", __func__); |
| 18821 | return -ENONET; |
| 18822 | } |
| 18823 | |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 18824 | halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
| 18825 | |
| 18826 | wlan_hdd_get_snr(pAdapter, &snr); |
| 18827 | wlan_hdd_get_rssi(pAdapter, &rssi); |
| 18828 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 18829 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18830 | TRACE_CODE_HDD_CFG80211_DUMP_SURVEY, |
| 18831 | pAdapter->sessionId, pAdapter->device_mode)); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 18832 | sme_GetOperationChannel(halHandle, &channel, pAdapter->sessionId); |
| 18833 | hdd_wlan_get_freq(channel, &freq); |
| 18834 | |
| 18835 | |
| 18836 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 18837 | { |
| 18838 | if (NULL == wiphy->bands[i]) |
| 18839 | { |
| 18840 | VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, |
| 18841 | "%s: wiphy->bands[i] is NULL, i = %d", __func__, i); |
| 18842 | continue; |
| 18843 | } |
| 18844 | |
| 18845 | for (j = 0; j < wiphy->bands[i]->n_channels; j++) |
| 18846 | { |
| 18847 | struct ieee80211_supported_band *band = wiphy->bands[i]; |
| 18848 | |
| 18849 | if (band->channels[j].center_freq == (v_U16_t)freq) |
| 18850 | { |
| 18851 | survey->channel = &band->channels[j]; |
| 18852 | /* The Rx BDs contain SNR values in dB for the received frames |
| 18853 | * while the supplicant expects noise. So we calculate and |
| 18854 | * return the value of noise (dBm) |
| 18855 | * SNR (dB) = RSSI (dBm) - NOISE (dBm) |
| 18856 | */ |
| 18857 | survey->noise = rssi - snr; |
| 18858 | survey->filled = SURVEY_INFO_NOISE_DBM; |
| 18859 | filled = 1; |
| 18860 | } |
| 18861 | } |
| 18862 | } |
| 18863 | |
| 18864 | if (filled) |
| 18865 | pAdapter->survey_idx = 1; |
| 18866 | else |
| 18867 | { |
| 18868 | pAdapter->survey_idx = 0; |
| 18869 | return -ENONET; |
| 18870 | } |
| 18871 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18872 | EXIT(); |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 18873 | return 0; |
| 18874 | } |
| 18875 | |
Mahesh A Saptasagar | 2757407 | 2014-06-17 13:39:04 +0530 | [diff] [blame] | 18876 | static int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy, |
| 18877 | struct net_device *dev, |
| 18878 | int idx, struct survey_info *survey) |
| 18879 | { |
| 18880 | int ret; |
| 18881 | |
| 18882 | vos_ssr_protect(__func__); |
| 18883 | ret = __wlan_hdd_cfg80211_dump_survey(wiphy, dev, idx, survey); |
| 18884 | vos_ssr_unprotect(__func__); |
| 18885 | |
| 18886 | return ret; |
| 18887 | } |
| 18888 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18889 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 18890 | * FUNCTION: __wlan_hdd_cfg80211_resume_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18891 | * this is called when cfg80211 driver resume |
| 18892 | * driver updates latest sched_scan scan result(if any) to cfg80211 database |
| 18893 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 18894 | int __wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18895 | { |
| 18896 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
| 18897 | hdd_adapter_t *pAdapter; |
| 18898 | hdd_adapter_list_node_t *pAdapterNode, *pNext; |
| 18899 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 18900 | |
| 18901 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18902 | |
Mahesh A Saptasagar | 7408839 | 2015-02-05 17:22:09 +0530 | [diff] [blame] | 18903 | if (0 != wlan_hdd_validate_context(pHddCtx)) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18904 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18905 | return 0; |
| 18906 | } |
| 18907 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 18908 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_RESUME_WLAN, |
| 18909 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18910 | spin_lock(&pHddCtx->schedScan_lock); |
| 18911 | pHddCtx->isWiphySuspended = FALSE; |
| 18912 | if (TRUE != pHddCtx->isSchedScanUpdatePending) |
| 18913 | { |
| 18914 | spin_unlock(&pHddCtx->schedScan_lock); |
| 18915 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18916 | "%s: Return resume is not due to PNO indication", __func__); |
| 18917 | return 0; |
| 18918 | } |
| 18919 | // Reset flag to avoid updatating cfg80211 data old results again |
| 18920 | pHddCtx->isSchedScanUpdatePending = FALSE; |
| 18921 | spin_unlock(&pHddCtx->schedScan_lock); |
| 18922 | |
| 18923 | status = hdd_get_front_adapter ( pHddCtx, &pAdapterNode ); |
| 18924 | |
| 18925 | while ( NULL != pAdapterNode && VOS_STATUS_SUCCESS == status ) |
| 18926 | { |
| 18927 | pAdapter = pAdapterNode->pAdapter; |
| 18928 | if ( (NULL != pAdapter) && |
| 18929 | (WLAN_HDD_INFRA_STATION == pAdapter->device_mode) ) |
| 18930 | { |
| 18931 | if (0 != wlan_hdd_cfg80211_update_bss(pHddCtx->wiphy, pAdapter)) |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 18932 | { |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18933 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_WARN, |
| 18934 | "%s: NO SCAN result", __func__); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 18935 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18936 | else |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 18937 | { |
| 18938 | /* Acquire wakelock to handle the case where APP's tries to |
| 18939 | * suspend immediately after updating the scan results. Whis |
| 18940 | * results in app's is in suspended state and not able to |
| 18941 | * process the connect request to AP |
| 18942 | */ |
Sushant Kaushik | 83392fa | 2015-05-05 17:44:40 +0530 | [diff] [blame] | 18943 | hdd_prevent_suspend_timeout(2000, |
| 18944 | WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18945 | cfg80211_sched_scan_results(pHddCtx->wiphy); |
Mahesh A Saptasagar | b9c5040 | 2014-01-16 15:49:22 +0530 | [diff] [blame] | 18946 | } |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18947 | |
| 18948 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18949 | "%s : cfg80211 scan result database updated", __func__); |
| 18950 | |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18951 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18952 | return 0; |
| 18953 | |
| 18954 | } |
| 18955 | status = hdd_get_next_adapter ( pHddCtx, pAdapterNode, &pNext ); |
| 18956 | pAdapterNode = pNext; |
| 18957 | } |
| 18958 | |
| 18959 | VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, |
| 18960 | "%s: Failed to find Adapter", __func__); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18961 | EXIT(); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18962 | return 0; |
| 18963 | } |
| 18964 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 18965 | int wlan_hdd_cfg80211_resume_wlan(struct wiphy *wiphy) |
| 18966 | { |
| 18967 | int ret; |
| 18968 | |
| 18969 | vos_ssr_protect(__func__); |
| 18970 | ret = __wlan_hdd_cfg80211_resume_wlan(wiphy); |
| 18971 | vos_ssr_unprotect(__func__); |
| 18972 | |
| 18973 | return ret; |
| 18974 | } |
| 18975 | |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18976 | /* |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 18977 | * FUNCTION: __wlan_hdd_cfg80211_suspend_wlan |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18978 | * this is called when cfg80211 driver suspends |
| 18979 | */ |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 18980 | int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18981 | struct cfg80211_wowlan *wow) |
| 18982 | { |
| 18983 | hdd_context_t *pHddCtx = wiphy_priv(wiphy); |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 18984 | int ret = 0; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18985 | |
| 18986 | ENTER(); |
Hanumantha Reddy Pothula | 7dc0e6c | 2015-03-06 15:11:16 +0530 | [diff] [blame] | 18987 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 18988 | ret = wlan_hdd_validate_context(pHddCtx); |
| 18989 | if (0 != ret) |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18990 | { |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 18991 | return ret; |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18992 | } |
| 18993 | |
Masti, Narayanraddi | c80e2bf | 2015-01-27 16:39:00 +0530 | [diff] [blame] | 18994 | |
Konamki, Sreelakshmi | 7b464be | 2015-07-14 12:17:01 +0530 | [diff] [blame] | 18995 | MTRACE(vos_trace(VOS_MODULE_ID_HDD, |
| 18996 | TRACE_CODE_HDD_CFG80211_SUSPEND_WLAN, |
| 18997 | NO_SESSION, pHddCtx->isWiphySuspended)); |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 18998 | pHddCtx->isWiphySuspended = TRUE; |
| 18999 | |
| 19000 | EXIT(); |
| 19001 | |
| 19002 | return 0; |
| 19003 | } |
| 19004 | |
Mahesh A Saptasagar | bcc5b66 | 2014-06-02 21:46:23 +0530 | [diff] [blame] | 19005 | int wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, |
| 19006 | struct cfg80211_wowlan *wow) |
| 19007 | { |
| 19008 | int ret; |
| 19009 | |
| 19010 | vos_ssr_protect(__func__); |
| 19011 | ret = __wlan_hdd_cfg80211_suspend_wlan(wiphy, wow); |
| 19012 | vos_ssr_unprotect(__func__); |
| 19013 | |
| 19014 | return ret; |
| 19015 | } |
Padma, Santhosh Kumar | 2ccac21 | 2015-10-20 17:27:27 +0530 | [diff] [blame] | 19016 | |
| 19017 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 19018 | static void wlan_hdd_cfg80211_oem_data_rsp_ind_new(void *ctx, |
| 19019 | void *pMsg) |
| 19020 | { |
| 19021 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 19022 | |
| 19023 | ENTER(); |
| 19024 | |
| 19025 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 19026 | return; |
| 19027 | } |
| 19028 | if (!pMsg) |
| 19029 | { |
| 19030 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("pMsg is null")); |
| 19031 | return; |
| 19032 | } |
| 19033 | |
| 19034 | send_oem_data_rsp_msg(sizeof(tOemDataRspNew), pMsg); |
| 19035 | |
| 19036 | EXIT(); |
| 19037 | return; |
| 19038 | |
| 19039 | } |
| 19040 | |
| 19041 | void wlan_hdd_cfg80211_oemdata_callback(void *ctx, const tANI_U16 evType, |
| 19042 | void *pMsg) |
| 19043 | { |
| 19044 | hdd_context_t *pHddCtx = (hdd_context_t *)ctx; |
| 19045 | |
| 19046 | ENTER(); |
| 19047 | |
| 19048 | if (wlan_hdd_validate_context(pHddCtx)) { |
| 19049 | return; |
| 19050 | } |
| 19051 | |
| 19052 | hddLog(VOS_TRACE_LEVEL_INFO, FL("Rcvd Event (%d)"), evType); |
| 19053 | |
| 19054 | switch(evType) { |
| 19055 | case SIR_HAL_START_OEM_DATA_RSP_IND_NEW: |
| 19056 | wlan_hdd_cfg80211_oem_data_rsp_ind_new(ctx, pMsg); |
| 19057 | break; |
| 19058 | default: |
| 19059 | hddLog(VOS_TRACE_LEVEL_ERROR, FL("invalid event type %d "), evType); |
| 19060 | break; |
| 19061 | } |
| 19062 | EXIT(); |
| 19063 | } |
| 19064 | #endif |
| 19065 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19066 | /* cfg80211_ops */ |
Gopichand Nakkala | 747461f | 2013-04-24 19:24:45 +0530 | [diff] [blame] | 19067 | static struct cfg80211_ops wlan_hdd_cfg80211_ops = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19068 | { |
| 19069 | .add_virtual_intf = wlan_hdd_add_virtual_intf, |
| 19070 | .del_virtual_intf = wlan_hdd_del_virtual_intf, |
| 19071 | .change_virtual_intf = wlan_hdd_cfg80211_change_iface, |
| 19072 | .change_station = wlan_hdd_change_station, |
| 19073 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) |
| 19074 | .add_beacon = wlan_hdd_cfg80211_add_beacon, |
| 19075 | .del_beacon = wlan_hdd_cfg80211_del_beacon, |
| 19076 | .set_beacon = wlan_hdd_cfg80211_set_beacon, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19077 | #else |
| 19078 | .start_ap = wlan_hdd_cfg80211_start_ap, |
| 19079 | .change_beacon = wlan_hdd_cfg80211_change_beacon, |
| 19080 | .stop_ap = wlan_hdd_cfg80211_stop_ap, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19081 | #endif |
| 19082 | .change_bss = wlan_hdd_cfg80211_change_bss, |
| 19083 | .add_key = wlan_hdd_cfg80211_add_key, |
| 19084 | .get_key = wlan_hdd_cfg80211_get_key, |
| 19085 | .del_key = wlan_hdd_cfg80211_del_key, |
| 19086 | .set_default_key = wlan_hdd_cfg80211_set_default_key, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 19087 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19088 | .set_channel = wlan_hdd_cfg80211_set_channel, |
Jeff Johnson | 3bbe4bf | 2013-01-18 17:05:29 -0800 | [diff] [blame] | 19089 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19090 | .scan = wlan_hdd_cfg80211_scan, |
| 19091 | .connect = wlan_hdd_cfg80211_connect, |
| 19092 | .disconnect = wlan_hdd_cfg80211_disconnect, |
| 19093 | .join_ibss = wlan_hdd_cfg80211_join_ibss, |
| 19094 | .leave_ibss = wlan_hdd_cfg80211_leave_ibss, |
| 19095 | .set_wiphy_params = wlan_hdd_cfg80211_set_wiphy_params, |
| 19096 | .set_tx_power = wlan_hdd_cfg80211_set_txpower, |
| 19097 | .get_tx_power = wlan_hdd_cfg80211_get_txpower, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19098 | .remain_on_channel = wlan_hdd_cfg80211_remain_on_channel, |
| 19099 | .cancel_remain_on_channel = wlan_hdd_cfg80211_cancel_remain_on_channel, |
DARAM SUDHA | 39eede6 | 2014-02-12 11:16:40 +0530 | [diff] [blame] | 19100 | .mgmt_tx = wlan_hdd_mgmt_tx, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19101 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) |
| 19102 | .mgmt_tx_cancel_wait = wlan_hdd_cfg80211_mgmt_tx_cancel_wait, |
| 19103 | .set_default_mgmt_key = wlan_hdd_set_default_mgmt_key, |
| 19104 | .set_txq_params = wlan_hdd_set_txq_params, |
| 19105 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19106 | .get_station = wlan_hdd_cfg80211_get_station, |
| 19107 | .set_power_mgmt = wlan_hdd_cfg80211_set_power_mgmt, |
| 19108 | .del_station = wlan_hdd_cfg80211_del_station, |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 19109 | .add_station = wlan_hdd_cfg80211_add_station, |
| 19110 | #ifdef FEATURE_WLAN_LFR |
| 19111 | .set_pmksa = wlan_hdd_cfg80211_set_pmksa, |
| 19112 | .del_pmksa = wlan_hdd_cfg80211_del_pmksa, |
| 19113 | .flush_pmksa = wlan_hdd_cfg80211_flush_pmksa, |
| 19114 | #endif |
Madan Mohan Koyyalamudi | ea77388 | 2012-11-02 13:37:21 -0700 | [diff] [blame] | 19115 | #if defined(WLAN_FEATURE_VOWIFI_11R) && defined(KERNEL_SUPPORT_11R_CFG80211) |
| 19116 | .update_ft_ies = wlan_hdd_cfg80211_update_ft_ies, |
| 19117 | #endif |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 19118 | #ifdef FEATURE_WLAN_TDLS |
| 19119 | .tdls_mgmt = wlan_hdd_cfg80211_tdls_mgmt, |
| 19120 | .tdls_oper = wlan_hdd_cfg80211_tdls_oper, |
| 19121 | #endif |
Gopichand Nakkala | 870cbae | 2013-03-15 21:16:09 +0530 | [diff] [blame] | 19122 | #ifdef WLAN_FEATURE_GTK_OFFLOAD |
| 19123 | .set_rekey_data = wlan_hdd_cfg80211_set_rekey_data, |
| 19124 | #endif /* WLAN_FEATURE_GTK_OFFLOAD */ |
Gopichand Nakkala | 8e93fde | 2013-05-10 17:40:12 +0530 | [diff] [blame] | 19125 | #ifdef FEATURE_WLAN_SCAN_PNO |
| 19126 | .sched_scan_start = wlan_hdd_cfg80211_sched_scan_start, |
| 19127 | .sched_scan_stop = wlan_hdd_cfg80211_sched_scan_stop, |
| 19128 | #endif /*FEATURE_WLAN_SCAN_PNO */ |
Kamath Vinayak | 4000c9a | 2013-08-23 14:24:27 +0530 | [diff] [blame] | 19129 | .resume = wlan_hdd_cfg80211_resume_wlan, |
| 19130 | .suspend = wlan_hdd_cfg80211_suspend_wlan, |
Gopichand Nakkala | c005b7c | 2013-05-14 16:04:14 +0530 | [diff] [blame] | 19131 | .set_mac_acl = wlan_hdd_cfg80211_set_mac_acl, |
Leo Chang | 9056f46 | 2013-08-01 19:21:11 -0700 | [diff] [blame] | 19132 | #ifdef WLAN_NL80211_TESTMODE |
| 19133 | .testmode_cmd = wlan_hdd_cfg80211_testmode, |
| 19134 | #endif |
Madan Mohan Koyyalamudi | d9383fd | 2013-08-13 09:27:30 +0530 | [diff] [blame] | 19135 | .dump_survey = wlan_hdd_cfg80211_dump_survey, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 19136 | }; |
| 19137 | |