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 49CE8A0C55; Wed, 13 Oct 2021 17:18:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CDFD4411FA; Wed, 13 Oct 2021 17:18:06 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id A5B14411EC for ; Wed, 13 Oct 2021 17:18:02 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10136"; a="290944063" X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="290944063" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2021 08:17:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,371,1624345200"; d="scan'208";a="441682052" Received: from silpixa00399126.ir.intel.com ([10.237.223.151]) by orsmga006.jf.intel.com with ESMTP; 13 Oct 2021 08:17:53 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: conor.walsh@intel.com, kevin.laatz@intel.com, fengchengwen@huawei.com, jerinj@marvell.com Date: Wed, 13 Oct 2021 16:17:26 +0100 Message-Id: <20211013151736.762378-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211013151736.762378-1-bruce.richardson@intel.com> References: <20210924102942.2878051-1-bruce.richardson@intel.com> <20211013151736.762378-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v7 03/13] 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 Reviewed-by: Conor Walsh --- lib/dmadev/rte_dmadev.c | 9 +++++++++ lib/dmadev/rte_dmadev.h | 29 +++++++++++++++++++++++++++++ lib/dmadev/rte_dmadev_core.h | 4 ++++ lib/dmadev/version.map | 1 + 4 files changed, 43 insertions(+) diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c index 3f9154e619..c737cc6cdc 100644 --- a/lib/dmadev/rte_dmadev.c +++ b/lib/dmadev/rte_dmadev.c @@ -830,6 +830,14 @@ dummy_completed_status(__rte_unused void *dev_private, return 0; } +static uint16_t +dummy_burst_capacity(__rte_unused const void *dev_private, + __rte_unused uint16_t vchan) +{ + RTE_DMA_LOG(ERR, "burst_capacity is not configured or not supported."); + return 0; +} + static void dma_fp_object_dummy(struct rte_dma_fp_object *obj) { @@ -840,4 +848,5 @@ dma_fp_object_dummy(struct rte_dma_fp_object *obj) obj->submit = dummy_submit; obj->completed = dummy_completed; obj->completed_status = dummy_completed_status; + obj->burst_capacity = dummy_burst_capacity; } diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h index e35aca7d1c..a0824be20d 100644 --- a/lib/dmadev/rte_dmadev.h +++ b/lib/dmadev/rte_dmadev.h @@ -1076,6 +1076,35 @@ rte_dma_completed_status(int16_t dev_id, uint16_t vchan, last_idx, 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. + * - 0 on error + */ +__rte_experimental +static inline uint16_t +rte_dma_burst_capacity(int16_t dev_id, uint16_t vchan) +{ + struct rte_dma_fp_object *obj = &rte_dma_fp_objs[dev_id]; + +#ifdef RTE_DMADEV_DEBUG + if (!rte_dma_is_valid(dev_id)) + return 0; + RTE_FUNC_PTR_OR_ERR_RET(*obbj->burst_capacity, 0); +#endif + return (*obj->burst_capacity)(obj->dev_private, vchan); +} + #ifdef __cplusplus } #endif diff --git a/lib/dmadev/rte_dmadev_core.h b/lib/dmadev/rte_dmadev_core.h index 236d9d38e5..e42d8739ab 100644 --- a/lib/dmadev/rte_dmadev_core.h +++ b/lib/dmadev/rte_dmadev_core.h @@ -47,6 +47,9 @@ typedef uint16_t (*rte_dma_completed_status_t)(void *dev_private, uint16_t vchan, const uint16_t nb_cpls, uint16_t *last_idx, enum rte_dma_status_code *status); +/** @internal Used to check the remaining space in descriptor ring. */ +typedef uint16_t (*rte_dma_burst_capacity_t)(const void *dev_private, uint16_t vchan); + /** * @internal * Fast-path dmadev functions and related data are hold in a flat array. @@ -69,6 +72,7 @@ struct rte_dma_fp_object { rte_dma_submit_t submit; rte_dma_completed_t completed; rte_dma_completed_status_t completed_status; + rte_dma_burst_capacity_t burst_capacity; } __rte_aligned(128); extern struct rte_dma_fp_object *rte_dma_fp_objs; diff --git a/lib/dmadev/version.map b/lib/dmadev/version.map index 8785e14648..4bbfdd52f6 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