xref: /linux/drivers/net/wireless/ti/wl18xx/scan.h (revision 2b27bdcc)
1*2b27bdccSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
278e28062SEliad Peller /*
378e28062SEliad Peller  * This file is part of wl18xx
478e28062SEliad Peller  *
578e28062SEliad Peller  * Copyright (C) 2012 Texas Instruments. All rights reserved.
678e28062SEliad Peller  */
778e28062SEliad Peller 
878e28062SEliad Peller #ifndef __WL18XX_SCAN_H__
978e28062SEliad Peller #define __WL18XX_SCAN_H__
1078e28062SEliad Peller 
1178e28062SEliad Peller #include "../wlcore/wlcore.h"
1278e28062SEliad Peller #include "../wlcore/cmd.h"
1378e28062SEliad Peller #include "../wlcore/scan.h"
1478e28062SEliad Peller 
1578e28062SEliad Peller struct tracking_ch_params {
1678e28062SEliad Peller 	struct conn_scan_ch_params channel;
1778e28062SEliad Peller 
1878e28062SEliad Peller 	__le32 bssid_lsb;
1978e28062SEliad Peller 	__le16 bssid_msb;
2078e28062SEliad Peller 
2178e28062SEliad Peller 	u8 padding[2];
2278e28062SEliad Peller } __packed;
2378e28062SEliad Peller 
2478e28062SEliad Peller /* probe request rate */
2578e28062SEliad Peller enum
2678e28062SEliad Peller {
2778e28062SEliad Peller 	WL18XX_SCAN_RATE_1	= 0,
2878e28062SEliad Peller 	WL18XX_SCAN_RATE_5_5	= 1,
2978e28062SEliad Peller 	WL18XX_SCAN_RATE_6	= 2,
3078e28062SEliad Peller };
3178e28062SEliad Peller 
320a1c720cSEliad Peller #define WL18XX_MAX_CHANNELS_5GHZ 32
330a1c720cSEliad Peller 
3478e28062SEliad Peller struct wl18xx_cmd_scan_params {
3578e28062SEliad Peller 	struct wl1271_cmd_header header;
3678e28062SEliad Peller 
3778e28062SEliad Peller 	u8 role_id;
3878e28062SEliad Peller 	u8 scan_type;
3978e28062SEliad Peller 
4078e28062SEliad Peller 	s8 rssi_threshold; /* for filtering (in dBm) */
4178e28062SEliad Peller 	s8 snr_threshold;  /* for filtering (in dB) */
4278e28062SEliad Peller 
4378e28062SEliad Peller 	u8 bss_type;	   /* for filtering */
4478e28062SEliad Peller 	u8 ssid_from_list; /* use ssid from configured ssid list */
4578e28062SEliad Peller 	u8 filter;	   /* forward only results with matching ssids */
4678e28062SEliad Peller 
4778e28062SEliad Peller 	/*
4878e28062SEliad Peller 	 * add broadcast ssid in addition to the configured ssids.
4978e28062SEliad Peller 	 * the driver should add dummy entry for it (?).
5078e28062SEliad Peller 	 */
5178e28062SEliad Peller 	u8 add_broadcast;
5278e28062SEliad Peller 
5378e28062SEliad Peller 	u8 urgency;
5478e28062SEliad Peller 	u8 protect;	 /* ??? */
5578e28062SEliad Peller 	u8 n_probe_reqs;    /* Number of probes requests per channel */
5678e28062SEliad Peller 	u8 terminate_after; /* early terminate scan operation */
5778e28062SEliad Peller 
5878e28062SEliad Peller 	u8 passive[SCAN_MAX_BANDS]; /* number of passive scan channels */
5978e28062SEliad Peller 	u8 active[SCAN_MAX_BANDS];  /* number of active scan channels */
6078e28062SEliad Peller 	u8 dfs;		   /* number of dfs channels in 5ghz */
6178e28062SEliad Peller 	u8 passive_active; /* number of passive before active channels 2.4ghz */
6278e28062SEliad Peller 
638698a3a4SEliad Peller 	__le16 short_cycles_msec;
648698a3a4SEliad Peller 	__le16 long_cycles_msec;
6578e28062SEliad Peller 	u8 short_cycles_count;
6678e28062SEliad Peller 	u8 total_cycles; /* 0 - infinite */
670b70078cSEyal Shapira 	u8 padding[2];
6878e28062SEliad Peller 
6978e28062SEliad Peller 	union {
7078e28062SEliad Peller 		struct {
7178e28062SEliad Peller 			struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
720a1c720cSEliad Peller 			struct conn_scan_ch_params channels_5[WL18XX_MAX_CHANNELS_5GHZ];
7378e28062SEliad Peller 			struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
7478e28062SEliad Peller 		};
7578e28062SEliad Peller 		struct tracking_ch_params channels_tracking[WL1271_SCAN_MAX_CHANNELS];
7678e28062SEliad Peller 	} ;
7778e28062SEliad Peller 
7878e28062SEliad Peller 	u8 ssid[IEEE80211_MAX_SSID_LEN];
7978e28062SEliad Peller 	u8 ssid_len;	 /* For SCAN_SSID_FILTER_SPECIFIC */
8078e28062SEliad Peller 	u8 tag;
810b70078cSEyal Shapira 	u8 rate;
820b70078cSEyal Shapira 
830b70078cSEyal Shapira 	/* send SCAN_REPORT_EVENT in periodic scans after each cycle
840b70078cSEyal Shapira 	* if number of results >= report_threshold. Must be 0 for
850b70078cSEyal Shapira 	* non periodic scans
860b70078cSEyal Shapira 	*/
870b70078cSEyal Shapira 	u8 report_threshold;
880b70078cSEyal Shapira 
890b70078cSEyal Shapira 	/* Should periodic scan stop after a report event was created.
900b70078cSEyal Shapira 	* Must be 0 for non periodic scans.
910b70078cSEyal Shapira 	*/
920b70078cSEyal Shapira 	u8 terminate_on_report;
930b70078cSEyal Shapira 
940b70078cSEyal Shapira 	u8 padding1[3];
9578e28062SEliad Peller } __packed;
9678e28062SEliad Peller 
9778e28062SEliad Peller struct wl18xx_cmd_scan_stop {
9878e28062SEliad Peller 	struct wl1271_cmd_header header;
9978e28062SEliad Peller 
10078e28062SEliad Peller 	u8 role_id;
10178e28062SEliad Peller 	u8 scan_type;
10278e28062SEliad Peller 	u8 padding[2];
10378e28062SEliad Peller } __packed;
10478e28062SEliad Peller 
10578e28062SEliad Peller int wl18xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
10678e28062SEliad Peller 		      struct cfg80211_scan_request *req);
10778e28062SEliad Peller int wl18xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif);
10878e28062SEliad Peller void wl18xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif);
10978e28062SEliad Peller int wl18xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
11078e28062SEliad Peller 			    struct cfg80211_sched_scan_request *req,
111633e2713SDavid Spinadel 			    struct ieee80211_scan_ies *ies);
11278e28062SEliad Peller void wl18xx_scan_sched_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif);
11378e28062SEliad Peller #endif
114