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

Added support to set and get runtime params for ML adapter.

Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
---
 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


      parent reply	other threads:[~2024-01-07 15:36 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 ` [PATCH 02/11] event/ml: add ml adapter capabilities get Srikanth Yalavarthi
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 ` Srikanth Yalavarthi [this message]

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-10-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).