DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: <dev@dpdk.org>
Cc: <bruce.richardson@intel.com>, <hemant.agrawal@nxp.com>,
	<gage.eads@intel.com>, <harry.van.haaren@intel.com>,
	<nipun.gupta@nxp.com>,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>
Subject: [dpdk-dev] [PATCH] eventdev: limit port link operation to configured queues
Date: Mon, 6 Feb 2017 10:59:37 +0530	[thread overview]
Message-ID: <1486358977-16542-1-git-send-email-jerin.jacob@caviumnetworks.com> (raw)

On port_setup, the link_map is updated only
for configured number of event queues.
Limit the port_links_get scan only to configured number
of event queues. Also, Limit the port link and unlink queue
validation to configured number of event queues.

Fixes: 8ca610e0487c ("eventdev: implement the northbound APIs")

Reported-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 lib/librte_eventdev/rte_eventdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index 2c5277a..09fc274 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -798,7 +798,7 @@ rte_event_port_link(uint8_t dev_id, uint8_t port_id,
 	}
 
 	for (i = 0; i < nb_links; i++)
-		if (queues[i] >= RTE_EVENT_MAX_QUEUES_PER_DEV)
+		if (queues[i] >= dev->data->nb_queues)
 			return -EINVAL;
 
 	diag = (*dev->dev_ops->port_link)(dev->data->ports[port_id], queues,
@@ -843,7 +843,7 @@ rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
 	}
 
 	for (i = 0; i < nb_unlinks; i++)
-		if (queues[i] >= RTE_EVENT_MAX_QUEUES_PER_DEV)
+		if (queues[i] >= dev->data->nb_queues)
 			return -EINVAL;
 
 	diag = (*dev->dev_ops->port_unlink)(dev->data->ports[port_id], queues,
@@ -879,7 +879,7 @@ rte_event_port_links_get(uint8_t dev_id, uint8_t port_id,
 	links_map = dev->data->links_map;
 	/* Point links_map to this port specific area */
 	links_map += (port_id * RTE_EVENT_MAX_QUEUES_PER_DEV);
-	for (i = 0; i < RTE_EVENT_MAX_QUEUES_PER_DEV; i++) {
+	for (i = 0; i < dev->data->nb_queues; i++) {
 		if (links_map[i] != EVENT_QUEUE_SERVICE_PRIORITY_INVALID) {
 			queues[count] = i;
 			priorities[count] = (uint8_t)links_map[i];
-- 
2.5.5

             reply	other threads:[~2017-02-06  5:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06  5:29 Jerin Jacob [this message]
2017-02-07 10:00 ` Nipun Gupta
2017-02-15 14:53   ` Bruce Richardson

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=1486358977-16542-1-git-send-email-jerin.jacob@caviumnetworks.com \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=gage.eads@intel.com \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.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).