src/dpdk/drivers/net/ice/base/ice_sched.c
enum ice_status
ice_sched_add_node(struct ice_port_info *pi, u8 layer,
		   struct ice_aqc_txsched_elem_data *info)
{
	struct ice_aqc_txsched_elem_data elem;
	struct ice_sched_node *parent;
	struct ice_sched_node *node;
	enum ice_status status;
	struct ice_hw *hw;

	if (!pi)
		return ICE_ERR_PARAM;

	hw = pi->hw;

	/* A valid parent node should be there */
	parent = ice_sched_find_node_by_teid(pi->root,
					     LE32_TO_CPU(info->parent_teid));
	if (!parent) {
		ice_debug(hw, ICE_DBG_SCHED, "Parent Node not found for parent_teid=0x%x\n",
			  LE32_TO_CPU(info->parent_teid));
		return ICE_ERR_PARAM;
	}

	/* query the current node information from FW before adding it
	 * to the SW DB
	 */
	status = ice_sched_query_elem(hw, LE32_TO_CPU(info->node_teid), &elem);
	if (status)
		return status;
	node = (struct ice_sched_node *)ice_malloc(hw, sizeof(*node));
	if (!node)
		return ICE_ERR_NO_MEMORY;
	if (hw->max_children[layer]) {
		/* coverity[suspicious_sizeof] */
		node->children = (struct ice_sched_node **)
			ice_calloc(hw, hw->max_children[layer], sizeof(*node));
		if (!node->children) {
			ice_free(hw, node);
			return ICE_ERR_NO_MEMORY;
		}
	}

	node->in_use = true;
	node->parent = parent;
	node->tx_sched_layer = layer;
	parent->children[parent->num_children++] = node;
	node->info = elem;
	return ICE_SUCCESS;
}
/**
 * ice_sched_add_node - Insert the Tx scheduler node in SW DB
 * @pi: port information structure
 * @layer: Scheduler layer of the node
 * @info: Scheduler element information from firmware
 *
 * This function inserts a scheduler node to the SW DB.
 */
Insert the Tx scheduler node in SW DB
@pi: port information structure
@layer: Scheduler layer of the node
@info: Scheduler element information from firmware

This function inserts a scheduler node to the SW DB.
Insert the Tx scheduler node in SW DB @pi : port information structure @layer : Scheduler layer of the node @info : Scheduler element information from firmware This function inserts a scheduler node to the SW DB .
enum ice_status
ice_sched_add_node(struct ice_port_info *pi, u8 layer,
		   struct ice_aqc_txsched_elem_data *info)
{
	struct ice_aqc_txsched_elem_data elem;
	struct ice_sched_node *parent;
	struct ice_sched_node *node;
	enum ice_status status;
	struct ice_hw *hw;
	if (!pi)
		return ICE_ERR_PARAM;
	hw = pi->hw;
	parent = ice_sched_find_node_by_teid(pi->root,
					     LE32_TO_CPU(info->parent_teid));
	if (!parent) {
		ice_debug(hw, ICE_DBG_SCHED, "Parent Node not found for parent_teid=0x%x\n",
			  LE32_TO_CPU(info->parent_teid));
		return ICE_ERR_PARAM;
	}
	status = ice_sched_query_elem(hw, LE32_TO_CPU(info->node_teid), &elem);
	if (status)
		return status;
	node = (struct ice_sched_node *)ice_malloc(hw, sizeof(*node));
	if (!node)
		return ICE_ERR_NO_MEMORY;
	if (hw->max_children[layer]) {
		node->children = (struct ice_sched_node **)
			ice_calloc(hw, hw->max_children[layer], sizeof(*node));
		if (!node->children) {
			ice_free(hw, node);
			return ICE_ERR_NO_MEMORY;
		}
	}
	node->in_use = true;
	node->parent = parent;
	node->tx_sched_layer = layer;
	parent->children[parent->num_children++] = node;
	node->info = elem;
	return ICE_SUCCESS;
}
enum ice_status ice_sched_add_node ( struct ice_port_info * pi , u8 layer , struct ice_aqc_txsched_elem_data * info ) { struct ice_aqc_txsched_elem_data elem ; struct ice_sched_node * parent ; struct ice_sched_node * node ; enum ice_status status ; struct ice_hw * hw ; if ( ! pi ) return ICE_ERR_PARAM ; hw = pi -> hw ; parent = ice_sched_find_node_by_teid ( pi -> root , LE32_TO_CPU ( info -> parent_teid ) ) ; if ( ! parent ) { ice_debug ( hw , ICE_DBG_SCHED , " \n " , LE32_TO_CPU ( info -> parent_teid ) ) ; return ICE_ERR_PARAM ; } status = ice_sched_query_elem ( hw , LE32_TO_CPU ( info -> node_teid ) , & elem ) ; if ( status ) return status ; node = ( struct ice_sched_node * ) ice_malloc ( hw , sizeof ( * node ) ) ; if ( ! node ) return ICE_ERR_NO_MEMORY ; if ( hw -> max_children [ layer ] ) { node -> children = ( struct ice_sched_node * * ) ice_calloc ( hw , hw -> max_children [ layer ] , sizeof ( * node ) ) ; if ( ! node -> children ) { ice_free ( hw , node ) ; return ICE_ERR_NO_MEMORY ; } } node -> in_use = true ; node -> parent = parent ; node -> tx_sched_layer = layer ; parent -> children [ parent -> num_children ++ ] = node ; node -> info = elem ; return ICE_SUCCESS ; }
ice_sched_add_node - Insert the Tx scheduler node in SW DB
 @pi: port information structure
 @layer: Scheduler layer of the node
 @info: Scheduler element information from firmware
ice_sched_add_node - Insert the Tx scheduler node in SW DB @pi : port information structure @layer : Scheduler layer of the node @info : Scheduler element information from firmware
/* A valid parent node should be there */ /* query the current node information from FW before adding it
	 * to the SW DB
	 */ /* coverity[suspicious_sizeof] */