xref: /openbmc/linux/drivers/net/wireless/ti/wl18xx/scan.h (revision 0b70078c)
178e28062SEliad Peller /*
278e28062SEliad Peller  * This file is part of wl18xx
378e28062SEliad Peller  *
478e28062SEliad Peller  * Copyright (C) 2012 Texas Instruments. All rights reserved.
578e28062SEliad Peller  *
678e28062SEliad Peller  * This program is free software; you can redistribute it and/or
778e28062SEliad Peller  * modify it under the terms of the GNU General Public License
878e28062SEliad Peller  * version 2 as published by the Free Software Foundation.
978e28062SEliad Peller  *
1078e28062SEliad Peller  * This program is distributed in the hope that it will be useful, but
1178e28062SEliad Peller  * WITHOUT ANY WARRANTY; without even the implied warranty of
1278e28062SEliad Peller  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1378e28062SEliad Peller  * General Public License for more details.
1478e28062SEliad Peller  *
1578e28062SEliad Peller  * You should have received a copy of the GNU General Public License
1678e28062SEliad Peller  * along with this program; if not, write to the Free Software
1778e28062SEliad Peller  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
1878e28062SEliad Peller  * 02110-1301 USA
1978e28062SEliad Peller  *
2078e28062SEliad Peller  */
2178e28062SEliad Peller 
2278e28062SEliad Peller #ifndef __WL18XX_SCAN_H__
2378e28062SEliad Peller #define __WL18XX_SCAN_H__
2478e28062SEliad Peller 
2578e28062SEliad Peller #include "../wlcore/wlcore.h"
2678e28062SEliad Peller #include "../wlcore/cmd.h"
2778e28062SEliad Peller #include "../wlcore/scan.h"
2878e28062SEliad Peller 
2978e28062SEliad Peller struct tracking_ch_params {
3078e28062SEliad Peller 	struct conn_scan_ch_params channel;
3178e28062SEliad Peller 
3278e28062SEliad Peller 	__le32 bssid_lsb;
3378e28062SEliad Peller 	__le16 bssid_msb;
3478e28062SEliad Peller 
3578e28062SEliad Peller 	u8 padding[2];
3678e28062SEliad Peller } __packed;
3778e28062SEliad Peller 
3878e28062SEliad Peller /* probe request rate */
3978e28062SEliad Peller enum
4078e28062SEliad Peller {
4178e28062SEliad Peller 	WL18XX_SCAN_RATE_1	= 0,
4278e28062SEliad Peller 	WL18XX_SCAN_RATE_5_5	= 1,
4378e28062SEliad Peller 	WL18XX_SCAN_RATE_6	= 2,
4478e28062SEliad Peller };
4578e28062SEliad Peller 
460a1c720cSEliad Peller #define WL18XX_MAX_CHANNELS_5GHZ 32
470a1c720cSEliad Peller 
4878e28062SEliad Peller struct wl18xx_cmd_scan_params {
4978e28062SEliad Peller 	struct wl1271_cmd_header header;
5078e28062SEliad Peller 
5178e28062SEliad Peller 	u8 role_id;
5278e28062SEliad Peller 	u8 scan_type;
5378e28062SEliad Peller 
5478e28062SEliad Peller 	s8 rssi_threshold; /* for filtering (in dBm) */
5578e28062SEliad Peller 	s8 snr_threshold;  /* for filtering (in dB) */
5678e28062SEliad Peller 
5778e28062SEliad Peller 	u8 bss_type;	   /* for filtering */
5878e28062SEliad Peller 	u8 ssid_from_list; /* use ssid from configured ssid list */
5978e28062SEliad Peller 	u8 filter;	   /* forward only results with matching ssids */
6078e28062SEliad Peller 
6178e28062SEliad Peller 	/*
6278e28062SEliad Peller 	 * add broadcast ssid in addition to the configured ssids.
6378e28062SEliad Peller 	 * the driver should add dummy entry for it (?).
6478e28062SEliad Peller 	 */
6578e28062SEliad Peller 	u8 add_broadcast;
6678e28062SEliad Peller 
6778e28062SEliad Peller 	u8 urgency;
6878e28062SEliad Peller 	u8 protect;	 /* ??? */
6978e28062SEliad Peller 	u8 n_probe_reqs;    /* Number of probes requests per channel */
7078e28062SEliad Peller 	u8 terminate_after; /* early terminate scan operation */
7178e28062SEliad Peller 
7278e28062SEliad Peller 	u8 passive[SCAN_MAX_BANDS]; /* number of passive scan channels */
7378e28062SEliad Peller 	u8 active[SCAN_MAX_BANDS];  /* number of active scan channels */
7478e28062SEliad Peller 	u8 dfs;		   /* number of dfs channels in 5ghz */
7578e28062SEliad Peller 	u8 passive_active; /* number of passive before active channels 2.4ghz */
7678e28062SEliad Peller 
7778e28062SEliad Peller 	__le16 short_cycles_sec;
7878e28062SEliad Peller 	__le16 long_cycles_sec;
7978e28062SEliad Peller 	u8 short_cycles_count;
8078e28062SEliad Peller 	u8 total_cycles; /* 0 - infinite */
810b70078cSEyal Shapira 	u8 padding[2];
8278e28062SEliad Peller 
8378e28062SEliad Peller 	union {
8478e28062SEliad Peller 		struct {
8578e28062SEliad Peller 			struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
860a1c720cSEliad Peller 			struct conn_scan_ch_params channels_5[WL18XX_MAX_CHANNELS_5GHZ];
8778e28062SEliad Peller 			struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
8878e28062SEliad Peller 		};
8978e28062SEliad Peller 		struct tracking_ch_params channels_tracking[WL1271_SCAN_MAX_CHANNELS];
9078e28062SEliad Peller 	} ;
9178e28062SEliad Peller 
9278e28062SEliad Peller 	u8 ssid[IEEE80211_MAX_SSID_LEN];
9378e28062SEliad Peller 	u8 ssid_len;	 /* For SCAN_SSID_FILTER_SPECIFIC */
9478e28062SEliad Peller 	u8 tag;
950b70078cSEyal Shapira 	u8 rate;
960b70078cSEyal Shapira 
970b70078cSEyal Shapira 	/* send SCAN_REPORT_EVENT in periodic scans after each cycle
980b70078cSEyal Shapira 	* if number of results >= report_threshold. Must be 0 for
990b70078cSEyal Shapira 	* non periodic scans
1000b70078cSEyal Shapira 	*/
1010b70078cSEyal Shapira 	u8 report_threshold;
1020b70078cSEyal Shapira 
1030b70078cSEyal Shapira 	/* Should periodic scan stop after a report event was created.
1040b70078cSEyal Shapira 	* Must be 0 for non periodic scans.
1050b70078cSEyal Shapira 	*/
1060b70078cSEyal Shapira 	u8 terminate_on_report;
1070b70078cSEyal Shapira 
1080b70078cSEyal Shapira 	u8 padding1[3];
10978e28062SEliad Peller } __packed;
11078e28062SEliad Peller 
11178e28062SEliad Peller struct wl18xx_cmd_scan_stop {
11278e28062SEliad Peller 	struct wl1271_cmd_header header;
11378e28062SEliad Peller 
11478e28062SEliad Peller 	u8 role_id;
11578e28062SEliad Peller 	u8 scan_type;
11678e28062SEliad Peller 	u8 padding[2];
11778e28062SEliad Peller } __packed;
11878e28062SEliad Peller 
11978e28062SEliad Peller int wl18xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
12078e28062SEliad Peller 		      struct cfg80211_scan_request *req);
12178e28062SEliad Peller int wl18xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif);
12278e28062SEliad Peller void wl18xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif);
12378e28062SEliad Peller int wl18xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
12478e28062SEliad Peller 			    struct cfg80211_sched_scan_request *req,
12578e28062SEliad Peller 			    struct ieee80211_sched_scan_ies *ies);
12678e28062SEliad Peller void wl18xx_scan_sched_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif);
12778e28062SEliad Peller #endif
128