[ovs-dev] fix vhost user stats
diff mbox

Message ID 1503548719-14087-1-git-send-email-wangzhike@jd.com
State Superseded
Delegated to: Darrell Ball
Headers show

Commit Message

Zhike Wang Aug. 24, 2017, 4:25 a.m. UTC
1. "+=" should be "="
2. tx_errors is a generic param, and should be 0 since vhost does not
   create such error.
   Or some app, like libvirt will complain for failure to find this key.

Signed-off-by: wangzhike <wangzhike@jd.com>
---
 lib/netdev-dpdk.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Darrell Ball Aug. 25, 2017, 12:42 a.m. UTC | #1
Hi Lawrence

    On 8/23/17, 9:25 PM, "ovs-dev-bounces@openvswitch.org on behalf of wangzhike" <ovs-dev-bounces@openvswitch.org on behalf of wangzhike@jd.com> wrote:
    
        1. "+=" should be "="
        2. tx_errors is a generic param, and should be 0 since vhost does not
           create such error.
           Or some app, like libvirt will complain for failure to find this key.
        
        Signed-off-by: wangzhike <wangzhike@jd.com>
        ---
         lib/netdev-dpdk.c | 7 ++++---
         1 file changed, 4 insertions(+), 3 deletions(-)
        
        diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
        index e90fd0e..1c50aa3 100644
        --- a/lib/netdev-dpdk.c
        +++ b/lib/netdev-dpdk.c
        @@ -2016,14 +2016,15 @@ netdev_dpdk_vhost_get_stats(const struct netdev *netdev,
         
             rte_spinlock_lock(&dev->stats_lock);
             /* Supported Stats */
        -    stats->rx_packets += dev->stats.rx_packets;
        -    stats->tx_packets += dev->stats.tx_packets;
        +    stats->rx_packets = dev->stats.rx_packets;
        +    stats->tx_packets = dev->stats.tx_packets;
             stats->rx_dropped = dev->stats.rx_dropped;
        -    stats->tx_dropped += dev->stats.tx_dropped;
        +    stats->tx_dropped = dev->stats.tx_dropped;


The above looks correct to me.


             stats->multicast = dev->stats.multicast;
             stats->rx_bytes = dev->stats.rx_bytes;
             stats->tx_bytes = dev->stats.tx_bytes;
             stats->rx_errors = dev->stats.rx_errors;
        +    stats->tx_errors = 0;

Typically, we only set what is supported by a particular netdev.
There are many others that fall into this category for netdev-dpdk vhost
Can you explain how you observed a problem by leaving tx_errors at the inited value for unsupported ?


             stats->rx_length_errors = dev->stats.rx_length_errors;
         
             stats->rx_1_to_64_packets = dev->stats.rx_1_to_64_packets;
        -- 
        1.8.3.1
        
        _______________________________________________
        dev mailing list
        dev@openvswitch.org
        https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=G2yxkmjSDSs1C5QHyvt_9_mCEZHww9omd5tSIH8ihgE&s=IdQYpNINPO3LgBWKaIiRhWuAMEvTC6qKHqGUVfoHfM8&e=

Patch
diff mbox

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index e90fd0e..1c50aa3 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2016,14 +2016,15 @@  netdev_dpdk_vhost_get_stats(const struct netdev *netdev,
 
     rte_spinlock_lock(&dev->stats_lock);
     /* Supported Stats */
-    stats->rx_packets += dev->stats.rx_packets;
-    stats->tx_packets += dev->stats.tx_packets;
+    stats->rx_packets = dev->stats.rx_packets;
+    stats->tx_packets = dev->stats.tx_packets;
     stats->rx_dropped = dev->stats.rx_dropped;
-    stats->tx_dropped += dev->stats.tx_dropped;
+    stats->tx_dropped = dev->stats.tx_dropped;
     stats->multicast = dev->stats.multicast;
     stats->rx_bytes = dev->stats.rx_bytes;
     stats->tx_bytes = dev->stats.tx_bytes;
     stats->rx_errors = dev->stats.rx_errors;
+    stats->tx_errors = 0;
     stats->rx_length_errors = dev->stats.rx_length_errors;
 
     stats->rx_1_to_64_packets = dev->stats.rx_1_to_64_packets;