[PATCH iwl-next 2/6] ice: count number of VSIS in agg_vsi_list
From: Jacob Keller <jacob.e.keller@intel.com>
Date: 2026-06-02 00:15:36
Also in:
intel-wired-lan
Subsystem:
intel ethernet drivers, networking drivers, the rest · Maintainers:
Tony Nguyen, Przemek Kitszel, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
The ice_sched_agg_info structure maintains a list of VSIs associated with the aggregator node. A following change is going to refactor logic from ice_lib.c, and remove the ice_agg_node wrapper structure. Doing so will require keeping track of how many VSIs are on a given aggregator node. To simplify this tracking, add a member to the ice_sched_agg_info structure which counts the number of VSIs using the node. Increment it when adding a VSI to the list, and decrement when removing the VSI from the list. This will avoid the need to iterate the agg_vsi_list to determine this information. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Aleksandr Loktionov <redacted> --- drivers/net/ethernet/intel/ice/ice_sched.h | 1 + drivers/net/ethernet/intel/ice/ice_sched.c | 7 +++++++ 2 files changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/intel/ice/ice_sched.h b/drivers/net/ethernet/intel/ice/ice_sched.h
index f2a619fcab8b..992aafc4369d 100644
--- a/drivers/net/ethernet/intel/ice/ice_sched.h
+++ b/drivers/net/ethernet/intel/ice/ice_sched.h@@ -68,6 +68,7 @@ struct ice_sched_agg_vsi_info { struct ice_sched_agg_info { struct list_head agg_vsi_list; DECLARE_BITMAP(tc_bitmap, ICE_MAX_TRAFFIC_CLASS); + u32 num_vsis; u32 agg_id; enum ice_agg_type agg_type; /* bw_t_info saves aggregator BW information */
diff --git a/drivers/net/ethernet/intel/ice/ice_sched.c b/drivers/net/ethernet/intel/ice/ice_sched.c
index a74f840cba23..bfca45f5c53c 100644
--- a/drivers/net/ethernet/intel/ice/ice_sched.c
+++ b/drivers/net/ethernet/intel/ice/ice_sched.c@@ -823,8 +823,10 @@ void ice_sched_clear_agg(struct ice_hw *hw) &agg_info->agg_vsi_list, list_entry) { list_del(&agg_vsi_info->list_entry); devm_kfree(ice_hw_to_dev(hw), agg_vsi_info); + agg_info->num_vsis--; } xa_erase(&hw->agg_list, index); + WARN_ON(agg_info->num_vsis > 0); devm_kfree(ice_hw_to_dev(hw), agg_info); } }
@@ -2072,6 +2074,7 @@ static void ice_sched_rm_agg_vsi_info(struct ice_port_info *pi, u16 vsi_handle) list_del(&agg_vsi_info->list_entry); devm_kfree(ice_hw_to_dev(pi->hw), agg_vsi_info); + agg_info->num_vsis--; return; } }
@@ -2473,6 +2476,7 @@ ice_move_all_vsi_to_dflt_agg(struct ice_port_info *pi, if (rm_vsi_info && !agg_vsi_info->tc_bitmap[0]) { list_del(&agg_vsi_info->list_entry); devm_kfree(ice_hw_to_dev(pi->hw), agg_vsi_info); + agg_info->num_vsis--; } }
@@ -2728,6 +2732,7 @@ ice_sched_cfg_agg(struct ice_port_info *pi, u32 agg_id, /* Initialize the aggregator VSI list head */ INIT_LIST_HEAD(&agg_info->agg_vsi_list); + agg_info->num_vsis = 0; /* Add new entry in aggregator array */ status = xa_insert(&hw->agg_list, agg_id, agg_info,
@@ -2915,6 +2920,7 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id, /* add VSI ID into the aggregator list */ agg_vsi_info->vsi_handle = vsi_handle; list_add(&agg_vsi_info->list_entry, &agg_info->agg_vsi_list); + agg_info->num_vsis++; } /* Move VSI node to new aggregator node for requested TC(s) */ ice_for_each_traffic_class(tc) {
@@ -2933,6 +2939,7 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id, if (old_agg_vsi_info && !old_agg_vsi_info->tc_bitmap[0]) { list_del(&old_agg_vsi_info->list_entry); devm_kfree(ice_hw_to_dev(pi->hw), old_agg_vsi_info); + old_agg_info->num_vsis--; } return status; }
--
2.54.0.1064.gd145956f57df