xref: /OK3568_Linux_fs/external/rkwifibt/drivers/bcmdhd/include/wl_bam.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Bad AP Manager for ADPS
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Copyright (C) 2020, Broadcom.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  *      Unless you and Broadcom execute a separate written software license
7*4882a593Smuzhiyun  * agreement governing use of this software, this software is licensed to you
8*4882a593Smuzhiyun  * under the terms of the GNU General Public License version 2 (the "GPL"),
9*4882a593Smuzhiyun  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10*4882a593Smuzhiyun  * following added to such license:
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  *      As a special exception, the copyright holders of this software give you
13*4882a593Smuzhiyun  * permission to link this software with independent modules, and to copy and
14*4882a593Smuzhiyun  * distribute the resulting executable under terms of your choice, provided that
15*4882a593Smuzhiyun  * you also meet, for each linked independent module, the terms and conditions of
16*4882a593Smuzhiyun  * the license of that module.  An independent module is a module which is not
17*4882a593Smuzhiyun  * derived from this software.  The special exception does not apply to any
18*4882a593Smuzhiyun  * modifications of the software.
19*4882a593Smuzhiyun  *
20*4882a593Smuzhiyun  *
21*4882a593Smuzhiyun  * <<Broadcom-WL-IPTag/Dual:>>
22*4882a593Smuzhiyun  */
23*4882a593Smuzhiyun #ifndef _WL_BAM_H_
24*4882a593Smuzhiyun #define _WL_BAM_H_
25*4882a593Smuzhiyun #include <typedefs.h>
26*4882a593Smuzhiyun #include <linux/kernel.h>
27*4882a593Smuzhiyun #include <linux/netdevice.h>
28*4882a593Smuzhiyun #include <net/cfg80211.h>
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #include <wl_cfgp2p.h>
31*4882a593Smuzhiyun #include <dhd.h>
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun #define WL_BAD_AP_MAX_ENTRY_NUM		20u
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun typedef struct wl_bad_ap_mngr {
36*4882a593Smuzhiyun 	osl_t *osh;
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun 	uint32 num;
39*4882a593Smuzhiyun 	spinlock_t lock;
40*4882a593Smuzhiyun #if !defined(DHD_ADPS_BAM_EXPORT)
41*4882a593Smuzhiyun 	struct mutex fs_lock;		/* lock for bad ap file list */
42*4882a593Smuzhiyun #endif  /* !DHD_ADPS_BAM_EXPORT */
43*4882a593Smuzhiyun 	struct list_head list;
44*4882a593Smuzhiyun } wl_bad_ap_mngr_t;
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun typedef struct wl_bad_ap_info {
47*4882a593Smuzhiyun 	struct	ether_addr bssid;
48*4882a593Smuzhiyun #if !defined(DHD_ADPS_BAM_EXPORT)
49*4882a593Smuzhiyun 	struct	tm tm;
50*4882a593Smuzhiyun 	uint32	status;
51*4882a593Smuzhiyun 	uint32	reason;
52*4882a593Smuzhiyun 	uint32	connect_count;
53*4882a593Smuzhiyun #endif	/* !DHD_ADPS_BAM_EXPORT */
54*4882a593Smuzhiyun } wl_bad_ap_info_t;
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun typedef struct wl_bad_ap_info_entry {
57*4882a593Smuzhiyun 	wl_bad_ap_info_t bad_ap;
58*4882a593Smuzhiyun 	struct list_head list;
59*4882a593Smuzhiyun } wl_bad_ap_info_entry_t;
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun void wl_bad_ap_mngr_init(struct bcm_cfg80211 *cfg);
62*4882a593Smuzhiyun void wl_bad_ap_mngr_deinit(struct bcm_cfg80211 *cfg);
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun int wl_bad_ap_mngr_add(wl_bad_ap_mngr_t *bad_ap_mngr, wl_bad_ap_info_t *bad_ap_info);
65*4882a593Smuzhiyun wl_bad_ap_info_entry_t* wl_bad_ap_mngr_find(wl_bad_ap_mngr_t *bad_ap_mngr,
66*4882a593Smuzhiyun         const struct ether_addr *bssid);
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun bool wl_adps_bad_ap_check(struct bcm_cfg80211 *cfg, const struct ether_addr *bssid);
69*4882a593Smuzhiyun int wl_adps_enabled(struct bcm_cfg80211 *cfg, struct net_device *ndev);
70*4882a593Smuzhiyun int wl_adps_set_suspend(struct bcm_cfg80211 *cfg, struct net_device *ndev, uint8 suspend);
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun s32 wl_adps_event_handler(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
73*4882a593Smuzhiyun 	const wl_event_msg_t *e, void *data);
74*4882a593Smuzhiyun #endif  /* _WL_BAM_H_ */
75