src/dpdk/drivers/net/ice/base/ice_sched.c
static enum ice_status
ice_sched_add_nodes_to_layer(struct ice_port_info *pi,
			     struct ice_sched_node *tc_node,
			     struct ice_sched_node *parent, u8 layer,
			     u16 num_nodes, u32 *first_node_teid,
			     u16 *num_nodes_added)
{
	u32 *first_teid_ptr = first_node_teid;
	u16 new_num_nodes = num_nodes;
	enum ice_status status = ICE_SUCCESS;

	*num_nodes_added = 0;
	while (*num_nodes_added < num_nodes) {
		u16 max_child_nodes, num_added = 0;
		u32 temp;

		status = ice_sched_add_nodes_to_hw_layer(pi, tc_node, parent,
							 layer,	new_num_nodes,
							 first_teid_ptr,
							 &num_added);
		if (status == ICE_SUCCESS)
			*num_nodes_added += num_added;
		/* added more nodes than requested ? */
		if (*num_nodes_added > num_nodes) {
			ice_debug(pi->hw, ICE_DBG_SCHED, "added extra nodes %d %d\n", num_nodes,
				  *num_nodes_added);
			status = ICE_ERR_CFG;
			break;
		}
		/* break if all the nodes are added successfully */
		if (status == ICE_SUCCESS && (*num_nodes_added == num_nodes))
			break;
		/* break if the error is not max limit */
		if (status != ICE_SUCCESS && status != ICE_ERR_MAX_LIMIT)
			break;
		/* Exceeded the max children */
		max_child_nodes = pi->hw->max_children[parent->tx_sched_layer];
		/* utilize all the spaces if the parent is not full */
		if (parent->num_children < max_child_nodes) {
			new_num_nodes = max_child_nodes - parent->num_children;
		} else {
			/* This parent is full, try the next sibling */
			parent = parent->sibling;
			/* Don't modify the first node TEID memory if the
			 * first node was added already in the above call.
			 * Instead send some temp memory for all other
			 * recursive calls.
			 */
			if (num_added)
				first_teid_ptr = &temp;

			new_num_nodes = num_nodes - *num_nodes_added;
		}
	}
	return status;
}
/**
 * ice_sched_add_nodes_to_layer - Add nodes to a given layer
 * @pi: port information structure
 * @tc_node: pointer to TC node
 * @parent: pointer to parent node
 * @layer: layer number to add nodes
 * @num_nodes: number of nodes to be added
 * @first_node_teid: pointer to the first node TEID
 * @num_nodes_added: pointer to number of nodes added
 *
 * This function add nodes to a given layer.
 */


This function add nodes to a given layer.
This function add nodes to a given layer .
static enum ice_status
ice_sched_add_nodes_to_layer(struct ice_port_info *pi,
			     struct ice_sched_node *tc_node,
			     struct ice_sched_node *parent, u8 layer,
			     u16 num_nodes, u32 *first_node_teid,
			     u16 *num_nodes_added)
{
	u32 *first_teid_ptr = first_node_teid;
	u16 new_num_nodes = num_nodes;
	enum ice_status status = ICE_SUCCESS;
	*num_nodes_added = 0;
	while (*num_nodes_added < num_nodes) {
		u16 max_child_nodes, num_added = 0;
		u32 temp;
		status = ice_sched_add_nodes_to_hw_layer(pi, tc_node, parent,
							 layer,	new_num_nodes,
							 first_teid_ptr,
							 &num_added);
		if (status == ICE_SUCCESS)
			*num_nodes_added += num_added;
		if (*num_nodes_added > num_nodes) {
			ice_debug(pi->hw, ICE_DBG_SCHED, "added extra nodes %d %d\n", num_nodes,
				  *num_nodes_added);
			status = ICE_ERR_CFG;
			break;
		}
		if (status == ICE_SUCCESS && (*num_nodes_added == num_nodes))
			break;
		if (status != ICE_SUCCESS && status != ICE_ERR_MAX_LIMIT)
			break;
		max_child_nodes = pi->hw->max_children[parent->tx_sched_layer];
		if (parent->num_children < max_child_nodes) {
			new_num_nodes = max_child_nodes - parent->num_children;
		} else {
			parent = parent->sibling;
			if (num_added)
				first_teid_ptr = &temp;
			new_num_nodes = num_nodes - *num_nodes_added;
		}
	}
	return status;
}
static enum ice_status ice_sched_add_nodes_to_layer ( struct ice_port_info * pi , struct ice_sched_node * tc_node , struct ice_sched_node * parent , u8 layer , u16 num_nodes , u32 * first_node_teid , u16 * num_nodes_added ) { u32 * first_teid_ptr = first_node_teid ; u16 new_num_nodes = num_nodes ; enum ice_status status = ICE_SUCCESS ; * num_nodes_added = 0 ; while ( * num_nodes_added < num_nodes ) { u16 max_child_nodes , num_added = 0 ; u32 temp ; status = ice_sched_add_nodes_to_hw_layer ( pi , tc_node , parent , layer , new_num_nodes , first_teid_ptr , & num_added ) ; if ( status == ICE_SUCCESS ) * num_nodes_added += num_added ; if ( * num_nodes_added > num_nodes ) { ice_debug ( pi -> hw , ICE_DBG_SCHED , " \n " , num_nodes , * num_nodes_added ) ; status = ICE_ERR_CFG ; break ; } if ( status == ICE_SUCCESS && ( * num_nodes_added == num_nodes ) ) break ; if ( status != ICE_SUCCESS && status != ICE_ERR_MAX_LIMIT ) break ; max_child_nodes = pi -> hw -> max_children [ parent -> tx_sched_layer ] ; if ( parent -> num_children < max_child_nodes ) { new_num_nodes = max_child_nodes - parent -> num_children ; } else { parent = parent -> sibling ; if ( num_added ) first_teid_ptr = & temp ; new_num_nodes = num_nodes - * num_nodes_added ; } } return status ; }
ice_sched_add_nodes_to_layer - Add nodes to a given layer
 @pi: port information structure
 @tc_node: pointer to TC node
 @parent: pointer to parent node
 @layer: layer number to add nodes
 @num_nodes: number of nodes to be added
 @first_node_teid: pointer to the first node TEID
 @num_nodes_added: pointer to number of nodes added
ice_sched_add_nodes_to_layer - Add nodes to a given layer @pi : port information structure @tc_node : pointer to TC node @parent : pointer to parent node @layer : layer number to add nodes @num_nodes : number of nodes to be added @first_node_teid : pointer to the first node TEID @num_nodes_added : pointer to number of nodes added
/* added more nodes than requested ? */ /* break if all the nodes are added successfully */ /* break if the error is not max limit */ /* Exceeded the max children */ /* utilize all the spaces if the parent is not full */ /* This parent is full, try the next sibling */ /* Don't modify the first node TEID memory if the
			 * first node was added already in the above call.
			 * Instead send some temp memory for all other
			 * recursive calls.
			 */