[ovs-dev] [PATCH v3 3/4] netdev-dpdk: Add stats for vhost tx retries.

Kevin Traynor ktraynor at redhat.com
Thu Jun 27 11:12:31 UTC 2019


vhost tx retries may occur, and it can be a sign that
the guest is not optimally configured.

Add some stats so a user will know if vhost tx retries are
occurring and hence give a hint that guest config should be
examined.

Signed-off-by: Kevin Traynor <ktraynor at redhat.com>
Acked-by: Flavio Leitner <fbl at sysclose.org>
Acked-by: Eelco Chaudron <echaudro at redhat.com>
---
 Documentation/topics/dpdk/vhost-user.rst | 5 +++++
 include/openvswitch/netdev.h             | 1 +
 lib/netdev-dpdk.c                        | 7 +++++--
 vswitchd/bridge.c                        | 3 ++-
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/Documentation/topics/dpdk/vhost-user.rst b/Documentation/topics/dpdk/vhost-user.rst
index 1dd02b8b6..3caa88231 100644
--- a/Documentation/topics/dpdk/vhost-user.rst
+++ b/Documentation/topics/dpdk/vhost-user.rst
@@ -112,4 +112,9 @@ The guest should also have sufficient cores dedicated for consuming and
 processing packets at the required rate.
 
+The amount of Tx retries on a vhost-user or vhost-user-client interface can be
+shown with::
+
+  ovs-vsctl get Interface dpdkvhostclient0 statistics:tx_retries
+
 .. _dpdk-vhost-user:
 
diff --git a/include/openvswitch/netdev.h b/include/openvswitch/netdev.h
index 0c10f7b48..4d18b9f66 100644
--- a/include/openvswitch/netdev.h
+++ b/include/openvswitch/netdev.h
@@ -46,4 +46,5 @@ struct netdev_stats {
     uint64_t multicast;         /* Multicast packets received. */
     uint64_t collisions;
+    uint64_t tx_retries;        /* Retries when unable to transmit.*/
 
     /* Detailed receive errors. */
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 0f3b9c6f4..65161deaf 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2298,5 +2298,6 @@ netdev_dpdk_vhost_update_tx_counters(struct netdev_stats *stats,
                                      struct dp_packet **packets,
                                      int attempted,
-                                     int dropped)
+                                     int dropped,
+                                     int retries)
 {
     int i;
@@ -2305,4 +2306,5 @@ netdev_dpdk_vhost_update_tx_counters(struct netdev_stats *stats,
     stats->tx_packets += sent;
     stats->tx_dropped += dropped;
+    stats->tx_retries += retries;
 
     for (i = 0; i < sent; i++) {
@@ -2359,5 +2361,5 @@ __netdev_dpdk_vhost_send(struct netdev *netdev, int qid,
     rte_spinlock_lock(&dev->stats_lock);
     netdev_dpdk_vhost_update_tx_counters(&dev->stats, pkts, total_pkts,
-                                         cnt + dropped);
+                                         cnt + dropped, retries);
     rte_spinlock_unlock(&dev->stats_lock);
 
@@ -2597,4 +2599,5 @@ netdev_dpdk_vhost_get_stats(const struct netdev *netdev,
     stats->rx_errors = dev->stats.rx_errors;
     stats->rx_length_errors = dev->stats.rx_length_errors;
+    stats->tx_retries = dev->stats.tx_retries;
 
     stats->rx_1_to_64_packets = dev->stats.rx_1_to_64_packets;
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 2976771ae..3dab8d4c7 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -2409,5 +2409,6 @@ iface_refresh_stats(struct iface *iface)
     IFACE_STAT(rx_oversize_errors,      "rx_oversize_errors")       \
     IFACE_STAT(rx_fragmented_errors,    "rx_fragmented_errors")     \
-    IFACE_STAT(rx_jabber_errors,        "rx_jabber_errors")
+    IFACE_STAT(rx_jabber_errors,        "rx_jabber_errors")         \
+    IFACE_STAT(tx_retries,              "tx_retries")
 
 #define IFACE_STAT(MEMBER, NAME) + 1
-- 
2.20.1



More information about the dev mailing list