[v2,20/44] event/octeontx2: add worker dual GWS dequeue functions

Message ID 20190628075024.404-21-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:49 a.m. UTC
  From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Add workder dual workslot mode dequeue functions.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 drivers/event/octeontx2/otx2_evdev.h       |  9 +++
 drivers/event/octeontx2/otx2_worker_dual.c | 66 ++++++++++++++++++++++
 2 files changed, 75 insertions(+)
  

Patch

diff --git a/drivers/event/octeontx2/otx2_evdev.h b/drivers/event/octeontx2/otx2_evdev.h
index fd2a4c330..30b5d2c32 100644
--- a/drivers/event/octeontx2/otx2_evdev.h
+++ b/drivers/event/octeontx2/otx2_evdev.h
@@ -214,6 +214,15 @@  uint16_t otx2_ssogws_dual_enq_new_burst(void *port, const struct rte_event ev[],
 uint16_t otx2_ssogws_dual_enq_fwd_burst(void *port, const struct rte_event ev[],
 					uint16_t nb_events);
 
+uint16_t otx2_ssogws_dual_deq(void *port, struct rte_event *ev,
+			      uint64_t timeout_ticks);
+uint16_t otx2_ssogws_dual_deq_burst(void *port, struct rte_event ev[],
+				    uint16_t nb_events, uint64_t timeout_ticks);
+uint16_t otx2_ssogws_dual_deq_timeout(void *port, struct rte_event *ev,
+				      uint64_t timeout_ticks);
+uint16_t otx2_ssogws_dual_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_dual.c b/drivers/event/octeontx2/otx2_worker_dual.c
index 661c78c23..58fd588f6 100644
--- a/drivers/event/octeontx2/otx2_worker_dual.c
+++ b/drivers/event/octeontx2/otx2_worker_dual.c
@@ -139,3 +139,69 @@  otx2_ssogws_dual_enq_fwd_burst(void *port, const struct rte_event ev[],
 
 	return 1;
 }
+
+uint16_t __hot
+otx2_ssogws_dual_deq(void *port, struct rte_event *ev, uint64_t timeout_ticks)
+{
+	struct otx2_ssogws_dual *ws = port;
+	uint8_t gw;
+
+	RTE_SET_USED(timeout_ticks);
+	if (ws->swtag_req) {
+		otx2_ssogws_swtag_wait((struct otx2_ssogws *)
+				       &ws->ws_state[!ws->vws]);
+		ws->swtag_req = 0;
+		return 1;
+	}
+
+	gw = otx2_ssogws_dual_get_work(&ws->ws_state[ws->vws],
+				       &ws->ws_state[!ws->vws], ev);
+	ws->vws = !ws->vws;
+
+	return gw;
+}
+
+uint16_t __hot
+otx2_ssogws_dual_deq_burst(void *port, struct rte_event ev[],
+			   uint16_t nb_events, uint64_t timeout_ticks)
+{
+	RTE_SET_USED(nb_events);
+
+	return otx2_ssogws_dual_deq(port, ev, timeout_ticks);
+}
+
+uint16_t __hot
+otx2_ssogws_dual_deq_timeout(void *port, struct rte_event *ev,
+			     uint64_t timeout_ticks)
+{
+	struct otx2_ssogws_dual *ws = port;
+	uint64_t iter;
+	uint8_t gw;
+
+	if (ws->swtag_req) {
+		otx2_ssogws_swtag_wait((struct otx2_ssogws *)
+				       &ws->ws_state[!ws->vws]);
+		ws->swtag_req = 0;
+		return 1;
+	}
+
+	gw = otx2_ssogws_dual_get_work(&ws->ws_state[ws->vws],
+				       &ws->ws_state[!ws->vws], ev);
+	ws->vws = !ws->vws;
+	for (iter = 1; iter < timeout_ticks && (gw == 0); iter++) {
+		gw = otx2_ssogws_dual_get_work(&ws->ws_state[ws->vws],
+					       &ws->ws_state[!ws->vws], ev);
+		ws->vws = !ws->vws;
+	}
+
+	return gw;
+}
+
+uint16_t __hot
+otx2_ssogws_dual_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_dual_deq_timeout(port, ev, timeout_ticks);
+}