[PATCH] net/vhost: report TX errors in port stats

Maxime Coquelin maxime.coquelin at redhat.com
Fri Oct 6 09:05:01 CEST 2023



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 at 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 at redhat.com>

Thanks,
Maxime



More information about the dev mailing list