[v2,28/44] event/octeontx2: add timer adapter capabilities

Message ID 20190628075024.404-29-pbhagavatula@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series OCTEONTX2 event device driver |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Pavan Nikhilesh Bhagavatula June 28, 2019, 7:50 a.m. UTC
  From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add function to retrieve event timer adapter capabilities.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 drivers/event/octeontx2/otx2_evdev.c     |  2 ++
 drivers/event/octeontx2/otx2_tim_evdev.c | 19 +++++++++++++++++++
 drivers/event/octeontx2/otx2_tim_evdev.h |  5 +++++
 3 files changed, 26 insertions(+)
  

Patch

diff --git a/drivers/event/octeontx2/otx2_evdev.c b/drivers/event/octeontx2/otx2_evdev.c
index a716167b3..a1222b3cf 100644
--- a/drivers/event/octeontx2/otx2_evdev.c
+++ b/drivers/event/octeontx2/otx2_evdev.c
@@ -1092,6 +1092,8 @@  static struct rte_eventdev_ops otx2_sso_ops = {
 	.port_unlink      = otx2_sso_port_unlink,
 	.timeout_ticks    = otx2_sso_timeout_ticks,
 
+	.timer_adapter_caps_get = otx2_tim_caps_get,
+
 	.xstats_get       = otx2_sso_xstats_get,
 	.xstats_reset     = otx2_sso_xstats_reset,
 	.xstats_get_names = otx2_sso_xstats_get_names,
diff --git a/drivers/event/octeontx2/otx2_tim_evdev.c b/drivers/event/octeontx2/otx2_tim_evdev.c
index 004701f64..0f20c163b 100644
--- a/drivers/event/octeontx2/otx2_tim_evdev.c
+++ b/drivers/event/octeontx2/otx2_tim_evdev.c
@@ -5,6 +5,25 @@ 
 #include "otx2_evdev.h"
 #include "otx2_tim_evdev.h"
 
+int
+otx2_tim_caps_get(const struct rte_eventdev *evdev, uint64_t flags,
+		  uint32_t *caps,
+		  const struct rte_event_timer_adapter_ops **ops)
+{
+	struct otx2_tim_evdev *dev = 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
 otx2_tim_init(struct rte_pci_device *pci_dev, struct otx2_dev *cmn_dev)
 {
diff --git a/drivers/event/octeontx2/otx2_tim_evdev.h b/drivers/event/octeontx2/otx2_tim_evdev.h
index 9f7aeb7df..e94c61b1a 100644
--- a/drivers/event/octeontx2/otx2_tim_evdev.h
+++ b/drivers/event/octeontx2/otx2_tim_evdev.h
@@ -13,6 +13,7 @@ 
 
 struct otx2_tim_evdev {
 	struct rte_pci_device *pci_dev;
+	struct rte_eventdev *event_dev;
 	struct otx2_mbox *mbox;
 	uint16_t nb_rings;
 	uintptr_t bar2;
@@ -30,6 +31,10 @@  tim_priv_get(void)
 	return mz->addr;
 }
 
+int otx2_tim_caps_get(const struct rte_eventdev *dev, uint64_t flags,
+		      uint32_t *caps,
+		      const struct rte_event_timer_adapter_ops **ops);
+
 void otx2_tim_init(struct rte_pci_device *pci_dev, struct otx2_dev *cmn_dev);
 void otx2_tim_fini(void);