From patchwork Thu Aug 24 04:25:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhike Wang X-Patchwork-Id: 805231 X-Patchwork-Delegate: dlu998@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xdB7C34Lkz9rvt for ; Thu, 24 Aug 2017 14:25:59 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 7ED0FA49; Thu, 24 Aug 2017 04:25:55 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 989449EE for ; Thu, 24 Aug 2017 04:25:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp.jd.com (smtp.jd.com [58.83.206.59]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2E207110 for ; Thu, 24 Aug 2017 04:25:52 +0000 (UTC) Received: from USHUB02.360buyAD.local (172.26.2.76) by hub04.360buyAD.local (172.17.27.18) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 24 Aug 2017 12:25:51 +0800 Received: from localhost.localdomain (39.109.125.70) by USHUB02.360buyAD.local (138.229.76.5) with Microsoft SMTP Server id 14.3.123.3; Thu, 24 Aug 2017 12:25:36 +0800 From: wangzhike To: Date: Wed, 23 Aug 2017 21:25:19 -0700 Message-ID: <1503548719-14087-1-git-send-email-wangzhike@jd.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [39.109.125.70] Cc: wangzhike Subject: [ovs-dev] [PATCH] fix vhost user stats X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 --- 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; 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;