[16/44] event/octeontx2: add worker dequeue functions

Message ID 20190601185355.370-17-pbhagavatula@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Jerin Jacob
Headers
Series OCTEON TX2 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 1, 2019, 6:53 p.m. UTC
  From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add worker event dequeue functions.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 drivers/event/octeontx2/otx2_evdev.h  | 10 +++++
 drivers/event/octeontx2/otx2_worker.c | 55 +++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
  

Patch

diff --git a/drivers/event/octeontx2/otx2_evdev.h b/drivers/event/octeontx2/otx2_evdev.h
index b5d889132..99ee6cea0 100644
--- a/drivers/event/octeontx2/otx2_evdev.h
+++ b/drivers/event/octeontx2/otx2_evdev.h
@@ -163,6 +163,16 @@  uint16_t otx2_ssogws_enq_new_burst(void *port, const struct rte_event ev[],
 uint16_t otx2_ssogws_enq_fwd_burst(void *port, const struct rte_event ev[],
 				   uint16_t nb_events);
 
+uint16_t otx2_ssogws_deq(void *port, struct rte_event *ev,
+			 uint64_t timeout_ticks);
+uint16_t otx2_ssogws_deq_burst(void *port, struct rte_event ev[],
+			       uint16_t nb_events, uint64_t timeout_ticks);
+uint16_t otx2_ssogws_deq_timeout(void *port, struct rte_event *ev,
+				 uint64_t timeout_ticks);
+uint16_t otx2_ssogws_deq_timeout_burst(void *port, struct rte_event ev[],
+				       uint16_t nb_events,
+				       uint64_t timeout_ticks);
+
 /* Init and Fini API's */
 int otx2_sso_init(struct rte_eventdev *event_dev);
 int otx2_sso_fini(struct rte_eventdev *event_dev);
diff --git a/drivers/event/octeontx2/otx2_worker.c b/drivers/event/octeontx2/otx2_worker.c
index 044c5f132..edc574673 100644
--- a/drivers/event/octeontx2/otx2_worker.c
+++ b/drivers/event/octeontx2/otx2_worker.c
@@ -81,6 +81,61 @@  otx2_ssogws_release_event(struct otx2_ssogws *ws)
 	otx2_ssogws_swtag_flush(ws);
 }
 
+uint16_t __hot
+otx2_ssogws_deq(void *port, struct rte_event *ev, uint64_t timeout_ticks)
+{
+	struct otx2_ssogws *ws = port;
+
+	RTE_SET_USED(timeout_ticks);
+
+	if (ws->swtag_req) {
+		ws->swtag_req = 0;
+		otx2_ssogws_swtag_wait(ws);
+		return 1;
+	}
+
+	return otx2_ssogws_get_work(ws, ev);
+}
+
+uint16_t __hot
+otx2_ssogws_deq_burst(void *port, struct rte_event ev[], uint16_t nb_events,
+		      uint64_t timeout_ticks)
+{
+	RTE_SET_USED(nb_events);
+
+	return otx2_ssogws_deq(port, ev, timeout_ticks);
+}
+
+uint16_t __hot
+otx2_ssogws_deq_timeout(void *port, struct rte_event *ev,
+			uint64_t timeout_ticks)
+{
+	struct otx2_ssogws *ws = port;
+	uint16_t ret = 1;
+	uint64_t iter;
+
+	if (ws->swtag_req) {
+		ws->swtag_req = 0;
+		otx2_ssogws_swtag_wait(ws);
+		return ret;
+	}
+
+	ret = otx2_ssogws_get_work(ws, ev);
+	for (iter = 1; iter < timeout_ticks && (ret == 0); iter++)
+		ret = otx2_ssogws_get_work(ws, ev);
+
+	return ret;
+}
+
+uint16_t __hot
+otx2_ssogws_deq_timeout_burst(void *port, struct rte_event ev[],
+			      uint16_t nb_events, uint64_t timeout_ticks)
+{
+	RTE_SET_USED(nb_events);
+
+	return otx2_ssogws_deq_timeout(port, ev, timeout_ticks);
+}
+
 uint16_t __hot
 otx2_ssogws_enq(void *port, const struct rte_event *ev)
 {