src/dpdk/drivers/net/ice/base/ice_sched.c
enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw)
{
	struct ice_aqc_query_txsched_res_resp *buf;
	enum ice_status status = ICE_SUCCESS;
	__le16 max_sibl;
	u8 i;

	if (hw->layer_info)
		return status;

	buf = (struct ice_aqc_query_txsched_res_resp *)
		ice_malloc(hw, sizeof(*buf));
	if (!buf)
		return ICE_ERR_NO_MEMORY;

	status = ice_aq_query_sched_res(hw, sizeof(*buf), buf, NULL);
	if (status)
		goto sched_query_out;

	hw->num_tx_sched_layers = LE16_TO_CPU(buf->sched_props.logical_levels);
	hw->num_tx_sched_phys_layers =
		LE16_TO_CPU(buf->sched_props.phys_levels);
	hw->flattened_layers = buf->sched_props.flattening_bitmap;
	hw->max_cgds = buf->sched_props.max_pf_cgds;

	/* max sibling group size of current layer refers to the max children
	 * of the below layer node.
	 * layer 1 node max children will be layer 2 max sibling group size
	 * layer 2 node max children will be layer 3 max sibling group size
	 * and so on. This array will be populated from root (index 0) to
	 * qgroup layer 7. Leaf node has no children.
	 */
	for (i = 0; i < hw->num_tx_sched_layers - 1; i++) {
		max_sibl = buf->layer_props[i + 1].max_sibl_grp_sz;
		hw->max_children[i] = LE16_TO_CPU(max_sibl);
	}

	hw->layer_info = (struct ice_aqc_layer_props *)
			 ice_memdup(hw, buf->layer_props,
				    (hw->num_tx_sched_layers *
				     sizeof(*hw->layer_info)),
				    ICE_NONDMA_TO_NONDMA);
	if (!hw->layer_info) {
		status = ICE_ERR_NO_MEMORY;
		goto sched_query_out;
	}

sched_query_out:
	ice_free(hw, buf);
	return status;
}
/**
 * ice_sched_query_res_alloc - query the FW for num of logical sched layers
 * @hw: pointer to the HW struct
 *
 * query FW for allocated scheduler resources and store in HW struct
 */
query the FW for num of logical sched layers
@hw: pointer to the HW struct

query FW for allocated scheduler resources and store in HW struct
query the FW for num of logical sched layers @hw : pointer to the HW struct query FW for allocated scheduler resources and store in HW struct
enum ice_status ice_sched_query_res_alloc(struct ice_hw *hw)
{
	struct ice_aqc_query_txsched_res_resp *buf;
	enum ice_status status = ICE_SUCCESS;
	__le16 max_sibl;
	u8 i;
	if (hw->layer_info)
		return status;
	buf = (struct ice_aqc_query_txsched_res_resp *)
		ice_malloc(hw, sizeof(*buf));
	if (!buf)
		return ICE_ERR_NO_MEMORY;
	status = ice_aq_query_sched_res(hw, sizeof(*buf), buf, NULL);
	if (status)
		goto sched_query_out;
	hw->num_tx_sched_layers = LE16_TO_CPU(buf->sched_props.logical_levels);
	hw->num_tx_sched_phys_layers =
		LE16_TO_CPU(buf->sched_props.phys_levels);
	hw->flattened_layers = buf->sched_props.flattening_bitmap;
	hw->max_cgds = buf->sched_props.max_pf_cgds;
	for (i = 0; i < hw->num_tx_sched_layers - 1; i++) {
		max_sibl = buf->layer_props[i + 1].max_sibl_grp_sz;
		hw->max_children[i] = LE16_TO_CPU(max_sibl);
	}
	hw->layer_info = (struct ice_aqc_layer_props *)
			 ice_memdup(hw, buf->layer_props,
				    (hw->num_tx_sched_layers *
				     sizeof(*hw->layer_info)),
				    ICE_NONDMA_TO_NONDMA);
	if (!hw->layer_info) {
		status = ICE_ERR_NO_MEMORY;
		goto sched_query_out;
	}
sched_query_out:
	ice_free(hw, buf);
	return status;
}
enum ice_status ice_sched_query_res_alloc ( struct ice_hw * hw ) { struct ice_aqc_query_txsched_res_resp * buf ; enum ice_status status = ICE_SUCCESS ; __le16 max_sibl ; u8 i ; if ( hw -> layer_info ) return status ; buf = ( struct ice_aqc_query_txsched_res_resp * ) ice_malloc ( hw , sizeof ( * buf ) ) ; if ( ! buf ) return ICE_ERR_NO_MEMORY ; status = ice_aq_query_sched_res ( hw , sizeof ( * buf ) , buf , NULL ) ; if ( status ) goto sched_query_out ; hw -> num_tx_sched_layers = LE16_TO_CPU ( buf -> sched_props . logical_levels ) ; hw -> num_tx_sched_phys_layers = LE16_TO_CPU ( buf -> sched_props . phys_levels ) ; hw -> flattened_layers = buf -> sched_props . flattening_bitmap ; hw -> max_cgds = buf -> sched_props . max_pf_cgds ; for ( i = 0 ; i < hw -> num_tx_sched_layers - 1 ; i ++ ) { max_sibl = buf -> layer_props [ i + 1 ] . max_sibl_grp_sz ; hw -> max_children [ i ] = LE16_TO_CPU ( max_sibl ) ; } hw -> layer_info = ( struct ice_aqc_layer_props * ) ice_memdup ( hw , buf -> layer_props , ( hw -> num_tx_sched_layers * sizeof ( * hw -> layer_info ) ) , ICE_NONDMA_TO_NONDMA ) ; if ( ! hw -> layer_info ) { status = ICE_ERR_NO_MEMORY ; goto sched_query_out ; } sched_query_out : ice_free ( hw , buf ) ; return status ; }
ice_sched_query_res_alloc - query the FW for num of logical sched layers
 @hw: pointer to the HW struct
ice_sched_query_res_alloc - query the FW for num of logical sched layers @hw : pointer to the HW struct
/* max sibling group size of current layer refers to the max children
	 * of the below layer node.
	 * layer 1 node max children will be layer 2 max sibling group size
	 * layer 2 node max children will be layer 3 max sibling group size
	 * and so on. This array will be populated from root (index 0) to
	 * qgroup layer 7. Leaf node has no children.
	 */