src/dpdk/drivers/net/ice/base/ice_sched.c
static enum ice_status
ice_sched_set_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
		       u16 q_handle, enum ice_rl_type rl_type, u32 bw)
{
	enum ice_status status = ICE_ERR_PARAM;
	struct ice_sched_node *node;
	struct ice_q_ctx *q_ctx;

	if (!ice_is_vsi_valid(pi->hw, vsi_handle))
		return ICE_ERR_PARAM;
	ice_acquire_lock(&pi->sched_lock);
	q_ctx = ice_get_lan_q_ctx(pi->hw, vsi_handle, tc, q_handle);
	if (!q_ctx)
		goto exit_q_bw_lmt;
	node = ice_sched_find_node_by_teid(pi->root, q_ctx->q_teid);
	if (!node) {
		ice_debug(pi->hw, ICE_DBG_SCHED, "Wrong q_teid\n");
		goto exit_q_bw_lmt;
	}

	/* Return error if it is not a leaf node */
	if (node->info.data.elem_type != ICE_AQC_ELEM_TYPE_LEAF)
		goto exit_q_bw_lmt;

	/* SRL bandwidth layer selection */
	if (rl_type == ICE_SHARED_BW) {
		u8 sel_layer; /* selected layer */

		sel_layer = ice_sched_get_rl_prof_layer(pi, rl_type,
							node->tx_sched_layer);
		if (sel_layer >= pi->hw->num_tx_sched_layers) {
			status = ICE_ERR_PARAM;
			goto exit_q_bw_lmt;
		}
		status = ice_sched_validate_srl_node(node, sel_layer);
		if (status)
			goto exit_q_bw_lmt;
	}

	if (bw == ICE_SCHED_DFLT_BW)
		status = ice_sched_set_node_bw_dflt_lmt(pi, node, rl_type);
	else
		status = ice_sched_set_node_bw_lmt(pi, node, rl_type, bw);

	if (!status)
		status = ice_sched_save_q_bw(q_ctx, rl_type, bw);

exit_q_bw_lmt:
	ice_release_lock(&pi->sched_lock);
	return status;
}
/**
 * ice_sched_set_q_bw_lmt - sets queue BW limit
 * @pi: port information structure
 * @vsi_handle: sw VSI handle
 * @tc: traffic class
 * @q_handle: software queue handle
 * @rl_type: min, max, or shared
 * @bw: bandwidth in Kbps
 *
 * This function sets BW limit of queue scheduling node.
 */


This function sets BW limit of queue scheduling node.
This function sets BW limit of queue scheduling node .
static enum ice_status
ice_sched_set_q_bw_lmt(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
		       u16 q_handle, enum ice_rl_type rl_type, u32 bw)
{
	enum ice_status status = ICE_ERR_PARAM;
	struct ice_sched_node *node;
	struct ice_q_ctx *q_ctx;
	if (!ice_is_vsi_valid(pi->hw, vsi_handle))
		return ICE_ERR_PARAM;
	ice_acquire_lock(&pi->sched_lock);
	q_ctx = ice_get_lan_q_ctx(pi->hw, vsi_handle, tc, q_handle);
	if (!q_ctx)
		goto exit_q_bw_lmt;
	node = ice_sched_find_node_by_teid(pi->root, q_ctx->q_teid);
	if (!node) {
		ice_debug(pi->hw, ICE_DBG_SCHED, "Wrong q_teid\n");
		goto exit_q_bw_lmt;
	}
	if (node->info.data.elem_type != ICE_AQC_ELEM_TYPE_LEAF)
		goto exit_q_bw_lmt;
	if (rl_type == ICE_SHARED_BW) {
		u8 sel_layer; 
		sel_layer = ice_sched_get_rl_prof_layer(pi, rl_type,
							node->tx_sched_layer);
		if (sel_layer >= pi->hw->num_tx_sched_layers) {
			status = ICE_ERR_PARAM;
			goto exit_q_bw_lmt;
		}
		status = ice_sched_validate_srl_node(node, sel_layer);
		if (status)
			goto exit_q_bw_lmt;
	}
	if (bw == ICE_SCHED_DFLT_BW)
		status = ice_sched_set_node_bw_dflt_lmt(pi, node, rl_type);
	else
		status = ice_sched_set_node_bw_lmt(pi, node, rl_type, bw);
	if (!status)
		status = ice_sched_save_q_bw(q_ctx, rl_type, bw);
exit_q_bw_lmt:
	ice_release_lock(&pi->sched_lock);
	return status;
}
static enum ice_status ice_sched_set_q_bw_lmt ( struct ice_port_info * pi , u16 vsi_handle , u8 tc , u16 q_handle , enum ice_rl_type rl_type , u32 bw ) { enum ice_status status = ICE_ERR_PARAM ; struct ice_sched_node * node ; struct ice_q_ctx * q_ctx ; if ( ! ice_is_vsi_valid ( pi -> hw , vsi_handle ) ) return ICE_ERR_PARAM ; ice_acquire_lock ( & pi -> sched_lock ) ; q_ctx = ice_get_lan_q_ctx ( pi -> hw , vsi_handle , tc , q_handle ) ; if ( ! q_ctx ) goto exit_q_bw_lmt ; node = ice_sched_find_node_by_teid ( pi -> root , q_ctx -> q_teid ) ; if ( ! node ) { ice_debug ( pi -> hw , ICE_DBG_SCHED , " \n " ) ; goto exit_q_bw_lmt ; } if ( node -> info . data . elem_type != ICE_AQC_ELEM_TYPE_LEAF ) goto exit_q_bw_lmt ; if ( rl_type == ICE_SHARED_BW ) { u8 sel_layer ; sel_layer = ice_sched_get_rl_prof_layer ( pi , rl_type , node -> tx_sched_layer ) ; if ( sel_layer >= pi -> hw -> num_tx_sched_layers ) { status = ICE_ERR_PARAM ; goto exit_q_bw_lmt ; } status = ice_sched_validate_srl_node ( node , sel_layer ) ; if ( status ) goto exit_q_bw_lmt ; } if ( bw == ICE_SCHED_DFLT_BW ) status = ice_sched_set_node_bw_dflt_lmt ( pi , node , rl_type ) ; else status = ice_sched_set_node_bw_lmt ( pi , node , rl_type , bw ) ; if ( ! status ) status = ice_sched_save_q_bw ( q_ctx , rl_type , bw ) ; exit_q_bw_lmt : ice_release_lock ( & pi -> sched_lock ) ; return status ; }
ice_sched_set_q_bw_lmt - sets queue BW limit
 @pi: port information structure
 @vsi_handle: sw VSI handle
 @tc: traffic class
 @q_handle: software queue handle
 @rl_type: min, max, or shared
 @bw: bandwidth in Kbps
ice_sched_set_q_bw_lmt - sets queue BW limit @pi : port information structure @vsi_handle : sw VSI handle @tc : traffic class @q_handle : software queue handle @rl_type : min max or shared @bw : bandwidth in Kbps
/* Return error if it is not a leaf node */ /* SRL bandwidth layer selection */ /* selected layer */