src/dpdk/drivers/net/ice/base/ice_sched.c
static enum ice_status
ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)
{
	enum ice_status status = ICE_ERR_PARAM;
	struct ice_vsi_ctx *vsi_ctx;
	u8 i;

	ice_debug(pi->hw, ICE_DBG_SCHED, "removing VSI %d\n", vsi_handle);
	if (!ice_is_vsi_valid(pi->hw, vsi_handle))
		return status;
	ice_acquire_lock(&pi->sched_lock);
	vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
	if (!vsi_ctx)
		goto exit_sched_rm_vsi_cfg;

	ice_for_each_traffic_class(i) {
		struct ice_sched_node *vsi_node, *tc_node;
		u8 j = 0;

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

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

		if (ice_sched_is_leaf_node_present(vsi_node)) {
			ice_debug(pi->hw, ICE_DBG_SCHED, "VSI has leaf nodes in TC %d\n", i);
			status = ICE_ERR_IN_USE;
			goto exit_sched_rm_vsi_cfg;
		}
		while (j < vsi_node->num_children) {
			if (vsi_node->children[j]->owner == owner) {
				ice_free_sched_node(pi, vsi_node->children[j]);

				/* reset the counter again since the num
				 * children will be updated after node removal
				 */
				j = 0;
			} else {
				j++;
			}
		}
		/* remove the VSI if it has no children */
		if (!vsi_node->num_children) {
			ice_free_sched_node(pi, vsi_node);
			vsi_ctx->sched.vsi_node[i] = NULL;

			/* clean up aggregator related VSI info if any */
			ice_sched_rm_agg_vsi_info(pi, vsi_handle);
		}
		if (owner == ICE_SCHED_NODE_OWNER_LAN)
			vsi_ctx->sched.max_lanq[i] = 0;
	}
	status = ICE_SUCCESS;

exit_sched_rm_vsi_cfg:
	ice_release_lock(&pi->sched_lock);
	return status;
}
/**
 * ice_sched_rm_vsi_cfg - remove the VSI and its children nodes
 * @pi: port information structure
 * @vsi_handle: software VSI handle
 * @owner: LAN or RDMA
 *
 * This function removes the VSI and its LAN or RDMA children nodes from the
 * scheduler tree.
 */
remove the VSI and its children nodes
@pi: port information structure
@vsi_handle: software VSI handle
@owner: LAN or RDMA

This function removes the VSI and its LAN or RDMA children nodes from the
scheduler tree.
remove the VSI and its children nodes @pi : port information structure @vsi_handle : software VSI handle @owner : LAN or RDMA This function removes the VSI and its LAN or RDMA children nodes from the scheduler tree .
static enum ice_status
ice_sched_rm_vsi_cfg(struct ice_port_info *pi, u16 vsi_handle, u8 owner)
{
	enum ice_status status = ICE_ERR_PARAM;
	struct ice_vsi_ctx *vsi_ctx;
	u8 i;
	ice_debug(pi->hw, ICE_DBG_SCHED, "removing VSI %d\n", vsi_handle);
	if (!ice_is_vsi_valid(pi->hw, vsi_handle))
		return status;
	ice_acquire_lock(&pi->sched_lock);
	vsi_ctx = ice_get_vsi_ctx(pi->hw, vsi_handle);
	if (!vsi_ctx)
		goto exit_sched_rm_vsi_cfg;
	ice_for_each_traffic_class(i) {
		struct ice_sched_node *vsi_node, *tc_node;
		u8 j = 0;
		tc_node = ice_sched_get_tc_node(pi, i);
		if (!tc_node)
			continue;
		vsi_node = ice_sched_get_vsi_node(pi, tc_node, vsi_handle);
		if (!vsi_node)
			continue;
		if (ice_sched_is_leaf_node_present(vsi_node)) {
			ice_debug(pi->hw, ICE_DBG_SCHED, "VSI has leaf nodes in TC %d\n", i);
			status = ICE_ERR_IN_USE;
			goto exit_sched_rm_vsi_cfg;
		}
		while (j < vsi_node->num_children) {
			if (vsi_node->children[j]->owner == owner) {
				ice_free_sched_node(pi, vsi_node->children[j]);
				j = 0;
			} else {
				j++;
			}
		}
		if (!vsi_node->num_children) {
			ice_free_sched_node(pi, vsi_node);
			vsi_ctx->sched.vsi_node[i] = NULL;
			ice_sched_rm_agg_vsi_info(pi, vsi_handle);
		}
		if (owner == ICE_SCHED_NODE_OWNER_LAN)
			vsi_ctx->sched.max_lanq[i] = 0;
	}
	status = ICE_SUCCESS;
exit_sched_rm_vsi_cfg:
	ice_release_lock(&pi->sched_lock);
	return status;
}
static enum ice_status ice_sched_rm_vsi_cfg ( struct ice_port_info * pi , u16 vsi_handle , u8 owner ) { enum ice_status status = ICE_ERR_PARAM ; struct ice_vsi_ctx * vsi_ctx ; u8 i ; ice_debug ( pi -> hw , ICE_DBG_SCHED , " \n " , vsi_handle ) ; if ( ! ice_is_vsi_valid ( pi -> hw , vsi_handle ) ) return status ; ice_acquire_lock ( & pi -> sched_lock ) ; vsi_ctx = ice_get_vsi_ctx ( pi -> hw , vsi_handle ) ; if ( ! vsi_ctx ) goto exit_sched_rm_vsi_cfg ; ice_for_each_traffic_class ( i ) { struct ice_sched_node * vsi_node , * tc_node ; u8 j = 0 ; tc_node = ice_sched_get_tc_node ( pi , i ) ; if ( ! tc_node ) continue ; vsi_node = ice_sched_get_vsi_node ( pi , tc_node , vsi_handle ) ; if ( ! vsi_node ) continue ; if ( ice_sched_is_leaf_node_present ( vsi_node ) ) { ice_debug ( pi -> hw , ICE_DBG_SCHED , " \n " , i ) ; status = ICE_ERR_IN_USE ; goto exit_sched_rm_vsi_cfg ; } while ( j < vsi_node -> num_children ) { if ( vsi_node -> children [ j ] -> owner == owner ) { ice_free_sched_node ( pi , vsi_node -> children [ j ] ) ; j = 0 ; } else { j ++ ; } } if ( ! vsi_node -> num_children ) { ice_free_sched_node ( pi , vsi_node ) ; vsi_ctx -> sched . vsi_node [ i ] = NULL ; ice_sched_rm_agg_vsi_info ( pi , vsi_handle ) ; } if ( owner == ICE_SCHED_NODE_OWNER_LAN ) vsi_ctx -> sched . max_lanq [ i ] = 0 ; } status = ICE_SUCCESS ; exit_sched_rm_vsi_cfg : ice_release_lock ( & pi -> sched_lock ) ; return status ; }
ice_sched_rm_vsi_cfg - remove the VSI and its children nodes
 @pi: port information structure
 @vsi_handle: software VSI handle
 @owner: LAN or RDMA
ice_sched_rm_vsi_cfg - remove the VSI and its children nodes @pi : port information structure @vsi_handle : software VSI handle @owner : LAN or RDMA
/* reset the counter again since the num
				 * children will be updated after node removal
				 */ /* remove the VSI if it has no children */ /* clean up aggregator related VSI info if any */