From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id BB40B4597C;
	Fri, 13 Sep 2024 14:11:20 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 4C5224025E;
	Fri, 13 Sep 2024 14:11:20 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173])
 by mails.dpdk.org (Postfix) with ESMTP id E18AB4003C
 for <dev@dpdk.org>; Fri, 13 Sep 2024 14:11:18 +0200 (CEST)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1])
 by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48DBKrAF019064;
 Fri, 13 Sep 2024 05:11:17 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=
 cc:content-transfer-encoding:content-type:date:from:message-id
 :mime-version:subject:to; s=pfpt0220; bh=OGYADSkVOK0FyK8Ps+FjGwN
 /RXXlyjiWRC+AMs3GEvY=; b=D8FHXfwjDVxxaNrWukcVhF07vJ1gJBMMTJrPsvD
 vvKC+4hU2bHDhnNWdwbFq1Q8vesaJ3SzhreEF0r4YwyhOI5aXhJd01aN6sRnq4Gy
 Coe9rO4cZRVFd1wyAZmraBFcHpG8gBdr6JGNQHnIhfnT/SOozDxV6N66XPJUrOEw
 c1Bm+Qpa+LA0Nvq6wsxKaTvdRKs/3MIbVuu1PB0uMEyWdP0QZLaZUKTBA1sgSfFH
 SIF1YGSNZPx1Vs8iQ+8iNcwgBU39oWYMHbvY09UcjglCHQUr805dWH/t9vLgPRMU
 0qorf9NwIzPboD0K8TvsXi8sK/fM7qwJAbtL9+Af/4zGVug==
Received: from dc5-exch05.marvell.com ([199.233.59.128])
 by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 41mmejg4fd-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);
 Fri, 13 Sep 2024 05:11:17 -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; Fri, 13 Sep 2024 05:11:00 -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; Fri, 13 Sep 2024 05:11:00 -0700
Received: from cavium-VAMSI-BM.. (unknown [10.28.36.156])
 by maili.marvell.com (Postfix) with ESMTP id D198A3F7044;
 Fri, 13 Sep 2024 05:10:56 -0700 (PDT)
From: Vamsi Krishna <vattunuru@marvell.com>
To: <thomas@monjalon.net>, <fengchengwen@huawei.com>,
 <bruce.richardson@intel.com>, <mb@smartsharesystems.com>
CC: <dev@dpdk.org>, <kevin.laatz@intel.com>, <jerinj@marvell.com>,
 <conor.walsh@intel.com>, <gmuthukrishn@marvell.com>,
 <vvelumuri@marvell.com>, <g.singh@nxp.com>,
 <sachin.saxena@oss.nxp.com>, <hemant.agrawal@nxp.com>,
 Vamsi Attunuru <vattunuru@marvell.com>, Amit Prakash Shukla
 <amitprakashs@marvell.com>
Subject: [RFC v0 1/1] dmadev: provide priority configuration support
Date: Fri, 13 Sep 2024 17:40:38 +0530
Message-ID: <20240913121038.315714-1-vattunuru@marvell.com>
X-Mailer: git-send-email 2.34.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-GUID: mQjBUK5iJ0RfMq3CYZDcDM0NUFYyLH6H
X-Proofpoint-ORIG-GUID: mQjBUK5iJ0RfMq3CYZDcDM0NUFYyLH6H
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Vamsi Attunuru <vattunuru@marvell.com>

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 <vattunuru@marvell.com>
Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
---

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 RFC is intended to support a strict prioirty scheme.

 doc/guides/rel_notes/release_24_11.rst | 15 +++------------
 lib/dmadev/rte_dmadev.c                | 10 ++++++++++
 lib/dmadev/rte_dmadev.h                | 11 +++++++++++
 3 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst
index 0ff70d9057..dc711bbf98 100644
--- a/doc/guides/rel_notes/release_24_11.rst
+++ b/doc/guides/rel_notes/release_24_11.rst
@@ -88,18 +88,9 @@ API Changes
 ABI Changes
 -----------
 
-.. This section should contain ABI changes. Sample format:
-
-   * sample: Add a short 1-2 sentence description of the ABI change
-     which was announced in the previous releases and made in this release.
-     Start with a scope label like "ethdev:".
-     Use fixed width quotes for ``function_names`` or ``struct_names``.
-     Use the past tense.
-
-   This section is a comment. Do not overwrite or remove it.
-   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..053170f55a 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -497,6 +497,16 @@ rte_dma_configure(int16_t dev_id, const struct rte_dma_conf *dev_conf)
 		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..d59fcf1b61 100644
--- a/lib/dmadev/rte_dmadev.h
+++ b/lib/dmadev/rte_dmadev.h
@@ -297,6 +297,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 +336,13 @@ struct rte_dma_conf {
 	 * @see RTE_DMA_CAPA_SILENT
 	 */
 	bool enable_silent;
+	/* The prioirty 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;
 };
 
 /**
-- 
2.34.1