From: Pavan Nikhilesh <pbhagavat...@marvell.com>

Add function to retrieve event timer adapter capabilities.

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

diff --git a/drivers/event/octeontx2/otx2_evdev.c 
b/drivers/event/octeontx2/otx2_evdev.c
index c247848be..86b9fee97 100644
--- a/drivers/event/octeontx2/otx2_evdev.c
+++ b/drivers/event/octeontx2/otx2_evdev.c
@@ -1087,6 +1087,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 a4f6bc673..aa470f0ad 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 = otx2_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 14bbaf43c..c71094c39 100644
--- a/drivers/event/octeontx2/otx2_tim_evdev.h
+++ b/drivers/event/octeontx2/otx2_tim_evdev.h
@@ -13,11 +13,28 @@
 
 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;
 };
 
+static inline struct otx2_tim_evdev *
+otx2_tim_priv_get(void)
+{
+       const struct rte_memzone *mz;
+
+       mz = rte_memzone_lookup(RTE_STR(OTX2_TIM_EVDEV_NAME));
+       if (mz == NULL)
+               return NULL;
+
+       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);
 
 #endif /* __OTX2_TIM_EVDEV_H__ */
-- 
2.21.0

Reply via email to