From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/2] net/mlx4: fix queue index check on flow rules
Date: Tue, 31 Oct 2017 11:31:07 +0100 [thread overview]
Message-ID: <1509445707-19349-2-git-send-email-adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <1509445707-19349-1-git-send-email-adrien.mazarguil@6wind.com>
Users are not prevented from creating flow rules targeting nonexistent
queues, which silently makes such rules drop-like.
While it can be thought as a feature, reporting an error instead is
actually far more useful in order to catch common mistakes.
Fixes: 078b8b452e6b ("net/mlx4: add RSS flow rule action support")
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx4/mlx4_flow.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c
index 86bac1b..8b87b29 100644
--- a/drivers/net/mlx4/mlx4_flow.c
+++ b/drivers/net/mlx4/mlx4_flow.c
@@ -734,6 +734,11 @@ mlx4_flow_prepare(struct priv *priv,
if (flow->rss)
break;
queue = action->conf;
+ if (queue->index >= priv->dev->data->nb_rx_queues) {
+ msg = "queue target index beyond number of"
+ " configured Rx queues";
+ goto exit_action_not_supported;
+ }
flow->rss = mlx4_rss_get
(priv, 0, mlx4_rss_hash_key_default, 1,
&queue->index);
@@ -760,6 +765,15 @@ mlx4_flow_prepare(struct priv *priv,
ETH_RSS_NONFRAG_IPV6_TCP),
};
/* Sanity checks. */
+ for (i = 0; i < rss->num; ++i)
+ if (rss->queue[i] >=
+ priv->dev->data->nb_rx_queues)
+ break;
+ if (i != rss->num) {
+ msg = "queue index target beyond number of"
+ " configured Rx queues";
+ goto exit_action_not_supported;
+ }
if (!rte_is_power_of_2(rss->num)) {
msg = "for RSS, mlx4 requires the number of"
" queues to be a power of two";
--
2.1.4
prev parent reply other threads:[~2017-10-31 10:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 10:31 [dpdk-dev] [PATCH 1/2] net/mlx4: fix Rx after updating number of queues Adrien Mazarguil
2017-10-31 10:31 ` Adrien Mazarguil [this message]
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=1509445707-19349-2-git-send-email-adrien.mazarguil@6wind.com \
--to=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.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).