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 458D6A0C46; Fri, 17 Sep 2021 15:31:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9BBCA410EF; Fri, 17 Sep 2021 15:31:14 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 1DFB3410F7 for ; Fri, 17 Sep 2021 15:31:12 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10109"; a="283805292" X-IronPort-AV: E=Sophos;i="5.85,301,1624345200"; d="scan'208";a="283805292" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2021 06:31:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,301,1624345200"; d="scan'208";a="701256277" Received: from silpixa00399126.ir.intel.com ([10.237.223.29]) by fmsmga005.fm.intel.com with ESMTP; 17 Sep 2021 06:31:10 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: conor.walsh@intel.com, kevin.laatz@intel.com, fengchengwen@huawei.com, jerinj@marvell.com Date: Fri, 17 Sep 2021 14:30:49 +0100 Message-Id: <20210917133056.90326-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210917133056.90326-1-bruce.richardson@intel.com> References: <20210826183301.333442-1-bruce.richardson@intel.com> <20210917133056.90326-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v4 2/9] dmadev: add burst capacity API 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" From: Kevin Laatz Add a burst capacity check API to the dmadev library. This API is useful to applications which need to how many descriptors can be enqueued in the current batch. For example, it could be used to determine whether all segments of a multi-segment packet can be enqueued in the same batch or not (to avoid half-offload of the packet). Signed-off-by: Kevin Laatz --- lib/dmadev/rte_dmadev.c | 11 +++++++++++ lib/dmadev/rte_dmadev.h | 19 +++++++++++++++++++ lib/dmadev/rte_dmadev_core.h | 5 ++++- lib/dmadev/version.map | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c index 859958fff8..ed342e0d32 100644 --- a/lib/dmadev/rte_dmadev.c +++ b/lib/dmadev/rte_dmadev.c @@ -684,6 +684,17 @@ dma_dump_capability(FILE *f, uint64_t dev_capa) fprintf(f, "\n"); } +int +rte_dma_burst_capacity(uint16_t dev_id, uint16_t vchan) +{ + const struct rte_dma_dev *dev = &rte_dma_devices[dev_id]; + + RTE_DMA_VALID_DEV_ID_OR_ERR_RET(dev_id, -EINVAL); + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->burst_capacity, -ENOTSUP); + return (*dev->dev_ops->burst_capacity)(dev, vchan); +} + int rte_dma_dump(int16_t dev_id, FILE *f) { diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h index 86c4a38f83..be4bb18ee6 100644 --- a/lib/dmadev/rte_dmadev.h +++ b/lib/dmadev/rte_dmadev.h @@ -693,6 +693,25 @@ __rte_experimental int rte_dma_vchan_status(uint16_t dev_id, uint16_t vchan, enum rte_dma_vchan_status *status); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Check remaining capacity in descriptor ring for the current burst. + * + * @param dev_id + * The identifier of the device. + * @param vchan + * The identifier of virtual DMA channel. + * + * @return + * - Remaining space in the descriptor ring for the current burst on success. + * - -ENOTSUP: if not supported by the device. + */ +__rte_experimental +int +rte_dma_burst_capacity(uint16_t dev_id, uint16_t vchan); + /** * @warning * @b EXPERIMENTAL: this API may change without prior notice. diff --git a/lib/dmadev/rte_dmadev_core.h b/lib/dmadev/rte_dmadev_core.h index 0eec1aa43b..21290ef471 100644 --- a/lib/dmadev/rte_dmadev_core.h +++ b/lib/dmadev/rte_dmadev_core.h @@ -58,6 +58,9 @@ typedef int (*rte_dma_stats_get_t)(const struct rte_dma_dev *dev, /** @internal Used to reset basic statistics. */ typedef int (*rte_dma_stats_reset_t)(struct rte_dma_dev *dev, uint16_t vchan); +/** @internal Used to check the remaining space in descriptor ring. */ +typedef uint16_t (*rte_dma_burst_capacity_t)(const struct rte_dma_dev *dev, uint16_t vchan); + /** @internal Used to dump internal information. */ typedef int (*rte_dma_dump_t)(const struct rte_dma_dev *dev, FILE *f); @@ -124,7 +127,7 @@ struct rte_dma_dev_ops { rte_dma_dump_t dev_dump; rte_dma_vchan_status_t vchan_status; - + rte_dma_burst_capacity_t burst_capacity; }; /** diff --git a/lib/dmadev/version.map b/lib/dmadev/version.map index 40ea517016..66420c4ede 100644 --- a/lib/dmadev/version.map +++ b/lib/dmadev/version.map @@ -1,6 +1,7 @@ EXPERIMENTAL { global: + rte_dma_burst_capacity; rte_dma_close; rte_dma_completed; rte_dma_completed_status; -- 2.30.2