Commit 97320888 authored by Benjamin Berg's avatar Benjamin Berg Committed by Johannes Berg
Browse files

wifi: iwlwifi: mvm: add the firmware API for channel survey



When requested, the firmware can return per-channel survey information
generally used for ACS (automatic channel selection). Add the API for
this, which consists of a flag and a new channel survey notification.

Signed-off-by: default avatarBenjamin Berg <benjamin.berg@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240506095953.1facde532676.I3864ac4bc0fecb7fd5136e85c07585ab7100234b@changeid


Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 2e194efa
Loading
Loading
Loading
Loading
+32 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
/*
 * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
 * Copyright (C) 2012-2014, 2018-2024 Intel Corporation
 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
 * Copyright (C) 2016-2017 Intel Deutschland GmbH
 */
@@ -13,6 +13,10 @@
 * enum iwl_scan_subcmd_ids - scan commands
 */
enum iwl_scan_subcmd_ids {
	/**
	 * @CHANNEL_SURVEY_NOTIF: &struct iwl_umac_scan_channel_survey_notif
	 */
	CHANNEL_SURVEY_NOTIF = 0xFB,
	/**
	 * @OFFLOAD_MATCH_INFO_NOTIF: &struct iwl_scan_offload_match_info
	 */
@@ -62,6 +66,8 @@ struct iwl_ssid_ie {
#define IWL_FAST_SCHED_SCAN_ITERATIONS 3
#define IWL_MAX_SCHED_SCAN_PLANS 2

#define IWL_MAX_NUM_NOISE_RESULTS 22

enum scan_framework_client {
	SCAN_CLIENT_SCHED_SCAN		= BIT(0),
	SCAN_CLIENT_NETDETECT		= BIT(1),
@@ -642,10 +648,13 @@ enum iwl_umac_scan_general_flags {
 *	notification per channel or not.
 * @IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER: Whether to allow channel
 *	reorder optimization or not.
 * @IWL_UMAC_SCAN_GEN_FLAGS2_COLLECT_CHANNEL_STATS: Enable channel statistics
 *	collection when #IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE is set.
 */
enum iwl_umac_scan_general_flags2 {
	IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL		= BIT(0),
	IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER	= BIT(1),
	IWL_UMAC_SCAN_GEN_FLAGS2_COLLECT_CHANNEL_STATS	= BIT(3),
};

/**
@@ -1258,4 +1267,26 @@ struct iwl_umac_scan_iter_complete_notif {
	struct iwl_scan_results_notif results[];
} __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */

/**
 * struct iwl_umac_scan_channel_survey_notif - data for survey
 * @channel: the channel scanned
 * @band: band of channel
 * @noise: noise floor measurements in negative dBm, invalid 0xff
 * @reserved: for future use and alignment
 * @active_time: time in ms the radio was turned on (on the channel)
 * @busy_time: time in ms the channel was sensed busy, 0 for a clean channel
 * @tx_time: time the radio spent transmitting data
 * @rx_time: time the radio spent receiving data
 */
struct iwl_umac_scan_channel_survey_notif {
	__le32 channel;
	__le32 band;
	u8 noise[IWL_MAX_NUM_NOISE_RESULTS];
	u8 reserved[2];
	__le32 active_time;
	__le32 busy_time;
	__le32 tx_time;
	__le32 rx_time;
} __packed; /* SCAN_CHANNEL_SURVEY_NTF_API_S_VER_1 */

#endif /* __iwl_fw_api_scan_h__ */
+1 −0
Original line number Diff line number Diff line
@@ -651,6 +651,7 @@ static const struct iwl_hcmd_names iwl_mvm_statistics_names[] = {
 * Access is done through binary search
 */
static const struct iwl_hcmd_names iwl_mvm_scan_names[] = {
	HCMD_NAME(CHANNEL_SURVEY_NOTIF),
	HCMD_NAME(OFFLOAD_MATCH_INFO_NOTIF),
};