From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f174.google.com (mail-we0-f174.google.com [74.125.82.174]) by dpdk.org (Postfix) with ESMTP id AF4F0A69 for ; Mon, 23 Mar 2015 11:42:51 +0100 (CET) Received: by weop45 with SMTP id p45so134146118weo.0 for ; Mon, 23 Mar 2015 03:42:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=XXvCVwailfchF8+YToYK/cKxt6HjvGDITFU5xzgEbWc=; b=gKc2VXdifoB80UUjc5hvIf/ZGYFCne/g/kJUOhr8UXWo2bKC6+Nb8h+DEa1+v751J9 W2fKDE1xRBuaOULKPfvgkRi0zAzqGNe3Ob0Uv4F2GgzC0iohaNxpNN1FhNDO3CwV4b+i erAQYXt8dMHCizTnd4q3azoLaoClvL8Yc8Y1mPxXPOjoHnpvOY3fUU1bYo0zB/U8yQ5P Gvvh0pgeQwZzoldjMH6maz/JZDZEzaj4wtxuud2p6XMOtUMDAO0ZszdWwY/Hh0FhrsXw 2G2mGA0vnRhETpZW++R1IL+bNi2ymMzQbGpfLbLcxM1hFpQZXNmu0byDeJmJD7k2gpYQ bXMw== X-Gm-Message-State: ALoCoQn+8nJwCYolYPFfIwy+EDwqYQPM58DODJ7IBOvEf4pC++QmZ+st9k7LjdybkoDllA4KmhZV X-Received: by 10.180.198.13 with SMTP id iy13mr18021904wic.7.1427107371500; Mon, 23 Mar 2015 03:42:51 -0700 (PDT) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id kr5sm808244wjc.1.2015.03.23.03.42.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Mar 2015 03:42:50 -0700 (PDT) From: Thomas Monjalon To: "Ouyang, Changchun" Date: Mon, 23 Mar 2015 11:42:10 +0100 Message-ID: <11509543.rOgWUoKvXr@xps13> Organization: 6WIND User-Agent: KMail/4.14.4 (Linux/3.18.4-1-ARCH; KDE/4.14.4; x86_64; ; ) In-Reply-To: <550FD107.8060109@intel.com> References: <1427093798-23078-1-git-send-email-changchun.ouyang@intel.com> <550FD107.8060109@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] virtio: Fix stats issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Mar 2015 10:42:51 -0000 2015-03-23 16:38, Ouyang, Changchun: > On 3/23/2015 3:20 PM, David Marchand wrote: > > On Mon, Mar 23, 2015 at 7:56 AM, Ouyang Changchun > > > wrote: > > > > It need clear/reset the stats information before count in all > > queues data. > > > > Signed-off-by: Changchun Ouyang > > > > --- > > lib/librte_pmd_virtio/virtio_ethdev.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c > > b/lib/librte_pmd_virtio/virtio_ethdev.c > > index 603be2d..e4cb55e 100644 > > --- a/lib/librte_pmd_virtio/virtio_ethdev.c > > +++ b/lib/librte_pmd_virtio/virtio_ethdev.c > > @@ -572,6 +572,10 @@ virtio_dev_stats_get(struct rte_eth_dev *dev, > > struct rte_eth_stats *stats) > > { > > unsigned i; > > > > + stats->opackets = 0; > > + stats->obytes = 0; > > + stats->oerrors = 0; > > > > > > stats are supposed to be zero'd in generic rte_ethdev.c before this > > pmd function is called, so this patch seems useless to me. > > Can you give some context ? > > > > Same comment for the i* part. > > > 2 reasons: > 1. this change could keep the stats_get has consistent behavior with the > one in other drivers; If there are some useless reset in other drivers, they should be removed. > 2. we don't rely on the assumption of caller always zero'd the stats, > and still can return correct value; The caller is ethdev and it is zero'ing the structure before the call: http://dpdk.org/browse/dpdk/commit/?id=02331c16ec0