xref: /OK3568_Linux_fs/external/rkwifibt/drivers/infineon/wl_cfgscan.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Header for Linux cfg80211 scan
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Portions of this code are copyright (c) 2021 Cypress Semiconductor Corporation
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Copyright (C) 1999-2017, Broadcom Corporation
7*4882a593Smuzhiyun  *
8*4882a593Smuzhiyun  *      Unless you and Broadcom execute a separate written software license
9*4882a593Smuzhiyun  * agreement governing use of this software, this software is licensed to you
10*4882a593Smuzhiyun  * under the terms of the GNU General Public License version 2 (the "GPL"),
11*4882a593Smuzhiyun  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
12*4882a593Smuzhiyun  * following added to such license:
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  *      As a special exception, the copyright holders of this software give you
15*4882a593Smuzhiyun  * permission to link this software with independent modules, and to copy and
16*4882a593Smuzhiyun  * distribute the resulting executable under terms of your choice, provided that
17*4882a593Smuzhiyun  * you also meet, for each linked independent module, the terms and conditions of
18*4882a593Smuzhiyun  * the license of that module.  An independent module is a module which is not
19*4882a593Smuzhiyun  * derived from this software.  The special exception does not apply to any
20*4882a593Smuzhiyun  * modifications of the software.
21*4882a593Smuzhiyun  *
22*4882a593Smuzhiyun  *      Notwithstanding the above, under no circumstances may you combine this
23*4882a593Smuzhiyun  * software in any way with any other Broadcom software provided under a license
24*4882a593Smuzhiyun  * other than the GPL, without Broadcom's express prior written consent.
25*4882a593Smuzhiyun  *
26*4882a593Smuzhiyun  *
27*4882a593Smuzhiyun  * <<Broadcom-WL-IPTag/Open:>>
28*4882a593Smuzhiyun  *
29*4882a593Smuzhiyun  * $Id$
30*4882a593Smuzhiyun  */
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #ifndef _wl_cfgscan_h_
33*4882a593Smuzhiyun #define _wl_cfgscan_h_
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #include <linux/wireless.h>
36*4882a593Smuzhiyun #include <typedefs.h>
37*4882a593Smuzhiyun #include <ethernet.h>
38*4882a593Smuzhiyun #include <wlioctl.h>
39*4882a593Smuzhiyun #include <linux/wireless.h>
40*4882a593Smuzhiyun #include <net/cfg80211.h>
41*4882a593Smuzhiyun #include <linux/rfkill.h>
42*4882a593Smuzhiyun #include <osl.h>
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0))
45*4882a593Smuzhiyun #define GET_SCAN_WDEV(scan_request) \
46*4882a593Smuzhiyun 	(scan_request && scan_request->dev) ? scan_request->dev->ieee80211_ptr : NULL;
47*4882a593Smuzhiyun #else
48*4882a593Smuzhiyun #define GET_SCAN_WDEV(scan_request) \
49*4882a593Smuzhiyun 	scan_request ? scan_request->wdev : NULL;
50*4882a593Smuzhiyun #endif // endif
51*4882a593Smuzhiyun #ifdef WL_SCHED_SCAN
52*4882a593Smuzhiyun #define GET_SCHED_SCAN_WDEV(scan_request) \
53*4882a593Smuzhiyun 	(scan_request && scan_request->dev) ? scan_request->dev->ieee80211_ptr : NULL;
54*4882a593Smuzhiyun #endif /* WL_SCHED_SCAN */
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun extern s32 wl_escan_handler(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
57*4882a593Smuzhiyun 	const wl_event_msg_t *e, void *data);
58*4882a593Smuzhiyun extern s32 wl_do_escan(struct bcm_cfg80211 *cfg, struct wiphy *wiphy,
59*4882a593Smuzhiyun 	struct net_device *ndev, struct cfg80211_scan_request *request);
60*4882a593Smuzhiyun extern s32 __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
61*4882a593Smuzhiyun 	struct cfg80211_scan_request *request, struct cfg80211_ssid *this_ssid);
62*4882a593Smuzhiyun #if defined(WL_CFG80211_P2P_DEV_IF)
63*4882a593Smuzhiyun extern s32 wl_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request);
64*4882a593Smuzhiyun #else
65*4882a593Smuzhiyun extern s32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
66*4882a593Smuzhiyun 	struct cfg80211_scan_request *request);
67*4882a593Smuzhiyun extern int wl_cfg80211_scan_stop(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev);
68*4882a593Smuzhiyun #endif /* WL_CFG80211_P2P_DEV_IF */
69*4882a593Smuzhiyun #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0))
70*4882a593Smuzhiyun extern void wl_cfg80211_abort_scan(struct wiphy *wiphy, struct wireless_dev *wdev);
71*4882a593Smuzhiyun #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) */
72*4882a593Smuzhiyun extern void wl_cfg80211_scan_abort(struct bcm_cfg80211 *cfg);
73*4882a593Smuzhiyun extern s32 wl_init_scan(struct bcm_cfg80211 *cfg);
74*4882a593Smuzhiyun extern int wl_cfg80211_scan_stop(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev);
75*4882a593Smuzhiyun extern s32 wl_notify_scan_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
76*4882a593Smuzhiyun 	const wl_event_msg_t *e, void *data);
77*4882a593Smuzhiyun extern void wl_cfg80211_set_passive_scan(struct net_device *dev, char *command);
78*4882a593Smuzhiyun #ifdef PNO_SUPPORT
79*4882a593Smuzhiyun extern s32 wl_notify_pfn_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
80*4882a593Smuzhiyun 	const wl_event_msg_t *e, void *data);
81*4882a593Smuzhiyun #endif /* PNO_SUPPORT */
82*4882a593Smuzhiyun #ifdef GSCAN_SUPPORT
83*4882a593Smuzhiyun extern s32 wl_notify_gscan_event(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
84*4882a593Smuzhiyun 	const wl_event_msg_t *e, void *data);
85*4882a593Smuzhiyun #endif /* GSCAN_SUPPORT */
86*4882a593Smuzhiyun 
87*4882a593Smuzhiyun #ifdef WES_SUPPORT
88*4882a593Smuzhiyun #ifdef CUSTOMER_SCAN_TIMEOUT_SETTING
89*4882a593Smuzhiyun #define CUSTOMER_WL_SCAN_TIMER_INTERVAL_MS	25000 /* Scan timeout */
90*4882a593Smuzhiyun enum wl_custom_scan_time_type {
91*4882a593Smuzhiyun 	WL_CUSTOM_SCAN_CHANNEL_TIME = 0,
92*4882a593Smuzhiyun 	WL_CUSTOM_SCAN_UNASSOC_TIME,
93*4882a593Smuzhiyun 	WL_CUSTOM_SCAN_PASSIVE_TIME,
94*4882a593Smuzhiyun 	WL_CUSTOM_SCAN_HOME_TIME,
95*4882a593Smuzhiyun 	WL_CUSTOM_SCAN_HOME_AWAY_TIME
96*4882a593Smuzhiyun };
97*4882a593Smuzhiyun extern s32 wl_cfg80211_custom_scan_time(struct net_device *dev,
98*4882a593Smuzhiyun 		enum wl_custom_scan_time_type type, int time);
99*4882a593Smuzhiyun #endif /* CUSTOMER_SCAN_TIMEOUT_SETTING */
100*4882a593Smuzhiyun #endif /* WES_SUPPORT */
101*4882a593Smuzhiyun 
102*4882a593Smuzhiyun #if defined(SUPPORT_RANDOM_MAC_SCAN)
103*4882a593Smuzhiyun int wl_cfg80211_set_random_mac(struct net_device *dev, bool enable);
104*4882a593Smuzhiyun int wl_cfg80211_random_mac_enable(struct net_device *dev);
105*4882a593Smuzhiyun int wl_cfg80211_random_mac_disable(struct net_device *dev);
106*4882a593Smuzhiyun int wl_cfg80211_scan_mac_enable(struct net_device *dev, uint8 *rand_mac, uint8 *rand_mask);
107*4882a593Smuzhiyun int wl_cfg80211_scan_mac_disable(struct net_device *dev);
108*4882a593Smuzhiyun #endif /* SUPPORT_RANDOM_MAC_SCAN */
109*4882a593Smuzhiyun 
110*4882a593Smuzhiyun #ifdef WL_SCHED_SCAN
111*4882a593Smuzhiyun extern int wl_cfg80211_sched_scan_start(struct wiphy *wiphy, struct net_device *dev,
112*4882a593Smuzhiyun 	struct cfg80211_sched_scan_request *request);
113*4882a593Smuzhiyun #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0))
114*4882a593Smuzhiyun int
115*4882a593Smuzhiyun wl_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev, u64 req);
116*4882a593Smuzhiyun #else
117*4882a593Smuzhiyun int wl_cfg80211_sched_scan_stop(struct wiphy *wiphy, struct net_device *dev);
118*4882a593Smuzhiyun #endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(4, 11, 0) */
119*4882a593Smuzhiyun #endif /* WL_SCHED_SCAN */
120*4882a593Smuzhiyun #endif /* _wl_cfgscan_h_ */
121