diff mbox series

[v3,10/42] event/octeontx2: support dequeue timeout tick conversion

Message ID 20190628182354.228-11-pbhagavatula@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers show
Series OCTEONTX2 event device driver | expand

Checks

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

Commit Message

Pavan Nikhilesh Bhagavatula June 28, 2019, 6:23 p.m. UTC
From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add function to convert dequeue timeout from ns to ticks.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 drivers/event/octeontx2/otx2_evdev.c | 11 +++++++++++
 drivers/event/octeontx2/otx2_evdev.h |  1 +
 2 files changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/drivers/event/octeontx2/otx2_evdev.c b/drivers/event/octeontx2/otx2_evdev.c
index 53e68902a..ef6693bc5 100644
--- a/drivers/event/octeontx2/otx2_evdev.c
+++ b/drivers/event/octeontx2/otx2_evdev.c
@@ -635,6 +635,16 @@  otx2_sso_port_setup(struct rte_eventdev *event_dev, uint8_t port_id,
 	return 0;
 }
 
+static int
+otx2_sso_timeout_ticks(struct rte_eventdev *event_dev, uint64_t ns,
+		       uint64_t *tmo_ticks)
+{
+	RTE_SET_USED(event_dev);
+	*tmo_ticks = NSEC2TICK(ns, rte_get_timer_hz());
+
+	return 0;
+}
+
 /* Initialize and register event driver with DPDK Application */
 static struct rte_eventdev_ops otx2_sso_ops = {
 	.dev_infos_get    = otx2_sso_info_get,
@@ -647,6 +657,7 @@  static struct rte_eventdev_ops otx2_sso_ops = {
 	.port_release     = otx2_sso_port_release,
 	.port_link        = otx2_sso_port_link,
 	.port_unlink      = otx2_sso_port_unlink,
+	.timeout_ticks    = otx2_sso_timeout_ticks,
 };
 
 #define OTX2_SSO_XAE_CNT	"xae_cnt"
diff --git a/drivers/event/octeontx2/otx2_evdev.h b/drivers/event/octeontx2/otx2_evdev.h
index 3f4931ff1..1a9de1b86 100644
--- a/drivers/event/octeontx2/otx2_evdev.h
+++ b/drivers/event/octeontx2/otx2_evdev.h
@@ -75,6 +75,7 @@ 
 
 #define NSEC2USEC(__ns)			((__ns) / 1E3)
 #define USEC2NSEC(__us)                 ((__us) * 1E3)
+#define NSEC2TICK(__ns, __freq)		(((__ns) * (__freq)) / 1E9)
 
 enum otx2_sso_lf_type {
 	SSO_LF_GGRP,