DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sunil Kumar Kori <sunil.kori@nxp.com>
To: <jerin.jacob@caviumnetworks.com>
Cc: <dev@dpdk.org>, <hemant.agrawal@nxp.com>
Subject: [dpdk-dev] [PATCH v2 10/12] event/dpaa: add eventdev enqueue/dequeue support
Date: Fri, 22 Dec 2017 20:47:23 +0530	[thread overview]
Message-ID: <20171222151725.11273-10-sunil.kori@nxp.com> (raw)
In-Reply-To: <20171222151725.11273-1-sunil.kori@nxp.com>

Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>
---
 drivers/event/dpaa/dpaa_eventdev.c | 114 +++++++++++++++++++++++++++++++++++++
 1 file changed, 114 insertions(+)

diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index 13345da..64b9eb4 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -60,6 +60,116 @@ dpaa_event_dequeue_timeout_ticks(struct rte_eventdev *dev, uint64_t ns,
 }
 
 static void
+dpaa_eventq_portal_add(u16 ch_id)
+{
+	uint32_t sdqcr;
+
+	sdqcr = QM_SDQCR_CHANNELS_POOL_CONV(ch_id);
+	qman_static_dequeue_add(sdqcr, NULL);
+}
+
+static uint16_t
+dpaa_event_enqueue_burst(void *port, const struct rte_event ev[],
+			 uint16_t nb_events)
+{
+	uint16_t i;
+	struct rte_mbuf *mbuf;
+
+	RTE_SET_USED(port);
+	/*Release all the contexts saved previously*/
+	for (i = 0; i < nb_events; i++) {
+		switch (ev[i].op) {
+		case RTE_EVENT_OP_RELEASE:
+			qman_dca_index(ev[i].impl_opaque, 0);
+			mbuf = DPAA_PER_LCORE_DQRR_MBUF(i);
+			mbuf->seqn = DPAA_INVALID_MBUF_SEQN;
+			DPAA_PER_LCORE_DQRR_HELD &= ~(1 << i);
+			DPAA_PER_LCORE_DQRR_SIZE--;
+			break;
+		default:
+			break;
+		}
+	}
+
+	return nb_events;
+}
+
+static uint16_t
+dpaa_event_enqueue(void *port, const struct rte_event *ev)
+{
+	return dpaa_event_enqueue_burst(port, ev, 1);
+}
+
+static uint16_t
+dpaa_event_dequeue_burst(void *port, struct rte_event ev[],
+			 uint16_t nb_events, uint64_t timeout_ticks)
+{
+	int ret;
+	u16 ch_id;
+	void *buffers[8];
+	u32 num_frames, i;
+	uint64_t wait_time, cur_ticks, start_ticks;
+	struct dpaa_port *portal = (struct dpaa_port *)port;
+	struct rte_mbuf *mbuf;
+
+	/* Affine current thread context to a qman portal */
+	ret = rte_dpaa_portal_init((void *)0);
+	if (ret) {
+		DPAA_EVENTDEV_ERR("Unable to initialize portal");
+		return ret;
+	}
+
+	if (unlikely(!portal->is_port_linked)) {
+		/*
+		 * Affine event queue for current thread context
+		 * to a qman portal.
+		 */
+		for (i = 0; i < portal->num_linked_evq; i++) {
+			ch_id = portal->evq_info[i].ch_id;
+			dpaa_eventq_portal_add(ch_id);
+		}
+		portal->is_port_linked = true;
+	}
+
+	/* Check if there are atomic contexts to be released */
+	i = 0;
+	while (DPAA_PER_LCORE_DQRR_SIZE) {
+		if (DPAA_PER_LCORE_DQRR_HELD & (1 << i)) {
+			qman_dca_index(i, 0);
+			mbuf = DPAA_PER_LCORE_DQRR_MBUF(i);
+			mbuf->seqn = DPAA_INVALID_MBUF_SEQN;
+			DPAA_PER_LCORE_DQRR_HELD &= ~(1 << i);
+			DPAA_PER_LCORE_DQRR_SIZE--;
+		}
+		i++;
+	}
+	DPAA_PER_LCORE_DQRR_HELD = 0;
+
+	if (portal->timeout == DPAA_EVENT_PORT_DEQUEUE_TIMEOUT_INVALID)
+		wait_time = timeout_ticks;
+	else
+		wait_time = portal->timeout;
+
+	/* Lets dequeue the frames */
+	start_ticks = rte_get_timer_cycles();
+	wait_time += start_ticks;
+	do {
+		num_frames = qman_portal_dequeue(ev, nb_events, buffers);
+		if (num_frames != 0)
+			break;
+		cur_ticks = rte_get_timer_cycles();
+	} while (cur_ticks < wait_time);
+
+	return num_frames;
+}
+
+static uint16_t
+dpaa_event_dequeue(void *port, struct rte_event *ev, uint64_t timeout_ticks)
+{
+	return dpaa_event_dequeue_burst(port, ev, 1, timeout_ticks);
+}
+
+static void
 dpaa_event_dev_info_get(struct rte_eventdev *dev,
 			struct rte_event_dev_info *dev_info)
 {
@@ -494,6 +604,10 @@ dpaa_event_dev_create(const char *name)
 	}
 
 	eventdev->dev_ops       = &dpaa_eventdev_ops;
+	eventdev->enqueue       = dpaa_event_enqueue;
+	eventdev->enqueue_burst = dpaa_event_enqueue_burst;
+	eventdev->dequeue       = dpaa_event_dequeue;
+	eventdev->dequeue_burst = dpaa_event_dequeue_burst;
 
 	/* For secondary processes, the primary has done all the work */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-- 
2.9.3

  parent reply	other threads:[~2017-12-22 15:17 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-15 13:08 [dpdk-dev] [PATCH 0/6] event/dpaa: Support for eventdev Sunil Kumar Kori
2017-12-15 13:08 ` [dpdk-dev] [PATCH 1/6] bus/dpaa: added event dequeue and consumption support Sunil Kumar Kori
2017-12-16 12:34   ` Jerin Jacob
2017-12-15 13:08 ` [dpdk-dev] [PATCH 2/6] bus/dpaa: add dpaa eventdev dynamic log support Sunil Kumar Kori
2017-12-15 13:08 ` [dpdk-dev] [PATCH 3/6] net/dpaa: ethdev Rx queue configurations with eventdev Sunil Kumar Kori
2017-12-15 13:08 ` [dpdk-dev] [PATCH 4/6] event/dpaa: add eventdev PMD Sunil Kumar Kori
2017-12-16 12:37   ` Jerin Jacob
2017-12-19  7:08     ` Sunil Kumar Kori
2017-12-15 13:08 ` [dpdk-dev] [PATCH 5/6] config: enabling compilation of DPAA " Sunil Kumar Kori
2017-12-16 12:39   ` Jerin Jacob
2017-12-15 13:08 ` [dpdk-dev] [PATCH 6/6] doc: add DPAA eventdev guide Sunil Kumar Kori
2017-12-22 15:17   ` [dpdk-dev] [PATCH v2 01/12] config: enabling compilation of DPAA eventdev PMD Sunil Kumar Kori
2017-12-22 15:17     ` [dpdk-dev] [PATCH v2 02/12] bus/dpaa: add event dequeue and consumption support Sunil Kumar Kori
2017-12-22 15:17     ` [dpdk-dev] [PATCH v2 03/12] bus/dpaa: add dpaa eventdev dynamic log support Sunil Kumar Kori
2017-12-22 15:17     ` [dpdk-dev] [PATCH v2 04/12] net/dpaa: ethdev Rx queue configurations with eventdev Sunil Kumar Kori
2017-12-22 15:17     ` [dpdk-dev] [PATCH v2 05/12] event/dpaa: add eventdev PMD Sunil Kumar Kori
2017-12-22 15:17     ` [dpdk-dev] [PATCH v2 06/12] event/dpaa: add event queue config get/set support Sunil Kumar Kori
2017-12-22 15:17     ` [dpdk-dev] [PATCH v2 07/12] event/dpaa: add event port " Sunil Kumar Kori
2017-12-22 15:17     ` [dpdk-dev] [PATCH v2 08/12] event/dpaa: add dequeue timeout conversion support Sunil Kumar Kori
2017-12-22 15:17     ` [dpdk-dev] [PATCH v2 09/12] event/dpaa: add eth rx adapter queue config support Sunil Kumar Kori
2017-12-22 15:17     ` Sunil Kumar Kori [this message]
2017-12-22 15:17     ` [dpdk-dev] [PATCH v2 11/12] config: add eventdev library to application Sunil Kumar Kori
2017-12-22 15:17     ` [dpdk-dev] [PATCH v2 12/12] doc: add DPAA eventdev guide Sunil Kumar Kori
2018-01-08 11:29       ` Jerin Jacob
2018-01-08 14:13         ` Hemant Agrawal
2018-01-10 12:10           ` Hemant Agrawal
2018-01-10 18:23             ` Jerin Jacob
2018-01-15 17:25               ` Jerin Jacob
2017-12-16 12:31 ` [dpdk-dev] [PATCH 0/6] event/dpaa: Support for eventdev Jerin Jacob
2018-01-16 17:57 ` [dpdk-dev] [PATCH 00/12 v3] " Nipun Gupta
2018-01-16 17:57   ` [dpdk-dev] [PATCH 01/12 v3] config: enabling compilation of DPAA eventdev PMD Nipun Gupta
2018-01-16 17:57   ` [dpdk-dev] [PATCH 02/12 v3] bus/dpaa: add event dequeue and consumption support Nipun Gupta
2018-01-16 17:57   ` [dpdk-dev] [PATCH 03/12 v3] bus/dpaa: add dpaa eventdev dynamic log support Nipun Gupta
2018-01-16 17:57   ` [dpdk-dev] [PATCH 04/12 v3] net/dpaa: ethdev Rx queue configurations with eventdev Nipun Gupta
2018-01-16 17:57   ` [dpdk-dev] [PATCH 05/12 v3] event/dpaa: add eventdev PMD Nipun Gupta
2018-01-16 17:57   ` [dpdk-dev] [PATCH 06/12 v3] event/dpaa: add event queue config get/set support Nipun Gupta
2018-01-16 17:58   ` [dpdk-dev] [PATCH 07/12 v3] event/dpaa: add event port " Nipun Gupta
2018-01-16 17:58   ` [dpdk-dev] [PATCH 08/12 v3] event/dpaa: add dequeue timeout conversion support Nipun Gupta
2018-01-16 11:50     ` Jerin Jacob
2018-01-16 13:35       ` Nipun Gupta
2018-01-16 17:58   ` [dpdk-dev] [PATCH 09/12 v3] event/dpaa: add eth rx adapter queue config support Nipun Gupta
2018-01-16 17:58   ` [dpdk-dev] [PATCH 10/12 v3] event/dpaa: add eventdev enqueue/dequeue support Nipun Gupta
2018-01-16 17:58   ` [dpdk-dev] [PATCH 11/12 v3] config: add eventdev library to application Nipun Gupta
2018-01-16 11:52     ` Jerin Jacob
2018-01-16 17:58   ` [dpdk-dev] [PATCH 12/12 v3] doc: add DPAA eventdev guide Nipun Gupta
2018-01-16 11:49     ` Jerin Jacob
2018-01-16 15:32     ` Kovacevic, Marko
2018-01-17  3:28       ` Nipun Gupta
2018-01-16 20:43 ` [dpdk-dev] [PATCH 00/10 v4] event/dpaa: Support for eventdev Nipun Gupta
2018-01-16 15:04   ` Jerin Jacob
2018-01-16 20:43   ` [dpdk-dev] [PATCH 01/10 v4] config: enabling compilation of DPAA eventdev PMD Nipun Gupta
2018-01-16 20:43   ` [dpdk-dev] [PATCH 02/10 v4] bus/dpaa: add event dequeue and consumption support Nipun Gupta
2018-01-16 20:43   ` [dpdk-dev] [PATCH 03/10 v4] bus/dpaa: add dpaa eventdev dynamic log support Nipun Gupta
2018-01-16 20:43   ` [dpdk-dev] [PATCH 04/10 v4] net/dpaa: ethdev Rx queue configurations with eventdev Nipun Gupta
2018-01-16 20:43   ` [dpdk-dev] [PATCH 05/10 v4] event/dpaa: add eventdev PMD Nipun Gupta
2018-01-16 20:43   ` [dpdk-dev] [PATCH 06/10 v4] event/dpaa: add event queue config get/set support Nipun Gupta
2018-01-16 20:44   ` [dpdk-dev] [PATCH 07/10 v4] event/dpaa: add event port " Nipun Gupta
2018-01-16 20:44   ` [dpdk-dev] [PATCH 08/10 v4] event/dpaa: add eth rx adapter queue config support Nipun Gupta
2018-01-16 20:44   ` [dpdk-dev] [PATCH 09/10 v4] event/dpaa: add eventdev enqueue/dequeue support Nipun Gupta
2018-01-16 20:44   ` [dpdk-dev] [PATCH 10/10 v4] doc: add DPAA eventdev guide Nipun Gupta
2018-01-17 16:54     ` Mcnamara, John
2018-01-18  6:56   ` [dpdk-dev] [PATCH 00/10 v4] event/dpaa: Support for eventdev Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171222151725.11273-10-sunil.kori@nxp.com \
    --to=sunil.kori@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).