| .. | .. |
|---|
| 1 | | -/* SPDX-License-Identifier: GPL-2.0 */ |
|---|
| 2 | 1 | /* |
|---|
| 3 | 2 | * Linux cfgp2p driver |
|---|
| 4 | 3 | * |
|---|
| 5 | | - * Copyright (C) 1999-2019, Broadcom Corporation |
|---|
| 6 | | - * |
|---|
| 4 | + * Portions of this code are copyright (c) 2022 Cypress Semiconductor Corporation |
|---|
| 5 | + * |
|---|
| 6 | + * Copyright (C) 1999-2017, Broadcom Corporation |
|---|
| 7 | + * |
|---|
| 7 | 8 | * Unless you and Broadcom execute a separate written software license |
|---|
| 8 | 9 | * agreement governing use of this software, this software is licensed to you |
|---|
| 9 | 10 | * under the terms of the GNU General Public License version 2 (the "GPL"), |
|---|
| 10 | 11 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the |
|---|
| 11 | 12 | * following added to such license: |
|---|
| 12 | | - * |
|---|
| 13 | + * |
|---|
| 13 | 14 | * As a special exception, the copyright holders of this software give you |
|---|
| 14 | 15 | * permission to link this software with independent modules, and to copy and |
|---|
| 15 | 16 | * distribute the resulting executable under terms of your choice, provided that |
|---|
| .. | .. |
|---|
| 17 | 18 | * the license of that module. An independent module is a module which is not |
|---|
| 18 | 19 | * derived from this software. The special exception does not apply to any |
|---|
| 19 | 20 | * modifications of the software. |
|---|
| 20 | | - * |
|---|
| 21 | + * |
|---|
| 21 | 22 | * Notwithstanding the above, under no circumstances may you combine this |
|---|
| 22 | 23 | * software in any way with any other Broadcom software provided under a license |
|---|
| 23 | 24 | * other than the GPL, without Broadcom's express prior written consent. |
|---|
| .. | .. |
|---|
| 25 | 26 | * |
|---|
| 26 | 27 | * <<Broadcom-WL-IPTag/Open:>> |
|---|
| 27 | 28 | * |
|---|
| 28 | | - * $Id: wl_cfgp2p.h 709309 2019-01-17 09:04:00Z $ |
|---|
| 29 | + * $Id: wl_cfgp2p.h 794110 2018-12-12 05:03:21Z $ |
|---|
| 29 | 30 | */ |
|---|
| 30 | 31 | #ifndef _wl_cfgp2p_h_ |
|---|
| 31 | 32 | #define _wl_cfgp2p_h_ |
|---|
| 32 | | -#include <proto/802.11.h> |
|---|
| 33 | | -#include <proto/p2p.h> |
|---|
| 33 | +#include <802.11.h> |
|---|
| 34 | +#include <p2p.h> |
|---|
| 34 | 35 | |
|---|
| 35 | 36 | struct bcm_cfg80211; |
|---|
| 36 | 37 | extern u32 wl_dbg_level; |
|---|
| .. | .. |
|---|
| 41 | 42 | * saved_ie[] array of structures which in turn contains a bsscfg index field. |
|---|
| 42 | 43 | */ |
|---|
| 43 | 44 | typedef enum { |
|---|
| 44 | | - P2PAPI_BSSCFG_PRIMARY, /* maps to driver's primary bsscfg */ |
|---|
| 45 | | - P2PAPI_BSSCFG_DEVICE, /* maps to driver's P2P device discovery bsscfg */ |
|---|
| 46 | | - P2PAPI_BSSCFG_CONNECTION1, /* maps to driver's P2P connection bsscfg */ |
|---|
| 45 | + P2PAPI_BSSCFG_PRIMARY, /**< maps to driver's primary bsscfg */ |
|---|
| 46 | + P2PAPI_BSSCFG_DEVICE, /**< maps to driver's P2P device discovery bsscfg */ |
|---|
| 47 | + P2PAPI_BSSCFG_CONNECTION1, /**< maps to driver's P2P connection bsscfg */ |
|---|
| 47 | 48 | P2PAPI_BSSCFG_CONNECTION2, |
|---|
| 48 | 49 | P2PAPI_BSSCFG_MAX |
|---|
| 49 | 50 | } p2p_bsscfg_type_t; |
|---|
| 50 | 51 | |
|---|
| 51 | 52 | typedef enum { |
|---|
| 52 | 53 | P2P_SCAN_PURPOSE_MIN, |
|---|
| 53 | | - P2P_SCAN_SOCIAL_CHANNEL, /* scan for social channel */ |
|---|
| 54 | | - P2P_SCAN_AFX_PEER_NORMAL, /* scan for action frame search */ |
|---|
| 55 | | - P2P_SCAN_AFX_PEER_REDUCED, /* scan for action frame search with short time */ |
|---|
| 56 | | - P2P_SCAN_DURING_CONNECTED, /* scan during connected status */ |
|---|
| 57 | | - P2P_SCAN_CONNECT_TRY, /* scan for connecting */ |
|---|
| 58 | | - P2P_SCAN_NORMAL, /* scan during not-connected status */ |
|---|
| 54 | + P2P_SCAN_SOCIAL_CHANNEL, /**< scan for social channel */ |
|---|
| 55 | + P2P_SCAN_AFX_PEER_NORMAL, /**< scan for action frame search */ |
|---|
| 56 | + P2P_SCAN_AFX_PEER_REDUCED, /**< scan for action frame search with short time */ |
|---|
| 57 | + P2P_SCAN_DURING_CONNECTED, /**< scan during connected status */ |
|---|
| 58 | + P2P_SCAN_CONNECT_TRY, /**< scan for connecting */ |
|---|
| 59 | + P2P_SCAN_NORMAL, /**< scan during not-connected status */ |
|---|
| 59 | 60 | P2P_SCAN_PURPOSE_MAX |
|---|
| 60 | 61 | } p2p_scan_purpose_t; |
|---|
| 61 | 62 | |
|---|
| 62 | | -/* vendor ies max buffer length for probe response or beacon */ |
|---|
| 63 | +/** vendor ies max buffer length for probe response or beacon */ |
|---|
| 63 | 64 | #define VNDR_IES_MAX_BUF_LEN 1400 |
|---|
| 64 | | -/* normal vendor ies buffer length */ |
|---|
| 65 | +/** normal vendor ies buffer length */ |
|---|
| 65 | 66 | #define VNDR_IES_BUF_LEN 512 |
|---|
| 66 | 67 | |
|---|
| 67 | 68 | struct p2p_bss { |
|---|
| .. | .. |
|---|
| 72 | 73 | }; |
|---|
| 73 | 74 | |
|---|
| 74 | 75 | struct p2p_info { |
|---|
| 75 | | - bool on; /* p2p on/off switch */ |
|---|
| 76 | + bool on; /**< p2p on/off switch */ |
|---|
| 76 | 77 | bool scan; |
|---|
| 77 | 78 | int16 search_state; |
|---|
| 78 | 79 | s8 vir_ifname[IFNAMSIZ]; |
|---|
| 79 | 80 | unsigned long status; |
|---|
| 80 | 81 | struct p2p_bss bss[P2PAPI_BSSCFG_MAX]; |
|---|
| 81 | | - struct timer_list listen_timer; |
|---|
| 82 | + timer_list_compat_t listen_timer; |
|---|
| 82 | 83 | wl_p2p_sched_t noa; |
|---|
| 83 | 84 | wl_p2p_ops_t ops; |
|---|
| 84 | 85 | wlc_ssid_t ssid; |
|---|
| 85 | 86 | s8 p2p_go_count; |
|---|
| 86 | | - struct bcm_cfg80211 *cfg; |
|---|
| 87 | 87 | }; |
|---|
| 88 | 88 | |
|---|
| 89 | | -#define MAX_VNDR_IE_NUMBER 5 |
|---|
| 89 | +#define MAX_VNDR_IE_NUMBER 10 |
|---|
| 90 | 90 | |
|---|
| 91 | 91 | struct parsed_vndr_ie_info { |
|---|
| 92 | | - char *ie_ptr; |
|---|
| 93 | | - u32 ie_len; /* total length including id & length field */ |
|---|
| 92 | + const char *ie_ptr; |
|---|
| 93 | + u32 ie_len; /**< total length including id & length field */ |
|---|
| 94 | 94 | vndr_ie_t vndrie; |
|---|
| 95 | 95 | }; |
|---|
| 96 | 96 | |
|---|
| .. | .. |
|---|
| 115 | 115 | WLP2P_STATUS_DISC_IN_PROGRESS |
|---|
| 116 | 116 | }; |
|---|
| 117 | 117 | |
|---|
| 118 | | - |
|---|
| 119 | 118 | #define wl_to_p2p_bss_ndev(cfg, type) ((cfg)->p2p->bss[type].dev) |
|---|
| 120 | 119 | #define wl_to_p2p_bss_bssidx(cfg, type) ((cfg)->p2p->bss[type].bssidx) |
|---|
| 121 | 120 | #define wl_to_p2p_bss_macaddr(cfg, type) &((cfg)->p2p->bss[type].mac_addr) |
|---|
| .. | .. |
|---|
| 137 | 136 | /* dword align allocation */ |
|---|
| 138 | 137 | #define WLC_IOCTL_MAXLEN 8192 |
|---|
| 139 | 138 | |
|---|
| 139 | +#ifdef CUSTOMER_HW4_DEBUG |
|---|
| 140 | +#define CFGP2P_ERROR_TEXT "CFGP2P-INFO2) " |
|---|
| 141 | +#else |
|---|
| 140 | 142 | #define CFGP2P_ERROR_TEXT "CFGP2P-ERROR) " |
|---|
| 143 | +#endif /* CUSTOMER_HW4_DEBUG */ |
|---|
| 141 | 144 | |
|---|
| 142 | | - |
|---|
| 145 | +#ifdef DHD_LOG_DUMP |
|---|
| 146 | +#define CFGP2P_ERR(args) \ |
|---|
| 147 | + do { \ |
|---|
| 148 | + if (wl_dbg_level & WL_DBG_ERR) { \ |
|---|
| 149 | + printk(KERN_INFO CFGP2P_ERROR_TEXT "%s : ", __func__); \ |
|---|
| 150 | + printk args; \ |
|---|
| 151 | + DHD_LOG_DUMP_WRITE("[%s] %s: ", \ |
|---|
| 152 | + dhd_log_dump_get_timestamp(), __func__); \ |
|---|
| 153 | + DHD_LOG_DUMP_WRITE args; \ |
|---|
| 154 | + } \ |
|---|
| 155 | + } while (0) |
|---|
| 156 | +#define CFGP2P_INFO(args) \ |
|---|
| 157 | + do { \ |
|---|
| 158 | + if (wl_dbg_level & WL_DBG_INFO) { \ |
|---|
| 159 | + printk(KERN_INFO "CFGP2P-INFO) %s : ", __func__); \ |
|---|
| 160 | + printk args; \ |
|---|
| 161 | + DHD_LOG_DUMP_WRITE("[%s] %s: ", \ |
|---|
| 162 | + dhd_log_dump_get_timestamp(), __func__); \ |
|---|
| 163 | + DHD_LOG_DUMP_WRITE args; \ |
|---|
| 164 | + } \ |
|---|
| 165 | + } while (0) |
|---|
| 166 | +#define CFGP2P_ACTION(args) \ |
|---|
| 167 | + do { \ |
|---|
| 168 | + if (wl_dbg_level & WL_DBG_P2P_ACTION) { \ |
|---|
| 169 | + printk(KERN_DEBUG "CFGP2P-ACTION) %s :", __func__); \ |
|---|
| 170 | + printk args; \ |
|---|
| 171 | + DHD_LOG_DUMP_WRITE("[%s] %s: ", \ |
|---|
| 172 | + dhd_log_dump_get_timestamp(), __func__); \ |
|---|
| 173 | + DHD_LOG_DUMP_WRITE args; \ |
|---|
| 174 | + } \ |
|---|
| 175 | + } while (0) |
|---|
| 176 | +#else |
|---|
| 143 | 177 | #define CFGP2P_ERR(args) \ |
|---|
| 144 | 178 | do { \ |
|---|
| 145 | 179 | if (wl_dbg_level & WL_DBG_ERR) { \ |
|---|
| .. | .. |
|---|
| 154 | 188 | printk args; \ |
|---|
| 155 | 189 | } \ |
|---|
| 156 | 190 | } while (0) |
|---|
| 191 | +#define CFGP2P_ACTION(args) \ |
|---|
| 192 | + do { \ |
|---|
| 193 | + if (wl_dbg_level & WL_DBG_P2P_ACTION) { \ |
|---|
| 194 | + printk(KERN_DEBUG "CFGP2P-ACTION) %s :", __func__); \ |
|---|
| 195 | + printk args; \ |
|---|
| 196 | + } \ |
|---|
| 197 | + } while (0) |
|---|
| 198 | +#endif /* DHD_LOG_DUMP */ |
|---|
| 199 | + |
|---|
| 157 | 200 | #define CFGP2P_DBG(args) \ |
|---|
| 158 | 201 | do { \ |
|---|
| 159 | 202 | if (wl_dbg_level & WL_DBG_DBG) { \ |
|---|
| .. | .. |
|---|
| 162 | 205 | } \ |
|---|
| 163 | 206 | } while (0) |
|---|
| 164 | 207 | |
|---|
| 165 | | -#define CFGP2P_ACTION(args) \ |
|---|
| 166 | | - do { \ |
|---|
| 167 | | - if (wl_dbg_level & WL_DBG_P2P_ACTION) { \ |
|---|
| 168 | | - printk(KERN_DEBUG "CFGP2P-ACTION) %s :", __func__); \ |
|---|
| 169 | | - printk args; \ |
|---|
| 170 | | - } \ |
|---|
| 171 | | - } while (0) |
|---|
| 172 | | -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) |
|---|
| 173 | 208 | #define INIT_TIMER(timer, func, duration, extra_delay) \ |
|---|
| 174 | 209 | do { \ |
|---|
| 175 | | - timer_setup(timer, func, 0); \ |
|---|
| 176 | | - timer->expires = jiffies + msecs_to_jiffies(duration + extra_delay); \ |
|---|
| 210 | + init_timer_compat(timer, func, cfg); \ |
|---|
| 211 | + timer_expires(timer) = jiffies + msecs_to_jiffies(duration + extra_delay); \ |
|---|
| 177 | 212 | add_timer(timer); \ |
|---|
| 178 | 213 | } while (0); |
|---|
| 179 | | -#else |
|---|
| 180 | | -#define INIT_TIMER(timer, func, duration, extra_delay) \ |
|---|
| 181 | | - do { \ |
|---|
| 182 | | - init_timer(timer); \ |
|---|
| 183 | | - timer->function = func; \ |
|---|
| 184 | | - timer->expires = jiffies + msecs_to_jiffies(duration + extra_delay); \ |
|---|
| 185 | | - timer->data = (unsigned long) cfg; \ |
|---|
| 186 | | - add_timer(timer); \ |
|---|
| 187 | | - } while (0); |
|---|
| 188 | | -#endif |
|---|
| 189 | 214 | |
|---|
| 190 | 215 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0)) && !defined(WL_CFG80211_P2P_DEV_IF) |
|---|
| 191 | 216 | #define WL_CFG80211_P2P_DEV_IF |
|---|
| 192 | 217 | |
|---|
| 193 | 218 | #ifdef WL_ENABLE_P2P_IF |
|---|
| 194 | 219 | #undef WL_ENABLE_P2P_IF |
|---|
| 195 | | -#endif |
|---|
| 220 | +#endif // endif |
|---|
| 196 | 221 | |
|---|
| 197 | 222 | #ifdef WL_SUPPORT_BACKPORTED_KPATCHES |
|---|
| 198 | 223 | #undef WL_SUPPORT_BACKPORTED_KPATCHES |
|---|
| 199 | | -#endif |
|---|
| 224 | +#endif // endif |
|---|
| 200 | 225 | #else |
|---|
| 201 | 226 | #ifdef WLP2P |
|---|
| 202 | 227 | #ifndef WL_ENABLE_P2P_IF |
|---|
| .. | .. |
|---|
| 207 | 232 | #endif /* (LINUX_VERSION >= VERSION(3, 8, 0)) */ |
|---|
| 208 | 233 | |
|---|
| 209 | 234 | #ifndef WL_CFG80211_P2P_DEV_IF |
|---|
| 235 | +#ifdef WL_NEWCFG_PRIVCMD_SUPPORT |
|---|
| 236 | +#undef WL_NEWCFG_PRIVCMD_SUPPORT |
|---|
| 237 | +#endif // endif |
|---|
| 210 | 238 | #endif /* WL_CFG80211_P2P_DEV_IF */ |
|---|
| 211 | 239 | |
|---|
| 212 | 240 | #if defined(WL_ENABLE_P2P_IF) && (defined(WL_CFG80211_P2P_DEV_IF) || \ |
|---|
| .. | .. |
|---|
| 228 | 256 | #define P2P_ECSA_CNT 50 |
|---|
| 229 | 257 | |
|---|
| 230 | 258 | extern void |
|---|
| 231 | | -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) |
|---|
| 232 | | -wl_cfgp2p_listen_expired(struct timer_list *t); |
|---|
| 233 | | -#else |
|---|
| 234 | 259 | wl_cfgp2p_listen_expired(unsigned long data); |
|---|
| 235 | | -#endif |
|---|
| 236 | 260 | extern bool |
|---|
| 237 | 261 | wl_cfgp2p_is_pub_action(void *frame, u32 frame_len); |
|---|
| 238 | 262 | extern bool |
|---|
| .. | .. |
|---|
| 285 | 309 | wl_cfgp2p_act_frm_search(struct bcm_cfg80211 *cfg, struct net_device *ndev, |
|---|
| 286 | 310 | s32 bssidx, s32 channel, struct ether_addr *tx_dst_addr); |
|---|
| 287 | 311 | |
|---|
| 288 | | -extern wpa_ie_fixed_t * |
|---|
| 289 | | -wl_cfgp2p_find_wpaie(u8 *parse, u32 len); |
|---|
| 312 | +extern const wpa_ie_fixed_t * |
|---|
| 313 | +wl_cfgp2p_find_wpaie(const u8 *parse, u32 len); |
|---|
| 290 | 314 | |
|---|
| 291 | | -extern wpa_ie_fixed_t * |
|---|
| 292 | | -wl_cfgp2p_find_wpsie(u8 *parse, u32 len); |
|---|
| 315 | +extern const wpa_ie_fixed_t * |
|---|
| 316 | +wl_cfgp2p_find_wpsie(const u8 *parse, u32 len); |
|---|
| 293 | 317 | |
|---|
| 294 | 318 | extern wifi_p2p_ie_t * |
|---|
| 295 | | -wl_cfgp2p_find_p2pie(u8 *parse, u32 len); |
|---|
| 319 | +wl_cfgp2p_find_p2pie(const u8 *parse, u32 len); |
|---|
| 296 | 320 | |
|---|
| 297 | | -extern wifi_wfd_ie_t * |
|---|
| 298 | | -wl_cfgp2p_find_wfdie(u8 *parse, u32 len); |
|---|
| 321 | +extern const wifi_wfd_ie_t * |
|---|
| 322 | +wl_cfgp2p_find_wfdie(const u8 *parse, u32 len); |
|---|
| 299 | 323 | extern s32 |
|---|
| 300 | 324 | wl_cfgp2p_set_management_ie(struct bcm_cfg80211 *cfg, struct net_device *ndev, s32 bssidx, |
|---|
| 301 | 325 | s32 pktflag, const u8 *vndr_ie, u32 vndr_ie_len); |
|---|
| .. | .. |
|---|
| 306 | 330 | wl_cfgp2p_find_ndev(struct bcm_cfg80211 *cfg, s32 bssidx); |
|---|
| 307 | 331 | extern s32 |
|---|
| 308 | 332 | wl_cfgp2p_find_type(struct bcm_cfg80211 *cfg, s32 bssidx, s32 *type); |
|---|
| 309 | | - |
|---|
| 310 | 333 | |
|---|
| 311 | 334 | extern s32 |
|---|
| 312 | 335 | wl_cfgp2p_listen_complete(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev, |
|---|
| .. | .. |
|---|
| 330 | 353 | |
|---|
| 331 | 354 | extern void |
|---|
| 332 | 355 | wl_cfg80211_change_ifaddr(u8* buf, struct ether_addr *p2p_int_addr, u8 element_id); |
|---|
| 333 | | -extern bool |
|---|
| 334 | | -wl_cfgp2p_bss_isup(struct net_device *ndev, int bsscfg_idx); |
|---|
| 335 | | - |
|---|
| 336 | | -extern s32 |
|---|
| 337 | | -wl_cfgp2p_bss(struct bcm_cfg80211 *cfg, struct net_device *ndev, s32 bsscfg_idx, s32 up); |
|---|
| 338 | | - |
|---|
| 339 | 356 | |
|---|
| 340 | 357 | extern s32 |
|---|
| 341 | 358 | wl_cfgp2p_supported(struct bcm_cfg80211 *cfg, struct net_device *ndev); |
|---|
| .. | .. |
|---|
| 355 | 372 | extern s32 |
|---|
| 356 | 373 | wl_cfgp2p_set_p2p_ecsa(struct bcm_cfg80211 *cfg, struct net_device *ndev, char* buf, int len); |
|---|
| 357 | 374 | |
|---|
| 358 | | -extern u8 * |
|---|
| 359 | | -wl_cfgp2p_retreive_p2pattrib(void *buf, u8 element_id); |
|---|
| 375 | +extern s32 |
|---|
| 376 | +wl_cfgp2p_increase_p2p_bw(struct bcm_cfg80211 *cfg, struct net_device *ndev, char* buf, int len); |
|---|
| 360 | 377 | |
|---|
| 361 | | -extern u8* |
|---|
| 362 | | -wl_cfgp2p_find_attrib_in_all_p2p_Ies(u8 *parse, u32 len, u32 attrib); |
|---|
| 378 | +extern const u8 * |
|---|
| 379 | +wl_cfgp2p_retreive_p2pattrib(const void *buf, u8 element_id); |
|---|
| 363 | 380 | |
|---|
| 364 | | -extern u8 * |
|---|
| 381 | +extern const u8* |
|---|
| 382 | +wl_cfgp2p_find_attrib_in_all_p2p_Ies(const u8 *parse, u32 len, u32 attrib); |
|---|
| 383 | + |
|---|
| 384 | +extern const u8 * |
|---|
| 365 | 385 | wl_cfgp2p_retreive_p2p_dev_addr(wl_bss_info_t *bi, u32 bi_length); |
|---|
| 366 | 386 | |
|---|
| 367 | 387 | extern s32 |
|---|
| .. | .. |
|---|
| 375 | 395 | |
|---|
| 376 | 396 | extern u32 |
|---|
| 377 | 397 | wl_cfgp2p_vndr_ie(struct bcm_cfg80211 *cfg, u8 *iebuf, s32 pktflag, |
|---|
| 378 | | - s8 *oui, s32 ie_id, s8 *data, s32 datalen, const s8* add_del_cmd); |
|---|
| 398 | + s8 *oui, s32 ie_id, const s8 *data, s32 datalen, const s8* add_del_cmd); |
|---|
| 379 | 399 | |
|---|
| 380 | 400 | extern int wl_cfgp2p_get_conn_idx(struct bcm_cfg80211 *cfg); |
|---|
| 381 | 401 | |
|---|
| .. | .. |
|---|
| 419 | 439 | #define WL_P2P_WILDCARD_SSID_LEN 7 |
|---|
| 420 | 440 | #define WL_P2P_INTERFACE_PREFIX "p2p" |
|---|
| 421 | 441 | #define WL_P2P_TEMP_CHAN 11 |
|---|
| 442 | +#define WL_P2P_TEMP_CHAN_5G 36 |
|---|
| 422 | 443 | #define WL_P2P_AF_STATUS_OFFSET 9 |
|---|
| 423 | 444 | |
|---|
| 424 | 445 | /* If the provision discovery is for JOIN operations, |
|---|