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 C7C56A0C4C; Thu, 14 Oct 2021 11:50:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBBC941257; Thu, 14 Oct 2021 11:49:33 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 8A82D4124D for ; Thu, 14 Oct 2021 11:49:30 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="225100252" X-IronPort-AV: E=Sophos;i="5.85,372,1624345200"; d="scan'208";a="225100252" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2021 02:49:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,372,1624345200"; d="scan'208";a="442042139" Received: from silpixa00401160.ir.intel.com ([10.55.129.96]) by orsmga006.jf.intel.com with ESMTP; 14 Oct 2021 02:49:28 -0700 From: Conor Walsh To: bruce.richardson@intel.com, fengchengwen@huawei.com, jerinj@marvell.com, kevin.laatz@intel.com Cc: dev@dpdk.org, Conor Walsh Date: Thu, 14 Oct 2021 09:49:00 +0000 Message-Id: <20211014094902.489159-11-conor.walsh@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211014094902.489159-1-conor.walsh@intel.com> References: <20210827172550.1522362-1-conor.walsh@intel.com> <20211014094902.489159-1-conor.walsh@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v7 10/12] dma/ioat: add burst capacity 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" Adds the ability to find the remaining space in the IOAT ring. Signed-off-by: Conor Walsh Signed-off-by: Kevin Laatz Acked-by: Bruce Richardson --- drivers/dma/ioat/ioat_dmadev.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/dma/ioat/ioat_dmadev.c b/drivers/dma/ioat/ioat_dmadev.c index 17ac3217c7..a230496b11 100644 --- a/drivers/dma/ioat/ioat_dmadev.c +++ b/drivers/dma/ioat/ioat_dmadev.c @@ -516,12 +516,25 @@ ioat_completed_status(void *dev_private, uint16_t qid __rte_unused, return count; } +/* Get the remaining capacity of the ring. */ +static uint16_t +ioat_burst_capacity(const void *dev_private, uint16_t vchan __rte_unused) +{ + const struct ioat_dmadev *ioat = dev_private; + unsigned short size = ioat->qcfg.nb_desc - 1; + unsigned short read = ioat->next_read; + unsigned short write = ioat->next_write; + unsigned short space = size - (write - read); + + return space; +} + /* Retrieve the generic stats of a DMA device. */ static int ioat_stats_get(const struct rte_dma_dev *dev, uint16_t vchan __rte_unused, struct rte_dma_stats *rte_stats, uint32_t size) { - struct rte_dma_stats *stats = (&((struct ioat_dmadev *)dev->dev_private)->stats); + struct rte_dma_stats *stats = (&((struct ioat_dmadev *)dev->fp_obj->dev_private)->stats); if (size < sizeof(rte_stats)) return -EINVAL; @@ -536,7 +549,7 @@ ioat_stats_get(const struct rte_dma_dev *dev, uint16_t vchan __rte_unused, static int ioat_stats_reset(struct rte_dma_dev *dev, uint16_t vchan __rte_unused) { - struct ioat_dmadev *ioat = dev->dev_private; + struct ioat_dmadev *ioat = dev->fp_obj->dev_private; ioat->stats = (struct rte_dma_stats){0}; return 0; @@ -548,7 +561,7 @@ ioat_vchan_status(const struct rte_dma_dev *dev, uint16_t vchan __rte_unused, enum rte_dma_vchan_status *status) { int state = 0; - const struct ioat_dmadev *ioat = dev->dev_private; + const struct ioat_dmadev *ioat = dev->fp_obj->dev_private; const uint16_t mask = ioat->qcfg.nb_desc - 1; const uint16_t last = __get_last_completed(ioat, &state); @@ -601,6 +614,7 @@ ioat_dmadev_create(const char *name, struct rte_pci_device *dev) dmadev->dev_ops = &ioat_dmadev_ops; + dmadev->fp_obj->burst_capacity = ioat_burst_capacity; dmadev->fp_obj->completed = ioat_completed; dmadev->fp_obj->completed_status = ioat_completed_status; dmadev->fp_obj->copy = ioat_enqueue_copy; -- 2.25.1