xref: /openbmc/linux/drivers/net/wireless/ti/wl12xx/scan.h (revision f3539c12)
1 /*
2  * This file is part of wl12xx
3  *
4  * Copyright (C) 2012 Texas Instruments. All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * version 2 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18  * 02110-1301 USA
19  *
20  */
21 
22 #ifndef __WL12XX_SCAN_H__
23 #define __WL12XX_SCAN_H__
24 
25 #include "../wlcore/wlcore.h"
26 #include "../wlcore/cmd.h"
27 #include "../wlcore/scan.h"
28 
29 #define WL12XX_MAX_CHANNELS_5GHZ 23
30 
31 struct basic_scan_params {
32 	/* Scan option flags (WL1271_SCAN_OPT_*) */
33 	__le16 scan_options;
34 	u8 role_id;
35 	/* Number of scan channels in the list (maximum 30) */
36 	u8 n_ch;
37 	/* This field indicates the number of probe requests to send
38 	   per channel for an active scan */
39 	u8 n_probe_reqs;
40 	u8 tid_trigger;
41 	u8 ssid_len;
42 	u8 use_ssid_list;
43 
44 	/* Rate bit field for sending the probes */
45 	__le32 tx_rate;
46 
47 	u8 ssid[IEEE80211_MAX_SSID_LEN];
48 	/* Band to scan */
49 	u8 band;
50 
51 	u8 scan_tag;
52 	u8 padding2[2];
53 } __packed;
54 
55 struct basic_scan_channel_params {
56 	/* Duration in TU to wait for frames on a channel for active scan */
57 	__le32 min_duration;
58 	__le32 max_duration;
59 	__le32 bssid_lsb;
60 	__le16 bssid_msb;
61 	u8 early_termination;
62 	u8 tx_power_att;
63 	u8 channel;
64 	/* FW internal use only! */
65 	u8 dfs_candidate;
66 	u8 activity_detected;
67 	u8 pad;
68 } __packed;
69 
70 struct wl1271_cmd_scan {
71 	struct wl1271_cmd_header header;
72 
73 	struct basic_scan_params params;
74 	struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS];
75 
76 	/* src mac address */
77 	u8 addr[ETH_ALEN];
78 	u8 padding[2];
79 } __packed;
80 
81 struct wl1271_cmd_sched_scan_config {
82 	struct wl1271_cmd_header header;
83 
84 	__le32 intervals[SCAN_MAX_CYCLE_INTERVALS];
85 
86 	s8 rssi_threshold; /* for filtering (in dBm) */
87 	s8 snr_threshold;  /* for filtering (in dB) */
88 
89 	u8 cycles;       /* maximum number of scan cycles */
90 	u8 report_after; /* report when this number of results are received */
91 	u8 terminate;    /* stop scanning after reporting */
92 
93 	u8 tag;
94 	u8 bss_type; /* for filtering */
95 	u8 filter_type;
96 
97 	u8 ssid_len;     /* For SCAN_SSID_FILTER_SPECIFIC */
98 	u8 ssid[IEEE80211_MAX_SSID_LEN];
99 
100 	u8 n_probe_reqs; /* Number of probes requests per channel */
101 
102 	u8 passive[SCAN_MAX_BANDS];
103 	u8 active[SCAN_MAX_BANDS];
104 
105 	u8 dfs;
106 
107 	u8 n_pactive_ch; /* number of pactive (passive until fw detects energy)
108 			    channels in BG band */
109 	u8 role_id;
110 	u8 padding[1];
111 	struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
112 	struct conn_scan_ch_params channels_5[WL12XX_MAX_CHANNELS_5GHZ];
113 	struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
114 } __packed;
115 
116 struct wl1271_cmd_sched_scan_start {
117 	struct wl1271_cmd_header header;
118 
119 	u8 tag;
120 	u8 role_id;
121 	u8 padding[2];
122 } __packed;
123 
124 struct wl1271_cmd_sched_scan_stop {
125 	struct wl1271_cmd_header header;
126 
127 	u8 tag;
128 	u8 role_id;
129 	u8 padding[2];
130 } __packed;
131 
132 int wl12xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
133 		      struct cfg80211_scan_request *req);
134 int wl12xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif);
135 void wl12xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif);
136 int wl12xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif  *wlvif,
137 			    struct cfg80211_sched_scan_request *req,
138 			    struct ieee80211_scan_ies *ies);
139 void wl12xx_scan_sched_scan_stop(struct wl1271 *wl,  struct wl12xx_vif *wlvif);
140 #endif
141