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 C3EA8A3168 for ; Wed, 16 Oct 2019 15:18:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 14BAA1E89F; Wed, 16 Oct 2019 15:18:08 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 647B51E870 for ; Wed, 16 Oct 2019 15:18:06 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2019 06:18:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,303,1566889200"; d="scan'208";a="370796799" Received: from silpixa00399953.ir.intel.com (HELO silpixa00399953.ger.corp.intel.com) ([10.237.223.218]) by orsmga005.jf.intel.com with ESMTP; 16 Oct 2019 06:18:04 -0700 From: Ciara Power To: bruce.richardson@intel.com Cc: dev@dpdk.org, Ciara Power Date: Wed, 16 Oct 2019 14:16:26 +0100 Message-Id: <20191016131626.63781-1-ciara.power@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] raw/ioat: enable xstats reset for ioat device 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 rawdev xstats_reset function is now enabled. It is called when the ioat autotest completes, to reset all xstat values after they have been modified during testing. Signed-off-by: Ciara Power --- drivers/raw/ioat/ioat_rawdev.c | 38 +++++++++++++++++++++++++++++ drivers/raw/ioat/ioat_rawdev_test.c | 6 +++++ 2 files changed, 44 insertions(+) diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c index 7270ad7aa..af8414b34 100644 --- a/drivers/raw/ioat/ioat_rawdev.c +++ b/drivers/raw/ioat/ioat_rawdev.c @@ -161,6 +161,43 @@ ioat_xstats_get_names(const struct rte_rawdev *dev, return RTE_DIM(xstat_names); } +static int +ioat_xstats_reset(struct rte_rawdev *dev, const uint32_t *ids, uint32_t nb_ids) +{ + struct rte_ioat_rawdev *ioat = dev->dev_private; + unsigned int i; + + if (!ids) { + ioat->enqueue_failed = 0; + ioat->enqueued = 0; + ioat->started = 0; + ioat->completed = 0; + return 0; + } + + for (i = 0; i < nb_ids; i++) { + switch (ids[i]) { + case 0: + ioat->enqueue_failed = 0; + break; + case 1: + ioat->enqueued = 0; + break; + case 2: + ioat->started = 0; + break; + case 3: + ioat->completed = 0; + break; + default: + IOAT_PMD_WARN("Invalid xstat id - cannot reset value"); + break; + } + } + + return 0; +} + extern int ioat_rawdev_test(uint16_t dev_id); static int @@ -173,6 +210,7 @@ ioat_rawdev_create(const char *name, struct rte_pci_device *dev) .dev_info_get = ioat_dev_info_get, .xstats_get = ioat_xstats_get, .xstats_get_names = ioat_xstats_get_names, + .xstats_reset = ioat_xstats_reset, .dev_selftest = ioat_rawdev_test, }; diff --git a/drivers/raw/ioat/ioat_rawdev_test.c b/drivers/raw/ioat/ioat_rawdev_test.c index f6c7dbb80..61d4bd066 100644 --- a/drivers/raw/ioat/ioat_rawdev_test.c +++ b/drivers/raw/ioat/ioat_rawdev_test.c @@ -220,6 +220,11 @@ ioat_rawdev_test(uint16_t dev_id) } printf("\n"); + if (rte_rawdev_xstats_reset(dev_id, NULL, 0) != 0) { + printf("Error resetting xstat values\n"); + goto err; + } + rte_mempool_free(pool); free(snames); free(stats); @@ -227,6 +232,7 @@ ioat_rawdev_test(uint16_t dev_id) return 0; err: + rte_rawdev_xstats_reset(dev_id, NULL, 0); rte_mempool_free(pool); free(snames); free(stats); -- 2.17.1