net/vhost: report TX errors in port stats

Message ID 20230930010024.34377-1-rdna@apple.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series net/vhost: report TX errors in port stats |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

Andrey Ignatov Sept. 30, 2023, 1 a.m. UTC
  vhost device doesn't report TX errors what complicates debugging of
dropped packets. Add oerrors to port stats.

- before (testpmd `show port stats`):
  TX-packets: 18328512   TX-errors: 0          TX-bytes:  1173024768

- after:
  TX-packets: 1737728    TX-errors: 131367616  TX-bytes:  111214592

Signed-off-by: Andrey Ignatov <rdna@apple.com>
---
 drivers/net/vhost/rte_eth_vhost.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Maxime Coquelin Oct. 6, 2023, 7:05 a.m. UTC | #1
On 9/30/23 03:00, Andrey Ignatov wrote:
> vhost device doesn't report TX errors what complicates debugging of
> dropped packets. Add oerrors to port stats.
> 
> - before (testpmd `show port stats`):
>    TX-packets: 18328512   TX-errors: 0          TX-bytes:  1173024768
> 
> - after:
>    TX-packets: 1737728    TX-errors: 131367616  TX-bytes:  111214592
> 
> Signed-off-by: Andrey Ignatov <rdna@apple.com>
> ---
>   drivers/net/vhost/rte_eth_vhost.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index 8d37ec9775..48a9a79efe 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -1299,6 +1299,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>   	unsigned i;
>   	unsigned long rx_total = 0, tx_total = 0;
>   	unsigned long rx_total_bytes = 0, tx_total_bytes = 0;
> +	unsigned long tx_total_errors = 0;
>   	struct vhost_queue *vq;
>   
>   	for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS &&
> @@ -1323,12 +1324,15 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>   
>   		stats->q_obytes[i] = vq->stats.bytes;
>   		tx_total_bytes += stats->q_obytes[i];
> +
> +		tx_total_errors += vq->stats.missed_pkts;
>   	}
>   
>   	stats->ipackets = rx_total;
>   	stats->opackets = tx_total;
>   	stats->ibytes = rx_total_bytes;
>   	stats->obytes = tx_total_bytes;
> +	stats->oerrors = tx_total_errors;
>   
>   	return 0;
>   }

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  
Maxime Coquelin Oct. 12, 2023, 1:49 p.m. UTC | #2
On 9/30/23 03:00, Andrey Ignatov wrote:
> vhost device doesn't report TX errors what complicates debugging of
> dropped packets. Add oerrors to port stats.
> 
> - before (testpmd `show port stats`):
>    TX-packets: 18328512   TX-errors: 0          TX-bytes:  1173024768
> 
> - after:
>    TX-packets: 1737728    TX-errors: 131367616  TX-bytes:  111214592
> 
> Signed-off-by: Andrey Ignatov <rdna@apple.com>
> ---
>   drivers/net/vhost/rte_eth_vhost.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
> index 8d37ec9775..48a9a79efe 100644
> --- a/drivers/net/vhost/rte_eth_vhost.c
> +++ b/drivers/net/vhost/rte_eth_vhost.c
> @@ -1299,6 +1299,7 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>   	unsigned i;
>   	unsigned long rx_total = 0, tx_total = 0;
>   	unsigned long rx_total_bytes = 0, tx_total_bytes = 0;
> +	unsigned long tx_total_errors = 0;
>   	struct vhost_queue *vq;
>   
>   	for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS &&
> @@ -1323,12 +1324,15 @@ eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
>   
>   		stats->q_obytes[i] = vq->stats.bytes;
>   		tx_total_bytes += stats->q_obytes[i];
> +
> +		tx_total_errors += vq->stats.missed_pkts;
>   	}
>   
>   	stats->ipackets = rx_total;
>   	stats->opackets = tx_total;
>   	stats->ibytes = rx_total_bytes;
>   	stats->obytes = tx_total_bytes;
> +	stats->oerrors = tx_total_errors;
>   
>   	return 0;
>   }

Applied to nex-virtio/for-next-net.

Thanks,
Maxime
  

Patch

diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 8d37ec9775..48a9a79efe 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -1299,6 +1299,7 @@  eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 	unsigned i;
 	unsigned long rx_total = 0, tx_total = 0;
 	unsigned long rx_total_bytes = 0, tx_total_bytes = 0;
+	unsigned long tx_total_errors = 0;
 	struct vhost_queue *vq;
 
 	for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS &&
@@ -1323,12 +1324,15 @@  eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 
 		stats->q_obytes[i] = vq->stats.bytes;
 		tx_total_bytes += stats->q_obytes[i];
+
+		tx_total_errors += vq->stats.missed_pkts;
 	}
 
 	stats->ipackets = rx_total;
 	stats->opackets = tx_total;
 	stats->ibytes = rx_total_bytes;
 	stats->obytes = tx_total_bytes;
+	stats->oerrors = tx_total_errors;
 
 	return 0;
 }