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 24E27A0526; Tue, 21 Jul 2020 11:57:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E0F741C0C3; Tue, 21 Jul 2020 11:56:25 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id B638F1C0B5 for ; Tue, 21 Jul 2020 11:56:20 +0200 (CEST) IronPort-SDR: NAVZh+hGKctJYYHKtyDsHwl2KY4CnFqohfk18Re77S4ucYJ4XW7jokvHlof80NTpWvm4eDy9zj rURYHpOVeH7g== X-IronPort-AV: E=McAfee;i="6000,8403,9688"; a="138191463" X-IronPort-AV: E=Sophos;i="5.75,378,1589266800"; d="scan'208";a="138191463" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2020 02:56:20 -0700 IronPort-SDR: OHBg/NmTvaqtx4NQpHbIScJF4KPtFUMfmpu9P8ovEIEmtEkehnkd/jCfmc9q5S5tBoKHqzc0BN HqJnZhjWX76w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,378,1589266800"; d="scan'208";a="488024509" Received: from silpixa00399126.ir.intel.com ([10.237.222.36]) by fmsmga005.fm.intel.com with ESMTP; 21 Jul 2020 02:56:18 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: cheng1.jiang@intel.com, patrick.fu@intel.com, kevin.laatz@intel.com, Bruce Richardson Date: Tue, 21 Jul 2020 10:51:37 +0100 Message-Id: <20200721095140.719297-18-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200721095140.719297-1-bruce.richardson@intel.com> References: <20200721095140.719297-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 20.11 17/20] raw/ioat: create separate statistics structure 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" Rather than having the xstats as fields inside the main driver structure, create a separate structure type for them. Signed-off-by: Bruce Richardson --- drivers/raw/ioat/ioat_rawdev.c | 21 ++++++++---------- drivers/raw/ioat/rte_ioat_rawdev_fns.h | 30 ++++++++++++++++---------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c index 48fe32d0a..e4d39a2ee 100644 --- a/drivers/raw/ioat/ioat_rawdev.c +++ b/drivers/raw/ioat/ioat_rawdev.c @@ -135,10 +135,10 @@ ioat_xstats_get(const struct rte_rawdev *dev, const unsigned int ids[], for (i = 0; i < n; i++) { switch (ids[i]) { - case 0: values[i] = ioat->enqueue_failed; break; - case 1: values[i] = ioat->enqueued; break; - case 2: values[i] = ioat->started; break; - case 3: values[i] = ioat->completed; break; + case 0: values[i] = ioat->xstats.enqueue_failed; break; + case 1: values[i] = ioat->xstats.enqueued; break; + case 2: values[i] = ioat->xstats.started; break; + case 3: values[i] = ioat->xstats.completed; break; default: values[i] = 0; break; } } @@ -169,26 +169,23 @@ ioat_xstats_reset(struct rte_rawdev *dev, const uint32_t *ids, uint32_t nb_ids) unsigned int i; if (!ids) { - ioat->enqueue_failed = 0; - ioat->enqueued = 0; - ioat->started = 0; - ioat->completed = 0; + memset(&ioat->xstats, 0, sizeof(ioat->xstats)); return 0; } for (i = 0; i < nb_ids; i++) { switch (ids[i]) { case 0: - ioat->enqueue_failed = 0; + ioat->xstats.enqueue_failed = 0; break; case 1: - ioat->enqueued = 0; + ioat->xstats.enqueued = 0; break; case 2: - ioat->started = 0; + ioat->xstats.started = 0; break; case 3: - ioat->completed = 0; + ioat->xstats.completed = 0; break; default: IOAT_PMD_WARN("Invalid xstat id - cannot reset value"); diff --git a/drivers/raw/ioat/rte_ioat_rawdev_fns.h b/drivers/raw/ioat/rte_ioat_rawdev_fns.h index 98af40894..813c1a157 100644 --- a/drivers/raw/ioat/rte_ioat_rawdev_fns.h +++ b/drivers/raw/ioat/rte_ioat_rawdev_fns.h @@ -47,17 +47,31 @@ enum rte_ioat_dev_type { RTE_IDXD_DEV, }; +/** + * @internal + * some statistics for tracking, if added/changed update xstats fns + */ +struct rte_ioat_xstats { + uint64_t enqueue_failed; + uint64_t enqueued; + uint64_t started; + uint64_t completed; +}; + /** * @internal * Structure representing an IOAT device instance * Structure representing a device instance */ struct rte_ioat_rawdev { + /* common fields at the top - match those in rte_idxd_rawdev */ enum rte_ioat_dev_type type; + struct rte_ioat_xstats xstats; + struct rte_rawdev *rawdev; const struct rte_memzone *mz; const struct rte_memzone *desc_mz; - volatile uint16_t *doorbell; + volatile uint16_t *doorbell __rte_cache_aligned; phys_addr_t status_addr; phys_addr_t ring_addr; @@ -70,12 +84,6 @@ struct rte_ioat_rawdev { unsigned short next_read; unsigned short next_write; - /* some statistics for tracking, if added/changed update xstats fns*/ - uint64_t enqueue_failed __rte_cache_aligned; - uint64_t enqueued; - uint64_t started; - uint64_t completed; - /* to report completions, the device will write status back here */ volatile uint64_t status __rte_cache_aligned; @@ -207,7 +215,7 @@ __ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst, struct rte_ioat_generic_hw_desc *desc; if (space == 0) { - ioat->enqueue_failed++; + ioat->xstats.enqueue_failed++; return 0; } @@ -226,7 +234,7 @@ __ioat_enqueue_copy(int dev_id, phys_addr_t src, phys_addr_t dst, (int64_t)src_hdl); rte_prefetch0(&ioat->desc_ring[ioat->next_write & mask]); - ioat->enqueued++; + ioat->xstats.enqueued++; return 1; } @@ -241,7 +249,7 @@ __ioat_perform_ops(int dev_id) .control.completion_update = 1; rte_compiler_barrier(); *ioat->doorbell = ioat->next_write; - ioat->started = ioat->enqueued; + ioat->xstats.started = ioat->xstats.enqueued; } /** @@ -307,7 +315,7 @@ __ioat_completed_ops(int dev_id, uint8_t max_copies, end: ioat->next_read = read; - ioat->completed += count; + ioat->xstats.completed += count; return count; } -- 2.25.1