src/dpdk/drivers/net/ice/base/ice_sched.c
enum ice_status
ice_cfg_agg_vsi_priority_per_tc(struct ice_port_info *pi, u32 agg_id,
				u16 num_vsis, u16 *vsi_handle_arr,
				u8 *node_prio, u8 tc)
{
	struct ice_sched_agg_vsi_info *agg_vsi_info;
	struct ice_sched_node *tc_node, *agg_node;
	enum ice_status status = ICE_ERR_PARAM;
	struct ice_sched_agg_info *agg_info;
	bool agg_id_present = false;
	struct ice_hw *hw = pi->hw;
	u16 i;

	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)
		goto exit_agg_priority_per_tc;

	tc_node = ice_sched_get_tc_node(pi, tc);
	if (!tc_node)
		goto exit_agg_priority_per_tc;

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

	if (num_vsis > hw->max_children[agg_node->tx_sched_layer])
		goto exit_agg_priority_per_tc;

	for (i = 0; i < num_vsis; i++) {
		struct ice_sched_node *vsi_node;
		bool vsi_handle_valid = false;
		u16 vsi_handle;

		status = ICE_ERR_PARAM;
		vsi_handle = vsi_handle_arr[i];
		if (!ice_is_vsi_valid(hw, vsi_handle))
			goto exit_agg_priority_per_tc;
		/* Verify child nodes before applying settings */
		LIST_FOR_EACH_ENTRY(agg_vsi_info, &agg_info->agg_vsi_list,
				    ice_sched_agg_vsi_info, list_entry)
			if (agg_vsi_info->vsi_handle == vsi_handle) {
				/* cppcheck-suppress unreadVariable */
				vsi_handle_valid = true;
				break;
			}

		if (!vsi_handle_valid)
			goto exit_agg_priority_per_tc;

		vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
		if (!vsi_node)
			goto exit_agg_priority_per_tc;

		if (ice_sched_find_node_in_subtree(hw, agg_node, vsi_node)) {
			/* Configure Priority */
			status = ice_sched_cfg_sibl_node_prio(pi, vsi_node,
							      node_prio[i]);
			if (status)
				break;
			status = ice_sched_save_vsi_prio(pi, vsi_handle, tc,
							 node_prio[i]);
			if (status)
				break;
		}
	}

exit_agg_priority_per_tc:
	ice_release_lock(&pi->sched_lock);
	return status;
}
/**
 * ice_cfg_agg_vsi_priority_per_tc - config aggregator's VSI priority per TC
 * @pi: port information structure
 * @agg_id: Aggregator ID
 * @num_vsis: number of VSI(s)
 * @vsi_handle_arr: array of software VSI handles
 * @node_prio: pointer to node priority
 * @tc: traffic class
 *
 * This function configures the node priority (Sibling Priority) of the
 * passed in VSI's for a given traffic class (TC) of an Aggregator ID.
 */


This function configures the node priority (Sibling Priority) of the
passed in VSI's for a given traffic class (TC) of an Aggregator ID.
This function configures the node priority ( Sibling Priority ) of the passed in VSI ' s for a given traffic class ( TC ) of an Aggregator ID .
enum ice_status
ice_cfg_agg_vsi_priority_per_tc(struct ice_port_info *pi, u32 agg_id,
				u16 num_vsis, u16 *vsi_handle_arr,
				u8 *node_prio, u8 tc)
{
	struct ice_sched_agg_vsi_info *agg_vsi_info;
	struct ice_sched_node *tc_node, *agg_node;
	enum ice_status status = ICE_ERR_PARAM;
	struct ice_sched_agg_info *agg_info;
	bool agg_id_present = false;
	struct ice_hw *hw = pi->hw;
	u16 i;
	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)
		goto exit_agg_priority_per_tc;
	tc_node = ice_sched_get_tc_node(pi, tc);
	if (!tc_node)
		goto exit_agg_priority_per_tc;
	agg_node = ice_sched_get_agg_node(pi, tc_node, agg_id);
	if (!agg_node)
		goto exit_agg_priority_per_tc;
	if (num_vsis > hw->max_children[agg_node->tx_sched_layer])
		goto exit_agg_priority_per_tc;
	for (i = 0; i < num_vsis; i++) {
		struct ice_sched_node *vsi_node;
		bool vsi_handle_valid = false;
		u16 vsi_handle;
		status = ICE_ERR_PARAM;
		vsi_handle = vsi_handle_arr[i];
		if (!ice_is_vsi_valid(hw, vsi_handle))
			goto exit_agg_priority_per_tc;
		LIST_FOR_EACH_ENTRY(agg_vsi_info, &agg_info->agg_vsi_list,
				    ice_sched_agg_vsi_info, list_entry)
			if (agg_vsi_info->vsi_handle == vsi_handle) {
				vsi_handle_valid = true;
				break;
			}
		if (!vsi_handle_valid)
			goto exit_agg_priority_per_tc;
		vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
		if (!vsi_node)
			goto exit_agg_priority_per_tc;
		if (ice_sched_find_node_in_subtree(hw, agg_node, vsi_node)) {
			status = ice_sched_cfg_sibl_node_prio(pi, vsi_node,
							      node_prio[i]);
			if (status)
				break;
			status = ice_sched_save_vsi_prio(pi, vsi_handle, tc,
							 node_prio[i]);
			if (status)
				break;
		}
	}
exit_agg_priority_per_tc:
	ice_release_lock(&pi->sched_lock);
	return status;
}
enum ice_status ice_cfg_agg_vsi_priority_per_tc ( struct ice_port_info * pi , u32 agg_id , u16 num_vsis , u16 * vsi_handle_arr , u8 * node_prio , u8 tc ) { struct ice_sched_agg_vsi_info * agg_vsi_info ; struct ice_sched_node * tc_node , * agg_node ; enum ice_status status = ICE_ERR_PARAM ; struct ice_sched_agg_info * agg_info ; bool agg_id_present = false ; struct ice_hw * hw = pi -> hw ; u16 i ; 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 ) goto exit_agg_priority_per_tc ; tc_node = ice_sched_get_tc_node ( pi , tc ) ; if ( ! tc_node ) goto exit_agg_priority_per_tc ; agg_node = ice_sched_get_agg_node ( pi , tc_node , agg_id ) ; if ( ! agg_node ) goto exit_agg_priority_per_tc ; if ( num_vsis > hw -> max_children [ agg_node -> tx_sched_layer ] ) goto exit_agg_priority_per_tc ; for ( i = 0 ; i < num_vsis ; i ++ ) { struct ice_sched_node * vsi_node ; bool vsi_handle_valid = false ; u16 vsi_handle ; status = ICE_ERR_PARAM ; vsi_handle = vsi_handle_arr [ i ] ; if ( ! ice_is_vsi_valid ( hw , vsi_handle ) ) goto exit_agg_priority_per_tc ; LIST_FOR_EACH_ENTRY ( agg_vsi_info , & agg_info -> agg_vsi_list , ice_sched_agg_vsi_info , list_entry ) if ( agg_vsi_info -> vsi_handle == vsi_handle ) { vsi_handle_valid = true ; break ; } if ( ! vsi_handle_valid ) goto exit_agg_priority_per_tc ; vsi_node = ice_sched_get_vsi_node ( pi , tc_node , vsi_handle ) ; if ( ! vsi_node ) goto exit_agg_priority_per_tc ; if ( ice_sched_find_node_in_subtree ( hw , agg_node , vsi_node ) ) { status = ice_sched_cfg_sibl_node_prio ( pi , vsi_node , node_prio [ i ] ) ; if ( status ) break ; status = ice_sched_save_vsi_prio ( pi , vsi_handle , tc , node_prio [ i ] ) ; if ( status ) break ; } } exit_agg_priority_per_tc : ice_release_lock ( & pi -> sched_lock ) ; return status ; }
ice_cfg_agg_vsi_priority_per_tc - config aggregator's VSI priority per TC
 @pi: port information structure
 @agg_id: Aggregator ID
 @num_vsis: number of VSI(s)
 @vsi_handle_arr: array of software VSI handles
 @node_prio: pointer to node priority
 @tc: traffic class
ice_cfg_agg_vsi_priority_per_tc - config aggregator ' s VSI priority per TC @pi : port information structure @agg_id : Aggregator ID @num_vsis : number of VSI ( s ) @vsi_handle_arr : array of software VSI handles @node_prio : pointer to node priority @tc : traffic class
/* Verify child nodes before applying settings */ /* cppcheck-suppress unreadVariable */ /* Configure Priority */