xref: /openbmc/linux/drivers/net/wireless/ti/wl18xx/scan.h (revision 884caada)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * This file is part of wl18xx
4  *
5  * Copyright (C) 2012 Texas Instruments. All rights reserved.
6  */
7 
8 #ifndef __WL18XX_SCAN_H__
9 #define __WL18XX_SCAN_H__
10 
11 #include "../wlcore/wlcore.h"
12 #include "../wlcore/cmd.h"
13 #include "../wlcore/scan.h"
14 
15 struct tracking_ch_params {
16 	struct conn_scan_ch_params channel;
17 
18 	__le32 bssid_lsb;
19 	__le16 bssid_msb;
20 
21 	u8 padding[2];
22 } __packed;
23 
24 /* probe request rate */
25 enum
26 {
27 	WL18XX_SCAN_RATE_1	= 0,
28 	WL18XX_SCAN_RATE_5_5	= 1,
29 	WL18XX_SCAN_RATE_6	= 2,
30 };
31 
32 #define WL18XX_MAX_CHANNELS_5GHZ 32
33 
34 struct wl18xx_cmd_scan_params {
35 	struct wl1271_cmd_header header;
36 
37 	u8 role_id;
38 	u8 scan_type;
39 
40 	s8 rssi_threshold; /* for filtering (in dBm) */
41 	s8 snr_threshold;  /* for filtering (in dB) */
42 
43 	u8 bss_type;	   /* for filtering */
44 	u8 ssid_from_list; /* use ssid from configured ssid list */
45 	u8 filter;	   /* forward only results with matching ssids */
46 
47 	/*
48 	 * add broadcast ssid in addition to the configured ssids.
49 	 * the driver should add dummy entry for it (?).
50 	 */
51 	u8 add_broadcast;
52 
53 	u8 urgency;
54 	u8 protect;	 /* ??? */
55 	u8 n_probe_reqs;    /* Number of probes requests per channel */
56 	u8 terminate_after; /* early terminate scan operation */
57 
58 	u8 passive[SCAN_MAX_BANDS]; /* number of passive scan channels */
59 	u8 active[SCAN_MAX_BANDS];  /* number of active scan channels */
60 	u8 dfs;		   /* number of dfs channels in 5ghz */
61 	u8 passive_active; /* number of passive before active channels 2.4ghz */
62 
63 	__le16 short_cycles_msec;
64 	__le16 long_cycles_msec;
65 	u8 short_cycles_count;
66 	u8 total_cycles; /* 0 - infinite */
67 	u8 padding[2];
68 
69 	union {
70 		struct {
71 			struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
72 			struct conn_scan_ch_params channels_5[WL18XX_MAX_CHANNELS_5GHZ];
73 			struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
74 		};
75 		struct tracking_ch_params channels_tracking[WL1271_SCAN_MAX_CHANNELS];
76 	} ;
77 
78 	u8 ssid[IEEE80211_MAX_SSID_LEN];
79 	u8 ssid_len;	 /* For SCAN_SSID_FILTER_SPECIFIC */
80 	u8 tag;
81 	u8 rate;
82 
83 	/* send SCAN_REPORT_EVENT in periodic scans after each cycle
84 	* if number of results >= report_threshold. Must be 0 for
85 	* non periodic scans
86 	*/
87 	u8 report_threshold;
88 
89 	/* Should periodic scan stop after a report event was created.
90 	* Must be 0 for non periodic scans.
91 	*/
92 	u8 terminate_on_report;
93 
94 	u8 padding1[3];
95 } __packed;
96 
97 struct wl18xx_cmd_scan_stop {
98 	struct wl1271_cmd_header header;
99 
100 	u8 role_id;
101 	u8 scan_type;
102 	u8 padding[2];
103 } __packed;
104 
105 int wl18xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
106 		      struct cfg80211_scan_request *req);
107 int wl18xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif);
108 void wl18xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif);
109 int wl18xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
110 			    struct cfg80211_sched_scan_request *req,
111 			    struct ieee80211_scan_ies *ies);
112 void wl18xx_scan_sched_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif);
113 #endif
114