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 1A7DBA0C52; Wed, 3 Nov 2021 19:02:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2161F4113E; Wed, 3 Nov 2021 19:02:08 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 41FFC40689 for ; Wed, 3 Nov 2021 19:02:03 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1A3FZHUG008843; Wed, 3 Nov 2021 11:02:02 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=/1h3li/JfKXWP81vem8rKQX1JpbO0JaUgNDSxaJL3T0=; b=dyPhc6iUqgGGBZCv7TMI7+A/ZRAw8sLVl//+4OAsq1+3Ux4f6lo7ccpKHioQMTEAxVlD a1/afzYfjQHs8wC3is/VrIJABD0qOeFF4m1MJL4qIvk/R8T+F/XeazLxT5uJUE/xVVFU uemYgMAoYMemvAdLZpfgep5Yp+BNBGuW1/bSRAVuAsd9iQbSmmv+pSYWXYij91uP03W+ xH1UmzPSyaJyGH8ARtv7f6/5ZlraAL9Lctm9eIQtkRDXS9YT35HXmjSVJ8ajtwmPJ2wz Yqw8vlYEnnYoVuHd15ZYwAwqSZtXwMgbqLjGfwBQ9ETIk/EowfrbEqXsAaRje418cc7X 3Q== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3c3ngrb4py-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 03 Nov 2021 11:02:02 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 3 Nov 2021 11:02:01 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 3 Nov 2021 11:02:00 -0700 Received: from rchintakuntla-lnx3.caveonetworks.com (unknown [10.111.140.81]) by maili.marvell.com (Postfix) with ESMTP id 75DFA5B695C; Wed, 3 Nov 2021 11:02:00 -0700 (PDT) From: Radha Mohan Chintakuntla To: , , , , , , , CC: , Radha Mohan Chintakuntla Date: Wed, 3 Nov 2021 11:01:50 -0700 Message-ID: <20211103180150.10416-5-radhac@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211103180150.10416-1-radhac@marvell.com> References: <20211102034019.28900-1-radhac@marvell.com> <20211103180150.10416-1-radhac@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: 9s2wxLKojq_GdDwM-eaHduyGcgIUaVrz X-Proofpoint-ORIG-GUID: 9s2wxLKojq_GdDwM-eaHduyGcgIUaVrz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-03_06,2021-11-03_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH v3 5/5] dma/cnxk: add stats function 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 the stats function to get the DMA statistics. Signed-off-by: Radha Mohan Chintakuntla --- drivers/dma/cnxk/cnxk_dmadev.c | 41 ++++++++++++++++++++++++++++++++-- drivers/dma/cnxk/cnxk_dmadev.h | 1 + 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/dma/cnxk/cnxk_dmadev.c b/drivers/dma/cnxk/cnxk_dmadev.c index 360e92f7ce..2824c1b44f 100644 --- a/drivers/dma/cnxk/cnxk_dmadev.c +++ b/drivers/dma/cnxk/cnxk_dmadev.c @@ -271,6 +271,7 @@ cnxk_dmadev_copy(void *dev_private, uint16_t vchan, rte_iova_t src, rte_wmb(); plt_write64(num_words, dpivf->rdpi.rbase + DPI_VDMA_DBELL); + dpivf->stats.submitted++; } dpivf->num_words += num_words; } @@ -336,6 +337,7 @@ cnxk_dmadev_copy_sg(void *dev_private, uint16_t vchan, rte_wmb(); plt_write64(num_words, dpivf->rdpi.rbase + DPI_VDMA_DBELL); + dpivf->stats.submitted += nb_src; } dpivf->num_words += num_words; } @@ -357,12 +359,14 @@ cnxk_dmadev_completed(void *dev_private, uint16_t vchan, const uint16_t nb_cpls, if (comp_ptr->cdata) { *has_error = 1; + dpivf->stats.errors++; break; } } *last_idx = cnt - 1; dpivf->conf.c_desc.tail = cnt; + dpivf->stats.completed += cnt; return cnt; } @@ -381,10 +385,13 @@ cnxk_dmadev_completed_status(void *dev_private, uint16_t vchan, struct cnxk_dpi_compl_s *comp_ptr = dpivf->conf.c_desc.compl_ptr[cnt]; status[cnt] = comp_ptr->cdata; + if (comp_ptr->cdata) + dpivf->stats.errors++; } *last_idx = cnt - 1; dpivf->conf.c_desc.tail = 0; + dpivf->stats.completed += cnt; return cnt; } @@ -396,17 +403,47 @@ cnxk_dmadev_submit(void *dev_private, uint16_t vchan __rte_unused) rte_wmb(); plt_write64(dpivf->num_words, dpivf->rdpi.rbase + DPI_VDMA_DBELL); + dpivf->stats.submitted++; return 0; } +static int +cnxk_stats_get(const struct rte_dma_dev *dev, uint16_t vchan, + struct rte_dma_stats *rte_stats, uint32_t size) +{ + struct cnxk_dpi_vf_s *dpivf = dev->fp_obj->dev_private; + struct rte_dma_stats *stats = &dpivf->stats; + + RTE_SET_USED(vchan); + + if (size < sizeof(rte_stats)) + return -EINVAL; + if (rte_stats == NULL) + return -EINVAL; + + *rte_stats = *stats; + return 0; +} + +static int +cnxk_stats_reset(struct rte_dma_dev *dev, uint16_t vchan __rte_unused) +{ + struct cnxk_dpi_vf_s *dpivf = dev->fp_obj->dev_private; + + dpivf->stats = (struct rte_dma_stats){0}; + return 0; +} + static const struct rte_dma_dev_ops cnxk_dmadev_ops = { - .dev_info_get = cnxk_dmadev_info_get, + .dev_close = cnxk_dmadev_close, .dev_configure = cnxk_dmadev_configure, + .dev_info_get = cnxk_dmadev_info_get, .dev_start = cnxk_dmadev_start, .dev_stop = cnxk_dmadev_stop, + .stats_get = cnxk_stats_get, + .stats_reset = cnxk_stats_reset, .vchan_setup = cnxk_dmadev_vchan_setup, - .dev_close = cnxk_dmadev_close, }; static int diff --git a/drivers/dma/cnxk/cnxk_dmadev.h b/drivers/dma/cnxk/cnxk_dmadev.h index eb94ff8ec7..5fc241b55e 100644 --- a/drivers/dma/cnxk/cnxk_dmadev.h +++ b/drivers/dma/cnxk/cnxk_dmadev.h @@ -35,6 +35,7 @@ struct cnxk_dpi_conf { struct cnxk_dpi_vf_s { struct roc_dpi rdpi; struct cnxk_dpi_conf conf; + struct rte_dma_stats stats; uint64_t cmd[DPI_MAX_CMD_SIZE]; uint32_t num_words; uint16_t desc_idx; -- 2.17.1