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