diff mbox series

[20/36] event/cnxk: add timer adapter capabilities

Message ID 20210306162942.6845-21-pbhagavatula@marvell.com (mailing list archive)
State New
Delegated to: Jerin Jacob
Headers show
Series Marvell CNXK Event device Driver | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Pavan Nikhilesh Bhagavatula March 6, 2021, 4:29 p.m. UTC
From: Shijith Thotton <sthotton@marvell.com>

Add function to retrieve event timer adapter capabilities.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
---
 drivers/event/cnxk/cn10k_eventdev.c |  2 ++
 drivers/event/cnxk/cn9k_eventdev.c  |  2 ++
 drivers/event/cnxk/cnxk_tim_evdev.c | 22 +++++++++++++++++++++-
 drivers/event/cnxk/cnxk_tim_evdev.h |  6 +++++-
 4 files changed, 30 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c
index 74070e005..30ca0d901 100644
--- a/drivers/event/cnxk/cn10k_eventdev.c
+++ b/drivers/event/cnxk/cn10k_eventdev.c
@@ -420,6 +420,8 @@  static struct rte_eventdev_ops cn10k_sso_dev_ops = {
 	.port_unlink = cn10k_sso_port_unlink,
 	.timeout_ticks = cnxk_sso_timeout_ticks,
 
+	.timer_adapter_caps_get = cnxk_tim_caps_get,
+
 	.dump = cnxk_sso_dump,
 	.dev_start = cn10k_sso_start,
 	.dev_stop = cn10k_sso_stop,
diff --git a/drivers/event/cnxk/cn9k_eventdev.c b/drivers/event/cnxk/cn9k_eventdev.c
index 4fb0f1ccc..773152e55 100644
--- a/drivers/event/cnxk/cn9k_eventdev.c
+++ b/drivers/event/cnxk/cn9k_eventdev.c
@@ -494,6 +494,8 @@  static struct rte_eventdev_ops cn9k_sso_dev_ops = {
 	.port_unlink = cn9k_sso_port_unlink,
 	.timeout_ticks = cnxk_sso_timeout_ticks,
 
+	.timer_adapter_caps_get = cnxk_tim_caps_get,
+
 	.dump = cnxk_sso_dump,
 	.dev_start = cn9k_sso_start,
 	.dev_stop = cn9k_sso_stop,
diff --git a/drivers/event/cnxk/cnxk_tim_evdev.c b/drivers/event/cnxk/cnxk_tim_evdev.c
index 76b17910f..6000b507a 100644
--- a/drivers/event/cnxk/cnxk_tim_evdev.c
+++ b/drivers/event/cnxk/cnxk_tim_evdev.c
@@ -5,6 +5,26 @@ 
 #include "cnxk_eventdev.h"
 #include "cnxk_tim_evdev.h"
 
+int
+cnxk_tim_caps_get(const struct rte_eventdev *evdev, uint64_t flags,
+		  uint32_t *caps,
+		  const struct rte_event_timer_adapter_ops **ops)
+{
+	struct cnxk_tim_evdev *dev = cnxk_tim_priv_get();
+
+	RTE_SET_USED(flags);
+	RTE_SET_USED(ops);
+
+	if (dev == NULL)
+		return -ENODEV;
+
+	/* Store evdev pointer for later use. */
+	dev->event_dev = (struct rte_eventdev *)(uintptr_t)evdev;
+	*caps = RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT;
+
+	return 0;
+}
+
 void
 cnxk_tim_init(struct roc_sso *sso)
 {
@@ -37,7 +57,7 @@  cnxk_tim_init(struct roc_sso *sso)
 void
 cnxk_tim_fini(void)
 {
-	struct cnxk_tim_evdev *dev = tim_priv_get();
+	struct cnxk_tim_evdev *dev = cnxk_tim_priv_get();
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return;
diff --git a/drivers/event/cnxk/cnxk_tim_evdev.h b/drivers/event/cnxk/cnxk_tim_evdev.h
index 6cf0adb21..8dcecb281 100644
--- a/drivers/event/cnxk/cnxk_tim_evdev.h
+++ b/drivers/event/cnxk/cnxk_tim_evdev.h
@@ -27,7 +27,7 @@  struct cnxk_tim_evdev {
 };
 
 static inline struct cnxk_tim_evdev *
-tim_priv_get(void)
+cnxk_tim_priv_get(void)
 {
 	const struct rte_memzone *mz;
 
@@ -38,6 +38,10 @@  tim_priv_get(void)
 	return mz->addr;
 }
 
+int cnxk_tim_caps_get(const struct rte_eventdev *dev, uint64_t flags,
+		      uint32_t *caps,
+		      const struct rte_event_timer_adapter_ops **ops);
+
 void cnxk_tim_init(struct roc_sso *sso);
 void cnxk_tim_fini(void);