src/dpdk/drivers/net/hns3/hns3_stats.c
static int
hns3_mac_query_reg_num(struct rte_eth_dev *dev, uint32_t *desc_num)
{
	struct hns3_adapter *hns = dev->data->dev_private;
	struct hns3_hw *hw = &hns->hw;
	struct hns3_cmd_desc desc;
	uint32_t *desc_data;
	uint32_t reg_num;
	int ret;

	hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_QUERY_MAC_REG_NUM, true);
	ret = hns3_cmd_send(hw, &desc, 1);
	if (ret)
		return ret;

	/*
	 * The num of MAC statistics registers that are provided by IMP in this
	 * version.
	 */
	desc_data = (uint32_t *)(&desc.data[0]);
	reg_num = rte_le_to_cpu_32(*desc_data);

	/*
	 * The descriptor number of 'query_additional_mac_stat command' is
	 * '1 + (reg_num-3)/4 + ((reg_num-3)%4 !=0)';
	 * This value is 83 in this version
	 */
	*desc_num = 1 + ((reg_num - 3) >> 2) +
		    (uint32_t)(((reg_num - 3) & 0x3) ? 1 : 0);

	return 0;
}
/*
 * Query Mac stat reg num command ,opcode id: 0x0033.
 * This command is used before send 'query_mac_stat command', the descriptor
 * number of 'query_mac_stat command' must match with reg_num in this command.
 * @praram rte_stats
 *   Pointer to structure rte_eth_stats.
 * @return
 *   0 on success.
 */
Query Mac stat reg num command ,opcode id: 0x0033.
This command is used before send 'query_mac_stat command', the descriptor
number of 'query_mac_stat command' must match with reg_num in this command.
Query Mac stat reg num command opcode id : 0x0033 . This command is used before send ' query_mac_stat command ' the descriptor number of ' query_mac_stat command ' must match with reg_num in this command .
static int
hns3_mac_query_reg_num(struct rte_eth_dev *dev, uint32_t *desc_num)
{
	struct hns3_adapter *hns = dev->data->dev_private;
	struct hns3_hw *hw = &hns->hw;
	struct hns3_cmd_desc desc;
	uint32_t *desc_data;
	uint32_t reg_num;
	int ret;
	hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_QUERY_MAC_REG_NUM, true);
	ret = hns3_cmd_send(hw, &desc, 1);
	if (ret)
		return ret;
	desc_data = (uint32_t *)(&desc.data[0]);
	reg_num = rte_le_to_cpu_32(*desc_data);
	*desc_num = 1 + ((reg_num - 3) >> 2) +
		    (uint32_t)(((reg_num - 3) & 0x3) ? 1 : 0);
	return 0;
}
static int hns3_mac_query_reg_num ( struct rte_eth_dev * dev , uint32_t * desc_num ) { struct hns3_adapter * hns = dev -> data -> dev_private ; struct hns3_hw * hw = & hns -> hw ; struct hns3_cmd_desc desc ; uint32_t * desc_data ; uint32_t reg_num ; int ret ; hns3_cmd_setup_basic_desc ( & desc , HNS3_OPC_QUERY_MAC_REG_NUM , true ) ; ret = hns3_cmd_send ( hw , & desc , 1 ) ; if ( ret ) return ret ; desc_data = ( uint32_t * ) ( & desc . data [ 0 ] ) ; reg_num = rte_le_to_cpu_32 ( * desc_data ) ; * desc_num = 1 + ( ( reg_num - 3 ) >> 2 ) + ( uint32_t ) ( ( ( reg_num - 3 ) & 0x3 ) ? 1 : 0 ) ; return 0 ; }
Query Mac stat reg num command ,opcode id: 0x0033.
Query Mac stat reg num command opcode id : 0x0033 .
/*
	 * The num of MAC statistics registers that are provided by IMP in this
	 * version.
	 */ /*
	 * The descriptor number of 'query_additional_mac_stat command' is
	 * '1 + (reg_num-3)/4 + ((reg_num-3)%4 !=0)';
	 * This value is 83 in this version
	 */