src/dpdk/drivers/net/ice/base/ice_sched.c
enum ice_status
ice_cfg_agg_bw_alloc(struct ice_port_info *pi, u32 agg_id, u8 ena_tcmap,
		     enum ice_rl_type rl_type, u8 *bw_alloc)
{
	struct ice_sched_agg_info *agg_info;
	bool agg_id_present = false;
	enum ice_status status = ICE_SUCCESS;
	struct ice_hw *hw = pi->hw;
	u8 tc;

	ice_acquire_lock(&pi->sched_lock);
	LIST_FOR_EACH_ENTRY(agg_info, &hw->agg_list, ice_sched_agg_info,
			    list_entry)
		if (agg_info->agg_id == agg_id) {
			agg_id_present = true;
			break;
		}
	if (!agg_id_present) {
		status = ICE_ERR_PARAM;
		goto exit_cfg_agg_bw_alloc;
	}

	/* Return success if no nodes are present across TC */
	ice_for_each_traffic_class(tc) {
		struct ice_sched_node *tc_node, *agg_node;

		if (!ice_is_tc_ena(ena_tcmap, tc))
			continue;

		tc_node = ice_sched_get_tc_node(pi, tc);
		if (!tc_node)
			continue;

		agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);
		if (!agg_node)
			continue;

		status = ice_sched_cfg_node_bw_alloc(hw, agg_node, rl_type,
						     bw_alloc[tc]);
		if (status)
			break;
		status = ice_sched_save_agg_bw_alloc(pi, agg_id, tc, rl_type,
						     bw_alloc[tc]);
		if (status)
			break;
	}

exit_cfg_agg_bw_alloc:
	ice_release_lock(&pi->sched_lock);
	return status;
}
/**
 * ice_cfg_agg_bw_alloc - config aggregator BW alloc
 * @pi: port information structure
 * @agg_id: aggregator ID
 * @ena_tcmap: enabled TC map
 * @rl_type: rate limit type CIR/EIR
 * @bw_alloc: array of BW alloc
 *
 * This function configures the BW allocation of passed in aggregator for
 * enabled traffic class(s).
 */


This function configures the BW allocation of passed in aggregator for
enabled traffic class(s).
This function configures the BW allocation of passed in aggregator for enabled traffic class ( s ) .
enum ice_status
ice_cfg_agg_bw_alloc(struct ice_port_info *pi, u32 agg_id, u8 ena_tcmap,
		     enum ice_rl_type rl_type, u8 *bw_alloc)
{
	struct ice_sched_agg_info *agg_info;
	bool agg_id_present = false;
	enum ice_status status = ICE_SUCCESS;
	struct ice_hw *hw = pi->hw;
	u8 tc;
	ice_acquire_lock(&pi->sched_lock);
	LIST_FOR_EACH_ENTRY(agg_info, &hw->agg_list, ice_sched_agg_info,
			    list_entry)
		if (agg_info->agg_id == agg_id) {
			agg_id_present = true;
			break;
		}
	if (!agg_id_present) {
		status = ICE_ERR_PARAM;
		goto exit_cfg_agg_bw_alloc;
	}
	ice_for_each_traffic_class(tc) {
		struct ice_sched_node *tc_node, *agg_node;
		if (!ice_is_tc_ena(ena_tcmap, tc))
			continue;
		tc_node = ice_sched_get_tc_node(pi, tc);
		if (!tc_node)
			continue;
		agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);
		if (!agg_node)
			continue;
		status = ice_sched_cfg_node_bw_alloc(hw, agg_node, rl_type,
						     bw_alloc[tc]);
		if (status)
			break;
		status = ice_sched_save_agg_bw_alloc(pi, agg_id, tc, rl_type,
						     bw_alloc[tc]);
		if (status)
			break;
	}
exit_cfg_agg_bw_alloc:
	ice_release_lock(&pi->sched_lock);
	return status;
}
enum ice_status ice_cfg_agg_bw_alloc ( struct ice_port_info * pi , u32 agg_id , u8 ena_tcmap , enum ice_rl_type rl_type , u8 * bw_alloc ) { struct ice_sched_agg_info * agg_info ; bool agg_id_present = false ; enum ice_status status = ICE_SUCCESS ; struct ice_hw * hw = pi -> hw ; u8 tc ; ice_acquire_lock ( & pi -> sched_lock ) ; LIST_FOR_EACH_ENTRY ( agg_info , & hw -> agg_list , ice_sched_agg_info , list_entry ) if ( agg_info -> agg_id == agg_id ) { agg_id_present = true ; break ; } if ( ! agg_id_present ) { status = ICE_ERR_PARAM ; goto exit_cfg_agg_bw_alloc ; } ice_for_each_traffic_class ( tc ) { struct ice_sched_node * tc_node , * agg_node ; if ( ! ice_is_tc_ena ( ena_tcmap , tc ) ) continue ; tc_node = ice_sched_get_tc_node ( pi , tc ) ; if ( ! tc_node ) continue ; agg_node = ice_sched_get_agg_node ( pi , tc_node , agg_id ) ; if ( ! agg_node ) continue ; status = ice_sched_cfg_node_bw_alloc ( hw , agg_node , rl_type , bw_alloc [ tc ] ) ; if ( status ) break ; status = ice_sched_save_agg_bw_alloc ( pi , agg_id , tc , rl_type , bw_alloc [ tc ] ) ; if ( status ) break ; } exit_cfg_agg_bw_alloc : ice_release_lock ( & pi -> sched_lock ) ; return status ; }
ice_cfg_agg_bw_alloc - config aggregator BW alloc
 @pi: port information structure
 @agg_id: aggregator ID
 @ena_tcmap: enabled TC map
 @rl_type: rate limit type CIR/EIR
 @bw_alloc: array of BW alloc
ice_cfg_agg_bw_alloc - config aggregator BW alloc @pi : port information structure @agg_id : aggregator ID @ena_tcmap : enabled TC map @rl_type : rate limit type CIR / EIR @bw_alloc : array of BW alloc
/* Return success if no nodes are present across TC */