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 D294543857; Sun, 7 Jan 2024 16:36:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D0BE40DCB; Sun, 7 Jan 2024 16:35:30 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id A3AEE4069D for ; Sun, 7 Jan 2024 16:35:25 +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 407DlRPx022570 for ; Sun, 7 Jan 2024 07:35:25 -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=yEw2OTXtCjDj7ZVh2b2A7taQHwDrVBaWHNUt3KKvqVw=; b=hOa NWvlrHzwAUQUpKKlkh2Oe90M1oGgNlWj1pw9V8lzYdOVEVV+8Gj5++OA6VdUYNG/ VctgLErDtHcung8bY/geEgj5U2dnO9voTQAwFs/Ko7jPovd/uYe5oI19157pycEl CHKygXEHn41DV1C1fXEzT67T/5nRm4cRWSURa15iLG3lJV6n2AOIubNKy4BTh68Y phVWuz/AhgTxbr4rgJ9DtLLE3rQidFhn9xXjcW9kYEc4P+C6wZFJ5VkvZ/Cz1eQL JHfDgk+7/sxT9MMeYSj1uXQGgdKpPQkw9zaYXhQsM1mLkkXddQD1Lq2yTr8gvuuK uC/mVGFb8U41LO9mrTQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3vf78n2a1r-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sun, 07 Jan 2024 07:35:24 -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:22 -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:22 -0800 Received: from ml-host-33.caveonetworks.com (unknown [10.110.143.233]) by maili.marvell.com (Postfix) with ESMTP id 7902E3F70A3; Sun, 7 Jan 2024 07:35:22 -0800 (PST) From: Srikanth Yalavarthi To: Srikanth Yalavarthi , Jerin Jacob CC: , , , Subject: [PATCH 09/11] event/ml: add support for runtime params Date: Sun, 7 Jan 2024 07:34:48 -0800 Message-ID: <20240107153454.3909-10-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: Y92PZ-BWs7XwZn_0EhozI0OootxtNxQH X-Proofpoint-GUID: Y92PZ-BWs7XwZn_0EhozI0OootxtNxQH 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 support to set and get runtime params for ML adapter. Signed-off-by: Srikanth Yalavarthi --- lib/eventdev/rte_event_ml_adapter.c | 99 +++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/lib/eventdev/rte_event_ml_adapter.c b/lib/eventdev/rte_event_ml_adapter.c index 474aeb6325b..feb488f730a 100644 --- a/lib/eventdev/rte_event_ml_adapter.c +++ b/lib/eventdev/rte_event_ml_adapter.c @@ -1166,3 +1166,102 @@ rte_event_ml_adapter_stop(uint8_t id) { return emla_adapter_ctrl(id, 0); } + +#define DEFAULT_MAX_NB 128 + +int +rte_event_ml_adapter_runtime_params_init(struct rte_event_ml_adapter_runtime_params *params) +{ + if (params == NULL) + return -EINVAL; + + memset(params, 0, sizeof(*params)); + params->max_nb = DEFAULT_MAX_NB; + + return 0; +} + +static int +ml_adapter_cap_check(struct event_ml_adapter *adapter) +{ + uint32_t caps; + int ret; + + if (!adapter->nb_qps) + return -EINVAL; + + ret = rte_event_ml_adapter_caps_get(adapter->eventdev_id, adapter->next_mldev_id, &caps); + if (ret) { + RTE_EDEV_LOG_ERR("Failed to get adapter caps dev %" PRIu8 " cdev %" PRIu8, + adapter->eventdev_id, adapter->next_mldev_id); + return ret; + } + + if ((caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD) || + (caps & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW)) + return -ENOTSUP; + + return 0; +} + +int +rte_event_ml_adapter_runtime_params_set(uint8_t id, + struct rte_event_ml_adapter_runtime_params *params) +{ + struct event_ml_adapter *adapter; + int ret; + + if (!emla_valid_id(id)) { + RTE_EDEV_LOG_ERR("Invalid ML adapter id = %d", id); + return -EINVAL; + } + + if (params == NULL) { + RTE_EDEV_LOG_ERR("params pointer is NULL"); + return -EINVAL; + } + + adapter = emla_id_to_adapter(id); + if (adapter == NULL) + return -EINVAL; + + ret = ml_adapter_cap_check(adapter); + if (ret) + return ret; + + rte_spinlock_lock(&adapter->lock); + adapter->max_nb = params->max_nb; + rte_spinlock_unlock(&adapter->lock); + + return 0; +} + +int +rte_event_ml_adapter_runtime_params_get(uint8_t id, + struct rte_event_ml_adapter_runtime_params *params) +{ + struct event_ml_adapter *adapter; + int ret; + + if (!emla_valid_id(id)) { + RTE_EDEV_LOG_ERR("Invalid ML adapter id = %d", id); + return -EINVAL; + } + + if (params == NULL) { + RTE_EDEV_LOG_ERR("params pointer is NULL"); + return -EINVAL; + } + + adapter = emla_id_to_adapter(id); + if (adapter == NULL) + return -EINVAL; + + ret = ml_adapter_cap_check(adapter); + if (ret) + return ret; + + params->max_nb = adapter->max_nb; + + return 0; +} -- 2.42.0