xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _wl_escan_
3 #define _wl_escan_
4 #include <linuxver.h>
5 #if defined(WL_WIRELESS_EXT)
6 #include <wl_iw.h>
7 #endif /* WL_WIRELESS_EXT */
8 #include <wl_android_ext.h>
9 #include <wl_iapsta.h>
10 #include <dhd_config.h>
11 
12 #define ESCAN_BUF_SIZE (64 * 1024)
13 
14 #define WL_ESCAN_TIMER_INTERVAL_MS	10000 /* Scan timeout */
15 
16 /* donlge escan state */
17 enum escan_state {
18 	ESCAN_STATE_DOWN,
19 	ESCAN_STATE_IDLE,
20 	ESCAN_STATE_SCANING
21 };
22 
23 typedef struct wl_scan_info {
24 	bool bcast_ssid;
25 	wlc_ssid_t ssid;
26 	wl_channel_list_t channels;
27 	int scan_time;
28 } wl_scan_info_t;
29 
30 typedef struct wl_escan_info {
31 	struct net_device *dev;
32 	bool scan_params_v2;
33 	dhd_pub_t *pub;
34 	timer_list_compat_t scan_timeout; /* Timer for catch scan event timeout */
35 	int escan_state;
36 	int ioctl_ver;
37 	u8 escan_buf[ESCAN_BUF_SIZE];
38 	wl_scan_results_t *bss_list;
39 	u8 *escan_ioctl_buf;
40 	struct mutex usr_sync; /* maily for up/down synchronization */
41 	int autochannel;
42 	int best_2g_ch;
43 	int best_5g_ch;
44 	int best_6g_ch;
45 #if defined(RSSIAVG)
46 	wl_rssi_cache_ctrl_t g_rssi_cache_ctrl;
47 	wl_rssi_cache_ctrl_t g_connected_rssi_cache_ctrl;
48 #endif
49 #if defined(BSSCACHE)
50 	wl_bss_cache_ctrl_t g_bss_cache_ctrl;
51 #endif
52 } wl_escan_info_t;
53 
54 #if defined(WLMESH)
55 enum mesh_info_id {
56 	MESH_INFO_MASTER_BSSID = 1,
57 	MESH_INFO_MASTER_CHANNEL,
58 	MESH_INFO_HOP_CNT,
59 	MESH_INFO_PEER_BSSID
60 };
61 
62 #define MAX_HOP_LIST 10
63 typedef struct wl_mesh_params {
64 	struct ether_addr master_bssid;
65 	uint16 master_channel;
66 	uint hop_cnt;
67 	struct ether_addr peer_bssid[MAX_HOP_LIST];
68 	uint32 scan_channel;
69 } wl_mesh_params_t;
70 bool wl_escan_mesh_info(struct net_device *dev,
71 	struct wl_escan_info *escan, struct ether_addr *peer_bssid,
72 	struct wl_mesh_params *mesh_info);
73 bool wl_escan_mesh_peer(struct net_device *dev,
74 	struct wl_escan_info *escan, wlc_ssid_t *cur_ssid, uint16 cur_chan, bool sae,
75 	struct wl_mesh_params *mesh_info);
76 #endif /* WLMESH */
77 
78 int wl_escan_set_scan(struct net_device *dev, wl_scan_info_t *scan_info);
79 #if defined(WL_WIRELESS_EXT)
80 int wl_escan_get_scan(struct net_device *dev,
81 	struct iw_request_info *info, struct iw_point *dwrq, char *extra);
82 #endif
83 int wl_escan_attach(struct net_device *dev);
84 void wl_escan_detach(struct net_device *dev);
85 int wl_escan_event_attach(struct net_device *dev, int ifidx);
86 int wl_escan_event_dettach(struct net_device *dev, int ifidx);
87 int wl_escan_up(struct net_device *dev);
88 void wl_escan_down(struct net_device *dev);
89 
90 #endif /* _wl_escan_ */
91