DPDK patches and discussions
 help / color / mirror / Atom feed
From: Liang Ma <liang.j.ma@intel.com>
To: jerin.jacob@caviumnetworks.com
Cc: dev@dpdk.org, harry.van.haaren@intel.com,
	bruce.richardson@intel.com, deepak.k.jain@intel.com,
	john.geary@intel.com, peter.mccarthy@intel.com, seanbh@gmail.com,
	marko.kovacevic@intel.com
Subject: [dpdk-dev] [PATCH v7 04/12] event/opdl: add event port config get/set support
Date: Wed, 10 Jan 2018 14:46:03 +0000	[thread overview]
Message-ID: <1515595571-139425-5-git-send-email-liang.j.ma@intel.com> (raw)
In-Reply-To: <1515595571-139425-1-git-send-email-liang.j.ma@intel.com>

Signed-off-by: Liang Ma <liang.j.ma@intel.com>
Signed-off-by: Peter Mccarthy <peter.mccarthy@intel.com>
---
 drivers/event/opdl/opdl_evdev.c | 152 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 152 insertions(+)

diff --git a/drivers/event/opdl/opdl_evdev.c b/drivers/event/opdl/opdl_evdev.c
index 11ac8fc..56e6910 100644
--- a/drivers/event/opdl/opdl_evdev.c
+++ b/drivers/event/opdl/opdl_evdev.c
@@ -26,6 +26,152 @@
 static void
 opdl_info_get(struct rte_eventdev *dev, struct rte_event_dev_info *info);
 
+static int
+opdl_port_link(struct rte_eventdev *dev,
+	       void *port,
+	       const uint8_t queues[],
+	       const uint8_t priorities[],
+	       uint16_t num)
+{
+	struct opdl_port *p = port;
+
+	RTE_SET_USED(priorities);
+	RTE_SET_USED(dev);
+
+	if (unlikely(dev->data->dev_started)) {
+		PMD_DRV_LOG(ERR, "DEV_ID:[%02d] : "
+			     "Attempt to link queue (%u) to port %d while device started\n",
+			     dev->data->dev_id,
+				queues[0],
+				p->id);
+		rte_errno = -EINVAL;
+		return 0;
+	}
+
+	/* Max of 1 queue per port */
+	if (num > 1) {
+		PMD_DRV_LOG(ERR, "DEV_ID:[%02d] : "
+			     "Attempt to link more than one queue (%u) to port %d requested\n",
+			     dev->data->dev_id,
+				num,
+				p->id);
+		rte_errno = -EDQUOT;
+		return 0;
+	}
+
+	if (!p->configured) {
+		PMD_DRV_LOG(ERR, "DEV_ID:[%02d] : "
+			     "port %d not configured, cannot link to %u\n",
+			     dev->data->dev_id,
+				p->id,
+				queues[0]);
+		rte_errno = -EINVAL;
+		return 0;
+	}
+
+	if (p->external_qid != OPDL_INVALID_QID) {
+		PMD_DRV_LOG(ERR, "DEV_ID:[%02d] : "
+			     "port %d already linked to queue %u, cannot link to %u\n",
+			     dev->data->dev_id,
+				p->id,
+				p->external_qid,
+				queues[0]);
+		rte_errno = -EINVAL;
+		return 0;
+	}
+
+	p->external_qid = queues[0];
+
+	return 1;
+}
+
+static int
+opdl_port_unlink(struct rte_eventdev *dev,
+		 void *port,
+		 uint8_t queues[],
+		 uint16_t nb_unlinks)
+{
+	struct opdl_port *p = port;
+
+	RTE_SET_USED(queues);
+	RTE_SET_USED(nb_unlinks);
+
+	if (unlikely(dev->data->dev_started)) {
+		PMD_DRV_LOG(ERR, "DEV_ID:[%02d] : "
+			     "Attempt to unlink queue (%u) to port %d while device started\n",
+			     dev->data->dev_id,
+			     queues[0],
+			     p->id);
+		rte_errno = -EINVAL;
+		return 0;
+	}
+	RTE_SET_USED(nb_unlinks);
+
+	/* Port Stuff */
+	p->queue_id = OPDL_INVALID_QID;
+	p->p_type = OPDL_INVALID_PORT;
+	p->external_qid = OPDL_INVALID_QID;
+
+	/* always unlink 0 queue due to statice pipeline */
+	return 0;
+}
+
+static int
+opdl_port_setup(struct rte_eventdev *dev,
+		uint8_t port_id,
+		const struct rte_event_port_conf *conf)
+{
+	struct opdl_evdev *device = opdl_pmd_priv(dev);
+	struct opdl_port *p = &device->ports[port_id];
+
+	RTE_SET_USED(conf);
+
+	/* Check if port already configured */
+	if (p->configured) {
+		PMD_DRV_LOG(ERR, "DEV_ID:[%02d] : "
+			     "Attempt to setup port %d which is already setup\n",
+			     dev->data->dev_id,
+			     p->id);
+		return -EDQUOT;
+	}
+
+	*p = (struct opdl_port){0}; /* zero entire structure */
+	p->id = port_id;
+	p->opdl = device;
+	p->queue_id = OPDL_INVALID_QID;
+	p->external_qid = OPDL_INVALID_QID;
+	dev->data->ports[port_id] = p;
+	rte_smp_wmb();
+	p->configured = 1;
+	device->nb_ports++;
+	return 0;
+}
+
+static void
+opdl_port_release(void *port)
+{
+	struct opdl_port *p = (void *)port;
+
+	if (p == NULL ||
+	    p->opdl->data->dev_started) {
+		return;
+	}
+
+	p->configured = 0;
+	p->initialized = 0;
+}
+
+static void
+opdl_port_def_conf(struct rte_eventdev *dev, uint8_t port_id,
+		struct rte_event_port_conf *port_conf)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(port_id);
+
+	port_conf->new_event_threshold = MAX_OPDL_CONS_Q_DEPTH;
+	port_conf->dequeue_depth = MAX_OPDL_CONS_Q_DEPTH;
+	port_conf->enqueue_depth = MAX_OPDL_CONS_Q_DEPTH;
+}
 
 static int
 opdl_queue_setup(struct rte_eventdev *dev,
@@ -413,6 +559,12 @@ opdl_probe(struct rte_vdev_device *vdev)
 		.queue_def_conf = opdl_queue_def_conf,
 		.queue_setup = opdl_queue_setup,
 		.queue_release = opdl_queue_release,
+		.port_def_conf = opdl_port_def_conf,
+		.port_setup = opdl_port_setup,
+		.port_release = opdl_port_release,
+		.port_link = opdl_port_link,
+		.port_unlink = opdl_port_unlink,
+
 
 		.xstats_get = opdl_xstats_get,
 		.xstats_get_names = opdl_xstats_get_names,
-- 
2.7.5

  parent reply	other threads:[~2018-01-10 14:46 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 11:23 [dpdk-dev] [RFC v4 PATCH 0/8] event: eventdev OPDL PMD Liang Ma
2017-12-22 11:23 ` [dpdk-dev] [PATCH v4 1/8] event/opdl: add the opdl ring infrastructure library Liang Ma
2017-12-22 16:02   ` Sean Harte
2018-01-08  6:46     ` Jerin Jacob
2018-01-08 11:19       ` Liang, Ma
2018-01-08 11:23         ` Jerin Jacob
2017-12-22 11:23 ` [dpdk-dev] [PATCH v4 2/8] event/opdl: add the opdl pmd main body and helper function Liang Ma
2017-12-22 11:23 ` [dpdk-dev] [PATCH v4 3/8] eventdev/opdl: opdl eventdev pmd unit test function Liang Ma
2017-12-22 11:23 ` [dpdk-dev] [PATCH v4 4/8] lib/librte_eventdev: extend the eventdev capability flags Liang Ma
2018-01-08  6:32   ` Jerin Jacob
2017-12-22 11:23 ` [dpdk-dev] [PATCH v4 5/8] event/*: apply the three new capability flags for sw/dppa2/octeontx Liang Ma
2017-12-22 11:23 ` [dpdk-dev] [PATCH v4 6/8] maintainers: add the opdl pmd maintainer information Liang Ma
2017-12-23 15:05   ` Thomas Monjalon
2017-12-22 11:23 ` [dpdk-dev] [PATCH v4 7/8] doc:update 18.02 release notes Liang Ma
2017-12-22 11:23 ` [dpdk-dev] [PATCH v4 8/8] doc: add eventdev opdl pmd docuement Liang Ma
2017-12-23 15:06 ` [dpdk-dev] [RFC v4 PATCH 0/8] event: eventdev OPDL PMD Thomas Monjalon
2018-01-09 12:20 ` [dpdk-dev] [RFC v5 PATCH 00/12] " Liang Ma
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 01/12] event/opdl: add the opdl ring infrastructure library Liang Ma
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 02/12] event/opdl: add opdl PMD main body and helper function Liang Ma
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 03/12] event/opdl: add event queue config get/set support Liang Ma
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 04/12] event/opdl: add event port " Liang Ma
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 05/12] event/opdl: add eventdev enqueue/dequeue support Liang Ma
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 06/12] event/opdl: opdl eventdev PMD unit test function Liang Ma
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 07/12] lib/librte_eventdev: extend the eventdev capability flags Liang Ma
2018-01-09 12:27     ` Jerin Jacob
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 08/12] event/dpaa2: apply the three new " Liang Ma
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 09/12] event/octeontx: " Liang Ma
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 10/12] event/sw: " Liang Ma
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 11/12] doc: update 18.02 release notes and maintainers info Liang Ma
2018-01-09 12:20   ` [dpdk-dev] [PATCH v5 12/12] doc: add eventdev opdl PMD guide Liang Ma
2018-01-09 14:18   ` [dpdk-dev] [RFC v6 PATCH 00/12] event: eventdev OPDL PMD Liang Ma
2018-01-09 14:18     ` [dpdk-dev] [PATCH v6 01/12] event/opdl: add the opdl ring infrastructure library Liang Ma
2018-01-10 10:00       ` Sean Harte
2018-01-09 14:18     ` [dpdk-dev] [PATCH v6 02/12] event/opdl: add opdl PMD main body and helper function Liang Ma
2018-01-09 14:18     ` [dpdk-dev] [PATCH v6 03/12] event/opdl: add event queue config get/set support Liang Ma
2018-01-09 14:18     ` [dpdk-dev] [PATCH v6 04/12] event/opdl: add event port " Liang Ma
2018-01-09 14:18     ` [dpdk-dev] [PATCH v6 05/12] event/opdl: add eventdev enqueue/dequeue support Liang Ma
2018-01-09 14:18     ` [dpdk-dev] [PATCH v6 06/12] event/opdl: opdl eventdev PMD unit test function Liang Ma
2018-01-09 14:18     ` [dpdk-dev] [PATCH v6 07/12] event/opdl: extend the eventdev capability flags Liang Ma
2018-01-09 14:18     ` [dpdk-dev] [PATCH v6 08/12] event/dpaa2: apply the three new " Liang Ma
2018-01-09 14:18     ` [dpdk-dev] [PATCH v6 09/12] event/octeontx: " Liang Ma
2018-01-09 14:18     ` [dpdk-dev] [PATCH v6 10/12] event/sw: " Liang Ma
2018-01-09 14:19     ` [dpdk-dev] [PATCH v6 11/12] doc: update 18.02 release notes and maintainers info Liang Ma
2018-01-10 10:38       ` Kovacevic, Marko
2018-01-09 14:19     ` [dpdk-dev] [PATCH v6 12/12] doc: add eventdev opdl PMD guide Liang Ma
2018-01-09 17:13     ` [dpdk-dev] [RFC v6 PATCH 00/12] event: eventdev OPDL PMD Van Haaren, Harry
2018-01-10 14:45     ` [dpdk-dev] [RFC v7 " Liang Ma
2018-01-10 14:46       ` [dpdk-dev] [PATCH v7 01/12] event/opdl: add the opdl ring infrastructure library Liang Ma
2018-01-10 14:46       ` [dpdk-dev] [PATCH v7 02/12] event/opdl: add opdl PMD main body and helper function Liang Ma
2018-01-10 14:46       ` [dpdk-dev] [PATCH v7 03/12] event/opdl: add event queue config get/set support Liang Ma
2018-01-10 14:46       ` Liang Ma [this message]
2018-01-10 14:46       ` [dpdk-dev] [PATCH v7 05/12] event/opdl: add eventdev enqueue/dequeue support Liang Ma
2018-01-10 14:46       ` [dpdk-dev] [PATCH v7 06/12] event/opdl: opdl eventdev PMD unit test function Liang Ma
2018-01-10 14:46       ` [dpdk-dev] [PATCH v7 07/12] event/opdl: extend the eventdev capability flags Liang Ma
2018-01-10 14:46       ` [dpdk-dev] [PATCH v7 08/12] event/dpaa2: apply the three new " Liang Ma
2018-01-10 14:46       ` [dpdk-dev] [PATCH v7 09/12] event/octeontx: " Liang Ma
2018-01-10 14:46       ` [dpdk-dev] [PATCH v7 10/12] event/sw: " Liang Ma
2018-01-10 14:46       ` [dpdk-dev] [PATCH v7 11/12] doc: update 18.02 release notes and maintainers info Liang Ma
2018-01-10 15:01         ` Kovacevic, Marko
2018-01-10 14:46       ` [dpdk-dev] [PATCH v7 12/12] doc: add eventdev opdl PMD guide Liang Ma
2018-01-10 15:01         ` Jerin Jacob
2018-01-10 15:08           ` Liang, Ma
2018-01-10 18:17             ` Jerin Jacob
2018-01-10 15:04         ` Kovacevic, Marko

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=1515595571-139425-5-git-send-email-liang.j.ma@intel.com \
    --to=liang.j.ma@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=deepak.k.jain@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=john.geary@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=peter.mccarthy@intel.com \
    --cc=seanbh@gmail.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).