18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * This file is part of wl18xx
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2012 Texas Instruments. All rights reserved.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __WL18XX_SCAN_H__
98c2ecf20Sopenharmony_ci#define __WL18XX_SCAN_H__
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include "../wlcore/wlcore.h"
128c2ecf20Sopenharmony_ci#include "../wlcore/cmd.h"
138c2ecf20Sopenharmony_ci#include "../wlcore/scan.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistruct tracking_ch_params {
168c2ecf20Sopenharmony_ci	struct conn_scan_ch_params channel;
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci	__le32 bssid_lsb;
198c2ecf20Sopenharmony_ci	__le16 bssid_msb;
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci	u8 padding[2];
228c2ecf20Sopenharmony_ci} __packed;
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/* probe request rate */
258c2ecf20Sopenharmony_cienum
268c2ecf20Sopenharmony_ci{
278c2ecf20Sopenharmony_ci	WL18XX_SCAN_RATE_1	= 0,
288c2ecf20Sopenharmony_ci	WL18XX_SCAN_RATE_5_5	= 1,
298c2ecf20Sopenharmony_ci	WL18XX_SCAN_RATE_6	= 2,
308c2ecf20Sopenharmony_ci};
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define WL18XX_MAX_CHANNELS_5GHZ 32
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistruct wl18xx_cmd_scan_params {
358c2ecf20Sopenharmony_ci	struct wl1271_cmd_header header;
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	u8 role_id;
388c2ecf20Sopenharmony_ci	u8 scan_type;
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	s8 rssi_threshold; /* for filtering (in dBm) */
418c2ecf20Sopenharmony_ci	s8 snr_threshold;  /* for filtering (in dB) */
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	u8 bss_type;	   /* for filtering */
448c2ecf20Sopenharmony_ci	u8 ssid_from_list; /* use ssid from configured ssid list */
458c2ecf20Sopenharmony_ci	u8 filter;	   /* forward only results with matching ssids */
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci	/*
488c2ecf20Sopenharmony_ci	 * add broadcast ssid in addition to the configured ssids.
498c2ecf20Sopenharmony_ci	 * the driver should add dummy entry for it (?).
508c2ecf20Sopenharmony_ci	 */
518c2ecf20Sopenharmony_ci	u8 add_broadcast;
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	u8 urgency;
548c2ecf20Sopenharmony_ci	u8 protect;	 /* ??? */
558c2ecf20Sopenharmony_ci	u8 n_probe_reqs;    /* Number of probes requests per channel */
568c2ecf20Sopenharmony_ci	u8 terminate_after; /* early terminate scan operation */
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci	u8 passive[SCAN_MAX_BANDS]; /* number of passive scan channels */
598c2ecf20Sopenharmony_ci	u8 active[SCAN_MAX_BANDS];  /* number of active scan channels */
608c2ecf20Sopenharmony_ci	u8 dfs;		   /* number of dfs channels in 5ghz */
618c2ecf20Sopenharmony_ci	u8 passive_active; /* number of passive before active channels 2.4ghz */
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci	__le16 short_cycles_msec;
648c2ecf20Sopenharmony_ci	__le16 long_cycles_msec;
658c2ecf20Sopenharmony_ci	u8 short_cycles_count;
668c2ecf20Sopenharmony_ci	u8 total_cycles; /* 0 - infinite */
678c2ecf20Sopenharmony_ci	u8 padding[2];
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci	union {
708c2ecf20Sopenharmony_ci		struct {
718c2ecf20Sopenharmony_ci			struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
728c2ecf20Sopenharmony_ci			struct conn_scan_ch_params channels_5[WL18XX_MAX_CHANNELS_5GHZ];
738c2ecf20Sopenharmony_ci			struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
748c2ecf20Sopenharmony_ci		};
758c2ecf20Sopenharmony_ci		struct tracking_ch_params channels_tracking[WL1271_SCAN_MAX_CHANNELS];
768c2ecf20Sopenharmony_ci	} ;
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci	u8 ssid[IEEE80211_MAX_SSID_LEN];
798c2ecf20Sopenharmony_ci	u8 ssid_len;	 /* For SCAN_SSID_FILTER_SPECIFIC */
808c2ecf20Sopenharmony_ci	u8 tag;
818c2ecf20Sopenharmony_ci	u8 rate;
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci	/* send SCAN_REPORT_EVENT in periodic scans after each cycle
848c2ecf20Sopenharmony_ci	* if number of results >= report_threshold. Must be 0 for
858c2ecf20Sopenharmony_ci	* non periodic scans
868c2ecf20Sopenharmony_ci	*/
878c2ecf20Sopenharmony_ci	u8 report_threshold;
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci	/* Should periodic scan stop after a report event was created.
908c2ecf20Sopenharmony_ci	* Must be 0 for non periodic scans.
918c2ecf20Sopenharmony_ci	*/
928c2ecf20Sopenharmony_ci	u8 terminate_on_report;
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci	u8 padding1[3];
958c2ecf20Sopenharmony_ci} __packed;
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_cistruct wl18xx_cmd_scan_stop {
988c2ecf20Sopenharmony_ci	struct wl1271_cmd_header header;
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci	u8 role_id;
1018c2ecf20Sopenharmony_ci	u8 scan_type;
1028c2ecf20Sopenharmony_ci	u8 padding[2];
1038c2ecf20Sopenharmony_ci} __packed;
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ciint wl18xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1068c2ecf20Sopenharmony_ci		      struct cfg80211_scan_request *req);
1078c2ecf20Sopenharmony_ciint wl18xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif);
1088c2ecf20Sopenharmony_civoid wl18xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif);
1098c2ecf20Sopenharmony_ciint wl18xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1108c2ecf20Sopenharmony_ci			    struct cfg80211_sched_scan_request *req,
1118c2ecf20Sopenharmony_ci			    struct ieee80211_scan_ies *ies);
1128c2ecf20Sopenharmony_civoid wl18xx_scan_sched_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif);
1138c2ecf20Sopenharmony_ci#endif
114