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 06A1A45A9F; Thu, 3 Oct 2024 13:53:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F15C402F1; Thu, 3 Oct 2024 13:53:57 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 8026040299 for ; Thu, 3 Oct 2024 13:53:56 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4934P6Ex028374; Thu, 3 Oct 2024 04:53:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=U VDE1h4LyKK60kDGRW7XGGkxu7DdFupt3VAv/HVDXkk=; b=REoEGj1Zmq07o8t0X AtrzyrBRbEVqzEDM3TGqESPol5ngZugemHFr1MSeG0fHundPIEICw0kXvmgFynlJ 48b+XW35OFWIMgxidBAEQB5Chdp+iFrDhOSkMGv4zpsZWjWnBS57Is0Vea8SPGC3 Q5JpAR6lqE73Gd38b0h462PG+YNdgh2tUkfu4wabotDtYs3mkrUDWCD1DWWr3YXM zHRdyXLp7pNZ7J7IeMRxf2muyKDCu1zu/9RMv0dLprhTjo6I6BfaZIoMcFlCOAwl LrxUkTvFDRtBcXgnppyzz7FrshNdaOOhLPRFPCeyBB3S0CfjBObGcxRoUBqozbpq JrwpA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 421avd9mgt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Oct 2024 04:53:55 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 3 Oct 2024 04:53:54 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 3 Oct 2024 04:53:54 -0700 Received: from cavium-VAMSI-BM.. (unknown [10.28.36.156]) by maili.marvell.com (Postfix) with ESMTP id DA9175B6927; Thu, 3 Oct 2024 04:53:49 -0700 (PDT) From: Vamsi Krishna To: , , , CC: , , , , , , , , , Vamsi Attunuru , Amit Prakash Shukla Subject: [PATCH v4 1/1] dmadev: support priority configuration Date: Thu, 3 Oct 2024 17:23:47 +0530 Message-ID: <20241003115347.1365370-1-vattunuru@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241003114133.1356496-1-vattunuru@marvell.com> References: <20241003114133.1356496-1-vattunuru@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: mpninSXMKyUmMKmryPixzyJRfa6Y5IOF X-Proofpoint-ORIG-GUID: mpninSXMKyUmMKmryPixzyJRfa6Y5IOF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 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 From: Vamsi Attunuru Some DMA controllers offer the ability to configure priority level for the hardware command queues, allowing for the prioritization of DMA command execution based on queue importance. This patch introduces the necessary fields in the dmadev structures to retrieve information about the hardware-supported priority levels and to enable priority configuration from the application. Signed-off-by: Vamsi Attunuru Signed-off-by: Amit Prakash Shukla --- V4 changes: * Rebased onto the latest V3 changes: * Corrected patch title V2 changes: * Reverted removed text from release_24_11.rst V1 changes: * Added trace support * Added new capability flag Deprecation notice: https://patches.dpdk.org/project/dpdk/patch/20240730144612.2132848-1-amitprakashs@marvell.com/ * Assuming we do not anticipate any advanced scheduling schemes for dmadev queues, this patch is intended to support a strict priority scheme. doc/guides/rel_notes/release_24_11.rst | 8 ++++++++ lib/dmadev/rte_dmadev.c | 15 +++++++++++++++ lib/dmadev/rte_dmadev.h | 21 +++++++++++++++++++++ lib/dmadev/rte_dmadev_trace.h | 2 ++ 4 files changed, 46 insertions(+) diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index e0a9aa55a1..9672d8c679 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -67,6 +67,11 @@ New Features The new statistics are useful for debugging and profiling. +* **Added strict priority capability flag in dmadev.** + + Added new capability flag ``RTE_DMA_CAPA_PRI_POLICY_SP`` to check if the + DMA device supports assigning fixed priority to its channels, allowing + for better control over resource allocation and scheduling. Removed Items ------------- @@ -112,6 +117,9 @@ ABI Changes Also, make sure to start the actual text at the margin. ======================================================= +* dmadev: Added ``nb_priorities`` field to ``rte_dma_info`` structure and + ``priority`` field to ``rte_dma_conf`` structure to get device supported + priority levels and configure required priority from the application. Known Issues ------------ diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c index 845727210f..3d9063dee3 100644 --- a/lib/dmadev/rte_dmadev.c +++ b/lib/dmadev/rte_dmadev.c @@ -497,6 +497,21 @@ rte_dma_configure(int16_t dev_id, const struct rte_dma_conf *dev_conf) return -EINVAL; } + if (dev_conf->priority && !(dev_info.dev_capa & RTE_DMA_CAPA_PRI_POLICY_SP)) { + RTE_DMA_LOG(ERR, "Device %d don't support prioritization", dev_id); + return -EINVAL; + } + + if (dev_info.nb_priorities == 1) { + RTE_DMA_LOG(ERR, "Device %d must support more than 1 priority, or else 0", dev_id); + return -EINVAL; + } + + if (dev_info.nb_priorities && (dev_conf->priority >= dev_info.nb_priorities)) { + RTE_DMA_LOG(ERR, "Device %d configure invalid priority", dev_id); + return -EINVAL; + } + if (*dev->dev_ops->dev_configure == NULL) return -ENOTSUP; ret = (*dev->dev_ops->dev_configure)(dev, dev_conf, diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h index 5474a5281d..e5f730c327 100644 --- a/lib/dmadev/rte_dmadev.h +++ b/lib/dmadev/rte_dmadev.h @@ -268,6 +268,16 @@ int16_t rte_dma_next_dev(int16_t start_dev_id); #define RTE_DMA_CAPA_OPS_COPY_SG RTE_BIT64(33) /** Support fill operation. */ #define RTE_DMA_CAPA_OPS_FILL RTE_BIT64(34) +/** Support strict prioritization at DMA HW channel level + * + * If device supports HW channel prioritization then application could + * assign fixed priority to the DMA HW channel using 'priority' field in + * struct rte_dma_conf. Number of supported priority levels will be known + * from 'nb_priorities' field in struct rte_dma_info. + * + * DMA devices which support prioritization can advertise this capability. + */ +#define RTE_DMA_CAPA_PRI_POLICY_SP RTE_BIT64(35) /**@}*/ /** @@ -297,6 +307,10 @@ struct rte_dma_info { int16_t numa_node; /** Number of virtual DMA channel configured. */ uint16_t nb_vchans; + /** Number of priority levels (must be > 1), if supported by DMA HW channel. + * 0 otherwise. + */ + uint16_t nb_priorities; }; /** @@ -332,6 +346,13 @@ struct rte_dma_conf { * @see RTE_DMA_CAPA_SILENT */ bool enable_silent; + /* The priority of the DMA HW channel. + * This value cannot be greater than or equal to the field 'nb_priorities' + * of struct rte_dma_info which get from rte_dma_info_get(). + * Among the values between '0' and 'nb_priorities - 1', lowest value + * indicates higher priority and vice-versa. + */ + uint16_t priority; }; /** diff --git a/lib/dmadev/rte_dmadev_trace.h b/lib/dmadev/rte_dmadev_trace.h index e55c4c6091..be089c065c 100644 --- a/lib/dmadev/rte_dmadev_trace.h +++ b/lib/dmadev/rte_dmadev_trace.h @@ -35,6 +35,7 @@ RTE_TRACE_POINT( rte_trace_point_emit_u16(dev_info->max_sges); rte_trace_point_emit_i16(dev_info->numa_node); rte_trace_point_emit_u16(dev_info->nb_vchans); + rte_trace_point_emit_u16(dev_info->nb_priorities); ) RTE_TRACE_POINT( @@ -48,6 +49,7 @@ RTE_TRACE_POINT( int enable_silent = (int)dev_conf->enable_silent; rte_trace_point_emit_i16(dev_id); rte_trace_point_emit_u16(dev_conf->nb_vchans); + rte_trace_point_emit_u16(dev_conf->priority); rte_trace_point_emit_int(enable_silent); rte_trace_point_emit_int(ret); ) -- 2.34.1