DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: dev@dpdk.org
Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	Yongseok Koh <yskoh@mellanox.com>
Subject: [dpdk-dev] [PATCH 2/2] net/mlx5: fix RSS flow rule with non existing queues
Date: Wed, 29 Mar 2017 09:53:39 +0200	[thread overview]
Message-ID: <853462d73e9e7da238c88f18418c1428b592a9eb.1490773631.git.nelio.laranjeiro@6wind.com> (raw)
In-Reply-To: <2a99263e0ab95c4af08ffb2dc17084a72b9265ee.1490773631.git.nelio.laranjeiro@6wind.com>
In-Reply-To: <2a99263e0ab95c4af08ffb2dc17084a72b9265ee.1490773631.git.nelio.laranjeiro@6wind.com>

RSS flow rule validation accepts any queue even non existing ones which
causes a segmentation fault at creation time.

Fixes: fb4db56ea074 ("net/mlx5: support RSS action flow rule")

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index b34be55..3691e95 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -488,16 +488,18 @@ priv_flow_validate(struct priv *priv,
 					break;
 				}
 			}
-			if (action->queues_n && !found) {
+			if (action->queues_n > 1 && !found) {
 				rte_flow_error_set(error, ENOTSUP,
 					   RTE_FLOW_ERROR_TYPE_ACTION,
 					   actions,
 					   "queue action not in RSS queues");
 				return -rte_errno;
 			}
-			action->queue = 1;
-			action->queues_n = 1;
-			action->queues[0] = queue->index;
+			if (!found) {
+				action->queue = 1;
+				action->queues_n = 1;
+				action->queues[0] = queue->index;
+			}
 		} else if (actions->type == RTE_FLOW_ACTION_TYPE_RSS) {
 			const struct rte_flow_action_rss *rss =
 				(const struct rte_flow_action_rss *)
@@ -524,6 +526,16 @@ priv_flow_validate(struct priv *priv,
 					return -rte_errno;
 				}
 			}
+			for (n = 0; n < rss->num; ++n) {
+				if (rss->queue[n] >= priv->rxqs_n) {
+					rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ACTION,
+						   actions,
+						   "queue id > number of"
+						   " queues");
+					return -rte_errno;
+				}
+			}
 			action->queue = 1;
 			for (n = 0; n < rss->num; ++n)
 				action->queues[n] = rss->queue[n];
-- 
2.1.4

  reply	other threads:[~2017-03-29  7:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29  7:53 [dpdk-dev] [PATCH 1/2] net/mlx5: remove duplicated process Nelio Laranjeiro
2017-03-29  7:53 ` Nelio Laranjeiro [this message]
2017-04-03 11:25 ` [dpdk-dev] [PATCH] net/mlx5: fix RSS flow rule with non existing queues Nelio Laranjeiro
2017-04-03 12:47   ` Ferruh Yigit

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=853462d73e9e7da238c88f18418c1428b592a9eb.1490773631.git.nelio.laranjeiro@6wind.com \
    --to=nelio.laranjeiro@6wind.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=yskoh@mellanox.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).