[dpdk-dev] [PATCH v1 10/12] net/ice: enable stats for DCF

Ye Xiaolong xiaolong.ye at intel.com
Sun Jun 7 12:19:59 CEST 2020


On 06/05, Ting Xu wrote:
>From: Qi Zhang <qi.z.zhang at intel.com>
>
>Add support to get and reset Rx/Tx stats in DCF. Query stats
>from PF.
>
>Signed-off-by: Qi Zhang <qi.z.zhang at intel.com>
>---
> drivers/net/ice/ice_dcf.c        |  27 ++++++++
> drivers/net/ice/ice_dcf.h        |   4 ++
> drivers/net/ice/ice_dcf_ethdev.c | 102 +++++++++++++++++++++++++++----
> 3 files changed, 120 insertions(+), 13 deletions(-)
>
>diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c

[snip]

>+static int
>+ice_dcf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>+{
>+	struct ice_dcf_adapter *ad = dev->data->dev_private;
>+	struct ice_dcf_hw *hw = &ad->real_hw;
>+	struct virtchnl_eth_stats pstats;
>+	int ret;
>+
>+	ret = ice_dcf_query_stats(hw, &pstats);
>+	if (ret == 0) {
>+		ice_dcf_update_stats(&hw->eth_stats_offset, &pstats);
>+		stats->ipackets = pstats.rx_unicast + pstats.rx_multicast +
>+				pstats.rx_broadcast - pstats.rx_discards;
>+		stats->opackets = pstats.tx_broadcast + pstats.tx_multicast +
>+						pstats.tx_unicast;
>+		stats->imissed = pstats.rx_discards;
>+		stats->oerrors = pstats.tx_errors + pstats.tx_discards;
>+		stats->ibytes = pstats.rx_bytes;
>+		stats->ibytes -= stats->ipackets * RTE_ETHER_CRC_LEN;
>+		stats->obytes = pstats.tx_bytes;
>+	} else {
>+		PMD_DRV_LOG(ERR, "Get statistics failed");
>+	}
>+	return -EIO;

Return -EIO even on success seems not correct.

>+}
>+
>+static int
>+ice_dcf_stats_reset(struct rte_eth_dev *dev)
>+{
>+	struct ice_dcf_adapter *ad = dev->data->dev_private;
>+	struct ice_dcf_hw *hw = &ad->real_hw;
>+	struct virtchnl_eth_stats pstats;
>+	int ret;
>+
>+	/* read stat values to clear hardware registers */
>+	ret = ice_dcf_query_stats(hw, &pstats);
>+	if (ret != 0)
>+		return ret;
>+
>+	/* set stats offset base on current values */
>+	hw->eth_stats_offset = pstats;
>+
>+	return 0;
>+}
>+
> static void
> ice_dcf_dev_close(struct rte_eth_dev *dev)
> {
>-- 
>2.17.1
>


More information about the dev mailing list