DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] ethdev: clarify what is included in generic byte statistics
@ 2021-01-20 12:44 Andrew Rybchenko
  2021-01-20 12:44 ` [dpdk-dev] [PATCH 2/2] net/sfc: fix generic byte statistics to exclude FCS bytes Andrew Rybchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrew Rybchenko @ 2021-01-20 12:44 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit
  Cc: dev, Stephen Hemminger, Viacheslav Galaktionov

From: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>

Different hardware gathers statistics differently, so some general
rules need to be established.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 lib/librte_ethdev/rte_ethdev.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index f5f8919186..a2dce7c161 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -240,6 +240,9 @@ void rte_eth_iterator_cleanup(struct rte_dev_iterator *iter);
  * Not all statistics fields in struct rte_eth_stats are supported
  * by any type of network interface card (NIC). If any statistics
  * field is not supported, its value is 0.
+ * All byte-related statistics do not include Ethernet FCS regardless
+ * of whether these bytes have been delivered to the application
+ * (see DEV_RX_OFFLOAD_KEEP_CRC).
  */
 struct rte_eth_stats {
 	uint64_t ipackets;  /**< Total number of successfully received packets. */
-- 
2.29.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH 2/2] net/sfc: fix generic byte statistics to exclude FCS bytes
  2021-01-20 12:44 [dpdk-dev] [PATCH 1/2] ethdev: clarify what is included in generic byte statistics Andrew Rybchenko
@ 2021-01-20 12:44 ` Andrew Rybchenko
  2021-01-27 11:21 ` [dpdk-dev] [PATCH 1/2] ethdev: clarify what is included in generic byte statistics Ferruh Yigit
  2021-01-27 11:31 ` Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Rybchenko @ 2021-01-20 12:44 UTC (permalink / raw)
  To: Andrew Lee, Robert Stonehouse
  Cc: dev, Stephen Hemminger, Viacheslav Galaktionov, stable

From: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>

Generic byte statistics should not include Ethernet FCS bytes.

Fixes: 1caab2f1e684 ("net/sfc: add basic statistics")
Cc: stable@dpdk.org

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 drivers/net/sfc/sfc_ethdev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c
index 93fc7baa0d..f5007c84ad 100644
--- a/drivers/net/sfc/sfc_ethdev.c
+++ b/drivers/net/sfc/sfc_ethdev.c
@@ -640,10 +640,19 @@ sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 			mac_stats[EFX_MAC_VADAPTER_TX_BROADCAST_BYTES];
 		stats->imissed = mac_stats[EFX_MAC_VADAPTER_RX_BAD_PACKETS];
 		stats->oerrors = mac_stats[EFX_MAC_VADAPTER_TX_BAD_PACKETS];
+
+		/* CRC is included in these stats, but shouldn't be */
+		stats->ibytes -= stats->ipackets * RTE_ETHER_CRC_LEN;
+		stats->obytes -= stats->opackets * RTE_ETHER_CRC_LEN;
 	} else {
 		stats->opackets = mac_stats[EFX_MAC_TX_PKTS];
 		stats->ibytes = mac_stats[EFX_MAC_RX_OCTETS];
 		stats->obytes = mac_stats[EFX_MAC_TX_OCTETS];
+
+		/* CRC is included in these stats, but shouldn't be */
+		stats->ibytes -= mac_stats[EFX_MAC_RX_PKTS] * RTE_ETHER_CRC_LEN;
+		stats->obytes -= mac_stats[EFX_MAC_TX_PKTS] * RTE_ETHER_CRC_LEN;
+
 		/*
 		 * Take into account stats which are whenever supported
 		 * on EF10. If some stat is not supported by current
-- 
2.29.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] ethdev: clarify what is included in generic byte statistics
  2021-01-20 12:44 [dpdk-dev] [PATCH 1/2] ethdev: clarify what is included in generic byte statistics Andrew Rybchenko
  2021-01-20 12:44 ` [dpdk-dev] [PATCH 2/2] net/sfc: fix generic byte statistics to exclude FCS bytes Andrew Rybchenko
@ 2021-01-27 11:21 ` Ferruh Yigit
  2021-01-27 11:31 ` Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2021-01-27 11:21 UTC (permalink / raw)
  To: Andrew Rybchenko, Thomas Monjalon
  Cc: dev, Stephen Hemminger, Viacheslav Galaktionov

On 1/20/2021 12:44 PM, Andrew Rybchenko wrote:
> From: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
> 
> Different hardware gathers statistics differently, so some general
> rules need to be established.
> 
> Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] ethdev: clarify what is included in generic byte statistics
  2021-01-20 12:44 [dpdk-dev] [PATCH 1/2] ethdev: clarify what is included in generic byte statistics Andrew Rybchenko
  2021-01-20 12:44 ` [dpdk-dev] [PATCH 2/2] net/sfc: fix generic byte statistics to exclude FCS bytes Andrew Rybchenko
  2021-01-27 11:21 ` [dpdk-dev] [PATCH 1/2] ethdev: clarify what is included in generic byte statistics Ferruh Yigit
@ 2021-01-27 11:31 ` Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2021-01-27 11:31 UTC (permalink / raw)
  To: Andrew Rybchenko, Thomas Monjalon
  Cc: dev, Stephen Hemminger, Viacheslav Galaktionov

On 1/20/2021 12:44 PM, Andrew Rybchenko wrote:
> From: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
> 
> Different hardware gathers statistics differently, so some general
> rules need to be established.
> 
> Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-01-27 11:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 12:44 [dpdk-dev] [PATCH 1/2] ethdev: clarify what is included in generic byte statistics Andrew Rybchenko
2021-01-20 12:44 ` [dpdk-dev] [PATCH 2/2] net/sfc: fix generic byte statistics to exclude FCS bytes Andrew Rybchenko
2021-01-27 11:21 ` [dpdk-dev] [PATCH 1/2] ethdev: clarify what is included in generic byte statistics Ferruh Yigit
2021-01-27 11:31 ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).