Skip to content

Commit 9732088

Browse files
benzeajmberg-intel
authored andcommitted
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: Benjamin Berg <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://msgid.link/20240506095953.1facde532676.I3864ac4bc0fecb7fd5136e85c07585ab7100234b@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 2e194ef commit 9732088

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

drivers/net/wireless/intel/iwlwifi/fw/api/scan.h

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
22
/*
3-
* Copyright (C) 2012-2014, 2018-2023 Intel Corporation
3+
* Copyright (C) 2012-2014, 2018-2024 Intel Corporation
44
* Copyright (C) 2013-2015 Intel Mobile Communications GmbH
55
* Copyright (C) 2016-2017 Intel Deutschland GmbH
66
*/
@@ -13,6 +13,10 @@
1313
* enum iwl_scan_subcmd_ids - scan commands
1414
*/
1515
enum iwl_scan_subcmd_ids {
16+
/**
17+
* @CHANNEL_SURVEY_NOTIF: &struct iwl_umac_scan_channel_survey_notif
18+
*/
19+
CHANNEL_SURVEY_NOTIF = 0xFB,
1620
/**
1721
* @OFFLOAD_MATCH_INFO_NOTIF: &struct iwl_scan_offload_match_info
1822
*/
@@ -62,6 +66,8 @@ struct iwl_ssid_ie {
6266
#define IWL_FAST_SCHED_SCAN_ITERATIONS 3
6367
#define IWL_MAX_SCHED_SCAN_PLANS 2
6468

69+
#define IWL_MAX_NUM_NOISE_RESULTS 22
70+
6571
enum scan_framework_client {
6672
SCAN_CLIENT_SCHED_SCAN = BIT(0),
6773
SCAN_CLIENT_NETDETECT = BIT(1),
@@ -642,10 +648,13 @@ enum iwl_umac_scan_general_flags {
642648
* notification per channel or not.
643649
* @IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER: Whether to allow channel
644650
* reorder optimization or not.
651+
* @IWL_UMAC_SCAN_GEN_FLAGS2_COLLECT_CHANNEL_STATS: Enable channel statistics
652+
* collection when #IWL_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE is set.
645653
*/
646654
enum iwl_umac_scan_general_flags2 {
647655
IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL = BIT(0),
648656
IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER = BIT(1),
657+
IWL_UMAC_SCAN_GEN_FLAGS2_COLLECT_CHANNEL_STATS = BIT(3),
649658
};
650659

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

1270+
/**
1271+
* struct iwl_umac_scan_channel_survey_notif - data for survey
1272+
* @channel: the channel scanned
1273+
* @band: band of channel
1274+
* @noise: noise floor measurements in negative dBm, invalid 0xff
1275+
* @reserved: for future use and alignment
1276+
* @active_time: time in ms the radio was turned on (on the channel)
1277+
* @busy_time: time in ms the channel was sensed busy, 0 for a clean channel
1278+
* @tx_time: time the radio spent transmitting data
1279+
* @rx_time: time the radio spent receiving data
1280+
*/
1281+
struct iwl_umac_scan_channel_survey_notif {
1282+
__le32 channel;
1283+
__le32 band;
1284+
u8 noise[IWL_MAX_NUM_NOISE_RESULTS];
1285+
u8 reserved[2];
1286+
__le32 active_time;
1287+
__le32 busy_time;
1288+
__le32 tx_time;
1289+
__le32 rx_time;
1290+
} __packed; /* SCAN_CHANNEL_SURVEY_NTF_API_S_VER_1 */
1291+
12611292
#endif /* __iwl_fw_api_scan_h__ */

drivers/net/wireless/intel/iwlwifi/mvm/ops.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,7 @@ static const struct iwl_hcmd_names iwl_mvm_statistics_names[] = {
651651
* Access is done through binary search
652652
*/
653653
static const struct iwl_hcmd_names iwl_mvm_scan_names[] = {
654+
HCMD_NAME(CHANNEL_SURVEY_NOTIF),
654655
HCMD_NAME(OFFLOAD_MATCH_INFO_NOTIF),
655656
};
656657

0 commit comments

Comments
 (0)