DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ivan Boule <ivan.boule@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 1/5] ethdev: check RX queue indices in RETA config against number of queues
Date: Fri, 16 May 2014 10:58:39 +0200	[thread overview]
Message-ID: <1400230723-2830-2-git-send-email-ivan.boule@6wind.com> (raw)
In-Reply-To: <1400230723-2830-1-git-send-email-ivan.boule@6wind.com>

Each entry of the RSS redirection table (RETA) of igb and ixgbe ports
contains a 4-bit RX queue index, thus imposing RSS RX queue indices to
be strictly lower than 16.
In addition, if a RETA entry is configured with a RX queue index that is
strictly lower than 16, but is greater or equal to the number of RX queues
of the port, then all input packets whose RSS hash value indexes that RETA
entry are silently dropped by the NIC.

Make the function rte_eth_dev_rss_reta_update() check that RX queue indices
that are supplied in the reta_conf argument are strictly lower than
ETH_RSS_RETA_MAX_QUEUE (16) and are strictly lower than the number of
RX queues of the port.

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
---
 lib/librte_ether/rte_ethdev.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index a5727dd..473c98b 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1501,6 +1501,7 @@ int
 rte_eth_dev_rss_reta_update(uint8_t port_id, struct rte_eth_rss_reta *reta_conf)
 {
 	struct rte_eth_dev *dev;
+	uint16_t max_rxq;
 	uint8_t i,j;
 
 	if (port_id >= nb_ports) {
@@ -1514,10 +1515,13 @@ rte_eth_dev_rss_reta_update(uint8_t port_id, struct rte_eth_rss_reta *reta_conf)
 		return (-EINVAL);
 	}
 
+	dev = &rte_eth_devices[port_id];
+	max_rxq = (dev->data->nb_rx_queues <= ETH_RSS_RETA_MAX_QUEUE) ?
+		dev->data->nb_rx_queues : ETH_RSS_RETA_MAX_QUEUE;
 	if (reta_conf->mask_lo != 0) {
 		for (i = 0; i < ETH_RSS_RETA_NUM_ENTRIES/2; i++) {
 			if ((reta_conf->mask_lo & (1ULL << i)) &&
-				(reta_conf->reta[i] >= ETH_RSS_RETA_MAX_QUEUE)) {
+				(reta_conf->reta[i] >= max_rxq)) {
 				PMD_DEBUG_TRACE("RETA hash index output"
 					"configration for port=%d,invalid"
 					"queue=%d\n",port_id,reta_conf->reta[i]);
@@ -1533,7 +1537,7 @@ rte_eth_dev_rss_reta_update(uint8_t port_id, struct rte_eth_rss_reta *reta_conf)
 
 			/* Check if the max entry >= 128 */
 			if ((reta_conf->mask_hi & (1ULL << i)) && 
-				(reta_conf->reta[j] >= ETH_RSS_RETA_MAX_QUEUE)) {
+				(reta_conf->reta[j] >= max_rxq)) {
 				PMD_DEBUG_TRACE("RETA hash index output"
 					"configration for port=%d,invalid"
 					"queue=%d\n",port_id,reta_conf->reta[j]);
@@ -1543,8 +1547,6 @@ rte_eth_dev_rss_reta_update(uint8_t port_id, struct rte_eth_rss_reta *reta_conf)
 		}
 	}
 
-	dev = &rte_eth_devices[port_id];
-
 	FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP);
 	return (*dev->dev_ops->reta_update)(dev, reta_conf);
 }
-- 
1.7.10.4

  reply	other threads:[~2014-05-16  8:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16  8:58 [dpdk-dev] [PATCH v2 0/5] allow to dynamically change RSS configuration Ivan Boule
2014-05-16  8:58 ` Ivan Boule [this message]
2014-05-16  8:58 ` [dpdk-dev] [PATCH v2 2/5] ethdev: allow to set RSS hash computation flags and/or key Ivan Boule
2014-05-16  8:58 ` [dpdk-dev] [PATCH v2 3/5] app/testpmd: configure RSS without restart Ivan Boule
2014-05-16  8:58 ` [dpdk-dev] [PATCH v2 4/5] ethdev: allow to get RSS hash functions and key Ivan Boule
2014-05-16  8:58 ` [dpdk-dev] [PATCH v2 5/5] app/testpmd: allow to configure RSS hash key Ivan Boule
2014-05-27 16:43 ` [dpdk-dev] [PATCH v2 0/5] allow to dynamically change RSS configuration Thomas Monjalon

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=1400230723-2830-2-git-send-email-ivan.boule@6wind.com \
    --to=ivan.boule@6wind.com \
    --cc=dev@dpdk.org \
    /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).