src/dpdk/drivers/net/ice/base/ice_dcb.c
enum ice_status
ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
			    struct ice_aqc_port_ets_elem *buf)
{
	struct ice_sched_node *node, *tc_node;
	struct ice_aqc_txsched_elem_data elem;
	enum ice_status status = ICE_SUCCESS;
	u32 teid1, teid2;
	u8 i, j;

	if (!pi)
		return ICE_ERR_PARAM;
	/* suspend the missing TC nodes */
	for (i = 0; i < pi->root->num_children; i++) {
		teid1 = LE32_TO_CPU(pi->root->children[i]->info.node_teid);
		ice_for_each_traffic_class(j) {
			teid2 = LE32_TO_CPU(buf->tc_node_teid[j]);
			if (teid1 == teid2)
				break;
		}
		if (j < ICE_MAX_TRAFFIC_CLASS)
			continue;
		/* TC is missing */
		pi->root->children[i]->in_use = false;
	}
	/* add the new TC nodes */
	ice_for_each_traffic_class(j) {
		teid2 = LE32_TO_CPU(buf->tc_node_teid[j]);
		if (teid2 == ICE_INVAL_TEID)
			continue;
		/* Is it already present in the tree ? */
		for (i = 0; i < pi->root->num_children; i++) {
			tc_node = pi->root->children[i];
			if (!tc_node)
				continue;
			teid1 = LE32_TO_CPU(tc_node->info.node_teid);
			if (teid1 == teid2) {
				tc_node->tc_num = j;
				tc_node->in_use = true;
				break;
			}
		}
		if (i < pi->root->num_children)
			continue;
		/* new TC */
		status = ice_sched_query_elem(pi->hw, teid2, &elem);
		if (!status)
			status = ice_sched_add_node(pi, 1, &elem);
		if (status)
			break;
		/* update the TC number */
		node = ice_sched_find_node_by_teid(pi->root, teid2);
		if (node)
			node->tc_num = j;
	}
	return status;
}
/**
 * ice_update_port_tc_tree_cfg - update TC tree configuration
 * @pi: port information structure
 * @buf: pointer to buffer
 *
 * update the SW DB with the new TC changes
 */
update TC tree configuration
@pi: port information structure
@buf: pointer to buffer

update the SW DB with the new TC changes
update TC tree configuration @pi : port information structure @buf : pointer to buffer update the SW DB with the new TC changes
enum ice_status
ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
			    struct ice_aqc_port_ets_elem *buf)
{
	struct ice_sched_node *node, *tc_node;
	struct ice_aqc_txsched_elem_data elem;
	enum ice_status status = ICE_SUCCESS;
	u32 teid1, teid2;
	u8 i, j;
	if (!pi)
		return ICE_ERR_PARAM;
	for (i = 0; i < pi->root->num_children; i++) {
		teid1 = LE32_TO_CPU(pi->root->children[i]->info.node_teid);
		ice_for_each_traffic_class(j) {
			teid2 = LE32_TO_CPU(buf->tc_node_teid[j]);
			if (teid1 == teid2)
				break;
		}
		if (j < ICE_MAX_TRAFFIC_CLASS)
			continue;
		pi->root->children[i]->in_use = false;
	}
	ice_for_each_traffic_class(j) {
		teid2 = LE32_TO_CPU(buf->tc_node_teid[j]);
		if (teid2 == ICE_INVAL_TEID)
			continue;
		for (i = 0; i < pi->root->num_children; i++) {
			tc_node = pi->root->children[i];
			if (!tc_node)
				continue;
			teid1 = LE32_TO_CPU(tc_node->info.node_teid);
			if (teid1 == teid2) {
				tc_node->tc_num = j;
				tc_node->in_use = true;
				break;
			}
		}
		if (i < pi->root->num_children)
			continue;
		status = ice_sched_query_elem(pi->hw, teid2, &elem);
		if (!status)
			status = ice_sched_add_node(pi, 1, &elem);
		if (status)
			break;
		node = ice_sched_find_node_by_teid(pi->root, teid2);
		if (node)
			node->tc_num = j;
	}
	return status;
}
enum ice_status ice_update_port_tc_tree_cfg ( struct ice_port_info * pi , struct ice_aqc_port_ets_elem * buf ) { struct ice_sched_node * node , * tc_node ; struct ice_aqc_txsched_elem_data elem ; enum ice_status status = ICE_SUCCESS ; u32 teid1 , teid2 ; u8 i , j ; if ( ! pi ) return ICE_ERR_PARAM ; for ( i = 0 ; i < pi -> root -> num_children ; i ++ ) { teid1 = LE32_TO_CPU ( pi -> root -> children [ i ] -> info . node_teid ) ; ice_for_each_traffic_class ( j ) { teid2 = LE32_TO_CPU ( buf -> tc_node_teid [ j ] ) ; if ( teid1 == teid2 ) break ; } if ( j < ICE_MAX_TRAFFIC_CLASS ) continue ; pi -> root -> children [ i ] -> in_use = false ; } ice_for_each_traffic_class ( j ) { teid2 = LE32_TO_CPU ( buf -> tc_node_teid [ j ] ) ; if ( teid2 == ICE_INVAL_TEID ) continue ; for ( i = 0 ; i < pi -> root -> num_children ; i ++ ) { tc_node = pi -> root -> children [ i ] ; if ( ! tc_node ) continue ; teid1 = LE32_TO_CPU ( tc_node -> info . node_teid ) ; if ( teid1 == teid2 ) { tc_node -> tc_num = j ; tc_node -> in_use = true ; break ; } } if ( i < pi -> root -> num_children ) continue ; status = ice_sched_query_elem ( pi -> hw , teid2 , & elem ) ; if ( ! status ) status = ice_sched_add_node ( pi , 1 , & elem ) ; if ( status ) break ; node = ice_sched_find_node_by_teid ( pi -> root , teid2 ) ; if ( node ) node -> tc_num = j ; } return status ; }
ice_update_port_tc_tree_cfg - update TC tree configuration
 @pi: port information structure
 @buf: pointer to buffer
ice_update_port_tc_tree_cfg - update TC tree configuration @pi : port information structure @buf : pointer to buffer
/* suspend the missing TC nodes */ /* TC is missing */ /* add the new TC nodes */ /* Is it already present in the tree ? */ /* new TC */ /* update the TC number */