src/dpdk/drivers/net/hns3/hns3_stats.c
static int
hns3_xstats_calc_num(struct rte_eth_dev *dev)
{
#define HNS3_PF_VF_RX_COMM_STATS_NUM	(HNS3_NUM_RX_BD_ERROR_XSTATS + \
					 HNS3_NUM_RXQ_DFX_XSTATS + \
					 HNS3_NUM_RX_QUEUE_STATS + \
					 HNS3_NUM_RXQ_BASIC_STATS)
#define HNS3_PF_VF_TX_COMM_STATS_NUM	(HNS3_NUM_TXQ_DFX_XSTATS + \
					 HNS3_NUM_TX_QUEUE_STATS + \
					 HNS3_NUM_TXQ_BASIC_STATS)

	struct hns3_adapter *hns = dev->data->dev_private;
	uint16_t nb_rx_q = dev->data->nb_rx_queues;
	uint16_t nb_tx_q = dev->data->nb_tx_queues;
	int rx_comm_stats_num = nb_rx_q * HNS3_PF_VF_RX_COMM_STATS_NUM;
	int tx_comm_stats_num = nb_tx_q * HNS3_PF_VF_TX_COMM_STATS_NUM;

	if (hns->is_vf)
		return rx_comm_stats_num + tx_comm_stats_num +
			HNS3_NUM_RESET_XSTATS;
	else
		return rx_comm_stats_num + tx_comm_stats_num +
			HNS3_FIX_NUM_STATS;
}
/* This function calculates the number of xstats based on the current config */
This function calculates the number of xstats based on the current config
This function calculates the number of xstats based on the current config
static int
hns3_xstats_calc_num(struct rte_eth_dev *dev)
{
#define HNS3_PF_VF_RX_COMM_STATS_NUM	(HNS3_NUM_RX_BD_ERROR_XSTATS + \
					 HNS3_NUM_RXQ_DFX_XSTATS + \
					 HNS3_NUM_RX_QUEUE_STATS + \
					 HNS3_NUM_RXQ_BASIC_STATS)
#define HNS3_PF_VF_TX_COMM_STATS_NUM	(HNS3_NUM_TXQ_DFX_XSTATS + \
					 HNS3_NUM_TX_QUEUE_STATS + \
					 HNS3_NUM_TXQ_BASIC_STATS)
	struct hns3_adapter *hns = dev->data->dev_private;
	uint16_t nb_rx_q = dev->data->nb_rx_queues;
	uint16_t nb_tx_q = dev->data->nb_tx_queues;
	int rx_comm_stats_num = nb_rx_q * HNS3_PF_VF_RX_COMM_STATS_NUM;
	int tx_comm_stats_num = nb_tx_q * HNS3_PF_VF_TX_COMM_STATS_NUM;
	if (hns->is_vf)
		return rx_comm_stats_num + tx_comm_stats_num +
			HNS3_NUM_RESET_XSTATS;
	else
		return rx_comm_stats_num + tx_comm_stats_num +
			HNS3_FIX_NUM_STATS;
}
static int hns3_xstats_calc_num ( struct rte_eth_dev * dev ) { #define HNS3_PF_VF_RX_COMM_STATS_NUM 	(HNS3_NUM_RX_BD_ERROR_XSTATS + \
					 HNS3_NUM_RXQ_DFX_XSTATS + \
					 HNS3_NUM_RX_QUEUE_STATS + \
					 HNS3_NUM_RXQ_BASIC_STATS) #define HNS3_PF_VF_TX_COMM_STATS_NUM 	(HNS3_NUM_TXQ_DFX_XSTATS + \
					 HNS3_NUM_TX_QUEUE_STATS + \
					 HNS3_NUM_TXQ_BASIC_STATS) struct hns3_adapter * hns = dev -> data -> dev_private ; uint16_t nb_rx_q = dev -> data -> nb_rx_queues ; uint16_t nb_tx_q = dev -> data -> nb_tx_queues ; int rx_comm_stats_num = nb_rx_q * HNS3_PF_VF_RX_COMM_STATS_NUM ; int tx_comm_stats_num = nb_tx_q * HNS3_PF_VF_TX_COMM_STATS_NUM ; if ( hns -> is_vf ) return rx_comm_stats_num + tx_comm_stats_num + HNS3_NUM_RESET_XSTATS ; else return rx_comm_stats_num + tx_comm_stats_num + HNS3_FIX_NUM_STATS ; }
This function calculates the number of xstats based on the current config
This function calculates the number of xstats based on the current config