| 1 |
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2024-2025 Intel Corporation |
| 4 |
*/ |
| 5 |
#ifndef __iwl_mld_scan_h__ |
| 6 |
#define __iwl_mld_scan_h__ |
| 7 |
|
| 8 |
int iwl_mld_alloc_scan_cmd(struct iwl_mld *mld); |
| 9 |
|
| 10 |
int iwl_mld_regular_scan_start(struct iwl_mld *mld, struct ieee80211_vif *vif, |
| 11 |
struct cfg80211_scan_request *req, |
| 12 |
struct ieee80211_scan_ies *ies); |
| 13 |
|
| 14 |
void iwl_mld_int_mlo_scan(struct iwl_mld *mld, struct ieee80211_vif *vif); |
| 15 |
|
| 16 |
void iwl_mld_handle_scan_iter_complete_notif(struct iwl_mld *mld, |
| 17 |
struct iwl_rx_packet *pkt); |
| 18 |
|
| 19 |
int iwl_mld_scan_stop(struct iwl_mld *mld, int type, bool notify); |
| 20 |
|
| 21 |
int iwl_mld_sched_scan_start(struct iwl_mld *mld, |
| 22 |
struct ieee80211_vif *vif, |
| 23 |
struct cfg80211_sched_scan_request *req, |
| 24 |
struct ieee80211_scan_ies *ies, |
| 25 |
int type); |
| 26 |
|
| 27 |
void iwl_mld_handle_match_found_notif(struct iwl_mld *mld, |
| 28 |
struct iwl_rx_packet *pkt); |
| 29 |
|
| 30 |
void iwl_mld_handle_scan_start_notif(struct iwl_mld *mld, |
| 31 |
struct iwl_rx_packet *pkt); |
| 32 |
|
| 33 |
void iwl_mld_handle_scan_complete_notif(struct iwl_mld *mld, |
| 34 |
struct iwl_rx_packet *pkt); |
| 35 |
|
| 36 |
int iwl_mld_mac80211_get_survey(struct ieee80211_hw *hw, int idx, |
| 37 |
struct survey_info *survey); |
| 38 |
|
| 39 |
void iwl_mld_handle_channel_survey_notif(struct iwl_mld *mld, |
| 40 |
struct iwl_rx_packet *pkt); |
| 41 |
|
| 42 |
#define WFA_TPC_IE_LEN 9 |
| 43 |
|
| 44 |
static inline int iwl_mld_scan_max_template_size(void) |
| 45 |
{ |
| 46 |
#define MAC_HDR_LEN 24 |
| 47 |
#define DS_IE_LEN 3 |
| 48 |
#define SSID_IE_LEN 2 |
| 49 |
|
| 50 |
/* driver create the 802.11 header, WFA TPC IE, DS parameter and SSID IE */ |
| 51 |
#define DRIVER_TOTAL_IES_LEN \ |
| 52 |
(MAC_HDR_LEN + WFA_TPC_IE_LEN + DS_IE_LEN + SSID_IE_LEN) |
| 53 |
|
| 54 |
BUILD_BUG_ON(SCAN_OFFLOAD_PROBE_REQ_SIZE < DRIVER_TOTAL_IES_LEN); |
| 55 |
|
| 56 |
return SCAN_OFFLOAD_PROBE_REQ_SIZE - DRIVER_TOTAL_IES_LEN; |
| 57 |
} |
| 58 |
|
| 59 |
void iwl_mld_report_scan_aborted(struct iwl_mld *mld); |
| 60 |
|
| 61 |
enum iwl_mld_scan_status { |
| 62 |
IWL_MLD_SCAN_NONE = 0, |
| 63 |
IWL_MLD_SCAN_REGULAR = BIT(0), |
| 64 |
IWL_MLD_SCAN_SCHED = BIT(1), |
| 65 |
IWL_MLD_SCAN_NETDETECT = BIT(2), |
| 66 |
IWL_MLD_SCAN_INT_MLO = BIT(3), |
| 67 |
}; |
| 68 |
|
| 69 |
/* enum iwl_mld_pass_all_sched_results_states - Defines the states for |
| 70 |
* handling/passing scheduled scan results to mac80211 |
| 71 |
* @SCHED_SCAN_PASS_ALL_STATE_DISABLED: Don't pass all scan results, only when |
| 72 |
* a match found. |
| 73 |
* @SCHED_SCAN_PASS_ALL_STATE_ENABLED: Pass all scan results is enabled |
| 74 |
* (no filtering). |
| 75 |
* @SCHED_SCAN_PASS_ALL_STATE_FOUND: A scan result is found, pass it on the |
| 76 |
* next scan iteration complete notification. |
| 77 |
*/ |
| 78 |
enum iwl_mld_pass_all_sched_results_states { |
| 79 |
SCHED_SCAN_PASS_ALL_STATE_DISABLED, |
| 80 |
SCHED_SCAN_PASS_ALL_STATE_ENABLED, |
| 81 |
SCHED_SCAN_PASS_ALL_STATE_FOUND, |
| 82 |
}; |
| 83 |
|
| 84 |
/** |
| 85 |
* enum iwl_mld_traffic_load - Levels of traffic load |
| 86 |
* |
| 87 |
* @IWL_MLD_TRAFFIC_LOW: low traffic load |
| 88 |
* @IWL_MLD_TRAFFIC_MEDIUM: medium traffic load |
| 89 |
* @IWL_MLD_TRAFFIC_HIGH: high traffic load |
| 90 |
*/ |
| 91 |
enum iwl_mld_traffic_load { |
| 92 |
IWL_MLD_TRAFFIC_LOW, |
| 93 |
IWL_MLD_TRAFFIC_MEDIUM, |
| 94 |
IWL_MLD_TRAFFIC_HIGH, |
| 95 |
}; |
| 96 |
|
| 97 |
/** |
| 98 |
* struct iwl_mld_scan - Scan data |
| 99 |
* @status: scan status, a combination of %enum iwl_mld_scan_status, |
| 100 |
* reflects the %scan.uid_status array. |
| 101 |
* @uid_status: array to track the scan status per uid. |
| 102 |
* @start_tsf: start time of last scan in TSF of the link that requested |
| 103 |
* the scan. |
| 104 |
* @last_ebs_failed: true if the last EBS (Energy Based Scan) failed. |
| 105 |
* @pass_all_sched_res: see %enum iwl_mld_pass_all_sched_results_states. |
| 106 |
* @fw_link_id: the current (regular) scan fw link id, used by scan |
| 107 |
* complete notif. |
| 108 |
* @traffic_load: traffic load related data |
| 109 |
* @traffic_load.last_stats_ts_usec: The timestamp of the last statistics |
| 110 |
* notification, used to calculate the elapsed time between two |
| 111 |
* notifications and determine the traffic load |
| 112 |
* @traffic_load.status: The current traffic load status, see |
| 113 |
* &enum iwl_mld_traffic_load |
| 114 |
* @cmd_size: size of %cmd. |
| 115 |
* @cmd: pointer to scan cmd buffer (allocated once in op mode start). |
| 116 |
* @last_6ghz_passive_jiffies: stores the last 6GHz passive scan time |
| 117 |
* in jiffies. |
| 118 |
* @last_start_time_jiffies: stores the last start time in jiffies |
| 119 |
* (interface up/reset/resume). |
| 120 |
* @last_mlo_scan_start_time: start time of the last MLO scan in nanoseconds |
| 121 |
* since boot. |
| 122 |
*/ |
| 123 |
struct iwl_mld_scan { |
| 124 |
/* Add here fields that need clean up on restart */ |
| 125 |
struct_group(zeroed_on_hw_restart, |
| 126 |
unsigned int status; |
| 127 |
u32 uid_status[IWL_MAX_UMAC_SCANS]; |
| 128 |
u64 start_tsf; |
| 129 |
bool last_ebs_failed; |
| 130 |
enum iwl_mld_pass_all_sched_results_states pass_all_sched_res; |
| 131 |
u8 fw_link_id; |
| 132 |
struct { |
| 133 |
u32 last_stats_ts_usec; |
| 134 |
enum iwl_mld_traffic_load status; |
| 135 |
} traffic_load; |
| 136 |
); |
| 137 |
/* And here fields that survive a fw restart */ |
| 138 |
size_t cmd_size; |
| 139 |
void *cmd; |
| 140 |
unsigned long last_6ghz_passive_jiffies; |
| 141 |
unsigned long last_start_time_jiffies; |
| 142 |
u64 last_mlo_scan_start_time; |
| 143 |
}; |
| 144 |
|
| 145 |
/** |
| 146 |
* struct iwl_mld_survey_channel - per-channel survey information |
| 147 |
* |
| 148 |
* Driver version of &struct survey_info with just the data we want to report. |
| 149 |
* |
| 150 |
* @time: time in ms the radio was on the channel |
| 151 |
* @time_busy: time in ms the channel was sensed busy |
| 152 |
* @noise: channel noise in dBm |
| 153 |
*/ |
| 154 |
struct iwl_mld_survey_channel { |
| 155 |
u32 time; |
| 156 |
u32 time_busy; |
| 157 |
s8 noise; |
| 158 |
}; |
| 159 |
|
| 160 |
/** |
| 161 |
* struct iwl_mld_survey - survey information |
| 162 |
* |
| 163 |
* Survey information for all available channels. |
| 164 |
* |
| 165 |
* @bands: per-band array for per-channel survey data, points into @channels |
| 166 |
* @n_channels: Number of @channels entries that are allocated |
| 167 |
* @channels: per-channel information |
| 168 |
*/ |
| 169 |
struct iwl_mld_survey { |
| 170 |
struct iwl_mld_survey_channel *bands[NUM_NL80211_BANDS]; |
| 171 |
|
| 172 |
int n_channels; |
| 173 |
struct iwl_mld_survey_channel channels[] __counted_by(n_channels); |
| 174 |
}; |
| 175 |
|
| 176 |
#endif /* __iwl_mld_scan_h__ */ |