DPDK patches and discussions
 help / color / mirror / Atom feed
From: Srikanth Yalavarthi <syalavarthi@marvell.com>
To: Jerin Jacob <jerinj@marvell.com>
Cc: <dev@dpdk.org>, <aprabhu@marvell.com>, <syalavarthi@marvell.com>,
	<sshankarnara@marvell.com>, <ptakkar@marvell.com>
Subject: [PATCH 02/11] event/ml: add ml adapter capabilities get
Date: Sun, 7 Jan 2024 07:34:41 -0800	[thread overview]
Message-ID: <20240107153454.3909-3-syalavarthi@marvell.com> (raw)
In-Reply-To: <20240107153454.3909-1-syalavarthi@marvell.com>

Added library function to get ML adapter capabilities.

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
---
 lib/eventdev/eventdev_pmd.h | 29 +++++++++++++++++++++++++++++
 lib/eventdev/rte_eventdev.c | 27 +++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)

diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h
index 1790587808a..94d505753dc 100644
--- a/lib/eventdev/eventdev_pmd.h
+++ b/lib/eventdev/eventdev_pmd.h
@@ -84,6 +84,8 @@ extern "C" {
 #define RTE_EVENT_TIMER_ADAPTER_SW_CAP \
 		RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC
 
+#define RTE_EVENT_ML_ADAPTER_SW_CAP 0x0
+
 #define RTE_EVENTDEV_DETACHED  (0)
 #define RTE_EVENTDEV_ATTACHED  (1)
 
@@ -1522,6 +1524,30 @@ typedef int (*eventdev_dma_adapter_stats_get)(const struct rte_eventdev *dev,
 typedef int (*eventdev_dma_adapter_stats_reset)(const struct rte_eventdev *dev,
 						const int16_t dma_dev_id);
 
+struct rte_ml_dev;
+
+/**
+ * Retrieve the event device's ML adapter capabilities for the
+ * specified MLDEV
+ *
+ * @param dev
+ *   Event device pointer
+ *
+ * @param mldev
+ *   ML device pointer
+ *
+ * @param[out] caps
+ *   A pointer to memory filled with event adapter capabilities.
+ *   It is expected to be pre-allocated & initialized by caller.
+ *
+ * @return
+ *   - 0: Success, driver provides event adapter capabilities for the
+ *	MLDEV.
+ *   - <0: Error code returned by the driver function.
+ *
+ */
+typedef int (*eventdev_ml_adapter_caps_get_t)(const struct rte_eventdev *dev,
+					      const struct rte_ml_dev *mldev, uint32_t *caps);
 
 /** Event device operations function pointer table */
 struct eventdev_ops {
@@ -1662,6 +1688,9 @@ struct eventdev_ops {
 	eventdev_dma_adapter_stats_reset dma_adapter_stats_reset;
 	/**< Reset DMA stats */
 
+	eventdev_ml_adapter_caps_get_t ml_adapter_caps_get;
+	/**< Get ML adapter capabilities */
+
 	eventdev_selftest dev_selftest;
 	/**< Start eventdev Selftest */
 
diff --git a/lib/eventdev/rte_eventdev.c b/lib/eventdev/rte_eventdev.c
index 157752868d5..7fbc6f3d98a 100644
--- a/lib/eventdev/rte_eventdev.c
+++ b/lib/eventdev/rte_eventdev.c
@@ -22,6 +22,7 @@
 #include <rte_cryptodev.h>
 #include <rte_dmadev.h>
 #include <cryptodev_pmd.h>
+#include <rte_mldev_pmd.h>
 #include <rte_telemetry.h>
 
 #include "rte_eventdev.h"
@@ -249,6 +250,32 @@ rte_event_dma_adapter_caps_get(uint8_t dev_id, uint8_t dma_dev_id, uint32_t *cap
 	return 0;
 }
 
+int
+rte_event_ml_adapter_caps_get(uint8_t evdev_id, int16_t mldev_id, uint32_t *caps)
+{
+	struct rte_eventdev *dev;
+	struct rte_ml_dev *mldev;
+
+	RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(evdev_id, -EINVAL);
+	if (!rte_ml_dev_is_valid_dev(mldev_id))
+		return -EINVAL;
+
+	dev = &rte_eventdevs[evdev_id];
+	mldev = rte_ml_dev_pmd_get_dev(mldev_id);
+
+	if (caps == NULL)
+		return -EINVAL;
+
+	if (dev->dev_ops->ml_adapter_caps_get == NULL)
+		*caps = RTE_EVENT_ML_ADAPTER_SW_CAP;
+	else
+		*caps = 0;
+
+	return dev->dev_ops->ml_adapter_caps_get ?
+		       (*dev->dev_ops->ml_adapter_caps_get)(dev, mldev, caps) :
+		       0;
+}
+
 static inline int
 event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
 {
-- 
2.42.0


  parent reply	other threads:[~2024-01-07 15:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-07 15:34 [PATCH 00/11] Introduce Event ML Adapter Srikanth Yalavarthi
2024-01-07 15:34 ` [PATCH 01/11] eventdev: introduce ML event adapter library Srikanth Yalavarthi
2024-02-02  8:51   ` Jerin Jacob
2024-02-07  9:17   ` Naga Harish K, S V
2024-01-07 15:34 ` Srikanth Yalavarthi [this message]
2024-01-07 15:34 ` [PATCH 03/11] event/ml: add adapter create and free Srikanth Yalavarthi
2024-01-07 15:34 ` [PATCH 04/11] event/ml: add adapter port get Srikanth Yalavarthi
2024-01-07 15:34 ` [PATCH 05/11] event/ml: add adapter queue pair add and delete Srikanth Yalavarthi
2024-01-07 15:34 ` [PATCH 06/11] event/ml: add support for service function Srikanth Yalavarthi
2024-01-07 15:34 ` [PATCH 07/11] event/ml: add adapter start and stop Srikanth Yalavarthi
2024-01-07 15:34 ` [PATCH 08/11] event/ml: add support to get adapter service ID Srikanth Yalavarthi
2024-01-07 15:34 ` [PATCH 09/11] event/ml: add support for runtime params Srikanth Yalavarthi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240107153454.3909-3-syalavarthi@marvell.com \
    --to=syalavarthi@marvell.com \
    --cc=aprabhu@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=ptakkar@marvell.com \
    --cc=sshankarnara@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).