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 C7F2143857; Sun, 7 Jan 2024 16:35:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 93B7340696; Sun, 7 Jan 2024 16:35:20 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 34D54402F2 for ; Sun, 7 Jan 2024 16:35:18 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 407EUkDo010955 for ; Sun, 7 Jan 2024 07:35:17 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=vXuv4eF6IrDfkLP1I4LcjDOs/R9/krZvw4Y4JK72b60=; b=SKL aB8rpBVt/QU65RHsCiMu65gUq/CmGBuO+0+IVRWfvqD7igCBr4iv9vxcQ+n5pTri qCU42JYyls8FF1AcXSq8N2xIJowhEbv0khC2beBW84U1Q1dUOzWDCVO0rgX9ig+b Z8QFYScSq1+QLuQvKNW32wdOtlyPMQrlw7MVMxy2iywMUgSUf+OonjFNZsA7vzJb fuKQU3iqD+QpdhkMOMgmKjTsc6a/pHkQKjCpncoUA7OL+h66mtqekGZJRca8aRQO dwHgEOKvU2eMP62U2BXwrfNYXAO0MVSUVU6CFKFCTvtZE3M7RWgy96p4cg/y0kGp Gx+y8+jP/z2oCf/PH/w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3vf78n2a1d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sun, 07 Jan 2024 07:35:17 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 7 Jan 2024 07:35:15 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sun, 7 Jan 2024 07:35:15 -0800 Received: from ml-host-33.caveonetworks.com (unknown [10.110.143.233]) by maili.marvell.com (Postfix) with ESMTP id 441723F70A1; Sun, 7 Jan 2024 07:35:15 -0800 (PST) From: Srikanth Yalavarthi To: Jerin Jacob CC: , , , , Subject: [PATCH 02/11] event/ml: add ml adapter capabilities get Date: Sun, 7 Jan 2024 07:34:41 -0800 Message-ID: <20240107153454.3909-3-syalavarthi@marvell.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240107153454.3909-1-syalavarthi@marvell.com> References: <20240107153454.3909-1-syalavarthi@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: nWpjs9-2gOfj84DAQsTeHPmjsMNV7MKT X-Proofpoint-GUID: nWpjs9-2gOfj84DAQsTeHPmjsMNV7MKT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_02,2023-12-07_01,2023-05-22_02 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 Added library function to get ML adapter capabilities. Signed-off-by: Srikanth Yalavarthi --- 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 #include #include +#include #include #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