src/dpdk/drivers/net/ice/base/ice_sched.c
static enum ice_status
ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,
			   u16 vsi_handle, ice_bitmap_t *tc_bitmap)
{
	struct ice_sched_agg_vsi_info *agg_vsi_info;
	struct ice_sched_agg_info *agg_info;
	enum ice_status status = ICE_SUCCESS;
	struct ice_hw *hw = pi->hw;
	u8 tc;

	if (!ice_is_vsi_valid(pi->hw, vsi_handle))
		return ICE_ERR_PARAM;
	agg_info = ice_get_agg_info(hw, agg_id);
	if (!agg_info)
		return ICE_ERR_PARAM;
	/* check if entry already exist */
	agg_vsi_info = ice_get_agg_vsi_info(agg_info, vsi_handle);
	if (!agg_vsi_info) {
		/* Create new entry for VSI under aggregator list */
		agg_vsi_info = (struct ice_sched_agg_vsi_info *)
			ice_malloc(hw, sizeof(*agg_vsi_info));
		if (!agg_vsi_info)
			return ICE_ERR_PARAM;

		/* 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);
	}
	/* Move VSI node to new aggregator node for requested TC(s) */
	ice_for_each_traffic_class(tc) {
		if (!ice_is_tc_ena(*tc_bitmap, tc))
			continue;

		/* Move VSI to new aggregator */
		status = ice_sched_move_vsi_to_agg(pi, vsi_handle, agg_id, tc);
		if (status)
			break;

		ice_set_bit(tc, agg_vsi_info->tc_bitmap);
	}
	return status;
}
/**
 * ice_sched_assoc_vsi_to_agg - associate/move VSI to new/default aggregator
 * @pi: port information structure
 * @agg_id: aggregator ID
 * @vsi_handle: software VSI handle
 * @tc_bitmap: TC bitmap of enabled TC(s)
 *
 * This function moves VSI to a new or default aggregator node. If VSI is
 * already associated to the aggregator node then no operation is performed on
 * the tree. This function needs to be called with scheduler lock held.
 */
associate/move VSI to new/default aggregator
@pi: port information structure
@agg_id: aggregator ID
@vsi_handle: software VSI handle
@tc_bitmap: TC bitmap of enabled TC(s)

This function moves VSI to a new or default aggregator node. If VSI is
already associated to the aggregator node then no operation is performed on
the tree. This function needs to be called with scheduler lock held.
associate / move VSI to new / default aggregator @pi : port information structure @agg_id : aggregator ID @vsi_handle : software VSI handle @tc_bitmap : TC bitmap of enabled TC ( s ) This function moves VSI to a new or default aggregator node . If VSI is already associated to the aggregator node then no operation is performed on the tree . This function needs to be called with scheduler lock held .
static enum ice_status
ice_sched_assoc_vsi_to_agg(struct ice_port_info *pi, u32 agg_id,
			   u16 vsi_handle, ice_bitmap_t *tc_bitmap)
{
	struct ice_sched_agg_vsi_info *agg_vsi_info;
	struct ice_sched_agg_info *agg_info;
	enum ice_status status = ICE_SUCCESS;
	struct ice_hw *hw = pi->hw;
	u8 tc;
	if (!ice_is_vsi_valid(pi->hw, vsi_handle))
		return ICE_ERR_PARAM;
	agg_info = ice_get_agg_info(hw, agg_id);
	if (!agg_info)
		return ICE_ERR_PARAM;
	agg_vsi_info = ice_get_agg_vsi_info(agg_info, vsi_handle);
	if (!agg_vsi_info) {
		agg_vsi_info = (struct ice_sched_agg_vsi_info *)
			ice_malloc(hw, sizeof(*agg_vsi_info));
		if (!agg_vsi_info)
			return ICE_ERR_PARAM;
		agg_vsi_info->vsi_handle = vsi_handle;
		LIST_ADD(&agg_vsi_info->list_entry, &agg_info->agg_vsi_list);
	}
	ice_for_each_traffic_class(tc) {
		if (!ice_is_tc_ena(*tc_bitmap, tc))
			continue;
		status = ice_sched_move_vsi_to_agg(pi, vsi_handle, agg_id, tc);
		if (status)
			break;
		ice_set_bit(tc, agg_vsi_info->tc_bitmap);
	}
	return status;
}
static enum ice_status ice_sched_assoc_vsi_to_agg ( struct ice_port_info * pi , u32 agg_id , u16 vsi_handle , ice_bitmap_t * tc_bitmap ) { struct ice_sched_agg_vsi_info * agg_vsi_info ; struct ice_sched_agg_info * agg_info ; enum ice_status status = ICE_SUCCESS ; struct ice_hw * hw = pi -> hw ; u8 tc ; if ( ! ice_is_vsi_valid ( pi -> hw , vsi_handle ) ) return ICE_ERR_PARAM ; agg_info = ice_get_agg_info ( hw , agg_id ) ; if ( ! agg_info ) return ICE_ERR_PARAM ; agg_vsi_info = ice_get_agg_vsi_info ( agg_info , vsi_handle ) ; if ( ! agg_vsi_info ) { agg_vsi_info = ( struct ice_sched_agg_vsi_info * ) ice_malloc ( hw , sizeof ( * agg_vsi_info ) ) ; if ( ! agg_vsi_info ) return ICE_ERR_PARAM ; agg_vsi_info -> vsi_handle = vsi_handle ; LIST_ADD ( & agg_vsi_info -> list_entry , & agg_info -> agg_vsi_list ) ; } ice_for_each_traffic_class ( tc ) { if ( ! ice_is_tc_ena ( * tc_bitmap , tc ) ) continue ; status = ice_sched_move_vsi_to_agg ( pi , vsi_handle , agg_id , tc ) ; if ( status ) break ; ice_set_bit ( tc , agg_vsi_info -> tc_bitmap ) ; } return status ; }
ice_sched_assoc_vsi_to_agg - associate/move VSI to new/default aggregator
 @pi: port information structure
 @agg_id: aggregator ID
 @vsi_handle: software VSI handle
 @tc_bitmap: TC bitmap of enabled TC(s)
ice_sched_assoc_vsi_to_agg - associate / move VSI to new / default aggregator @pi : port information structure @agg_id : aggregator ID @vsi_handle : software VSI handle @tc_bitmap : TC bitmap of enabled TC ( s )
/* check if entry already exist */ /* Create new entry for VSI under aggregator list */ /* add VSI ID into the aggregator list */ /* Move VSI node to new aggregator node for requested TC(s) */ /* Move VSI to new aggregator */