Skip to contentSkip to conversation

net/vhost: report TX errors in port stats

PATCH Applied Andrey Ignatov 2 participants 3 messages Sep 30, 2023 – Oct 12, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/vhost: report TX errors in port stats

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

---
 drivers/net/vhost/rte_eth_vhost.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/vhost/rte_eth_vhost.c +4 -0
index 8d37ec9775..48a9a79efe 100644
@@ -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;
 }
Signature · 1 line
2.37.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · Andrey Ignatov

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
---
  drivers/net/vhost/rte_eth_vhost.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/net/vhost/rte_eth_vhost.c +3 -0
index 8d37ec9775..48a9a79efe 100644
@@ -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;

drivers/net/vhost/rte_eth_vhost.c eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) · line 1338

Quoted 10 lines
drivers/net/vhost/rte_eth_vhost.c +1 -0
  	}
 
  	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;
  }

Thanks,
Maxime

#2 lore raw
In reply to Andrey Ignatov
Quoted 32 lines · Andrey Ignatov

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
---
  drivers/net/vhost/rte_eth_vhost.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/net/vhost/rte_eth_vhost.c +3 -0
index 8d37ec9775..48a9a79efe 100644
@@ -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;

drivers/net/vhost/rte_eth_vhost.c eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) · line 1338

Quoted 10 lines
drivers/net/vhost/rte_eth_vhost.c +1 -0
  	}
 
  	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