src/dpdk/drivers/net/ice/base/ice_common.c
enum ice_status
ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,
		u16 *q_handles, u16 *q_ids, u32 *q_teids,
		enum ice_disq_rst_src rst_src, u16 vmvf_num,
		struct ice_sq_cd *cd)
{
	enum ice_status status = ICE_ERR_DOES_NOT_EXIST;
	struct ice_aqc_dis_txq_item *qg_list;
	struct ice_q_ctx *q_ctx;
	struct ice_hw *hw;
	u16 i, buf_size;

	if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)
		return ICE_ERR_CFG;

	hw = pi->hw;

	if (!num_queues) {
		/* if queue is disabled already yet the disable queue command
		 * has to be sent to complete the VF reset, then call
		 * ice_aq_dis_lan_txq without any queue information
		 */
		if (rst_src)
			return ice_aq_dis_lan_txq(hw, 0, NULL, 0, rst_src,
						  vmvf_num, NULL);
		return ICE_ERR_CFG;
	}

	buf_size = ice_struct_size(qg_list, q_id, 1);
	qg_list = (struct ice_aqc_dis_txq_item *)ice_malloc(hw, buf_size);
	if (!qg_list)
		return ICE_ERR_NO_MEMORY;

	ice_acquire_lock(&pi->sched_lock);

	for (i = 0; i < num_queues; i++) {
		struct ice_sched_node *node;

		node = ice_sched_find_node_by_teid(pi->root, q_teids[i]);
		if (!node)
			continue;
		q_ctx = ice_get_lan_q_ctx(hw, vsi_handle, tc, q_handles[i]);
		if (!q_ctx) {
			ice_debug(hw, ICE_DBG_SCHED, "invalid queue handle%d\n",
				  q_handles[i]);
			continue;
		}
		if (q_ctx->q_handle != q_handles[i]) {
			ice_debug(hw, ICE_DBG_SCHED, "Err:handles %d %d\n",
				  q_ctx->q_handle, q_handles[i]);
			continue;
		}
		qg_list->parent_teid = node->info.parent_teid;
		qg_list->num_qs = 1;
		qg_list->q_id[0] = CPU_TO_LE16(q_ids[i]);
		status = ice_aq_dis_lan_txq(hw, 1, qg_list, buf_size, rst_src,
					    vmvf_num, cd);

		if (status != ICE_SUCCESS)
			break;
		ice_free_sched_node(pi, node);
		q_ctx->q_handle = ICE_INVAL_Q_HANDLE;
	}
	ice_release_lock(&pi->sched_lock);
	ice_free(hw, qg_list);
	return status;
}
/**
 * ice_dis_vsi_txq
 * @pi: port information structure
 * @vsi_handle: software VSI handle
 * @tc: TC number
 * @num_queues: number of queues
 * @q_handles: pointer to software queue handle array
 * @q_ids: pointer to the q_id array
 * @q_teids: pointer to queue node teids
 * @rst_src: if called due to reset, specifies the reset source
 * @vmvf_num: the relative VM or VF number that is undergoing the reset
 * @cd: pointer to command details structure or NULL
 *
 * This function removes queues and their corresponding nodes in SW DB
 */


This function removes queues and their corresponding nodes in SW DB
This function removes queues and their corresponding nodes in SW DB
enum ice_status
ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,
		u16 *q_handles, u16 *q_ids, u32 *q_teids,
		enum ice_disq_rst_src rst_src, u16 vmvf_num,
		struct ice_sq_cd *cd)
{
	enum ice_status status = ICE_ERR_DOES_NOT_EXIST;
	struct ice_aqc_dis_txq_item *qg_list;
	struct ice_q_ctx *q_ctx;
	struct ice_hw *hw;
	u16 i, buf_size;
	if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)
		return ICE_ERR_CFG;
	hw = pi->hw;
	if (!num_queues) {
		if (rst_src)
			return ice_aq_dis_lan_txq(hw, 0, NULL, 0, rst_src,
						  vmvf_num, NULL);
		return ICE_ERR_CFG;
	}
	buf_size = ice_struct_size(qg_list, q_id, 1);
	qg_list = (struct ice_aqc_dis_txq_item *)ice_malloc(hw, buf_size);
	if (!qg_list)
		return ICE_ERR_NO_MEMORY;
	ice_acquire_lock(&pi->sched_lock);
	for (i = 0; i < num_queues; i++) {
		struct ice_sched_node *node;
		node = ice_sched_find_node_by_teid(pi->root, q_teids[i]);
		if (!node)
			continue;
		q_ctx = ice_get_lan_q_ctx(hw, vsi_handle, tc, q_handles[i]);
		if (!q_ctx) {
			ice_debug(hw, ICE_DBG_SCHED, "invalid queue handle%d\n",
				  q_handles[i]);
			continue;
		}
		if (q_ctx->q_handle != q_handles[i]) {
			ice_debug(hw, ICE_DBG_SCHED, "Err:handles %d %d\n",
				  q_ctx->q_handle, q_handles[i]);
			continue;
		}
		qg_list->parent_teid = node->info.parent_teid;
		qg_list->num_qs = 1;
		qg_list->q_id[0] = CPU_TO_LE16(q_ids[i]);
		status = ice_aq_dis_lan_txq(hw, 1, qg_list, buf_size, rst_src,
					    vmvf_num, cd);
		if (status != ICE_SUCCESS)
			break;
		ice_free_sched_node(pi, node);
		q_ctx->q_handle = ICE_INVAL_Q_HANDLE;
	}
	ice_release_lock(&pi->sched_lock);
	ice_free(hw, qg_list);
	return status;
}
enum ice_status ice_dis_vsi_txq ( struct ice_port_info * pi , u16 vsi_handle , u8 tc , u8 num_queues , u16 * q_handles , u16 * q_ids , u32 * q_teids , enum ice_disq_rst_src rst_src , u16 vmvf_num , struct ice_sq_cd * cd ) { enum ice_status status = ICE_ERR_DOES_NOT_EXIST ; struct ice_aqc_dis_txq_item * qg_list ; struct ice_q_ctx * q_ctx ; struct ice_hw * hw ; u16 i , buf_size ; if ( ! pi || pi -> port_state != ICE_SCHED_PORT_STATE_READY ) return ICE_ERR_CFG ; hw = pi -> hw ; if ( ! num_queues ) { if ( rst_src ) return ice_aq_dis_lan_txq ( hw , 0 , NULL , 0 , rst_src , vmvf_num , NULL ) ; return ICE_ERR_CFG ; } buf_size = ice_struct_size ( qg_list , q_id , 1 ) ; qg_list = ( struct ice_aqc_dis_txq_item * ) ice_malloc ( hw , buf_size ) ; if ( ! qg_list ) return ICE_ERR_NO_MEMORY ; ice_acquire_lock ( & pi -> sched_lock ) ; for ( i = 0 ; i < num_queues ; i ++ ) { struct ice_sched_node * node ; node = ice_sched_find_node_by_teid ( pi -> root , q_teids [ i ] ) ; if ( ! node ) continue ; q_ctx = ice_get_lan_q_ctx ( hw , vsi_handle , tc , q_handles [ i ] ) ; if ( ! q_ctx ) { ice_debug ( hw , ICE_DBG_SCHED , " \n " , q_handles [ i ] ) ; continue ; } if ( q_ctx -> q_handle != q_handles [ i ] ) { ice_debug ( hw , ICE_DBG_SCHED , " \n " , q_ctx -> q_handle , q_handles [ i ] ) ; continue ; } qg_list -> parent_teid = node -> info . parent_teid ; qg_list -> num_qs = 1 ; qg_list -> q_id [ 0 ] = CPU_TO_LE16 ( q_ids [ i ] ) ; status = ice_aq_dis_lan_txq ( hw , 1 , qg_list , buf_size , rst_src , vmvf_num , cd ) ; if ( status != ICE_SUCCESS ) break ; ice_free_sched_node ( pi , node ) ; q_ctx -> q_handle = ICE_INVAL_Q_HANDLE ; } ice_release_lock ( & pi -> sched_lock ) ; ice_free ( hw , qg_list ) ; return status ; }
ice_dis_vsi_txq
 @pi: port information structure
 @vsi_handle: software VSI handle
 @tc: TC number
 @num_queues: number of queues
 @q_handles: pointer to software queue handle array
 @q_ids: pointer to the q_id array
 @q_teids: pointer to queue node teids
 @rst_src: if called due to reset, specifies the reset source
 @vmvf_num: the relative VM or VF number that is undergoing the reset
 @cd: pointer to command details structure or NULL
ice_dis_vsi_txq @pi : port information structure @vsi_handle : software VSI handle @tc : TC number @num_queues : number of queues @q_handles : pointer to software queue handle array @q_ids : pointer to the q_id array @q_teids : pointer to queue node teids @rst_src : if called due to reset specifies the reset source @vmvf_num : the relative VM or VF number that is undergoing the reset @cd : pointer to command details structure or NULL
/* if queue is disabled already yet the disable queue command
		 * has to be sent to complete the VF reset, then call
		 * ice_aq_dis_lan_txq without any queue information
		 */