DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gage Eads <gage.eads@intel.com>
To: dev@dpdk.org
Cc: jerin.jacob@caviumnetworks.com, bruce.richardson@intel.com,
	hemant.agrawal@nxp.com, harry.van.haaren@intel.com,
	nipun.gupta@nxp.com
Subject: [dpdk-dev] [PATCH] eventdev: Fix links_map initialization
Date: Wed,  1 Mar 2017 22:47:36 -0600	[thread overview]
Message-ID: <1488430056-32055-1-git-send-email-gage.eads@intel.com> (raw)

This patch initializes the links_map array entries to
EVENT_QUEUE_SERVICE_PRIORITY_INVALID, as expected by
rte_event_port_links_get().

Signed-off-by: Gage Eads <gage.eads@intel.com>
---
 lib/librte_eventdev/rte_eventdev.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index 68bfc3b..b8cd92b 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -190,6 +190,8 @@ rte_event_dev_queue_config(struct rte_eventdev *dev, uint8_t nb_queues)
 	return 0;
 }
 
+#define EVENT_QUEUE_SERVICE_PRIORITY_INVALID (0xdead)
+
 static inline int
 rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 {
@@ -251,6 +253,9 @@ rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 					"nb_ports %u", nb_ports);
 			return -(ENOMEM);
 		}
+		for (i = 0; i < nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV; i++)
+			dev->data->links_map[i] =
+				EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 	} else if (dev->data->ports != NULL && nb_ports != 0) {/* re-config */
 		RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->port_release, -ENOTSUP);
 
@@ -305,6 +310,10 @@ rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 
 		if (nb_ports > old_nb_ports) {
 			uint8_t new_ps = nb_ports - old_nb_ports;
+			unsigned int old_links_map_end =
+				old_nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;
+			unsigned int links_map_end =
+				nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV;
 
 			memset(ports + old_nb_ports, 0,
 				sizeof(ports[0]) * new_ps);
@@ -312,9 +321,9 @@ rte_event_dev_port_config(struct rte_eventdev *dev, uint8_t nb_ports)
 				sizeof(ports_dequeue_depth[0]) * new_ps);
 			memset(ports_enqueue_depth + old_nb_ports, 0,
 				sizeof(ports_enqueue_depth[0]) * new_ps);
-			memset(links_map +
-				(old_nb_ports * RTE_EVENT_MAX_QUEUES_PER_DEV),
-				0, sizeof(ports_enqueue_depth[0]) * new_ps);
+			for (i = old_links_map_end; i < links_map_end; i++)
+				links_map[i] =
+					EVENT_QUEUE_SERVICE_PRIORITY_INVALID;
 		}
 
 		dev->data->ports = ports;
@@ -815,8 +824,6 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 	return diag;
 }
 
-#define EVENT_QUEUE_SERVICE_PRIORITY_INVALID (0xdead)
-
 int
 rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 		      uint8_t queues[], uint16_t nb_unlinks)
-- 
2.7.4

             reply	other threads:[~2017-03-02  4:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02  4:47 Gage Eads [this message]
2017-03-06 13:06 ` Jerin Jacob
2017-03-06 14:38   ` Eads, Gage
2017-03-06 16:51     ` Jerin Jacob
2017-03-06 17:02 ` [dpdk-dev] [PATCH v2] eventdev: Fix links_map initialization for sw PMD Gage Eads
2017-03-07  6:12   ` Jerin Jacob
2017-03-07 16:25 ` [dpdk-dev] [PATCH v3] eventdev: fix links map initialization for SW PMD Gage Eads
2017-03-13  8:52   ` 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=1488430056-32055-1-git-send-email-gage.eads@intel.com \
    --to=gage.eads@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=nipun.gupta@nxp.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).