1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * This file is part of wl12xx 4 * 5 * Copyright (C) 2012 Texas Instruments. All rights reserved. 6 */ 7 8 #ifndef __WL12XX_SCAN_H__ 9 #define __WL12XX_SCAN_H__ 10 11 #include "../wlcore/wlcore.h" 12 #include "../wlcore/cmd.h" 13 #include "../wlcore/scan.h" 14 15 #define WL12XX_MAX_CHANNELS_5GHZ 23 16 17 struct basic_scan_params { 18 /* Scan option flags (WL1271_SCAN_OPT_*) */ 19 __le16 scan_options; 20 u8 role_id; 21 /* Number of scan channels in the list (maximum 30) */ 22 u8 n_ch; 23 /* This field indicates the number of probe requests to send 24 per channel for an active scan */ 25 u8 n_probe_reqs; 26 u8 tid_trigger; 27 u8 ssid_len; 28 u8 use_ssid_list; 29 30 /* Rate bit field for sending the probes */ 31 __le32 tx_rate; 32 33 u8 ssid[IEEE80211_MAX_SSID_LEN]; 34 /* Band to scan */ 35 u8 band; 36 37 u8 scan_tag; 38 u8 padding2[2]; 39 } __packed; 40 41 struct basic_scan_channel_params { 42 /* Duration in TU to wait for frames on a channel for active scan */ 43 __le32 min_duration; 44 __le32 max_duration; 45 __le32 bssid_lsb; 46 __le16 bssid_msb; 47 u8 early_termination; 48 u8 tx_power_att; 49 u8 channel; 50 /* FW internal use only! */ 51 u8 dfs_candidate; 52 u8 activity_detected; 53 u8 pad; 54 } __packed; 55 56 struct wl1271_cmd_scan { 57 struct wl1271_cmd_header header; 58 59 struct basic_scan_params params; 60 struct basic_scan_channel_params channels[WL1271_SCAN_MAX_CHANNELS]; 61 62 /* src mac address */ 63 u8 addr[ETH_ALEN]; 64 u8 padding[2]; 65 } __packed; 66 67 struct wl1271_cmd_sched_scan_config { 68 struct wl1271_cmd_header header; 69 70 __le32 intervals[SCAN_MAX_CYCLE_INTERVALS]; 71 72 s8 rssi_threshold; /* for filtering (in dBm) */ 73 s8 snr_threshold; /* for filtering (in dB) */ 74 75 u8 cycles; /* maximum number of scan cycles */ 76 u8 report_after; /* report when this number of results are received */ 77 u8 terminate; /* stop scanning after reporting */ 78 79 u8 tag; 80 u8 bss_type; /* for filtering */ 81 u8 filter_type; 82 83 u8 ssid_len; /* For SCAN_SSID_FILTER_SPECIFIC */ 84 u8 ssid[IEEE80211_MAX_SSID_LEN]; 85 86 u8 n_probe_reqs; /* Number of probes requests per channel */ 87 88 u8 passive[SCAN_MAX_BANDS]; 89 u8 active[SCAN_MAX_BANDS]; 90 91 u8 dfs; 92 93 u8 n_pactive_ch; /* number of pactive (passive until fw detects energy) 94 channels in BG band */ 95 u8 role_id; 96 u8 padding[1]; 97 struct conn_scan_ch_params channels_2[MAX_CHANNELS_2GHZ]; 98 struct conn_scan_ch_params channels_5[WL12XX_MAX_CHANNELS_5GHZ]; 99 struct conn_scan_ch_params channels_4[MAX_CHANNELS_4GHZ]; 100 } __packed; 101 102 struct wl1271_cmd_sched_scan_start { 103 struct wl1271_cmd_header header; 104 105 u8 tag; 106 u8 role_id; 107 u8 padding[2]; 108 } __packed; 109 110 struct wl1271_cmd_sched_scan_stop { 111 struct wl1271_cmd_header header; 112 113 u8 tag; 114 u8 role_id; 115 u8 padding[2]; 116 } __packed; 117 118 int wl12xx_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, 119 struct cfg80211_scan_request *req); 120 int wl12xx_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif); 121 void wl12xx_scan_completed(struct wl1271 *wl, struct wl12xx_vif *wlvif); 122 int wl12xx_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif, 123 struct cfg80211_sched_scan_request *req, 124 struct ieee80211_scan_ies *ies); 125 void wl12xx_scan_sched_scan_stop(struct wl1271 *wl, struct wl12xx_vif *wlvif); 126 #endif 127