18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * This file is part of wl12xx
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2012 Texas Instruments. All rights reserved.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __WL12XX_SCAN_H__
98c2ecf20Sopenharmony_ci#define __WL12XX_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_ci#define WL12XX_MAX_CHANNELS_5GHZ 23
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistruct basic_scan_params {
188c2ecf20Sopenharmony_ci	/* Scan option flags (WL1271_SCAN_OPT_*) */
198c2ecf20Sopenharmony_ci	__le16 scan_options;
208c2ecf20Sopenharmony_ci	u8 role_id;
218c2ecf20Sopenharmony_ci	/* Number of scan channels in the list (maximum 30) */
228c2ecf20Sopenharmony_ci	u8 n_ch;
238c2ecf20Sopenharmony_ci	/* This field indicates the number of probe requests to send
248c2ecf20Sopenharmony_ci	   per channel for an active scan */
258c2ecf20Sopenharmony_ci	u8 n_probe_reqs;
268c2ecf20Sopenharmony_ci	u8 tid_trigger;
278c2ecf20Sopenharmony_ci	u8 ssid_len;
288c2ecf20Sopenharmony_ci	u8 use_ssid_list;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci	/* Rate bit field for sending the probes */
318c2ecf20Sopenharmony_ci	__le32 tx_rate;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci	u8 ssid[IEEE80211_MAX_SSID_LEN];
348c2ecf20Sopenharmony_ci	/* Band to scan */
358c2ecf20Sopenharmony_ci	u8 band;
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	u8 scan_tag;
388c2ecf20Sopenharmony_ci	u8 padding2[2];
398c2ecf20Sopenharmony_ci} __packed;
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cistruct basic_scan_channel_params {
428c2ecf20Sopenharmony_ci	/* Duration in TU to wait for frames on a channel for active scan */
438c2ecf20Sopenharmony_ci	__le32 min_duration;
448c2ecf20Sopenharmony_ci	__le32 max_duration;
458c2ecf20Sopenharmony_ci	__le32 bssid_lsb;
468c2ecf20Sopenharmony_ci	__le16 bssid_msb;
478c2ecf20Sopenharmony_ci	u8 early_termination;
488c2ecf20Sopenharmony_ci	u8 tx_power_att;
498c2ecf20Sopenharmony_ci	u8 channel;
508c2ecf20Sopenharmony_ci	/* FW internal use only! */
518c2ecf20Sopenharmony_ci	u8 dfs_candidate;
528c2ecf20Sopenharmony_ci	u8 activity_detected;
538c2ecf20Sopenharmony_ci	u8 pad;
548c2ecf20Sopenharmony_ci} __packed;
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_cistruct wl1271_cmd_scan {
578c2ecf20Sopenharmony_ci	struct wl1271_cmd_header header;
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci	struct basic_scan_params params;
608c2ecf20Sopenharmony_ci	struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS];
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci	/* src mac address */
638c2ecf20Sopenharmony_ci	u8 addr[ETH_ALEN];
648c2ecf20Sopenharmony_ci	u8 padding[2];
658c2ecf20Sopenharmony_ci} __packed;
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_cistruct wl1271_cmd_sched_scan_config {
688c2ecf20Sopenharmony_ci	struct wl1271_cmd_header header;
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	__le32 intervals[SCAN_MAX_CYCLE_INTERVALS];
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci	s8 rssi_threshold; /* for filtering (in dBm) */
738c2ecf20Sopenharmony_ci	s8 snr_threshold;  /* for filtering (in dB) */
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci	u8 cycles;       /* maximum number of scan cycles */
768c2ecf20Sopenharmony_ci	u8 report_after; /* report when this number of results are received */
778c2ecf20Sopenharmony_ci	u8 terminate;    /* stop scanning after reporting */
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci	u8 tag;
808c2ecf20Sopenharmony_ci	u8 bss_type; /* for filtering */
818c2ecf20Sopenharmony_ci	u8 filter_type;
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci	u8 ssid_len;     /* For SCAN_SSID_FILTER_SPECIFIC */
848c2ecf20Sopenharmony_ci	u8 ssid[IEEE80211_MAX_SSID_LEN];
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci	u8 n_probe_reqs; /* Number of probes requests per channel */
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci	u8 passive[SCAN_MAX_BANDS];
898c2ecf20Sopenharmony_ci	u8 active[SCAN_MAX_BANDS];
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci	u8 dfs;
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci	u8 n_pactive_ch; /* number of pactive (passive until fw detects energy)
948c2ecf20Sopenharmony_ci			    channels in BG band */
958c2ecf20Sopenharmony_ci	u8 role_id;
968c2ecf20Sopenharmony_ci	u8 padding[1];
978c2ecf20Sopenharmony_ci	struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ];
988c2ecf20Sopenharmony_ci	struct conn_scan_ch_params channels_5[WL12XX_MAX_CHANNELS_5GHZ];
998c2ecf20Sopenharmony_ci	struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ];
1008c2ecf20Sopenharmony_ci} __packed;
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_cistruct wl1271_cmd_sched_scan_start {
1038c2ecf20Sopenharmony_ci	struct wl1271_cmd_header header;
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci	u8 tag;
1068c2ecf20Sopenharmony_ci	u8 role_id;
1078c2ecf20Sopenharmony_ci	u8 padding[2];
1088c2ecf20Sopenharmony_ci} __packed;
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_cistruct wl1271_cmd_sched_scan_stop {
1118c2ecf20Sopenharmony_ci	struct wl1271_cmd_header header;
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci	u8 tag;
1148c2ecf20Sopenharmony_ci	u8 role_id;
1158c2ecf20Sopenharmony_ci	u8 padding[2];
1168c2ecf20Sopenharmony_ci} __packed;
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ciint wl12xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1198c2ecf20Sopenharmony_ci		      struct cfg80211_scan_request *req);
1208c2ecf20Sopenharmony_ciint wl12xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif);
1218c2ecf20Sopenharmony_civoid wl12xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif);
1228c2ecf20Sopenharmony_ciint wl12xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif  *wlvif,
1238c2ecf20Sopenharmony_ci			    struct cfg80211_sched_scan_request *req,
1248c2ecf20Sopenharmony_ci			    struct ieee80211_scan_ies *ies);
1258c2ecf20Sopenharmony_civoid wl12xx_scan_sched_scan_stop(struct wl1271 *wl,  struct wl12xx_vif *wlvif);
1268c2ecf20Sopenharmony_ci#endif
127