> -----Original Message----- > From: Intel-wired-lan <[email protected]> On Behalf Of Jacob > Keller > Sent: 02 June 2026 05:44 > To: Intel Wired LAN <[email protected]>; > [email protected]; Nguyen, Anthony L <[email protected]> > Cc: Kitszel, Przemyslaw <[email protected]>; Loktionov, Aleksandr > <[email protected]>; Keller, Jacob E <[email protected]>; > Loktionov, Aleksandr <[email protected]> > Subject: [Intel-wired-lan] [PATCH iwl-next 4/6] ice: remove ice_agg_node > wrapper structure > > The ice_set_agg_vsi() function has bespoke logic for identifying a suitable > aggregator node to use for a VSI. The main goal of the function is to ensure > that various types of VSIs do not share aggregator nodes. It uses fixed size > arrays of struct ice_agg_node in the PF structure to keep track of which > aggregator nodes are currently used. > > The scheduler code already keeps track of almost all of this information via > the ice_sched_agg_info structures. It doesn't make sense to store similar > information in two places. Indeed, this leaves open the possibility that the > two have conflicting data. > > The recent change to refactor the aggregator info to an xarray allows lookup > via index. This enables reworking the logic in ice_set_agg_vsi() and removal > of the ice_agg_node wrapper structure. > > Introduce ice_cfg_vsi_agg() in ice_sched.c. This function will locate a > suitable aggregator node between the provided minimum and maximum ID. If no > node exists, it will allocate a new one. It will then configure the node and > move the VSI into the node immediately. > > We do not free a newly allocated node if the device fails to configure the > scheduler. The node will continue to exist within the aggregator node xarray > list, and be reused in the future when another VSI is configured. > > This is similar to the logic used before, but now integrated better into the > scheduler code. It also occurs all in a single critical section of the > scheduler lock, rather than being split between multiple lock/unlock rounds. > > Remove the ice_agg_node arrays and structure, and all of its related code > including the bespoke logic in ice_set_agg_vsi() as well as the associated > cleanup in ice_vsi_decfg() and ice_pf_dis_all_vsi(). The logic in > ice_pf_dis_all_vsi() is questionable anyways, since it reset the num_vsis > count without clearing the valid flag or the agg_node pointers in the VSI > structures. With the refactor, the VSI count for each aggregator node now > always matches with what the scheduler actually has configured. > > Only the VF logic actually uses the previously stored aggregator node data. > To avoid use-after-free issues, don't store a pointer to the aggregator node. > Instead, store just the ID of the associated node. Update > ice_vf_rebuild_aggregator_node_cfg() to use ice_cfg_vsi_agg() instead of > using ice_move_vsi_to_agg(). This ensures that the node will be created if it > was ever removed for any reason. Store the agg_id in the VSI structure using > a signed 64-bit value to allow storing -1 in the case where no aggregator > node was configured. > > This refactor drops the arrays in the ice_pf structure, reducing its size by > 1152 bytes, or ~5% of the structures size. > > Signed-off-by: Jacob Keller <[email protected]> > Reviewed-by: Aleksandr Loktionov <[email protected]> > --- > drivers/net/ethernet/intel/ice/ice.h | 23 ++---- > drivers/net/ethernet/intel/ice/ice_sched.h | 5 ++ > drivers/net/ethernet/intel/ice/ice_lib.c | 114 +++++----------------------- > drivers/net/ethernet/intel/ice/ice_main.c | 7 -- > drivers/net/ethernet/intel/ice/ice_sched.c | 102 +++++++++++++++++++++++++ > drivers/net/ethernet/intel/ice/ice_vf_lib.c | 22 +++--- > 6 files changed, 140 insertions(+), 133 deletions(-) >
Tested-by: Rinitha S <[email protected]> (A Contingent worker at Intel)
