bd075dec59464d56ad28bdb4e2debcb0c1856280
[cascardo/linux.git] / drivers / net / wireless / ti / wl12xx / scan.h
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 struct basic_scan_params {
30         /* Scan option flags (WL1271_SCAN_OPT_*) */
31         __le16 scan_options;
32         u8 role_id;
33         /* Number of scan channels in the list (maximum 30) */
34         u8 n_ch;
35         /* This field indicates the number of probe requests to send
36            per channel for an active scan */
37         u8 n_probe_reqs;
38         u8 tid_trigger;
39         u8 ssid_len;
40         u8 use_ssid_list;
41
42         /* Rate bit field for sending the probes */
43         __le32 tx_rate;
44
45         u8 ssid[IEEE80211_MAX_SSID_LEN];
46         /* Band to scan */
47         u8 band;
48
49         u8 scan_tag;
50         u8 padding2[2];
51 } __packed;
52
53 struct basic_scan_channel_params {
54         /* Duration in TU to wait for frames on a channel for active scan */
55         __le32 min_duration;
56         __le32 max_duration;
57         __le32 bssid_lsb;
58         __le16 bssid_msb;
59         u8 early_termination;
60         u8 tx_power_att;
61         u8 channel;
62         /* FW internal use only! */
63         u8 dfs_candidate;
64         u8 activity_detected;
65         u8 pad;
66 } __packed;
67
68 struct wl1271_cmd_scan {
69         struct wl1271_cmd_header header;
70
71         struct basic_scan_params params;
72         struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS];
73
74         /* src mac address */
75         u8 addr[ETH_ALEN];
76         u8 padding[2];
77 } __packed;
78
79 struct wl1271_cmd_sched_scan_config {
80         struct wl1271_cmd_header header;
81
82         __le32 intervals[SCAN_MAX_CYCLE_INTERVALS];
83
84         s8 rssi_threshold; /* for filtering (in dBm) */
85         s8 snr_threshold;  /* for filtering (in dB) */
86
87         u8 cycles;       /* maximum number of scan cycles */
88         u8 report_after; /* report when this number of results are received */
89         u8 terminate;    /* stop scanning after reporting */
90
91         u8 tag;
92         u8 bss_type; /* for filtering */
93         u8 filter_type;
94
95         u8 ssid_len;     /* For SCAN_SSID_FILTER_SPECIFIC */
96         u8 ssid[IEEE80211_MAX_SSID_LEN];
97
98         u8 n_probe_reqs; /* Number of probes requests per channel */
99
100         u8 passive[SCAN_MAX_BANDS];
101         u8 active[SCAN_MAX_BANDS];
102
103         u8 dfs;
104
105         u8 n_pactive_ch; /* number of pactive (passive until fw detects energy)
106                             channels in BG band */
107         u8 role_id;
108         u8 padding[1];
109         struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
110         struct conn_scan_ch_params channels_5[MAX_CHANNELS_5GHZ];
111         struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
112 } __packed;
113
114 struct wl1271_cmd_sched_scan_start {
115         struct wl1271_cmd_header header;
116
117         u8 tag;
118         u8 role_id;
119         u8 padding[2];
120 } __packed;
121
122 struct wl1271_cmd_sched_scan_stop {
123         struct wl1271_cmd_header header;
124
125         u8 tag;
126         u8 role_id;
127         u8 padding[2];
128 } __packed;
129
130 int wl12xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
131                       struct cfg80211_scan_request *req);
132 int wl12xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif);
133 void wl12xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif);
134 int wl12xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif  *wlvif,
135                             struct cfg80211_sched_scan_request *req,
136                             struct ieee80211_sched_scan_ies *ies);
137 void wl12xx_scan_sched_scan_stop(struct wl1271 *wl,  struct wl12xx_vif *wlvif);
138 #endif