DPDK patches and discussions
 help / color / mirror / Atom feed
From: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
To: Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	Yongseok Koh <yskoh@mellanox.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 4/4] net/mlx5: refuse empty VLAN flow specification
Date: Tue, 13 Mar 2018 15:17:39 +0100	[thread overview]
Message-ID: <0fdcf57a444961b082e7b4baaab6cc072c99da0d.1520950386.git.nelio.laranjeiro@6wind.com> (raw)
In-Reply-To: <cover.1520950386.git.nelio.laranjeiro@6wind.com>
In-Reply-To: <cover.1520950386.git.nelio.laranjeiro@6wind.com>

Verbs specification does help to distinguish between packets having an VLAN
and those which do not have, this ends by having flow rule which does not
react as the user expects e.g.

 flow create 0 ingress pattern eth / vlan / end action queue index 0 / end
 flow create 0 ingress pattern eth / end action queue index 1 / end

are colliding in Verbs definition as in both rule are matching packets with
or without VLAN.
For this reason, the VLAN specification must not be empty, otherwise the
PMD has to refuse it.

Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_flow.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 5c096ca9c..875a5028d 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1305,9 +1305,18 @@ mlx5_flow_create_vlan(const struct rte_flow_item *item,
 			eth->val.vlan_tag = spec->tci;
 			eth->mask.vlan_tag = mask->tci;
 			eth->val.vlan_tag &= eth->mask.vlan_tag;
+			/*
+			 * From verbs perspective an empty VLAN is equivalent
+			 * to a packet without VLAN layer.
+			 */
+			if (!eth->mask.vlan_tag)
+				goto error;
 		}
+		return 0;
 	}
-	return 0;
+error:
+	return rte_flow_error_set(data->error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM,
+				  item, "VLAN cannot be empty");
 }
 
 /**
-- 
2.11.0

      parent reply	other threads:[~2018-03-13 14:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15  9:23 [dpdk-dev] [PATCH] net/mlx5: change tunnel flow priority Nelio Laranjeiro
2018-02-16 11:17 ` Adrien Mazarguil
2018-03-13 14:17 ` [dpdk-dev] [PATCH 0/4] net/mlx5: multiple fix and improvements in flows Nelio Laranjeiro
2018-03-21 14:53   ` Shahaf Shuler
2018-03-13 14:17 ` [dpdk-dev] [PATCH 1/4] net/mlx5: change tunnel flow priority Nelio Laranjeiro
2018-03-13 14:17 ` [dpdk-dev] [PATCH 2/4] net/mlx5: fix flow single queue Nelio Laranjeiro
2018-03-21 18:45   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2018-03-28  9:04     ` Ferruh Yigit
2018-03-28 11:13       ` Shahaf Shuler
2018-03-28 11:34         ` Nélio Laranjeiro
2018-03-28 13:16           ` Ferruh Yigit
2018-03-28 15:09             ` Nélio Laranjeiro
2018-03-28 16:38               ` Ferruh Yigit
2018-03-13 14:17 ` [dpdk-dev] [PATCH 3/4] net/mlx5: improve flow error explanation Nelio Laranjeiro
2018-03-13 14:17 ` Nelio Laranjeiro [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=0fdcf57a444961b082e7b4baaab6cc072c99da0d.1520950386.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).