From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B2B5BA0548; Fri, 27 Aug 2021 19:22:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6F3E941296; Fri, 27 Aug 2021 19:21:33 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id D0166411E7 for ; Fri, 27 Aug 2021 19:21:30 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10089"; a="198235964" X-IronPort-AV: E=Sophos;i="5.84,357,1620716400"; d="scan'208";a="198235964" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2021 10:21:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,357,1620716400"; d="scan'208";a="445009616" Received: from silpixa00401122.ir.intel.com ([10.55.128.10]) by orsmga002.jf.intel.com with ESMTP; 27 Aug 2021 10:21:28 -0700 From: Kevin Laatz To: dev@dpdk.org Cc: bruce.richardson@intel.com, fengchengwen@huawei.com, jerinj@marvell.com, conor.walsh@intel.com, Kevin Laatz Date: Fri, 27 Aug 2021 17:20:47 +0000 Message-Id: <20210827172048.558704-13-kevin.laatz@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210827172048.558704-1-kevin.laatz@intel.com> References: <20210827172048.558704-1-kevin.laatz@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 12/13] dma/idxd: add operation statistic tracking X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Add statistic tracking for DSA devices. Signed-off-by: Bruce Richardson Signed-off-by: Kevin Laatz --- doc/guides/dmadevs/idxd.rst | 11 +++++++++++ drivers/dma/idxd/idxd_bus.c | 2 ++ drivers/dma/idxd/idxd_common.c | 23 +++++++++++++++++++++++ drivers/dma/idxd/idxd_internal.h | 3 +++ 4 files changed, 39 insertions(+) diff --git a/doc/guides/dmadevs/idxd.rst b/doc/guides/dmadevs/idxd.rst index 8bf99ef453..ba8bbac8b7 100644 --- a/doc/guides/dmadevs/idxd.rst +++ b/doc/guides/dmadevs/idxd.rst @@ -242,3 +242,14 @@ of memory is overwritten, or filled, with a short pattern of data. Fill operations can be performed in much the same was as copy operations described above, just using the ``rte_dmadev_fill()`` function rather than the ``rte_dmadev_copy()`` function. + +Querying Device Statistics +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The statistics from the IDXD dmadev device can be got via the stats functions in +the ``rte_dmadev`` library, i.e. ``rte_dmadev_stats_get()``. The statistics +returned for each device instance are: + +* ``submitted_count`` +* ``completed_fail_count`` +* ``completed_count`` diff --git a/drivers/dma/idxd/idxd_bus.c b/drivers/dma/idxd/idxd_bus.c index ad4f076bad..9482dab9be 100644 --- a/drivers/dma/idxd/idxd_bus.c +++ b/drivers/dma/idxd/idxd_bus.c @@ -98,6 +98,8 @@ static const struct rte_dmadev_ops idxd_vdev_ops = { .dev_configure = idxd_configure, .vchan_setup = idxd_vchan_setup, .dev_info_get = idxd_info_get, + .stats_get = idxd_stats_get, + .stats_reset = idxd_stats_reset, }; static void * diff --git a/drivers/dma/idxd/idxd_common.c b/drivers/dma/idxd/idxd_common.c index 50b205d92f..2f5addb359 100644 --- a/drivers/dma/idxd/idxd_common.c +++ b/drivers/dma/idxd/idxd_common.c @@ -66,6 +66,8 @@ __submit(struct idxd_dmadev *idxd) if (++idxd->batch_idx_write > idxd->max_batches) idxd->batch_idx_write = 0; + idxd->stats.submitted += idxd->batch_size; + idxd->batch_start += idxd->batch_size; idxd->batch_size = 0; idxd->batch_idx_ring[idxd->batch_idx_write] = idxd->batch_start; @@ -356,6 +358,7 @@ idxd_completed(struct rte_dmadev *dev, uint16_t qid __rte_unused, uint16_t max_o ret += batch; } while (batch > 0 && *has_error == false); + idxd->stats.completed += ret; *last_idx = idxd->ids_returned - 1; return ret; } @@ -373,6 +376,7 @@ idxd_completed_status(struct rte_dmadev *dev, uint16_t qid __rte_unused, uint16_ ret += batch; } while (batch > 0); + idxd->stats.completed += ret; *last_idx = idxd->ids_returned - 1; return ret; } @@ -406,6 +410,25 @@ idxd_dump(const struct rte_dmadev *dev, FILE *f) return 0; } +int +idxd_stats_get(const struct rte_dmadev *dev, uint16_t vchan __rte_unused, + struct rte_dmadev_stats *stats, uint32_t stats_sz) +{ + struct idxd_dmadev *idxd = dev->dev_private; + if (stats_sz < sizeof(*stats)) + return -EINVAL; + *stats = idxd->stats; + return 0; +} + +int +idxd_stats_reset(struct rte_dmadev *dev, uint16_t vchan __rte_unused) +{ + struct idxd_dmadev *idxd = dev->dev_private; + idxd->stats = (struct rte_dmadev_stats){0}; + return 0; +} + int idxd_info_get(const struct rte_dmadev *dev, struct rte_dmadev_info *info, uint32_t size) { diff --git a/drivers/dma/idxd/idxd_internal.h b/drivers/dma/idxd/idxd_internal.h index 4bcfe5372b..5079b4207d 100644 --- a/drivers/dma/idxd/idxd_internal.h +++ b/drivers/dma/idxd/idxd_internal.h @@ -95,5 +95,8 @@ uint16_t idxd_completed(struct rte_dmadev *dev, uint16_t qid, uint16_t max_ops, uint16_t idxd_completed_status(struct rte_dmadev *dev, uint16_t qid __rte_unused, uint16_t max_ops, uint16_t *last_idx, enum rte_dma_status_code *status); +int idxd_stats_get(const struct rte_dmadev *dev, uint16_t vchan, + struct rte_dmadev_stats *stats, uint32_t stats_sz); +int idxd_stats_reset(struct rte_dmadev *dev, uint16_t vchan); #endif /* _IDXD_INTERNAL_H_ */ -- 2.30.2