Thread (65 messages) read the whole thread 65 messages, 4 authors, 2020-06-29

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

From: Ye Xiaolong <hidden>
Date: 2020-06-07 10:28:18

On 06/05, Ting Xu wrote:
quoted hunk ↗ jump to hunk
From: Qi Zhang <redacted>

Add support to get and reset Rx/Tx stats in DCF. Query stats
from PF.

Signed-off-by: Qi Zhang <redacted>
---
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help