diff mbox series

[v2,05/33] event/cnxk: add platform specific device config

Message ID 20210426174441.2302-6-pbhagavatula@marvell.com (mailing list archive)
State Changes Requested, archived
Delegated to: Jerin Jacob
Headers show
Series Marvell CNXK Event device Driver | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Pavan Nikhilesh Bhagavatula April 26, 2021, 5:44 p.m. UTC
From: Shijith Thotton <sthotton@marvell.com>

Add platform specific event device configuration that attaches the
requested number of SSO HWS(event ports) and HWGRP(event queues) LFs
to the RVU PF/VF.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 drivers/event/cnxk/cn10k_eventdev.c | 35 +++++++++++++++++++++++++++
 drivers/event/cnxk/cn9k_eventdev.c  | 37 +++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)
diff mbox series

Patch

diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c
index 34238d3b5..352df88fc 100644
--- a/drivers/event/cnxk/cn10k_eventdev.c
+++ b/drivers/event/cnxk/cn10k_eventdev.c
@@ -16,6 +16,14 @@  cn10k_sso_set_rsrc(void *arg)
 			      dev->sso.max_hwgrp;
 }
 
+static int
+cn10k_sso_rsrc_init(void *arg, uint8_t hws, uint8_t hwgrp)
+{
+	struct cnxk_sso_evdev *dev = arg;
+
+	return roc_sso_rsrc_init(&dev->sso, hws, hwgrp);
+}
+
 static void
 cn10k_sso_info_get(struct rte_eventdev *event_dev,
 		   struct rte_event_dev_info *dev_info)
@@ -26,8 +34,35 @@  cn10k_sso_info_get(struct rte_eventdev *event_dev,
 	cnxk_sso_info_get(dev, dev_info);
 }
 
+static int
+cn10k_sso_dev_configure(const struct rte_eventdev *event_dev)
+{
+	struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
+	int rc;
+
+	rc = cnxk_sso_dev_validate(event_dev);
+	if (rc < 0) {
+		plt_err("Invalid event device configuration");
+		return -EINVAL;
+	}
+
+	roc_sso_rsrc_fini(&dev->sso);
+
+	rc = cn10k_sso_rsrc_init(dev, dev->nb_event_ports,
+				 dev->nb_event_queues);
+	if (rc < 0) {
+		plt_err("Failed to initialize SSO resources");
+		return -ENODEV;
+	}
+
+	return rc;
+}
+
 static struct rte_eventdev_ops cn10k_sso_dev_ops = {
 	.dev_infos_get = cn10k_sso_info_get,
+	.dev_configure = cn10k_sso_dev_configure,
+	.queue_def_conf = cnxk_sso_queue_def_conf,
+	.port_def_conf = cnxk_sso_port_def_conf,
 };
 
 static int
diff --git a/drivers/event/cnxk/cn9k_eventdev.c b/drivers/event/cnxk/cn9k_eventdev.c
index 238540828..126388a23 100644
--- a/drivers/event/cnxk/cn9k_eventdev.c
+++ b/drivers/event/cnxk/cn9k_eventdev.c
@@ -22,6 +22,17 @@  cn9k_sso_set_rsrc(void *arg)
 			      dev->sso.max_hwgrp;
 }
 
+static int
+cn9k_sso_rsrc_init(void *arg, uint8_t hws, uint8_t hwgrp)
+{
+	struct cnxk_sso_evdev *dev = arg;
+
+	if (dev->dual_ws)
+		hws = hws * CN9K_DUAL_WS_NB_WS;
+
+	return roc_sso_rsrc_init(&dev->sso, hws, hwgrp);
+}
+
 static void
 cn9k_sso_info_get(struct rte_eventdev *event_dev,
 		  struct rte_event_dev_info *dev_info)
@@ -32,8 +43,34 @@  cn9k_sso_info_get(struct rte_eventdev *event_dev,
 	cnxk_sso_info_get(dev, dev_info);
 }
 
+static int
+cn9k_sso_dev_configure(const struct rte_eventdev *event_dev)
+{
+	struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev);
+	int rc;
+
+	rc = cnxk_sso_dev_validate(event_dev);
+	if (rc < 0) {
+		plt_err("Invalid event device configuration");
+		return -EINVAL;
+	}
+
+	roc_sso_rsrc_fini(&dev->sso);
+
+	rc = cn9k_sso_rsrc_init(dev, dev->nb_event_ports, dev->nb_event_queues);
+	if (rc < 0) {
+		plt_err("Failed to initialize SSO resources");
+		return -ENODEV;
+	}
+
+	return rc;
+}
+
 static struct rte_eventdev_ops cn9k_sso_dev_ops = {
 	.dev_infos_get = cn9k_sso_info_get,
+	.dev_configure = cn9k_sso_dev_configure,
+	.queue_def_conf = cnxk_sso_queue_def_conf,
+	.port_def_conf = cnxk_sso_port_def_conf,
 };
 
 static int