From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E59BA0613 for ; Tue, 27 Aug 2019 23:35:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5CCB11C1E1; Tue, 27 Aug 2019 23:35:43 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3BF7B1C1D0; Tue, 27 Aug 2019 23:35:41 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Aug 2019 14:35:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,438,1559545200"; d="scan'208";a="174702026" Received: from txasoft-yocto.an.intel.com ([10.123.72.192]) by orsmga008.jf.intel.com with ESMTP; 27 Aug 2019 14:35:39 -0700 From: Gage Eads To: dev@dpdk.org Cc: bruce.richardson@intel.com, harry.van.haaren@intel.com, stable@dpdk.org Date: Tue, 27 Aug 2019 16:34:59 -0500 Message-Id: <20190827213459.23441-1-gage.eads@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] event/sw: fix xstats reset value assignment bug X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The sw PMD implements xstats reset by having the xstat get operations return a value to the statistic's value at the last reset. The value at the last reset is maintained in the per-xstat reset_value field, but the PMD was setting reset_value = current - reset_value instead of reset_value = current. Fixes: c1ad03df7ad5 ("event/sw: support xstats") Cc: stable@dpdk.org Signed-off-by: Gage Eads --- drivers/event/sw/sw_evdev_xstats.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/event/sw/sw_evdev_xstats.c b/drivers/event/sw/sw_evdev_xstats.c index 7a6caa64d..90664903b 100644 --- a/drivers/event/sw/sw_evdev_xstats.c +++ b/drivers/event/sw/sw_evdev_xstats.c @@ -491,7 +491,7 @@ sw_xstats_update(struct sw_evdev *sw, enum rte_event_dev_xstats_mode mode, values[xidx] = val; if (xs->reset_allowed && reset) - xs->reset_value = val; + xs->reset_value += val; xidx++; } @@ -544,8 +544,7 @@ sw_xstats_reset_range(struct sw_evdev *sw, uint32_t start, uint32_t num) if (!xs->reset_allowed) continue; - uint64_t val = xs->fn(sw, xs->obj_idx, xs->stat, xs->extra_arg) - - xs->reset_value; + uint64_t val = xs->fn(sw, xs->obj_idx, xs->stat, xs->extra_arg); xs->reset_value = val; } } -- 2.13.6