DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dekel Peled <dekelp@nvidia.com>
To: matan@nvidia.com, shahafs@nvidia.com, viacheslavo@nvidia.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 5/5] net/mlx5: enforce limitation on IPv6 next proto
Date: Thu, 15 Oct 2020 17:05:57 +0300	[thread overview]
Message-ID: <ec04f03ea6b345fbdbe6b4c4d0df0e8b4706c3f6.1602770369.git.dekelp@nvidia.com> (raw)
In-Reply-To: <cover.1602770369.git.dekelp@nvidia.com>

Due to PRM requirement, the IPv6 header item 'proto' field, indicating
the next header protocol, should not be set as extension header.
This patch adds the relevant validation, and documents the limitation.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 doc/guides/nics/mlx5.rst     |  7 +++++++
 drivers/net/mlx5/mlx5_flow.c | 14 ++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/doc/guides/nics/mlx5.rst b/doc/guides/nics/mlx5.rst
index a071db2..c2bd737 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -317,6 +317,13 @@ Limitations
   - The E-Switch Sample flow must have the eswitch_manager VPORT destination (PF or ECPF) and no additional actions.
   - For ConnectX-5, the ``RTE_FLOW_ACTION_TYPE_SAMPLE`` is typically used as first action in the E-Switch egress flow if with header modify or encapsulation actions.
 
+- IPv6 header item 'proto' field, indicating the next header protocol, should
+  not be set as extension header.
+  In case the next header is an extension header, it should not be specified in
+  IPv6 header item 'proto' field.
+  The last extension header item 'next header' field can specify the following
+  header protocol type.
+
 Statistics
 ----------
 
diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 1116ebb..2922cae 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1977,9 +1977,9 @@ struct mlx5_flow_tunnel_info {
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "IPv6 cannot follow L2/VLAN layer "
 					  "which ether type is not IPv6");
+	if (mask && spec)
+		next_proto = mask->hdr.proto & spec->hdr.proto;
 	if (item_flags & MLX5_FLOW_LAYER_IPV6_ENCAP) {
-		if (mask && spec)
-			next_proto = mask->hdr.proto & spec->hdr.proto;
 		if (next_proto == IPPROTO_IPIP || next_proto == IPPROTO_IPV6)
 			return rte_flow_error_set(error, EINVAL,
 						  RTE_FLOW_ERROR_TYPE_ITEM,
@@ -1987,6 +1987,16 @@ struct mlx5_flow_tunnel_info {
 						  "multiple tunnel "
 						  "not supported");
 	}
+	if (next_proto == IPPROTO_HOPOPTS  ||
+	    next_proto == IPPROTO_ROUTING  ||
+	    next_proto == IPPROTO_FRAGMENT ||
+	    next_proto == IPPROTO_ESP	   ||
+	    next_proto == IPPROTO_AH	   ||
+	    next_proto == IPPROTO_DSTOPTS)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "IPv6 proto (next header) should "
+					  "not be set as extension header");
 	if (item_flags & MLX5_FLOW_LAYER_IPIP)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
-- 
1.8.3.1


  parent reply	other threads:[~2020-10-15 14:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13 14:16 [dpdk-dev] [PATCH 0/5] net/mlx5: support match on L3 fragmented packets Dekel Peled
2020-10-13 14:16 ` [dpdk-dev] [PATCH 1/5] net/mlx5: remove handling of ICMP " Dekel Peled
2020-10-13 14:16 ` [dpdk-dev] [PATCH 2/5] net/mlx5: support match on IPv4 fragment packets Dekel Peled
2020-10-13 14:16 ` [dpdk-dev] [PATCH 3/5] net/mlx5: support match on IPv6 " Dekel Peled
2020-10-13 14:16 ` [dpdk-dev] [PATCH 4/5] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
2020-10-13 14:16 ` [dpdk-dev] [PATCH 5/5] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
2020-10-15 14:05 ` [dpdk-dev] [PATCH v2 0/5] net/mlx5: support match on L3 fragmented packets Dekel Peled
2020-10-15 14:05   ` [dpdk-dev] [PATCH v2 1/5] net/mlx5: remove handling of ICMP " Dekel Peled
2020-10-15 14:05   ` [dpdk-dev] [PATCH v2 2/5] net/mlx5: support match on IPv4 fragment packets Dekel Peled
2020-10-15 14:05   ` [dpdk-dev] [PATCH v2 3/5] net/mlx5: support match on IPv6 " Dekel Peled
2020-10-15 14:05   ` [dpdk-dev] [PATCH v2 4/5] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
2020-10-15 14:05   ` Dekel Peled [this message]
2020-10-18 15:14   ` [dpdk-dev] [PATCH v2 0/5] net/mlx5: support match on L3 fragmented packets Raslan Darawsheh

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=ec04f03ea6b345fbdbe6b4c4d0df0e8b4706c3f6.1602770369.git.dekelp@nvidia.com \
    --to=dekelp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=viacheslavo@nvidia.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).