Skip to content

Commit 37c5920

Browse files
vraj-amranguy11
authored andcommitted
ice: remove the VSI info from previous agg
Remove the VSI info from previous aggregator after moving the VSI to a new aggregator. Signed-off-by: Victor Raj <[email protected]> Tested-by: Tony Brelinski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 172db5f commit 37c5920

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

drivers/net/ethernet/intel/ice/ice_sched.c

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2745,8 +2745,8 @@ static enum ice_status
27452745
ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,
27462746
u16 vsi_handle, unsigned long *tc_bitmap)
27472747
{
2748-
struct ice_sched_agg_vsi_info *agg_vsi_info;
2749-
struct ice_sched_agg_info *agg_info;
2748+
struct ice_sched_agg_vsi_info *agg_vsi_info, *old_agg_vsi_info = NULL;
2749+
struct ice_sched_agg_info *agg_info, *old_agg_info;
27502750
enum ice_status status = 0;
27512751
struct ice_hw *hw = pi->hw;
27522752
u8 tc;
@@ -2756,6 +2756,20 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,
27562756
agg_info = ice_get_agg_info(hw, agg_id);
27572757
if (!agg_info)
27582758
return ICE_ERR_PARAM;
2759+
/* If the VSI is already part of another aggregator then update
2760+
* its VSI info list
2761+
*/
2762+
old_agg_info = ice_get_vsi_agg_info(hw, vsi_handle);
2763+
if (old_agg_info && old_agg_info != agg_info) {
2764+
struct ice_sched_agg_vsi_info *vtmp;
2765+
2766+
list_for_each_entry_safe(old_agg_vsi_info, vtmp,
2767+
&old_agg_info->agg_vsi_list,
2768+
list_entry)
2769+
if (old_agg_vsi_info->vsi_handle == vsi_handle)
2770+
break;
2771+
}
2772+
27592773
/* check if entry already exist */
27602774
agg_vsi_info = ice_get_agg_vsi_info(agg_info, vsi_handle);
27612775
if (!agg_vsi_info) {
@@ -2780,6 +2794,12 @@ ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,
27802794
break;
27812795

27822796
set_bit(tc, agg_vsi_info->tc_bitmap);
2797+
if (old_agg_vsi_info)
2798+
clear_bit(tc, old_agg_vsi_info->tc_bitmap);
2799+
}
2800+
if (old_agg_vsi_info && !old_agg_vsi_info->tc_bitmap[0]) {
2801+
list_del(&old_agg_vsi_info->list_entry);
2802+
devm_kfree(ice_hw_to_dev(pi->hw), old_agg_vsi_info);
27832803
}
27842804
return status;
27852805
}

0 commit comments

Comments
 (0)