DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets
@ 2020-09-30 14:10 Dekel Peled
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 01/10] ethdev: add extensions attributes to IPv6 item Dekel Peled
                   ` (11 more replies)
  0 siblings, 12 replies; 101+ messages in thread
From: Dekel Peled @ 2020-09-30 14:10 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This series implements support of matching on packets based on the
fragmentation attribute of the packet, i.e. if packet is a fragment
of a larger packet, or the opposite - packet is not a fragment.

In ethdev, add API to support IPv6 extension headers, and specifically
the IPv6 fragment extension header item.
In MLX5 PMD, support match on IPv4 fragmented packets, IPv6 fragmented
packets, and IPv6 fragment extension header item.
Testpmd CLI is updated accordingly.
Documentation is updated accordingly.

Dekel Peled (10):
  ethdev: add extensions attributes to IPv6 item
  ethdev: add IPv6 fragment extension header item
  app/testpmd: support IPv4 fragments
  app/testpmd: support IPv6 fragments
  app/testpmd: support IPv6 fragment extension item
  net/mlx5: remove handling of ICMP fragmented packets
  net/mlx5: support match on IPv4 fragment packets
  net/mlx5: support match on IPv6 fragment packets
  net/mlx5: support match on IPv6 fragment ext. item
  doc: update release notes for MLX5 L3 frag support

 app/test-pmd/cmdline_flow.c            |  53 +++++
 doc/guides/prog_guide/rte_flow.rst     |  28 ++-
 doc/guides/rel_notes/release_20_11.rst |  10 +
 drivers/net/mlx5/mlx5_flow.c           |  48 +++--
 drivers/net/mlx5/mlx5_flow.h           |  14 ++
 drivers/net/mlx5/mlx5_flow_dv.c        | 382 +++++++++++++++++++++++++++++----
 drivers/net/mlx5/mlx5_flow_verbs.c     |   9 +-
 lib/librte_ethdev/rte_flow.c           |   1 +
 lib/librte_ethdev/rte_flow.h           |  46 +++-
 lib/librte_ip_frag/rte_ip_frag.h       |  26 +--
 lib/librte_net/rte_ip.h                |  26 ++-
 11 files changed, 555 insertions(+), 88 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH 01/10] ethdev: add extensions attributes to IPv6 item
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
@ 2020-09-30 14:10 ` Dekel Peled
  2020-09-30 14:54   ` Ori Kam
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 02/10] ethdev: add IPv6 fragment extension header item Dekel Peled
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-09-30 14:10 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Using the current implementation of DPDK, an application cannot match on
IPv6 packets, based on the existing extension headers, in a simple way.

Field 'Next Header' in IPv6 header indicates type of the first extension
header only. Following extension headers can't be identified by
inspecting the IPv6 header.
As a result, the existence or absence of specific extension headers
can't be used for packet matching.

For example, fragmented IPv6 packets contain a dedicated extension header
(which is implemented in a later patch of this series).
Non-fragmented packets don't contain the fragment extension header.
For an application to match on non-fragmented IPv6 packets, the current
implementation doesn't provide a suitable solution.
Matching on the Next Header field is not sufficient, since additional
extension headers might be present in the same packet.
To match on fragmented IPv6 packets, the same difficulty exists.

This patch implements the update as detailed in RFC [1].
A set of additional values will be added to IPv6 header struct.
These values will indicate the existence of every defined extension
header type, providing simple means for identification of existing
extensions in the packet header.
Continuing the above example, fragmented packets can be identified using
the specific value indicating existence of fragment extension header.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 16 +++++++++++++---
 lib/librte_ethdev/rte_flow.h       | 25 +++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 119b128..0b476da 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -946,11 +946,21 @@ Item: ``IPV6``
 
 Matches an IPv6 header.
 
-Note: IPv6 options are handled by dedicated pattern items, see `Item:
-IPV6_EXT`_.
+Dedicated flags indicate existence of specific extension headers.
+Every type of extension header can use a dedicated pattern item, or
+the generic `Item: IPV6_EXT`_.
 
 - ``hdr``: IPv6 header definition (``rte_ip.h``).
-- Default ``mask`` matches source and destination addresses only.
+- ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
+- ``rout_ext_exist``: Routing extension header exists.
+- ``frag_ext_exist``: Fragment extension header exists.
+- ``auth_ext_exist``: Authentication extension header exists.
+- ``esp_ext_exist``: Encapsulation Security Payload extension header exists.
+- ``dest_ext_exist``: Destination Options extension header exists.
+- ``mobil_ext_exist``: Mobility extension header exists.
+- ``hip_ext_exist``: Host Identity Protocol extension header exists.
+- ``shim6_ext_exist``: Shim6 Protocol extension header exists.
+- Default ``mask`` matches ``hdr`` source and destination addresses only.
 
 Item: ``ICMP``
 ^^^^^^^^^^^^^^
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index da8bfa5..5b5bed2 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -792,11 +792,32 @@ struct rte_flow_item_ipv4 {
  *
  * Matches an IPv6 header.
  *
- * Note: IPv6 options are handled by dedicated pattern items, see
- * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
+ * Dedicated flags indicate existence of specific extension headers.
+ * Every type of extension header can use a dedicated pattern item, or
+ * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.
  */
 struct rte_flow_item_ipv6 {
 	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
+	uint32_t hop_ext_exist:1;
+	/**< Hop-by-Hop Options extension header exists. */
+	uint32_t rout_ext_exist:1;
+	/**< Routing extension header exists. */
+	uint32_t frag_ext_exist:1;
+	/**< Fragment extension header exists. */
+	uint32_t auth_ext_exist:1;
+	/**< Authentication extension header exists. */
+	uint32_t esp_ext_exist:1;
+	/**< Encapsulation Security Payload extension header exists. */
+	uint32_t dest_ext_exist:1;
+	/**< Destination Options extension header exists. */
+	uint32_t mobil_ext_exist:1;
+	/**< Mobility extension header exists. */
+	uint32_t hip_ext_exist:1;
+	/**< Host Identity Protocol extension header exists. */
+	uint32_t shim6_ext_exist:1;
+	/**< Shim6 Protocol extension header exists. */
+	uint32_t reserved:23;
+	/**< Reserved for future extension headers, must be zero. */
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH 02/10] ethdev: add IPv6 fragment extension header item
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 01/10] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-09-30 14:10 ` Dekel Peled
  2020-09-30 14:55   ` Ori Kam
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 03/10] app/testpmd: support IPv4 fragments Dekel Peled
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-09-30 14:10 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Applications handling fragmented IPv6 packets need to match on IPv6
fragment extension header, in order to identify the fragments order
and location in the packet.
This patch introduces the IPv6 fragment extension header item,
proposed in [1].

Relevant definitions are moved from lib/librte_ip_frag/rte_ip_frag.h
to lib/librte_net/rte_ip.h, as they are needed for IPv6 header handling.
struct ipv6_extension_fragment renamed to rte_ipv6_fragment_ext to
adapt it to the common naming convention.

Default mask is not defined, since all fields are optional.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 16 ++++++++++++++--
 lib/librte_ethdev/rte_flow.c       |  1 +
 lib/librte_ethdev/rte_flow.h       | 21 +++++++++++++++++++++
 lib/librte_ip_frag/rte_ip_frag.h   | 26 ++------------------------
 lib/librte_net/rte_ip.h            | 26 ++++++++++++++++++++++++--
 5 files changed, 62 insertions(+), 28 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 0b476da..826e45d 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -947,8 +947,8 @@ Item: ``IPV6``
 Matches an IPv6 header.
 
 Dedicated flags indicate existence of specific extension headers.
-Every type of extension header can use a dedicated pattern item, or
-the generic `Item: IPV6_EXT`_.
+Every type of extension header can use a dedicated pattern item,
+for example `Item: IPV6_FRAG_EXT`_, or the generic `Item: IPV6_EXT`_.
 
 - ``hdr``: IPv6 header definition (``rte_ip.h``).
 - ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
@@ -1187,6 +1187,18 @@ Normally preceded by any of:
 - `Item: IPV6`_
 - `Item: IPV6_EXT`_
 
+Item: ``IPV6_FRAG_EXT``
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches the presence of IPv6 fragment extension header.
+
+- ``hdr``: IPv6 fragment extension header definition (``rte_ip.h``).
+
+Normally preceded by any of:
+
+- `Item: IPV6`_
+- `Item: IPV6_EXT`_
+
 Item: ``ICMP6``
 ^^^^^^^^^^^^^^^
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index f8fdd68..c1f3132 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -72,6 +72,7 @@ struct rte_flow_desc_data {
 	MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)),
 	MK_FLOW_ITEM(ARP_ETH_IPV4, sizeof(struct rte_flow_item_arp_eth_ipv4)),
 	MK_FLOW_ITEM(IPV6_EXT, sizeof(struct rte_flow_item_ipv6_ext)),
+	MK_FLOW_ITEM(IPV6_FRAG_EXT, sizeof(struct rte_flow_item_ipv6_frag_ext)),
 	MK_FLOW_ITEM(ICMP6, sizeof(struct rte_flow_item_icmp6)),
 	MK_FLOW_ITEM(ICMP6_ND_NS, sizeof(struct rte_flow_item_icmp6_nd_ns)),
 	MK_FLOW_ITEM(ICMP6_ND_NA, sizeof(struct rte_flow_item_icmp6_nd_na)),
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 5b5bed2..1443e6a 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -368,6 +368,13 @@ enum rte_flow_item_type {
 	RTE_FLOW_ITEM_TYPE_IPV6_EXT,
 
 	/**
+	 * Matches the presence of IPv6 fragment extension header.
+	 *
+	 * See struct rte_flow_item_ipv6_frag_ext.
+	 */
+	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
+
+	/**
 	 * Matches any ICMPv6 header.
 	 *
 	 * See struct rte_flow_item_icmp6.
@@ -1188,6 +1195,20 @@ struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
 #endif
 
 /**
+ * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
+ *
+ * Matches the presence of IPv6 fragment extension header.
+ *
+ * Preceded by any of:
+ *
+ * - RTE_FLOW_ITEM_TYPE_IPV6
+ * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
+ */
+struct rte_flow_item_ipv6_frag_ext {
+	struct rte_ipv6_fragment_ext hdr;
+};
+
+/**
  * RTE_FLOW_ITEM_TYPE_ICMP6
  *
  * Matches any ICMPv6 header.
diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h
index 66edd7e..0bfe64b 100644
--- a/lib/librte_ip_frag/rte_ip_frag.h
+++ b/lib/librte_ip_frag/rte_ip_frag.h
@@ -110,30 +110,8 @@ struct rte_ip_frag_tbl {
 	__extension__ struct ip_frag_pkt pkt[0]; /**< hash table. */
 };
 
-/** IPv6 fragment extension header */
-#define	RTE_IPV6_EHDR_MF_SHIFT			0
-#define	RTE_IPV6_EHDR_MF_MASK			1
-#define	RTE_IPV6_EHDR_FO_SHIFT			3
-#define	RTE_IPV6_EHDR_FO_MASK			(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
-#define	RTE_IPV6_EHDR_FO_ALIGN			(1 << RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_FRAG_USED_MASK			\
-	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
-
-#define RTE_IPV6_GET_MF(x)				((x) & RTE_IPV6_EHDR_MF_MASK)
-#define RTE_IPV6_GET_FO(x)				((x) >> RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
-	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
-
-struct ipv6_extension_fragment {
-	uint8_t next_header;            /**< Next header type */
-	uint8_t reserved;               /**< Reserved */
-	uint16_t frag_data;             /**< All fragmentation data */
-	uint32_t id;                    /**< Packet ID */
-} __rte_packed;
-
-
+/* struct ipv6_extension_fragment moved to librte_net/rte_ip.h and renamed. */
+#define ipv6_extension_fragment	rte_ipv6_fragment_ext
 
 /**
  * Create a new IP fragmentation table.
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index fcd1eb3..3081c46 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -456,8 +456,30 @@ struct rte_ipv6_hdr {
 	return (uint16_t)cksum;
 }
 
-/* IPv6 fragmentation header size */
-#define RTE_IPV6_FRAG_HDR_SIZE 8
+/** IPv6 fragment extension header. */
+#define	RTE_IPV6_EHDR_MF_SHIFT	0
+#define	RTE_IPV6_EHDR_MF_MASK	1
+#define	RTE_IPV6_EHDR_FO_SHIFT	3
+#define	RTE_IPV6_EHDR_FO_MASK	(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
+#define	RTE_IPV6_EHDR_FO_ALIGN	(1 << RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_FRAG_USED_MASK	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
+
+#define RTE_IPV6_GET_MF(x)	((x) & RTE_IPV6_EHDR_MF_MASK)
+#define RTE_IPV6_GET_FO(x)	((x) >> RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
+	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
+
+struct rte_ipv6_fragment_ext {
+	uint8_t next_header;	/**< Next header type */
+	uint8_t reserved;	/**< Reserved */
+	rte_be16_t frag_data;	/**< All fragmentation data */
+	rte_be32_t id;		/**< Packet ID */
+} __rte_packed;
+
+/* IPv6 fragment extension header size */
+#define RTE_IPV6_FRAG_HDR_SIZE	sizeof(struct rte_ipv6_fragment_ext)
 
 /**
  * Parse next IPv6 header extension
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH 03/10] app/testpmd: support IPv4 fragments
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 01/10] ethdev: add extensions attributes to IPv6 item Dekel Peled
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 02/10] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-09-30 14:10 ` Dekel Peled
  2020-09-30 14:54   ` Ori Kam
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 04/10] app/testpmd: support IPv6 fragments Dekel Peled
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-09-30 14:10 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates testpmd CLI to support fragment_offset field of
IPv4 header item.

To match on non-fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 0 fragment_offset mask 0x3fff ...
To match on fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 1 fragment_offset last 0x3fff
fragment_offset mask 0x3fff ...
(Use the full available range 1 to 0x3fff to include all possible
values.)
To match on any IPv4 packets, fragmented and non-fragmented,
the fragment_offset field should not be specified for match.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 6263d30..0c964c1 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -129,6 +129,7 @@ enum index {
 	ITEM_VLAN_INNER_TYPE,
 	ITEM_IPV4,
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -871,6 +872,7 @@ struct parse_action_priv {
 
 static const enum index item_ipv4[] = {
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -2093,6 +2095,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
 					     hdr.type_of_service)),
 	},
+	[ITEM_IPV4_FRAGMENT_OFFSET] = {
+		.name = "fragment_offset",
+		.help = "fragmentation flags and fragment offset",
+		.next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
+					     hdr.fragment_offset)),
+	},
 	[ITEM_IPV4_TTL] = {
 		.name = "ttl",
 		.help = "time to live",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH 04/10] app/testpmd: support IPv6 fragments
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
                   ` (2 preceding siblings ...)
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 03/10] app/testpmd: support IPv4 fragments Dekel Peled
@ 2020-09-30 14:10 ` Dekel Peled
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 05/10] app/testpmd: support IPv6 fragment extension item Dekel Peled
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-09-30 14:10 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], introduced frag_ext_exist field for
IPv6 header item, used to indicate match on fragmented/non-fragmented
packets.
This patch updates testpmd CLI to support the new field.

To match on non-fragmented IPv6 packets, need to use pattern:
... ipv6 frag_ext_exist spec 0 frag_ext_exist mask 1 ...
To match on fragmented IPv6 packets, need to use pattern:
... ipv6 frag_ext_exist spec 1 frag_ext_exist mask 1 ...
To match on any IPv6 packets, the frag_ext_exist field should
not be specified for match.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 0c964c1..55cc30f 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -141,6 +141,7 @@ enum index {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_FRAG_EXT_EXIST,
 	ITEM_ICMP,
 	ITEM_ICMP_TYPE,
 	ITEM_ICMP_CODE,
@@ -888,6 +889,7 @@ struct parse_action_priv {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_FRAG_EXT_EXIST,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2181,6 +2183,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6,
 					     hdr.dst_addr)),
 	},
+	[ITEM_IPV6_FRAG_EXT_EXIST] = {
+		.name = "frag_ext_exist",
+		.help = "fragment packet attribute",
+		.next = NEXT(item_ipv6, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_ipv6,
+					   frag_ext_exist, 1)),
+	},
 	[ITEM_ICMP] = {
 		.name = "icmp",
 		.help = "match ICMP header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH 05/10] app/testpmd: support IPv6 fragment extension item
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
                   ` (3 preceding siblings ...)
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 04/10] app/testpmd: support IPv6 fragments Dekel Peled
@ 2020-09-30 14:10 ` Dekel Peled
  2020-09-30 14:56   ` Ori Kam
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 06/10] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-09-30 14:10 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch updates testpmd CLI to support the new item and its fields.

To match on fragmented IPv6 packets, this item is added to pattern:
... ipv6 / ipv6_frag_ext ...

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 55cc30f..ef166e3 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -193,6 +193,9 @@ enum index {
 	ITEM_ARP_ETH_IPV4_TPA,
 	ITEM_IPV6_EXT,
 	ITEM_IPV6_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT,
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
 	ITEM_ICMP6,
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -784,6 +787,7 @@ struct parse_action_priv {
 	ITEM_VXLAN_GPE,
 	ITEM_ARP_ETH_IPV4,
 	ITEM_IPV6_EXT,
+	ITEM_IPV6_FRAG_EXT,
 	ITEM_ICMP6,
 	ITEM_ICMP6_ND_NS,
 	ITEM_ICMP6_ND_NA,
@@ -1003,6 +1007,13 @@ struct parse_action_priv {
 	ZERO,
 };
 
+static const enum index item_ipv6_frag_ext[] = {
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_icmp6[] = {
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -2560,6 +2571,30 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_ext,
 					     next_hdr)),
 	},
+	[ITEM_IPV6_FRAG_EXT] = {
+		.name = "ipv6_frag_ext",
+		.help = "match presence of IPv6 fragment extension header",
+		.priv = PRIV_ITEM(IPV6_FRAG_EXT,
+				sizeof(struct rte_flow_item_ipv6_frag_ext)),
+		.next = NEXT(item_ipv6_frag_ext),
+		.call = parse_vc,
+	},
+	[ITEM_IPV6_FRAG_EXT_NEXT_HDR] = {
+		.name = "next_hdr",
+		.help = "next header",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_ipv6_frag_ext,
+					hdr.next_header)),
+	},
+	[ITEM_IPV6_FRAG_EXT_FRAG_DATA] = {
+		.name = "frag_data",
+		.help = "Fragment flags and offset",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_frag_ext,
+					     hdr.frag_data)),
+	},
 	[ITEM_ICMP6] = {
 		.name = "icmp6",
 		.help = "match any ICMPv6 header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH 06/10] net/mlx5: remove handling of ICMP fragmented packets
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
                   ` (4 preceding siblings ...)
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 05/10] app/testpmd: support IPv6 fragment extension item Dekel Peled
@ 2020-09-30 14:10 ` Dekel Peled
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 07/10] net/mlx5: support match on IPv4 fragment packets Dekel Peled
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-09-30 14:10 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Commit [1] forced setting of match on 'frag' bit mask 1 and value 0.
Previous patch in this series added support of match on fragmented and
non-fragmented packets on L3 items, so this setting is now redundant.

This patch removes the changes done in [1].

[1] commit 85407db9f60d ("net/mlx5: fix matching for ICMP fragments")

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 79fdf34..0a0a5a4 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7345,12 +7345,6 @@ struct field_modify_info modify_tcp[] = {
 		return;
 	if (!icmp6_m)
 		icmp6_m = &rte_flow_item_icmp6_mask;
-	/*
-	 * Force flow only to match the non-fragmented IPv6 ICMPv6 packets.
-	 * If only the protocol is specified, no need to match the frag.
-	 */
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmpv6_type, icmp6_m->type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type,
 		 icmp6_v->type & icmp6_m->type);
@@ -7398,12 +7392,6 @@ struct field_modify_info modify_tcp[] = {
 		return;
 	if (!icmp_m)
 		icmp_m = &rte_flow_item_icmp_mask;
-	/*
-	 * Force flow only to match the non-fragmented IPv4 ICMP packets.
-	 * If only the protocol is specified, no need to match the frag.
-	 */
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmp_type,
 		 icmp_m->hdr.icmp_type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmp_type,
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH 07/10] net/mlx5: support match on IPv4 fragment packets
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
                   ` (5 preceding siblings ...)
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 06/10] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
@ 2020-09-30 14:10 ` Dekel Peled
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 08/10] net/mlx5: support match on IPv6 " Dekel Peled
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-09-30 14:10 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch adds to MLX5 PMD the support of matching on IPv4
fragmented and non-fragmented packets, using the IPv4 header
fragment_offset field.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c       |  48 ++++++++----
 drivers/net/mlx5/mlx5_flow.h       |  10 +++
 drivers/net/mlx5/mlx5_flow_dv.c    | 156 +++++++++++++++++++++++++++++++------
 drivers/net/mlx5/mlx5_flow_verbs.c |   9 ++-
 4 files changed, 178 insertions(+), 45 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index ffa7646..906741f 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -474,6 +474,8 @@ struct mlx5_flow_tunnel_info {
  *   Bit-masks covering supported fields by the NIC to compare with user mask.
  * @param[in] size
  *   Bit-masks size in bytes.
+ * @param[in] range_accepted
+ *   True if range of values is accepted for specific fields, false otherwise.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -485,6 +487,7 @@ struct mlx5_flow_tunnel_info {
 			  const uint8_t *mask,
 			  const uint8_t *nic_mask,
 			  unsigned int size,
+			  bool range_accepted,
 			  struct rte_flow_error *error)
 {
 	unsigned int i;
@@ -502,7 +505,7 @@ struct mlx5_flow_tunnel_info {
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "mask/last without a spec is not"
 					  " supported");
-	if (item->spec && item->last) {
+	if (item->spec && item->last && !range_accepted) {
 		uint8_t spec[size];
 		uint8_t last[size];
 		unsigned int i;
@@ -1277,7 +1280,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_icmp6_mask,
-		 sizeof(struct rte_flow_item_icmp6), error);
+		 sizeof(struct rte_flow_item_icmp6),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1329,7 +1333,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_icmp_mask,
-		 sizeof(struct rte_flow_item_icmp), error);
+		 sizeof(struct rte_flow_item_icmp),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1384,7 +1389,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_eth),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -1438,7 +1443,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_vlan),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!tunnel && mask->tci != RTE_BE16(0x0fff)) {
@@ -1502,6 +1507,7 @@ struct mlx5_flow_tunnel_info {
 			     uint64_t last_item,
 			     uint16_t ether_type,
 			     const struct rte_flow_item_ipv4 *acc_mask,
+			     bool range_accepted,
 			     struct rte_flow_error *error)
 {
 	const struct rte_flow_item_ipv4 *mask = item->mask;
@@ -1572,7 +1578,7 @@ struct mlx5_flow_tunnel_info {
 					acc_mask ? (const uint8_t *)acc_mask
 						 : (const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_ipv4),
-					error);
+					range_accepted, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1592,6 +1598,8 @@ struct mlx5_flow_tunnel_info {
  * @param[in] acc_mask
  *   Acceptable mask, if NULL default internal default mask
  *   will be used to check whether item fields are supported.
+ * @param[in] range_accepted
+ *   True if range of values is accepted for specific fields, false otherwise.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -1671,7 +1679,7 @@ struct mlx5_flow_tunnel_info {
 					acc_mask ? (const uint8_t *)acc_mask
 						 : (const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_ipv6),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1726,7 +1734,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_udp_mask,
-		 sizeof(struct rte_flow_item_udp), error);
+		 sizeof(struct rte_flow_item_udp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1781,7 +1790,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)flow_mask,
-		 sizeof(struct rte_flow_item_tcp), error);
+		 sizeof(struct rte_flow_item_tcp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1835,7 +1845,7 @@ struct mlx5_flow_tunnel_info {
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_vxlan_mask,
 		 sizeof(struct rte_flow_item_vxlan),
-		 error);
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (spec) {
@@ -1906,7 +1916,7 @@ struct mlx5_flow_tunnel_info {
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_vxlan_gpe_mask,
 		 sizeof(struct rte_flow_item_vxlan_gpe),
-		 error);
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (spec) {
@@ -1980,7 +1990,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&gre_key_default_mask,
-		 sizeof(rte_be32_t), error);
+		 sizeof(rte_be32_t), MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -2032,7 +2042,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&nic_mask,
-		 sizeof(struct rte_flow_item_gre), error);
+		 sizeof(struct rte_flow_item_gre), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 #ifndef HAVE_MLX5DV_DR
@@ -2107,7 +2118,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 				  (item, (const uint8_t *)mask,
 				   (const uint8_t *)&nic_mask,
-				   sizeof(struct rte_flow_item_geneve), error);
+				   sizeof(struct rte_flow_item_geneve),
+				   MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (spec) {
@@ -2190,7 +2202,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_mpls_mask,
-		 sizeof(struct rte_flow_item_mpls), error);
+		 sizeof(struct rte_flow_item_mpls),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2245,7 +2258,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_nvgre_mask,
-		 sizeof(struct rte_flow_item_nvgre), error);
+		 sizeof(struct rte_flow_item_nvgre),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2339,7 +2353,7 @@ struct mlx5_flow_tunnel_info {
 					 acc_mask ? (const uint8_t *)acc_mask
 						  : (const uint8_t *)&nic_mask,
 					 sizeof(struct rte_flow_item_ecpri),
-					 error);
+					 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 }
 
 /* Allocate unique ID for the split Q/RSS subflows. */
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 279daf2..1e30c93 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -330,6 +330,14 @@ enum mlx5_feature_name {
 #define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \
 					  sizeof(struct rte_flow_item_ipv4))
 
+/* IPv4 fragment_offset field contains relevant data in bits 2 to 15. */
+#define MLX5_IPV4_FRAG_OFFSET_MASK \
+		(RTE_IPV4_HDR_OFFSET_MASK | RTE_IPV4_HDR_MF_FLAG)
+
+/* Specific item's fields can accept a range of values (using spec and last). */
+#define MLX5_ITEM_RANGE_NOT_ACCEPTED	false
+#define MLX5_ITEM_RANGE_ACCEPTED	true
+
 /* Software header modify action numbers of a flow. */
 #define MLX5_ACT_NUM_MDF_IPV4		1
 #define MLX5_ACT_NUM_MDF_IPV6		4
@@ -985,6 +993,7 @@ int mlx5_flow_item_acceptable(const struct rte_flow_item *item,
 			      const uint8_t *mask,
 			      const uint8_t *nic_mask,
 			      unsigned int size,
+			      bool range_accepted,
 			      struct rte_flow_error *error);
 int mlx5_flow_validate_item_eth(const struct rte_flow_item *item,
 				uint64_t item_flags,
@@ -1002,6 +1011,7 @@ int mlx5_flow_validate_item_ipv4(const struct rte_flow_item *item,
 				 uint64_t last_item,
 				 uint16_t ether_type,
 				 const struct rte_flow_item_ipv4 *acc_mask,
+				 bool range_accepted,
 				 struct rte_flow_error *error);
 int mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
 				 uint64_t item_flags,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 0a0a5a4..3379caf 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1418,7 +1418,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_mark),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1494,7 +1494,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_meta),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -1547,7 +1547,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_tag),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (mask->index != 0xff)
@@ -1618,7 +1618,7 @@ struct field_modify_info modify_tcp[] = {
 				(item, (const uint8_t *)mask,
 				 (const uint8_t *)&rte_flow_item_port_id_mask,
 				 sizeof(struct rte_flow_item_port_id),
-				 error);
+				 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!spec)
@@ -1691,7 +1691,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_vlan),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!tunnel && mask->tci != RTE_BE16(0x0fff)) {
@@ -1778,11 +1778,126 @@ struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "Match is supported for GTP"
 					  " flags only");
-	return mlx5_flow_item_acceptable
-		(item, (const uint8_t *)mask,
-		 (const uint8_t *)&nic_mask,
-		 sizeof(struct rte_flow_item_gtp),
-		 error);
+	return mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
+					 (const uint8_t *)&nic_mask,
+					 sizeof(struct rte_flow_item_gtp),
+					 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
+}
+
+/**
+ * Validate IPV4 item.
+ * Use existing validation function mlx5_flow_validate_item_ipv4(), and
+ * add specific validation of fragment_offset field,
+ *
+ * @param[in] item
+ *   Item specification.
+ * @param[in] item_flags
+ *   Bit-fields that holds the items detected until now.
+ * @param[out] error
+ *   Pointer to error structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+flow_dv_validate_item_ipv4(const struct rte_flow_item *item,
+			   uint64_t item_flags,
+			   uint64_t last_item,
+			   uint16_t ether_type,
+			   struct rte_flow_error *error)
+{
+	int ret;
+	const struct rte_flow_item_ipv4 *spec = item->spec;
+	const struct rte_flow_item_ipv4 *last = item->last;
+	const struct rte_flow_item_ipv4 *mask = item->mask;
+	rte_be16_t fragment_offset_spec = 0;
+	rte_be16_t fragment_offset_last = 0;
+	const struct rte_flow_item_ipv4 nic_ipv4_mask = {
+		.hdr = {
+			.src_addr = RTE_BE32(0xffffffff),
+			.dst_addr = RTE_BE32(0xffffffff),
+			.type_of_service = 0xff,
+			.fragment_offset = RTE_BE16(0xffff),
+			.next_proto_id = 0xff,
+			.time_to_live = 0xff,
+		},
+	};
+
+	ret = mlx5_flow_validate_item_ipv4(item, item_flags, last_item,
+					   ether_type, &nic_ipv4_mask,
+					   MLX5_ITEM_RANGE_ACCEPTED, error);
+	if (ret < 0)
+		return ret;
+	if (spec && mask)
+		fragment_offset_spec = spec->hdr.fragment_offset &
+				       mask->hdr.fragment_offset;
+	if (!fragment_offset_spec)
+		return 0;
+	/*
+	 * spec and mask are valid, enforce using full mask to make sure the
+	 * complete value is used correctly.
+	 */
+	if ((mask->hdr.fragment_offset & RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+			!= RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM_MASK,
+					  item, "must use full mask for"
+					  " fragment_offset");
+	/*
+	 * Match on fragment_offset 0x2000 means MF is 1 and frag-offset is 0,
+	 * indicating this is 1st fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(RTE_IPV4_HDR_MF_FLAG))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "match on first fragment not "
+					  "supported");
+	if (fragment_offset_spec && !last)
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "specified value not supported");
+	/* spec and last are valid, validate the specified range. */
+	fragment_offset_last = last->hdr.fragment_offset &
+			       mask->hdr.fragment_offset;
+	/*
+	 * Match on fragment_offset spec 0x2001 and last 0x3fff
+	 * means MF is 1 and frag-offset is > 0.
+	 * This packet is fragment 2nd and onward, excluding last.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(RTE_IPV4_HDR_MF_FLAG + 1) &&
+	    fragment_offset_last == RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on following "
+					  "fragments not supported");
+	/*
+	 * Match on fragment_offset spec 0x0001 and last 0x1fff
+	 * means MF is 0 and frag-offset is > 0.
+	 * This packet is last fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(1) &&
+	    fragment_offset_last == RTE_BE16(RTE_IPV4_HDR_OFFSET_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on last "
+					  "fragment not supported");
+	/*
+	 * Match on fragment_offset spec 0x0001 and last 0x3fff
+	 * means MF and/or frag-offset is not 0.
+	 * This is a fragmented packet.
+	 * Other range values are invalid and rejected.
+	 */
+	if (!(fragment_offset_spec == RTE_BE16(1) &&
+	      fragment_offset_last == RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK)))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST, last,
+					  "specified range not supported");
+	return 0;
 }
 
 /**
@@ -5084,15 +5199,6 @@ struct field_modify_info modify_tcp[] = {
 			.dst_port = RTE_BE16(UINT16_MAX),
 		}
 	};
-	const struct rte_flow_item_ipv4 nic_ipv4_mask = {
-		.hdr = {
-			.src_addr = RTE_BE32(0xffffffff),
-			.dst_addr = RTE_BE32(0xffffffff),
-			.type_of_service = 0xff,
-			.next_proto_id = 0xff,
-			.time_to_live = 0xff,
-		},
-	};
 	const struct rte_flow_item_ipv6 nic_ipv6_mask = {
 		.hdr = {
 			.src_addr =
@@ -5192,11 +5298,9 @@ struct field_modify_info modify_tcp[] = {
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			mlx5_flow_tunnel_ip_check(items, next_protocol,
 						  &item_flags, &tunnel);
-			ret = mlx5_flow_validate_item_ipv4(items, item_flags,
-							   last_item,
-							   ether_type,
-							   &nic_ipv4_mask,
-							   error);
+			ret = flow_dv_validate_item_ipv4(items, item_flags,
+							 last_item, ether_type,
+							 error);
 			if (ret < 0)
 				return ret;
 			last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :
@@ -6296,6 +6400,10 @@ struct field_modify_info modify_tcp[] = {
 		 ipv4_m->hdr.time_to_live);
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ttl_hoplimit,
 		 ipv4_v->hdr.time_to_live & ipv4_m->hdr.time_to_live);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag,
+		 !!(ipv4_m->hdr.fragment_offset));
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
+		 !!(ipv4_v->hdr.fragment_offset & ipv4_m->hdr.fragment_offset));
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 62c18b8..276bcb5 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1312,10 +1312,11 @@
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
-			ret = mlx5_flow_validate_item_ipv4(items, item_flags,
-							   last_item,
-							   ether_type, NULL,
-							   error);
+			ret = mlx5_flow_validate_item_ipv4
+						(items, item_flags,
+						 last_item, ether_type, NULL,
+						 MLX5_ITEM_RANGE_NOT_ACCEPTED,
+						 error);
 			if (ret < 0)
 				return ret;
 			last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH 08/10] net/mlx5: support match on IPv6 fragment packets
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
                   ` (6 preceding siblings ...)
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 07/10] net/mlx5: support match on IPv4 fragment packets Dekel Peled
@ 2020-09-30 14:10 ` Dekel Peled
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 09/10] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-09-30 14:10 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch adds to MLX5 PMD the support of matching on IPv6
fragmented and non-fragmented packets, using the new field
frag_ext_exist, added to rte_flow following RFC [1].

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 3379caf..4403abc 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5211,6 +5211,7 @@ struct field_modify_info modify_tcp[] = {
 			.proto = 0xff,
 			.hop_limits = 0xff,
 		},
+		.frag_ext_exist = 1,
 	};
 	const struct rte_flow_item_ecpri nic_ecpri_mask = {
 		.hdr = {
@@ -6519,6 +6520,10 @@ struct field_modify_info modify_tcp[] = {
 		 ipv6_m->hdr.hop_limits);
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ttl_hoplimit,
 		 ipv6_v->hdr.hop_limits & ipv6_m->hdr.hop_limits);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag,
+		 !!(ipv6_m->frag_ext_exist));
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
+		 !!(ipv6_v->frag_ext_exist & ipv6_m->frag_ext_exist));
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH 09/10] net/mlx5: support match on IPv6 fragment ext. item
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
                   ` (7 preceding siblings ...)
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 08/10] net/mlx5: support match on IPv6 " Dekel Peled
@ 2020-09-30 14:10 ` Dekel Peled
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 10/10] doc: update release notes for MLX5 L3 frag support Dekel Peled
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-09-30 14:10 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch adds to MLX5 PMD the option to match on this item type.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.h    |   4 +
 drivers/net/mlx5/mlx5_flow_dv.c | 209 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 213 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 1e30c93..376519f 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -122,6 +122,10 @@ enum mlx5_feature_name {
 /* Pattern eCPRI Layer bit. */
 #define MLX5_FLOW_LAYER_ECPRI (UINT64_C(1) << 29)
 
+/* IPv6 Fragment Extension Header bit. */
+#define MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT (1u << 30)
+#define MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT (1u << 31)
+
 /* Outer Masks. */
 #define MLX5_FLOW_LAYER_OUTER_L3 \
 	(MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 4403abc..eb1db12 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1901,6 +1901,120 @@ struct field_modify_info modify_tcp[] = {
 }
 
 /**
+ * Validate IPV6 fragment extension item.
+ *
+ * @param[in] item
+ *   Item specification.
+ * @param[in] item_flags
+ *   Bit-fields that holds the items detected until now.
+ * @param[out] error
+ *   Pointer to error structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+flow_dv_validate_item_ipv6_frag_ext(const struct rte_flow_item *item,
+				    uint64_t item_flags,
+				    struct rte_flow_error *error)
+{
+	const struct rte_flow_item_ipv6_frag_ext *spec = item->spec;
+	const struct rte_flow_item_ipv6_frag_ext *last = item->last;
+	const struct rte_flow_item_ipv6_frag_ext *mask = item->mask;
+	rte_be16_t frag_data_spec = 0;
+	rte_be16_t frag_data_last = 0;
+	const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
+	const uint64_t l4m = tunnel ? MLX5_FLOW_LAYER_INNER_L4 :
+				      MLX5_FLOW_LAYER_OUTER_L4;
+	int ret = 0;
+	struct rte_flow_item_ipv6_frag_ext nic_mask = {
+		.hdr = {
+			.next_header = 0xff,
+			.frag_data = RTE_BE16(0xffff),
+		},
+	};
+
+	if (item_flags & l4m)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "ipv6 fragment extension item cannot "
+					  "follow L4 item.");
+	if ((tunnel && !(item_flags & MLX5_FLOW_LAYER_INNER_L3_IPV6)) ||
+	    (!tunnel && !(item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV6)))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "ipv6 fragment extension item must "
+					  "follow ipv6 item");
+	if (spec && mask)
+		frag_data_spec = spec->hdr.frag_data & mask->hdr.frag_data;
+	if (!frag_data_spec)
+		return 0;
+	/*
+	 * spec and mask are valid, enforce using full mask to make sure the
+	 * complete value is used correctly.
+	 */
+	if ((mask->hdr.frag_data & RTE_BE16(RTE_IPV6_FRAG_USED_MASK)) !=
+				RTE_BE16(RTE_IPV6_FRAG_USED_MASK))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM_MASK,
+					  item, "must use full mask for"
+					  " frag_data");
+	/*
+	 * Match on frag_data 0x00001 means M is 1 and frag-offset is 0.
+	 * This is 1st fragment of fragmented packet.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_MF_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "match on first fragment not "
+					  "supported");
+	if (frag_data_spec && !last)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "specified value not supported");
+	ret = mlx5_flow_item_acceptable
+				(item, (const uint8_t *)mask,
+				 (const uint8_t *)&nic_mask,
+				 sizeof(struct rte_flow_item_ipv6_frag_ext),
+				 MLX5_ITEM_RANGE_ACCEPTED, error);
+	if (ret)
+		return ret;
+	/* spec and last are valid, validate the specified range. */
+	frag_data_last = last->hdr.frag_data & mask->hdr.frag_data;
+	/*
+	 * Match on frag_data spec 0x0009 and last 0xfff9
+	 * means M is 1 and frag-offset is > 0.
+	 * This packet is fragment 2nd and onward, excluding last.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_FO_ALIGN |
+				       RTE_IPV6_EHDR_MF_MASK) &&
+	    frag_data_last == RTE_BE16(RTE_IPV6_FRAG_USED_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on following "
+					  "fragments not supported");
+	/*
+	 * Match on frag_data spec 0x0008 and last 0xfff8
+	 * means M is 0 and frag-offset is > 0.
+	 * This packet is last fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_FO_ALIGN) &&
+	    frag_data_last == RTE_BE16(RTE_IPV6_EHDR_FO_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on last "
+					  "fragment not supported");
+	/* Other range values are invalid and rejected. */
+	return rte_flow_error_set(error, EINVAL,
+				  RTE_FLOW_ERROR_TYPE_ITEM_LAST, last,
+				  "specified range not supported");
+}
+
+/**
  * Validate the pop VLAN action.
  *
  * @param[in] dev
@@ -5349,6 +5463,29 @@ struct field_modify_info modify_tcp[] = {
 				next_protocol = 0xff;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT:
+			ret = flow_dv_validate_item_ipv6_frag_ext(items,
+								  item_flags,
+								  error);
+			if (ret < 0)
+				return ret;
+			last_item = tunnel ?
+					MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT :
+					MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT;
+			if (items->mask != NULL &&
+			    ((const struct rte_flow_item_ipv6_frag_ext *)
+			     items->mask)->hdr.next_header) {
+				next_protocol =
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->spec)->hdr.next_header;
+				next_protocol &=
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->mask)->hdr.next_header;
+			} else {
+				/* Reset for inner layer. */
+				next_protocol = 0xff;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			ret = mlx5_flow_validate_item_tcp
 						(items, item_flags,
@@ -6527,6 +6664,57 @@ struct field_modify_info modify_tcp[] = {
 }
 
 /**
+ * Add IPV6 fragment extension item to matcher and to the value.
+ *
+ * @param[in, out] matcher
+ *   Flow matcher.
+ * @param[in, out] key
+ *   Flow matcher value.
+ * @param[in] item
+ *   Flow pattern to translate.
+ * @param[in] inner
+ *   Item is inner pattern.
+ */
+static void
+flow_dv_translate_item_ipv6_frag_ext(void *matcher, void *key,
+				     const struct rte_flow_item *item,
+				     int inner)
+{
+	const struct rte_flow_item_ipv6_frag_ext *ipv6_frag_ext_m = item->mask;
+	const struct rte_flow_item_ipv6_frag_ext *ipv6_frag_ext_v = item->spec;
+	const struct rte_flow_item_ipv6_frag_ext nic_mask = {
+		.hdr = {
+			.next_header = 0xff,
+			.frag_data = RTE_BE16(0xffff),
+		},
+	};
+	void *headers_m;
+	void *headers_v;
+
+	if (inner) {
+		headers_m = MLX5_ADDR_OF(fte_match_param, matcher,
+					 inner_headers);
+		headers_v = MLX5_ADDR_OF(fte_match_param, key, inner_headers);
+	} else {
+		headers_m = MLX5_ADDR_OF(fte_match_param, matcher,
+					 outer_headers);
+		headers_v = MLX5_ADDR_OF(fte_match_param, key, outer_headers);
+	}
+	/* IPv6 fragment extension item exists, so packet is IP fragment. */
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 1);
+	if (!ipv6_frag_ext_v)
+		return;
+	if (!ipv6_frag_ext_m)
+		ipv6_frag_ext_m = &nic_mask;
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol,
+		 ipv6_frag_ext_m->hdr.next_header);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
+		 ipv6_frag_ext_v->hdr.next_header &
+		 ipv6_frag_ext_m->hdr.next_header);
+}
+
+/**
  * Add TCP item to matcher and to the value.
  *
  * @param[in, out] matcher
@@ -8868,6 +9056,27 @@ struct field_modify_info modify_tcp[] = {
 				next_protocol = 0xff;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT:
+			flow_dv_translate_item_ipv6_frag_ext(match_mask,
+							     match_value,
+							     items, tunnel);
+			last_item = tunnel ?
+					MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT :
+					MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT;
+			if (items->mask != NULL &&
+			    ((const struct rte_flow_item_ipv6_frag_ext *)
+			     items->mask)->hdr.next_header) {
+				next_protocol =
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->spec)->hdr.next_header;
+				next_protocol &=
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->mask)->hdr.next_header;
+			} else {
+				/* Reset for inner layer. */
+				next_protocol = 0xff;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			flow_dv_translate_item_tcp(match_mask, match_value,
 						   items, tunnel);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH 10/10] doc: update release notes for MLX5 L3 frag support
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
                   ` (8 preceding siblings ...)
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 09/10] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
@ 2020-09-30 14:10 ` Dekel Peled
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
  2020-10-14 16:35 ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Dekel Peled
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-09-30 14:10 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates 20.11 release notes with the changes included in
patches of this series:
1) MLX5 support of matching on IPv4/IPv6 fragmented/non-fragmented
   packets.
2) ABI change in ethdev struct rte_flow_item_ipv6.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 doc/guides/rel_notes/release_20_11.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 4bcf220..60d3243 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -84,6 +84,11 @@ New Features
 
   * Added support for 200G PAM4 link speed.
 
+* **Updated Mellanox mlx5 driver.**
+
+  Updated Mellanox mlx5 driver with new features and improvements, including:
+
+  * Added support for matching on fragmented/non-fragmented IPv4/IPv6 packets.
 
 Removed Items
 -------------
@@ -209,6 +214,11 @@ ABI Changes
 
   * ``ethdev`` internal functions are marked with ``__rte_internal`` tag.
 
+  * Added extensions' attributes to struct ``rte_flow_item_ipv6``.
+    A set of additional values added to struct, indicating the existence of
+    every defined extension header type.
+    Applications should use the new values for identification of existing
+    extensions in the packet header.
 
 Known Issues
 ------------
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH 01/10] ethdev: add extensions attributes to IPv6 item
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 01/10] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-09-30 14:54   ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-09-30 14:54 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev


> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Wednesday, September 30, 2020 5:10 PM
> Subject: [PATCH 01/10] ethdev: add extensions attributes to IPv6 item
> 
> Using the current implementation of DPDK, an application cannot match on
> IPv6 packets, based on the existing extension headers, in a simple way.
> 
> Field 'Next Header' in IPv6 header indicates type of the first extension
> header only. Following extension headers can't be identified by
> inspecting the IPv6 header.
> As a result, the existence or absence of specific extension headers
> can't be used for packet matching.
> 
> For example, fragmented IPv6 packets contain a dedicated extension header
> (which is implemented in a later patch of this series).
> Non-fragmented packets don't contain the fragment extension header.
> For an application to match on non-fragmented IPv6 packets, the current
> implementation doesn't provide a suitable solution.
> Matching on the Next Header field is not sufficient, since additional
> extension headers might be present in the same packet.
> To match on fragmented IPv6 packets, the same difficulty exists.
> 
> This patch implements the update as detailed in RFC [1].
> A set of additional values will be added to IPv6 header struct.
> These values will indicate the existence of every defined extension
> header type, providing simple means for identification of existing
> extensions in the packet header.
> Continuing the above example, fragmented packets can be identified using
> the specific value indicating existence of fragment extension header.
> 
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmails.dp
> dk.org%2Farchives%2Fdev%2F2020-
> August%2F177257.html&amp;data=02%7C01%7Corika%40nvidia.com%7C5a12
> 16c396994e296ce308d8654aa25a%7C43083d15727340c1b7db39efd9ccc17a%7
> C0%7C1%7C637370718505729468&amp;sdata=ym5QBAFHOsuNfcKxhc%2Fj60B
> ojpD%2B5G1mvUuYAxKZP6k%3D&amp;reserved=0
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---
Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH 03/10] app/testpmd: support IPv4 fragments
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 03/10] app/testpmd: support IPv4 fragments Dekel Peled
@ 2020-09-30 14:54   ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-09-30 14:54 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev



> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Wednesday, September 30, 2020 5:10 PM
> Subject: [PATCH 03/10] app/testpmd: support IPv4 fragments
> 
> This patch updates testpmd CLI to support fragment_offset field of
> IPv4 header item.
> 
> To match on non-fragmented IPv4 packets, need to use pattern:
> ... ipv4 fragment_offset spec 0 fragment_offset mask 0x3fff ...
> To match on fragmented IPv4 packets, need to use pattern:
> ... ipv4 fragment_offset spec 1 fragment_offset last 0x3fff
> fragment_offset mask 0x3fff ...
> (Use the full available range 1 to 0x3fff to include all possible
> values.)
> To match on any IPv4 packets, fragmented and non-fragmented,
> the fragment_offset field should not be specified for match.
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---
>  app/test-pmd/cmdline_flow.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 6263d30..0c964c1 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -129,6 +129,7 @@ enum index {
>  	ITEM_VLAN_INNER_TYPE,
>  	ITEM_IPV4,
>  	ITEM_IPV4_TOS,
> +	ITEM_IPV4_FRAGMENT_OFFSET,
>  	ITEM_IPV4_TTL,
>  	ITEM_IPV4_PROTO,
>  	ITEM_IPV4_SRC,
> @@ -871,6 +872,7 @@ struct parse_action_priv {
> 
>  static const enum index item_ipv4[] = {
>  	ITEM_IPV4_TOS,
> +	ITEM_IPV4_FRAGMENT_OFFSET,
>  	ITEM_IPV4_TTL,
>  	ITEM_IPV4_PROTO,
>  	ITEM_IPV4_SRC,
> @@ -2093,6 +2095,13 @@ static int comp_set_raw_index(struct context *,
> const struct token *,
>  		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
>  					     hdr.type_of_service)),
>  	},
> +	[ITEM_IPV4_FRAGMENT_OFFSET] = {
> +		.name = "fragment_offset",
> +		.help = "fragmentation flags and fragment offset",
> +		.next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED),
> item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
> +					     hdr.fragment_offset)),
> +	},
>  	[ITEM_IPV4_TTL] = {
>  		.name = "ttl",
>  		.help = "time to live",
> --
> 1.8.3.1

Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH 02/10] ethdev: add IPv6 fragment extension header item
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 02/10] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-09-30 14:55   ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-09-30 14:55 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev



> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Wednesday, September 30, 2020 5:10 PM
> Subject: [PATCH 02/10] ethdev: add IPv6 fragment extension header item
> 
> Applications handling fragmented IPv6 packets need to match on IPv6
> fragment extension header, in order to identify the fragments order
> and location in the packet.
> This patch introduces the IPv6 fragment extension header item,
> proposed in [1].
> 
> Relevant definitions are moved from lib/librte_ip_frag/rte_ip_frag.h
> to lib/librte_net/rte_ip.h, as they are needed for IPv6 header handling.
> struct ipv6_extension_fragment renamed to rte_ipv6_fragment_ext to
> adapt it to the common naming convention.
> 
> Default mask is not defined, since all fields are optional.
> 
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmails.dpd
> k.org%2Farchives%2Fdev%2F2020-
> March%2F160255.html&amp;data=02%7C01%7Corika%40nvidia.com%7C52959
> fd24ed2489868e308d8654abe56%7C43083d15727340c1b7db39efd9ccc17a%7C
> 0%7C0%7C637370718986486792&amp;sdata=EPQFJHS9JJvzNj%2Ff9ODWt6yd3
> F1HhQiKcPX6UD1eWGA%3D&amp;reserved=0
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---
>  doc/guides/prog_guide/rte_flow.rst | 16 ++++++++++++++--
>  lib/librte_ethdev/rte_flow.c       |  1 +
>  lib/librte_ethdev/rte_flow.h       | 21 +++++++++++++++++++++
>  lib/librte_ip_frag/rte_ip_frag.h   | 26 ++------------------------
>  lib/librte_net/rte_ip.h            | 26 ++++++++++++++++++++++++--
>  5 files changed, 62 insertions(+), 28 deletions(-)
> 
> diff --git a/doc/guides/prog_guide/rte_flow.rst
> b/doc/guides/prog_guide/rte_flow.rst
> index 0b476da..826e45d 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -947,8 +947,8 @@ Item: ``IPV6``
>  Matches an IPv6 header.
> 
>  Dedicated flags indicate existence of specific extension headers.
> -Every type of extension header can use a dedicated pattern item, or
> -the generic `Item: IPV6_EXT`_.
> +Every type of extension header can use a dedicated pattern item,
> +for example `Item: IPV6_FRAG_EXT`_, or the generic `Item: IPV6_EXT`_.
> 
>  - ``hdr``: IPv6 header definition (``rte_ip.h``).
>  - ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
> @@ -1187,6 +1187,18 @@ Normally preceded by any of:
>  - `Item: IPV6`_
>  - `Item: IPV6_EXT`_
> 
> +Item: ``IPV6_FRAG_EXT``
> +^^^^^^^^^^^^^^^^^^^^^^^
> +
> +Matches the presence of IPv6 fragment extension header.
> +
> +- ``hdr``: IPv6 fragment extension header definition (``rte_ip.h``).
> +
> +Normally preceded by any of:
> +
> +- `Item: IPV6`_
> +- `Item: IPV6_EXT`_
> +
>  Item: ``ICMP6``
>  ^^^^^^^^^^^^^^^
> 
> diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
> index f8fdd68..c1f3132 100644
> --- a/lib/librte_ethdev/rte_flow.c
> +++ b/lib/librte_ethdev/rte_flow.c
> @@ -72,6 +72,7 @@ struct rte_flow_desc_data {
>  	MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)),
>  	MK_FLOW_ITEM(ARP_ETH_IPV4, sizeof(struct
> rte_flow_item_arp_eth_ipv4)),
>  	MK_FLOW_ITEM(IPV6_EXT, sizeof(struct rte_flow_item_ipv6_ext)),
> +	MK_FLOW_ITEM(IPV6_FRAG_EXT, sizeof(struct
> rte_flow_item_ipv6_frag_ext)),
>  	MK_FLOW_ITEM(ICMP6, sizeof(struct rte_flow_item_icmp6)),
>  	MK_FLOW_ITEM(ICMP6_ND_NS, sizeof(struct
> rte_flow_item_icmp6_nd_ns)),
>  	MK_FLOW_ITEM(ICMP6_ND_NA, sizeof(struct
> rte_flow_item_icmp6_nd_na)),
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 5b5bed2..1443e6a 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -368,6 +368,13 @@ enum rte_flow_item_type {
>  	RTE_FLOW_ITEM_TYPE_IPV6_EXT,
> 
>  	/**
> +	 * Matches the presence of IPv6 fragment extension header.
> +	 *
> +	 * See struct rte_flow_item_ipv6_frag_ext.
> +	 */
> +	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
> +
> +	/**
>  	 * Matches any ICMPv6 header.
>  	 *
>  	 * See struct rte_flow_item_icmp6.
> @@ -1188,6 +1195,20 @@ struct rte_flow_item_ipv6_ext
> rte_flow_item_ipv6_ext_mask = {
>  #endif
> 
>  /**
> + * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
> + *
> + * Matches the presence of IPv6 fragment extension header.
> + *
> + * Preceded by any of:
> + *
> + * - RTE_FLOW_ITEM_TYPE_IPV6
> + * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
> + */
> +struct rte_flow_item_ipv6_frag_ext {
> +	struct rte_ipv6_fragment_ext hdr;
> +};
> +
> +/**
>   * RTE_FLOW_ITEM_TYPE_ICMP6
>   *
>   * Matches any ICMPv6 header.
> diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h
> index 66edd7e..0bfe64b 100644
> --- a/lib/librte_ip_frag/rte_ip_frag.h
> +++ b/lib/librte_ip_frag/rte_ip_frag.h
> @@ -110,30 +110,8 @@ struct rte_ip_frag_tbl {
>  	__extension__ struct ip_frag_pkt pkt[0]; /**< hash table. */
>  };
> 
> -/** IPv6 fragment extension header */
> -#define	RTE_IPV6_EHDR_MF_SHIFT			0
> -#define	RTE_IPV6_EHDR_MF_MASK			1
> -#define	RTE_IPV6_EHDR_FO_SHIFT			3
> -#define	RTE_IPV6_EHDR_FO_MASK			(~((1 <<
> RTE_IPV6_EHDR_FO_SHIFT) - 1))
> -#define	RTE_IPV6_EHDR_FO_ALIGN			(1 <<
> RTE_IPV6_EHDR_FO_SHIFT)
> -
> -#define RTE_IPV6_FRAG_USED_MASK			\
> -	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
> -
> -#define RTE_IPV6_GET_MF(x)				((x) &
> RTE_IPV6_EHDR_MF_MASK)
> -#define RTE_IPV6_GET_FO(x)				((x) >>
> RTE_IPV6_EHDR_FO_SHIFT)
> -
> -#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
> -	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) &
> RTE_IPV6_EHDR_MF_MASK))
> -
> -struct ipv6_extension_fragment {
> -	uint8_t next_header;            /**< Next header type */
> -	uint8_t reserved;               /**< Reserved */
> -	uint16_t frag_data;             /**< All fragmentation data */
> -	uint32_t id;                    /**< Packet ID */
> -} __rte_packed;
> -
> -
> +/* struct ipv6_extension_fragment moved to librte_net/rte_ip.h and renamed.
> */
> +#define ipv6_extension_fragment	rte_ipv6_fragment_ext
> 
>  /**
>   * Create a new IP fragmentation table.
> diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
> index fcd1eb3..3081c46 100644
> --- a/lib/librte_net/rte_ip.h
> +++ b/lib/librte_net/rte_ip.h
> @@ -456,8 +456,30 @@ struct rte_ipv6_hdr {
>  	return (uint16_t)cksum;
>  }
> 
> -/* IPv6 fragmentation header size */
> -#define RTE_IPV6_FRAG_HDR_SIZE 8
> +/** IPv6 fragment extension header. */
> +#define	RTE_IPV6_EHDR_MF_SHIFT	0
> +#define	RTE_IPV6_EHDR_MF_MASK	1
> +#define	RTE_IPV6_EHDR_FO_SHIFT	3
> +#define	RTE_IPV6_EHDR_FO_MASK	(~((1 <<
> RTE_IPV6_EHDR_FO_SHIFT) - 1))
> +#define	RTE_IPV6_EHDR_FO_ALIGN	(1 <<
> RTE_IPV6_EHDR_FO_SHIFT)
> +
> +#define RTE_IPV6_FRAG_USED_MASK	(RTE_IPV6_EHDR_MF_MASK |
> RTE_IPV6_EHDR_FO_MASK)
> +
> +#define RTE_IPV6_GET_MF(x)	((x) & RTE_IPV6_EHDR_MF_MASK)
> +#define RTE_IPV6_GET_FO(x)	((x) >> RTE_IPV6_EHDR_FO_SHIFT)
> +
> +#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
> +	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) &
> RTE_IPV6_EHDR_MF_MASK))
> +
> +struct rte_ipv6_fragment_ext {
> +	uint8_t next_header;	/**< Next header type */
> +	uint8_t reserved;	/**< Reserved */
> +	rte_be16_t frag_data;	/**< All fragmentation data */
> +	rte_be32_t id;		/**< Packet ID */
> +} __rte_packed;
> +
> +/* IPv6 fragment extension header size */
> +#define RTE_IPV6_FRAG_HDR_SIZE	sizeof(struct rte_ipv6_fragment_ext)
> 
>  /**
>   * Parse next IPv6 header extension
> --
> 1.8.3.1

Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH 05/10] app/testpmd: support IPv6 fragment extension item
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 05/10] app/testpmd: support IPv6 fragment extension item Dekel Peled
@ 2020-09-30 14:56   ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-09-30 14:56 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev



> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Wednesday, September 30, 2020 5:10 PM
> Cc: dev@dpdk.org
> Subject: [PATCH 05/10] app/testpmd: support IPv6 fragment extension item
> 
> rte_flow update, following RFC [1], added to ethdev the rte_flow item
> ipv6_frag_ext.
> This patch updates testpmd CLI to support the new item and its fields.
> 
> To match on fragmented IPv6 packets, this item is added to pattern:
> ... ipv6 / ipv6_frag_ext ...
> 
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmails.dpd
> k.org%2Farchives%2Fdev%2F2020-
> March%2F160255.html&amp;data=02%7C01%7Corika%40nvidia.com%7C1effc
> aa06bc943080a7408d8654aec04%7C43083d15727340c1b7db39efd9ccc17a%7C
> 0%7C1%7C637370719741604850&amp;sdata=zgkbW7cwAMc9gKHeCvtDhQvFB
> c5605SqbfMF6hO3iPU%3D&amp;reserved=0
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---
>  app/test-pmd/cmdline_flow.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
> index 55cc30f..ef166e3 100644
> --- a/app/test-pmd/cmdline_flow.c
> +++ b/app/test-pmd/cmdline_flow.c
> @@ -193,6 +193,9 @@ enum index {
>  	ITEM_ARP_ETH_IPV4_TPA,
>  	ITEM_IPV6_EXT,
>  	ITEM_IPV6_EXT_NEXT_HDR,
> +	ITEM_IPV6_FRAG_EXT,
> +	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
> +	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
>  	ITEM_ICMP6,
>  	ITEM_ICMP6_TYPE,
>  	ITEM_ICMP6_CODE,
> @@ -784,6 +787,7 @@ struct parse_action_priv {
>  	ITEM_VXLAN_GPE,
>  	ITEM_ARP_ETH_IPV4,
>  	ITEM_IPV6_EXT,
> +	ITEM_IPV6_FRAG_EXT,
>  	ITEM_ICMP6,
>  	ITEM_ICMP6_ND_NS,
>  	ITEM_ICMP6_ND_NA,
> @@ -1003,6 +1007,13 @@ struct parse_action_priv {
>  	ZERO,
>  };
> 
> +static const enum index item_ipv6_frag_ext[] = {
> +	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
> +	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
> +	ITEM_NEXT,
> +	ZERO,
> +};
> +
>  static const enum index item_icmp6[] = {
>  	ITEM_ICMP6_TYPE,
>  	ITEM_ICMP6_CODE,
> @@ -2560,6 +2571,30 @@ static int comp_set_raw_index(struct context *,
> const struct token *,
>  		.args = ARGS(ARGS_ENTRY_HTON(struct
> rte_flow_item_ipv6_ext,
>  					     next_hdr)),
>  	},
> +	[ITEM_IPV6_FRAG_EXT] = {
> +		.name = "ipv6_frag_ext",
> +		.help = "match presence of IPv6 fragment extension header",
> +		.priv = PRIV_ITEM(IPV6_FRAG_EXT,
> +				sizeof(struct rte_flow_item_ipv6_frag_ext)),
> +		.next = NEXT(item_ipv6_frag_ext),
> +		.call = parse_vc,
> +	},
> +	[ITEM_IPV6_FRAG_EXT_NEXT_HDR] = {
> +		.name = "next_hdr",
> +		.help = "next header",
> +		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
> +			     item_param),
> +		.args = ARGS(ARGS_ENTRY(struct
> rte_flow_item_ipv6_frag_ext,
> +					hdr.next_header)),
> +	},
> +	[ITEM_IPV6_FRAG_EXT_FRAG_DATA] = {
> +		.name = "frag_data",
> +		.help = "Fragment flags and offset",
> +		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
> +			     item_param),
> +		.args = ARGS(ARGS_ENTRY_HTON(struct
> rte_flow_item_ipv6_frag_ext,
> +					     hdr.frag_data)),
> +	},
>  	[ITEM_ICMP6] = {
>  		.name = "icmp6",
>  		.help = "match any ICMPv6 header",
> --
> 1.8.3.1

Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
                   ` (9 preceding siblings ...)
  2020-09-30 14:10 ` [dpdk-dev] [PATCH 10/10] doc: update release notes for MLX5 L3 frag support Dekel Peled
@ 2020-10-01 21:14 ` Dekel Peled
  2020-10-01 21:14   ` [dpdk-dev] [PATCH v2 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
                     ` (11 more replies)
  2020-10-14 16:35 ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Dekel Peled
  11 siblings, 12 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:14 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This series implements support of matching on packets based on the
fragmentation attribute of the packet, i.e. if packet is a fragment
of a larger packet, or the opposite - packet is not a fragment.

In ethdev, add API to support IPv6 extension headers, and specifically
the IPv6 fragment extension header item.
In MLX5 PMD, support match on IPv4 fragmented packets, IPv6 fragmented
packets, and IPv6 fragment extension header item.
Testpmd CLI is updated accordingly.
Documentation is updated accordingly.

---
v2: add patch 'net/mlx5: enforce limitation on IPv6 next proto'
---

Dekel Peled (11):
  ethdev: add extensions attributes to IPv6 item
  ethdev: add IPv6 fragment extension header item
  app/testpmd: support IPv4 fragments
  app/testpmd: support IPv6 fragments
  app/testpmd: support IPv6 fragment extension item
  net/mlx5: remove handling of ICMP fragmented packets
  net/mlx5: support match on IPv4 fragment packets
  net/mlx5: support match on IPv6 fragment packets
  net/mlx5: support match on IPv6 fragment ext. item
  doc: update release notes for MLX5 L3 frag support
  net/mlx5: enforce limitation on IPv6 next proto

 app/test-pmd/cmdline_flow.c            |  53 +++++
 doc/guides/nics/mlx5.rst               |   7 +
 doc/guides/prog_guide/rte_flow.rst     |  28 ++-
 doc/guides/rel_notes/release_20_11.rst |  10 +
 drivers/net/mlx5/mlx5_flow.c           |  62 ++++--
 drivers/net/mlx5/mlx5_flow.h           |  14 ++
 drivers/net/mlx5/mlx5_flow_dv.c        | 382 +++++++++++++++++++++++++++++----
 drivers/net/mlx5/mlx5_flow_verbs.c     |   9 +-
 lib/librte_ethdev/rte_flow.c           |   1 +
 lib/librte_ethdev/rte_flow.h           |  46 +++-
 lib/librte_ip_frag/rte_ip_frag.h       |  26 +--
 lib/librte_net/rte_ip.h                |  26 ++-
 12 files changed, 574 insertions(+), 90 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
@ 2020-10-01 21:14   ` Dekel Peled
  2020-10-04 13:45     ` Ori Kam
  2020-10-01 21:14   ` [dpdk-dev] [PATCH v2 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
                     ` (10 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:14 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Using the current implementation of DPDK, an application cannot match on
IPv6 packets, based on the existing extension headers, in a simple way.

Field 'Next Header' in IPv6 header indicates type of the first extension
header only. Following extension headers can't be identified by
inspecting the IPv6 header.
As a result, the existence or absence of specific extension headers
can't be used for packet matching.

For example, fragmented IPv6 packets contain a dedicated extension header
(which is implemented in a later patch of this series).
Non-fragmented packets don't contain the fragment extension header.
For an application to match on non-fragmented IPv6 packets, the current
implementation doesn't provide a suitable solution.
Matching on the Next Header field is not sufficient, since additional
extension headers might be present in the same packet.
To match on fragmented IPv6 packets, the same difficulty exists.

This patch implements the update as detailed in RFC [1].
A set of additional values will be added to IPv6 header struct.
These values will indicate the existence of every defined extension
header type, providing simple means for identification of existing
extensions in the packet header.
Continuing the above example, fragmented packets can be identified using
the specific value indicating existence of fragment extension header.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 16 +++++++++++++---
 lib/librte_ethdev/rte_flow.h       | 25 +++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 119b128..0b476da 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -946,11 +946,21 @@ Item: ``IPV6``
 
 Matches an IPv6 header.
 
-Note: IPv6 options are handled by dedicated pattern items, see `Item:
-IPV6_EXT`_.
+Dedicated flags indicate existence of specific extension headers.
+Every type of extension header can use a dedicated pattern item, or
+the generic `Item: IPV6_EXT`_.
 
 - ``hdr``: IPv6 header definition (``rte_ip.h``).
-- Default ``mask`` matches source and destination addresses only.
+- ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
+- ``rout_ext_exist``: Routing extension header exists.
+- ``frag_ext_exist``: Fragment extension header exists.
+- ``auth_ext_exist``: Authentication extension header exists.
+- ``esp_ext_exist``: Encapsulation Security Payload extension header exists.
+- ``dest_ext_exist``: Destination Options extension header exists.
+- ``mobil_ext_exist``: Mobility extension header exists.
+- ``hip_ext_exist``: Host Identity Protocol extension header exists.
+- ``shim6_ext_exist``: Shim6 Protocol extension header exists.
+- Default ``mask`` matches ``hdr`` source and destination addresses only.
 
 Item: ``ICMP``
 ^^^^^^^^^^^^^^
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index da8bfa5..5b5bed2 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -792,11 +792,32 @@ struct rte_flow_item_ipv4 {
  *
  * Matches an IPv6 header.
  *
- * Note: IPv6 options are handled by dedicated pattern items, see
- * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
+ * Dedicated flags indicate existence of specific extension headers.
+ * Every type of extension header can use a dedicated pattern item, or
+ * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.
  */
 struct rte_flow_item_ipv6 {
 	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
+	uint32_t hop_ext_exist:1;
+	/**< Hop-by-Hop Options extension header exists. */
+	uint32_t rout_ext_exist:1;
+	/**< Routing extension header exists. */
+	uint32_t frag_ext_exist:1;
+	/**< Fragment extension header exists. */
+	uint32_t auth_ext_exist:1;
+	/**< Authentication extension header exists. */
+	uint32_t esp_ext_exist:1;
+	/**< Encapsulation Security Payload extension header exists. */
+	uint32_t dest_ext_exist:1;
+	/**< Destination Options extension header exists. */
+	uint32_t mobil_ext_exist:1;
+	/**< Mobility extension header exists. */
+	uint32_t hip_ext_exist:1;
+	/**< Host Identity Protocol extension header exists. */
+	uint32_t shim6_ext_exist:1;
+	/**< Shim6 Protocol extension header exists. */
+	uint32_t reserved:23;
+	/**< Reserved for future extension headers, must be zero. */
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 02/11] ethdev: add IPv6 fragment extension header item
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
  2020-10-01 21:14   ` [dpdk-dev] [PATCH v2 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-10-01 21:14   ` Dekel Peled
  2020-10-01 21:27     ` Stephen Hemminger
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 03/11] app/testpmd: support IPv4 fragments Dekel Peled
                     ` (9 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:14 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Applications handling fragmented IPv6 packets need to match on IPv6
fragment extension header, in order to identify the fragments order
and location in the packet.
This patch introduces the IPv6 fragment extension header item,
proposed in [1].

Relevant definitions are moved from lib/librte_ip_frag/rte_ip_frag.h
to lib/librte_net/rte_ip.h, as they are needed for IPv6 header handling.
struct ipv6_extension_fragment renamed to rte_ipv6_fragment_ext to
adapt it to the common naming convention.

Default mask is not defined, since all fields are optional.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 16 ++++++++++++++--
 lib/librte_ethdev/rte_flow.c       |  1 +
 lib/librte_ethdev/rte_flow.h       | 21 +++++++++++++++++++++
 lib/librte_ip_frag/rte_ip_frag.h   | 26 ++------------------------
 lib/librte_net/rte_ip.h            | 26 ++++++++++++++++++++++++--
 5 files changed, 62 insertions(+), 28 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 0b476da..826e45d 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -947,8 +947,8 @@ Item: ``IPV6``
 Matches an IPv6 header.
 
 Dedicated flags indicate existence of specific extension headers.
-Every type of extension header can use a dedicated pattern item, or
-the generic `Item: IPV6_EXT`_.
+Every type of extension header can use a dedicated pattern item,
+for example `Item: IPV6_FRAG_EXT`_, or the generic `Item: IPV6_EXT`_.
 
 - ``hdr``: IPv6 header definition (``rte_ip.h``).
 - ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
@@ -1187,6 +1187,18 @@ Normally preceded by any of:
 - `Item: IPV6`_
 - `Item: IPV6_EXT`_
 
+Item: ``IPV6_FRAG_EXT``
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches the presence of IPv6 fragment extension header.
+
+- ``hdr``: IPv6 fragment extension header definition (``rte_ip.h``).
+
+Normally preceded by any of:
+
+- `Item: IPV6`_
+- `Item: IPV6_EXT`_
+
 Item: ``ICMP6``
 ^^^^^^^^^^^^^^^
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index f8fdd68..c1f3132 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -72,6 +72,7 @@ struct rte_flow_desc_data {
 	MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)),
 	MK_FLOW_ITEM(ARP_ETH_IPV4, sizeof(struct rte_flow_item_arp_eth_ipv4)),
 	MK_FLOW_ITEM(IPV6_EXT, sizeof(struct rte_flow_item_ipv6_ext)),
+	MK_FLOW_ITEM(IPV6_FRAG_EXT, sizeof(struct rte_flow_item_ipv6_frag_ext)),
 	MK_FLOW_ITEM(ICMP6, sizeof(struct rte_flow_item_icmp6)),
 	MK_FLOW_ITEM(ICMP6_ND_NS, sizeof(struct rte_flow_item_icmp6_nd_ns)),
 	MK_FLOW_ITEM(ICMP6_ND_NA, sizeof(struct rte_flow_item_icmp6_nd_na)),
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 5b5bed2..1443e6a 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -368,6 +368,13 @@ enum rte_flow_item_type {
 	RTE_FLOW_ITEM_TYPE_IPV6_EXT,
 
 	/**
+	 * Matches the presence of IPv6 fragment extension header.
+	 *
+	 * See struct rte_flow_item_ipv6_frag_ext.
+	 */
+	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
+
+	/**
 	 * Matches any ICMPv6 header.
 	 *
 	 * See struct rte_flow_item_icmp6.
@@ -1188,6 +1195,20 @@ struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
 #endif
 
 /**
+ * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
+ *
+ * Matches the presence of IPv6 fragment extension header.
+ *
+ * Preceded by any of:
+ *
+ * - RTE_FLOW_ITEM_TYPE_IPV6
+ * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
+ */
+struct rte_flow_item_ipv6_frag_ext {
+	struct rte_ipv6_fragment_ext hdr;
+};
+
+/**
  * RTE_FLOW_ITEM_TYPE_ICMP6
  *
  * Matches any ICMPv6 header.
diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h
index 66edd7e..0bfe64b 100644
--- a/lib/librte_ip_frag/rte_ip_frag.h
+++ b/lib/librte_ip_frag/rte_ip_frag.h
@@ -110,30 +110,8 @@ struct rte_ip_frag_tbl {
 	__extension__ struct ip_frag_pkt pkt[0]; /**< hash table. */
 };
 
-/** IPv6 fragment extension header */
-#define	RTE_IPV6_EHDR_MF_SHIFT			0
-#define	RTE_IPV6_EHDR_MF_MASK			1
-#define	RTE_IPV6_EHDR_FO_SHIFT			3
-#define	RTE_IPV6_EHDR_FO_MASK			(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
-#define	RTE_IPV6_EHDR_FO_ALIGN			(1 << RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_FRAG_USED_MASK			\
-	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
-
-#define RTE_IPV6_GET_MF(x)				((x) & RTE_IPV6_EHDR_MF_MASK)
-#define RTE_IPV6_GET_FO(x)				((x) >> RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
-	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
-
-struct ipv6_extension_fragment {
-	uint8_t next_header;            /**< Next header type */
-	uint8_t reserved;               /**< Reserved */
-	uint16_t frag_data;             /**< All fragmentation data */
-	uint32_t id;                    /**< Packet ID */
-} __rte_packed;
-
-
+/* struct ipv6_extension_fragment moved to librte_net/rte_ip.h and renamed. */
+#define ipv6_extension_fragment	rte_ipv6_fragment_ext
 
 /**
  * Create a new IP fragmentation table.
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index fcd1eb3..3081c46 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -456,8 +456,30 @@ struct rte_ipv6_hdr {
 	return (uint16_t)cksum;
 }
 
-/* IPv6 fragmentation header size */
-#define RTE_IPV6_FRAG_HDR_SIZE 8
+/** IPv6 fragment extension header. */
+#define	RTE_IPV6_EHDR_MF_SHIFT	0
+#define	RTE_IPV6_EHDR_MF_MASK	1
+#define	RTE_IPV6_EHDR_FO_SHIFT	3
+#define	RTE_IPV6_EHDR_FO_MASK	(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
+#define	RTE_IPV6_EHDR_FO_ALIGN	(1 << RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_FRAG_USED_MASK	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
+
+#define RTE_IPV6_GET_MF(x)	((x) & RTE_IPV6_EHDR_MF_MASK)
+#define RTE_IPV6_GET_FO(x)	((x) >> RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
+	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
+
+struct rte_ipv6_fragment_ext {
+	uint8_t next_header;	/**< Next header type */
+	uint8_t reserved;	/**< Reserved */
+	rte_be16_t frag_data;	/**< All fragmentation data */
+	rte_be32_t id;		/**< Packet ID */
+} __rte_packed;
+
+/* IPv6 fragment extension header size */
+#define RTE_IPV6_FRAG_HDR_SIZE	sizeof(struct rte_ipv6_fragment_ext)
 
 /**
  * Parse next IPv6 header extension
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 03/11] app/testpmd: support IPv4 fragments
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
  2020-10-01 21:14   ` [dpdk-dev] [PATCH v2 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
  2020-10-01 21:14   ` [dpdk-dev] [PATCH v2 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-10-01 21:15   ` Dekel Peled
  2020-10-04 13:47     ` Ori Kam
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 04/11] app/testpmd: support IPv6 fragments Dekel Peled
                     ` (8 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:15 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates testpmd CLI to support fragment_offset field of
IPv4 header item.

To match on non-fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 0 fragment_offset mask 0x3fff ...
To match on fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 1 fragment_offset last 0x3fff
fragment_offset mask 0x3fff ...
(Use the full available range 1 to 0x3fff to include all possible
values.)
To match on any IPv4 packets, fragmented and non-fragmented,
the fragment_offset field should not be specified for match.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 6e04d53..a9bf29f 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -129,6 +129,7 @@ enum index {
 	ITEM_VLAN_INNER_TYPE,
 	ITEM_IPV4,
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -873,6 +874,7 @@ struct parse_action_priv {
 
 static const enum index item_ipv4[] = {
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -2097,6 +2099,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
 					     hdr.type_of_service)),
 	},
+	[ITEM_IPV4_FRAGMENT_OFFSET] = {
+		.name = "fragment_offset",
+		.help = "fragmentation flags and fragment offset",
+		.next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
+					     hdr.fragment_offset)),
+	},
 	[ITEM_IPV4_TTL] = {
 		.name = "ttl",
 		.help = "time to live",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 04/11] app/testpmd: support IPv6 fragments
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
                     ` (2 preceding siblings ...)
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 03/11] app/testpmd: support IPv4 fragments Dekel Peled
@ 2020-10-01 21:15   ` Dekel Peled
  2020-10-04 13:49     ` Ori Kam
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
                     ` (7 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:15 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], introduced frag_ext_exist field for
IPv6 header item, used to indicate match on fragmented/non-fragmented
packets.
This patch updates testpmd CLI to support the new field.

To match on non-fragmented IPv6 packets, need to use pattern:
... ipv6 frag_ext_exist spec 0 frag_ext_exist mask 1 ...
To match on fragmented IPv6 packets, need to use pattern:
... ipv6 frag_ext_exist spec 1 frag_ext_exist mask 1 ...
To match on any IPv6 packets, the frag_ext_exist field should
not be specified for match.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index a9bf29f..b078095 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -141,6 +141,7 @@ enum index {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_FRAG_EXT_EXIST,
 	ITEM_ICMP,
 	ITEM_ICMP_TYPE,
 	ITEM_ICMP_CODE,
@@ -890,6 +891,7 @@ struct parse_action_priv {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_FRAG_EXT_EXIST,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2185,6 +2187,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6,
 					     hdr.dst_addr)),
 	},
+	[ITEM_IPV6_FRAG_EXT_EXIST] = {
+		.name = "frag_ext_exist",
+		.help = "fragment packet attribute",
+		.next = NEXT(item_ipv6, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_ipv6,
+					   frag_ext_exist, 1)),
+	},
 	[ITEM_ICMP] = {
 		.name = "icmp",
 		.help = "match ICMP header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 05/11] app/testpmd: support IPv6 fragment extension item
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
                     ` (3 preceding siblings ...)
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 04/11] app/testpmd: support IPv6 fragments Dekel Peled
@ 2020-10-01 21:15   ` Dekel Peled
  2020-10-04 13:47     ` Ori Kam
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
                     ` (6 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:15 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch updates testpmd CLI to support the new item and its fields.

To match on fragmented IPv6 packets, this item is added to pattern:
... ipv6 / ipv6_frag_ext ...

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b078095..1f800eb 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -195,6 +195,9 @@ enum index {
 	ITEM_ARP_ETH_IPV4_TPA,
 	ITEM_IPV6_EXT,
 	ITEM_IPV6_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT,
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
 	ITEM_ICMP6,
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -786,6 +789,7 @@ struct parse_action_priv {
 	ITEM_VXLAN_GPE,
 	ITEM_ARP_ETH_IPV4,
 	ITEM_IPV6_EXT,
+	ITEM_IPV6_FRAG_EXT,
 	ITEM_ICMP6,
 	ITEM_ICMP6_ND_NS,
 	ITEM_ICMP6_ND_NA,
@@ -1007,6 +1011,13 @@ struct parse_action_priv {
 	ZERO,
 };
 
+static const enum index item_ipv6_frag_ext[] = {
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_icmp6[] = {
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -2578,6 +2589,30 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_ext,
 					     next_hdr)),
 	},
+	[ITEM_IPV6_FRAG_EXT] = {
+		.name = "ipv6_frag_ext",
+		.help = "match presence of IPv6 fragment extension header",
+		.priv = PRIV_ITEM(IPV6_FRAG_EXT,
+				sizeof(struct rte_flow_item_ipv6_frag_ext)),
+		.next = NEXT(item_ipv6_frag_ext),
+		.call = parse_vc,
+	},
+	[ITEM_IPV6_FRAG_EXT_NEXT_HDR] = {
+		.name = "next_hdr",
+		.help = "next header",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_ipv6_frag_ext,
+					hdr.next_header)),
+	},
+	[ITEM_IPV6_FRAG_EXT_FRAG_DATA] = {
+		.name = "frag_data",
+		.help = "Fragment flags and offset",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_frag_ext,
+					     hdr.frag_data)),
+	},
 	[ITEM_ICMP6] = {
 		.name = "icmp6",
 		.help = "match any ICMPv6 header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 06/11] net/mlx5: remove handling of ICMP fragmented packets
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
                     ` (4 preceding siblings ...)
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
@ 2020-10-01 21:15   ` Dekel Peled
  2020-10-04 13:49     ` Ori Kam
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
                     ` (5 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:15 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Commit [1] forced setting of match on 'frag' bit mask 1 and value 0.
Previous patch in this series added support of match on fragmented and
non-fragmented packets on L3 items, so this setting is now redundant.

This patch removes the changes done in [1].

[1] commit 85407db9f60d ("net/mlx5: fix matching for ICMP fragments")

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 79fdf34..0a0a5a4 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7345,12 +7345,6 @@ struct field_modify_info modify_tcp[] = {
 		return;
 	if (!icmp6_m)
 		icmp6_m = &rte_flow_item_icmp6_mask;
-	/*
-	 * Force flow only to match the non-fragmented IPv6 ICMPv6 packets.
-	 * If only the protocol is specified, no need to match the frag.
-	 */
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmpv6_type, icmp6_m->type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type,
 		 icmp6_v->type & icmp6_m->type);
@@ -7398,12 +7392,6 @@ struct field_modify_info modify_tcp[] = {
 		return;
 	if (!icmp_m)
 		icmp_m = &rte_flow_item_icmp_mask;
-	/*
-	 * Force flow only to match the non-fragmented IPv4 ICMP packets.
-	 * If only the protocol is specified, no need to match the frag.
-	 */
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmp_type,
 		 icmp_m->hdr.icmp_type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmp_type,
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 07/11] net/mlx5: support match on IPv4 fragment packets
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
                     ` (5 preceding siblings ...)
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
@ 2020-10-01 21:15   ` Dekel Peled
  2020-10-04 13:48     ` Ori Kam
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 08/11] net/mlx5: support match on IPv6 " Dekel Peled
                     ` (4 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:15 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch adds to MLX5 PMD the support of matching on IPv4
fragmented and non-fragmented packets, using the IPv4 header
fragment_offset field.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c       |  48 ++++++++----
 drivers/net/mlx5/mlx5_flow.h       |  10 +++
 drivers/net/mlx5/mlx5_flow_dv.c    | 156 +++++++++++++++++++++++++++++++------
 drivers/net/mlx5/mlx5_flow_verbs.c |   9 ++-
 4 files changed, 178 insertions(+), 45 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index ffa7646..906741f 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -474,6 +474,8 @@ struct mlx5_flow_tunnel_info {
  *   Bit-masks covering supported fields by the NIC to compare with user mask.
  * @param[in] size
  *   Bit-masks size in bytes.
+ * @param[in] range_accepted
+ *   True if range of values is accepted for specific fields, false otherwise.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -485,6 +487,7 @@ struct mlx5_flow_tunnel_info {
 			  const uint8_t *mask,
 			  const uint8_t *nic_mask,
 			  unsigned int size,
+			  bool range_accepted,
 			  struct rte_flow_error *error)
 {
 	unsigned int i;
@@ -502,7 +505,7 @@ struct mlx5_flow_tunnel_info {
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "mask/last without a spec is not"
 					  " supported");
-	if (item->spec && item->last) {
+	if (item->spec && item->last && !range_accepted) {
 		uint8_t spec[size];
 		uint8_t last[size];
 		unsigned int i;
@@ -1277,7 +1280,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_icmp6_mask,
-		 sizeof(struct rte_flow_item_icmp6), error);
+		 sizeof(struct rte_flow_item_icmp6),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1329,7 +1333,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_icmp_mask,
-		 sizeof(struct rte_flow_item_icmp), error);
+		 sizeof(struct rte_flow_item_icmp),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1384,7 +1389,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_eth),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -1438,7 +1443,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_vlan),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!tunnel && mask->tci != RTE_BE16(0x0fff)) {
@@ -1502,6 +1507,7 @@ struct mlx5_flow_tunnel_info {
 			     uint64_t last_item,
 			     uint16_t ether_type,
 			     const struct rte_flow_item_ipv4 *acc_mask,
+			     bool range_accepted,
 			     struct rte_flow_error *error)
 {
 	const struct rte_flow_item_ipv4 *mask = item->mask;
@@ -1572,7 +1578,7 @@ struct mlx5_flow_tunnel_info {
 					acc_mask ? (const uint8_t *)acc_mask
 						 : (const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_ipv4),
-					error);
+					range_accepted, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1592,6 +1598,8 @@ struct mlx5_flow_tunnel_info {
  * @param[in] acc_mask
  *   Acceptable mask, if NULL default internal default mask
  *   will be used to check whether item fields are supported.
+ * @param[in] range_accepted
+ *   True if range of values is accepted for specific fields, false otherwise.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -1671,7 +1679,7 @@ struct mlx5_flow_tunnel_info {
 					acc_mask ? (const uint8_t *)acc_mask
 						 : (const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_ipv6),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1726,7 +1734,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_udp_mask,
-		 sizeof(struct rte_flow_item_udp), error);
+		 sizeof(struct rte_flow_item_udp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1781,7 +1790,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)flow_mask,
-		 sizeof(struct rte_flow_item_tcp), error);
+		 sizeof(struct rte_flow_item_tcp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1835,7 +1845,7 @@ struct mlx5_flow_tunnel_info {
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_vxlan_mask,
 		 sizeof(struct rte_flow_item_vxlan),
-		 error);
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (spec) {
@@ -1906,7 +1916,7 @@ struct mlx5_flow_tunnel_info {
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_vxlan_gpe_mask,
 		 sizeof(struct rte_flow_item_vxlan_gpe),
-		 error);
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (spec) {
@@ -1980,7 +1990,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&gre_key_default_mask,
-		 sizeof(rte_be32_t), error);
+		 sizeof(rte_be32_t), MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -2032,7 +2042,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&nic_mask,
-		 sizeof(struct rte_flow_item_gre), error);
+		 sizeof(struct rte_flow_item_gre), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 #ifndef HAVE_MLX5DV_DR
@@ -2107,7 +2118,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 				  (item, (const uint8_t *)mask,
 				   (const uint8_t *)&nic_mask,
-				   sizeof(struct rte_flow_item_geneve), error);
+				   sizeof(struct rte_flow_item_geneve),
+				   MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (spec) {
@@ -2190,7 +2202,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_mpls_mask,
-		 sizeof(struct rte_flow_item_mpls), error);
+		 sizeof(struct rte_flow_item_mpls),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2245,7 +2258,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_nvgre_mask,
-		 sizeof(struct rte_flow_item_nvgre), error);
+		 sizeof(struct rte_flow_item_nvgre),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2339,7 +2353,7 @@ struct mlx5_flow_tunnel_info {
 					 acc_mask ? (const uint8_t *)acc_mask
 						  : (const uint8_t *)&nic_mask,
 					 sizeof(struct rte_flow_item_ecpri),
-					 error);
+					 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 }
 
 /* Allocate unique ID for the split Q/RSS subflows. */
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 279daf2..1e30c93 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -330,6 +330,14 @@ enum mlx5_feature_name {
 #define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \
 					  sizeof(struct rte_flow_item_ipv4))
 
+/* IPv4 fragment_offset field contains relevant data in bits 2 to 15. */
+#define MLX5_IPV4_FRAG_OFFSET_MASK \
+		(RTE_IPV4_HDR_OFFSET_MASK | RTE_IPV4_HDR_MF_FLAG)
+
+/* Specific item's fields can accept a range of values (using spec and last). */
+#define MLX5_ITEM_RANGE_NOT_ACCEPTED	false
+#define MLX5_ITEM_RANGE_ACCEPTED	true
+
 /* Software header modify action numbers of a flow. */
 #define MLX5_ACT_NUM_MDF_IPV4		1
 #define MLX5_ACT_NUM_MDF_IPV6		4
@@ -985,6 +993,7 @@ int mlx5_flow_item_acceptable(const struct rte_flow_item *item,
 			      const uint8_t *mask,
 			      const uint8_t *nic_mask,
 			      unsigned int size,
+			      bool range_accepted,
 			      struct rte_flow_error *error);
 int mlx5_flow_validate_item_eth(const struct rte_flow_item *item,
 				uint64_t item_flags,
@@ -1002,6 +1011,7 @@ int mlx5_flow_validate_item_ipv4(const struct rte_flow_item *item,
 				 uint64_t last_item,
 				 uint16_t ether_type,
 				 const struct rte_flow_item_ipv4 *acc_mask,
+				 bool range_accepted,
 				 struct rte_flow_error *error);
 int mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
 				 uint64_t item_flags,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 0a0a5a4..3379caf 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1418,7 +1418,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_mark),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1494,7 +1494,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_meta),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -1547,7 +1547,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_tag),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (mask->index != 0xff)
@@ -1618,7 +1618,7 @@ struct field_modify_info modify_tcp[] = {
 				(item, (const uint8_t *)mask,
 				 (const uint8_t *)&rte_flow_item_port_id_mask,
 				 sizeof(struct rte_flow_item_port_id),
-				 error);
+				 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!spec)
@@ -1691,7 +1691,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_vlan),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!tunnel && mask->tci != RTE_BE16(0x0fff)) {
@@ -1778,11 +1778,126 @@ struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "Match is supported for GTP"
 					  " flags only");
-	return mlx5_flow_item_acceptable
-		(item, (const uint8_t *)mask,
-		 (const uint8_t *)&nic_mask,
-		 sizeof(struct rte_flow_item_gtp),
-		 error);
+	return mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
+					 (const uint8_t *)&nic_mask,
+					 sizeof(struct rte_flow_item_gtp),
+					 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
+}
+
+/**
+ * Validate IPV4 item.
+ * Use existing validation function mlx5_flow_validate_item_ipv4(), and
+ * add specific validation of fragment_offset field,
+ *
+ * @param[in] item
+ *   Item specification.
+ * @param[in] item_flags
+ *   Bit-fields that holds the items detected until now.
+ * @param[out] error
+ *   Pointer to error structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+flow_dv_validate_item_ipv4(const struct rte_flow_item *item,
+			   uint64_t item_flags,
+			   uint64_t last_item,
+			   uint16_t ether_type,
+			   struct rte_flow_error *error)
+{
+	int ret;
+	const struct rte_flow_item_ipv4 *spec = item->spec;
+	const struct rte_flow_item_ipv4 *last = item->last;
+	const struct rte_flow_item_ipv4 *mask = item->mask;
+	rte_be16_t fragment_offset_spec = 0;
+	rte_be16_t fragment_offset_last = 0;
+	const struct rte_flow_item_ipv4 nic_ipv4_mask = {
+		.hdr = {
+			.src_addr = RTE_BE32(0xffffffff),
+			.dst_addr = RTE_BE32(0xffffffff),
+			.type_of_service = 0xff,
+			.fragment_offset = RTE_BE16(0xffff),
+			.next_proto_id = 0xff,
+			.time_to_live = 0xff,
+		},
+	};
+
+	ret = mlx5_flow_validate_item_ipv4(item, item_flags, last_item,
+					   ether_type, &nic_ipv4_mask,
+					   MLX5_ITEM_RANGE_ACCEPTED, error);
+	if (ret < 0)
+		return ret;
+	if (spec && mask)
+		fragment_offset_spec = spec->hdr.fragment_offset &
+				       mask->hdr.fragment_offset;
+	if (!fragment_offset_spec)
+		return 0;
+	/*
+	 * spec and mask are valid, enforce using full mask to make sure the
+	 * complete value is used correctly.
+	 */
+	if ((mask->hdr.fragment_offset & RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+			!= RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM_MASK,
+					  item, "must use full mask for"
+					  " fragment_offset");
+	/*
+	 * Match on fragment_offset 0x2000 means MF is 1 and frag-offset is 0,
+	 * indicating this is 1st fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(RTE_IPV4_HDR_MF_FLAG))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "match on first fragment not "
+					  "supported");
+	if (fragment_offset_spec && !last)
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "specified value not supported");
+	/* spec and last are valid, validate the specified range. */
+	fragment_offset_last = last->hdr.fragment_offset &
+			       mask->hdr.fragment_offset;
+	/*
+	 * Match on fragment_offset spec 0x2001 and last 0x3fff
+	 * means MF is 1 and frag-offset is > 0.
+	 * This packet is fragment 2nd and onward, excluding last.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(RTE_IPV4_HDR_MF_FLAG + 1) &&
+	    fragment_offset_last == RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on following "
+					  "fragments not supported");
+	/*
+	 * Match on fragment_offset spec 0x0001 and last 0x1fff
+	 * means MF is 0 and frag-offset is > 0.
+	 * This packet is last fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(1) &&
+	    fragment_offset_last == RTE_BE16(RTE_IPV4_HDR_OFFSET_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on last "
+					  "fragment not supported");
+	/*
+	 * Match on fragment_offset spec 0x0001 and last 0x3fff
+	 * means MF and/or frag-offset is not 0.
+	 * This is a fragmented packet.
+	 * Other range values are invalid and rejected.
+	 */
+	if (!(fragment_offset_spec == RTE_BE16(1) &&
+	      fragment_offset_last == RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK)))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST, last,
+					  "specified range not supported");
+	return 0;
 }
 
 /**
@@ -5084,15 +5199,6 @@ struct field_modify_info modify_tcp[] = {
 			.dst_port = RTE_BE16(UINT16_MAX),
 		}
 	};
-	const struct rte_flow_item_ipv4 nic_ipv4_mask = {
-		.hdr = {
-			.src_addr = RTE_BE32(0xffffffff),
-			.dst_addr = RTE_BE32(0xffffffff),
-			.type_of_service = 0xff,
-			.next_proto_id = 0xff,
-			.time_to_live = 0xff,
-		},
-	};
 	const struct rte_flow_item_ipv6 nic_ipv6_mask = {
 		.hdr = {
 			.src_addr =
@@ -5192,11 +5298,9 @@ struct field_modify_info modify_tcp[] = {
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			mlx5_flow_tunnel_ip_check(items, next_protocol,
 						  &item_flags, &tunnel);
-			ret = mlx5_flow_validate_item_ipv4(items, item_flags,
-							   last_item,
-							   ether_type,
-							   &nic_ipv4_mask,
-							   error);
+			ret = flow_dv_validate_item_ipv4(items, item_flags,
+							 last_item, ether_type,
+							 error);
 			if (ret < 0)
 				return ret;
 			last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :
@@ -6296,6 +6400,10 @@ struct field_modify_info modify_tcp[] = {
 		 ipv4_m->hdr.time_to_live);
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ttl_hoplimit,
 		 ipv4_v->hdr.time_to_live & ipv4_m->hdr.time_to_live);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag,
+		 !!(ipv4_m->hdr.fragment_offset));
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
+		 !!(ipv4_v->hdr.fragment_offset & ipv4_m->hdr.fragment_offset));
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 62c18b8..276bcb5 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1312,10 +1312,11 @@
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
-			ret = mlx5_flow_validate_item_ipv4(items, item_flags,
-							   last_item,
-							   ether_type, NULL,
-							   error);
+			ret = mlx5_flow_validate_item_ipv4
+						(items, item_flags,
+						 last_item, ether_type, NULL,
+						 MLX5_ITEM_RANGE_NOT_ACCEPTED,
+						 error);
 			if (ret < 0)
 				return ret;
 			last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 08/11] net/mlx5: support match on IPv6 fragment packets
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
                     ` (6 preceding siblings ...)
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
@ 2020-10-01 21:15   ` Dekel Peled
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
                     ` (3 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:15 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch adds to MLX5 PMD the support of matching on IPv6
fragmented and non-fragmented packets, using the new field
frag_ext_exist, added to rte_flow following RFC [1].

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 3379caf..4403abc 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5211,6 +5211,7 @@ struct field_modify_info modify_tcp[] = {
 			.proto = 0xff,
 			.hop_limits = 0xff,
 		},
+		.frag_ext_exist = 1,
 	};
 	const struct rte_flow_item_ecpri nic_ecpri_mask = {
 		.hdr = {
@@ -6519,6 +6520,10 @@ struct field_modify_info modify_tcp[] = {
 		 ipv6_m->hdr.hop_limits);
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ttl_hoplimit,
 		 ipv6_v->hdr.hop_limits & ipv6_m->hdr.hop_limits);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag,
+		 !!(ipv6_m->frag_ext_exist));
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
+		 !!(ipv6_v->frag_ext_exist & ipv6_m->frag_ext_exist));
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 09/11] net/mlx5: support match on IPv6 fragment ext. item
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
                     ` (7 preceding siblings ...)
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 08/11] net/mlx5: support match on IPv6 " Dekel Peled
@ 2020-10-01 21:15   ` Dekel Peled
  2020-10-04 13:51     ` Ori Kam
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
                     ` (2 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:15 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch adds to MLX5 PMD the option to match on this item type.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.h    |   4 +
 drivers/net/mlx5/mlx5_flow_dv.c | 209 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 213 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 1e30c93..376519f 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -122,6 +122,10 @@ enum mlx5_feature_name {
 /* Pattern eCPRI Layer bit. */
 #define MLX5_FLOW_LAYER_ECPRI (UINT64_C(1) << 29)
 
+/* IPv6 Fragment Extension Header bit. */
+#define MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT (1u << 30)
+#define MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT (1u << 31)
+
 /* Outer Masks. */
 #define MLX5_FLOW_LAYER_OUTER_L3 \
 	(MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 4403abc..eb1db12 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1901,6 +1901,120 @@ struct field_modify_info modify_tcp[] = {
 }
 
 /**
+ * Validate IPV6 fragment extension item.
+ *
+ * @param[in] item
+ *   Item specification.
+ * @param[in] item_flags
+ *   Bit-fields that holds the items detected until now.
+ * @param[out] error
+ *   Pointer to error structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+flow_dv_validate_item_ipv6_frag_ext(const struct rte_flow_item *item,
+				    uint64_t item_flags,
+				    struct rte_flow_error *error)
+{
+	const struct rte_flow_item_ipv6_frag_ext *spec = item->spec;
+	const struct rte_flow_item_ipv6_frag_ext *last = item->last;
+	const struct rte_flow_item_ipv6_frag_ext *mask = item->mask;
+	rte_be16_t frag_data_spec = 0;
+	rte_be16_t frag_data_last = 0;
+	const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
+	const uint64_t l4m = tunnel ? MLX5_FLOW_LAYER_INNER_L4 :
+				      MLX5_FLOW_LAYER_OUTER_L4;
+	int ret = 0;
+	struct rte_flow_item_ipv6_frag_ext nic_mask = {
+		.hdr = {
+			.next_header = 0xff,
+			.frag_data = RTE_BE16(0xffff),
+		},
+	};
+
+	if (item_flags & l4m)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "ipv6 fragment extension item cannot "
+					  "follow L4 item.");
+	if ((tunnel && !(item_flags & MLX5_FLOW_LAYER_INNER_L3_IPV6)) ||
+	    (!tunnel && !(item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV6)))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "ipv6 fragment extension item must "
+					  "follow ipv6 item");
+	if (spec && mask)
+		frag_data_spec = spec->hdr.frag_data & mask->hdr.frag_data;
+	if (!frag_data_spec)
+		return 0;
+	/*
+	 * spec and mask are valid, enforce using full mask to make sure the
+	 * complete value is used correctly.
+	 */
+	if ((mask->hdr.frag_data & RTE_BE16(RTE_IPV6_FRAG_USED_MASK)) !=
+				RTE_BE16(RTE_IPV6_FRAG_USED_MASK))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM_MASK,
+					  item, "must use full mask for"
+					  " frag_data");
+	/*
+	 * Match on frag_data 0x00001 means M is 1 and frag-offset is 0.
+	 * This is 1st fragment of fragmented packet.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_MF_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "match on first fragment not "
+					  "supported");
+	if (frag_data_spec && !last)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "specified value not supported");
+	ret = mlx5_flow_item_acceptable
+				(item, (const uint8_t *)mask,
+				 (const uint8_t *)&nic_mask,
+				 sizeof(struct rte_flow_item_ipv6_frag_ext),
+				 MLX5_ITEM_RANGE_ACCEPTED, error);
+	if (ret)
+		return ret;
+	/* spec and last are valid, validate the specified range. */
+	frag_data_last = last->hdr.frag_data & mask->hdr.frag_data;
+	/*
+	 * Match on frag_data spec 0x0009 and last 0xfff9
+	 * means M is 1 and frag-offset is > 0.
+	 * This packet is fragment 2nd and onward, excluding last.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_FO_ALIGN |
+				       RTE_IPV6_EHDR_MF_MASK) &&
+	    frag_data_last == RTE_BE16(RTE_IPV6_FRAG_USED_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on following "
+					  "fragments not supported");
+	/*
+	 * Match on frag_data spec 0x0008 and last 0xfff8
+	 * means M is 0 and frag-offset is > 0.
+	 * This packet is last fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_FO_ALIGN) &&
+	    frag_data_last == RTE_BE16(RTE_IPV6_EHDR_FO_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on last "
+					  "fragment not supported");
+	/* Other range values are invalid and rejected. */
+	return rte_flow_error_set(error, EINVAL,
+				  RTE_FLOW_ERROR_TYPE_ITEM_LAST, last,
+				  "specified range not supported");
+}
+
+/**
  * Validate the pop VLAN action.
  *
  * @param[in] dev
@@ -5349,6 +5463,29 @@ struct field_modify_info modify_tcp[] = {
 				next_protocol = 0xff;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT:
+			ret = flow_dv_validate_item_ipv6_frag_ext(items,
+								  item_flags,
+								  error);
+			if (ret < 0)
+				return ret;
+			last_item = tunnel ?
+					MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT :
+					MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT;
+			if (items->mask != NULL &&
+			    ((const struct rte_flow_item_ipv6_frag_ext *)
+			     items->mask)->hdr.next_header) {
+				next_protocol =
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->spec)->hdr.next_header;
+				next_protocol &=
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->mask)->hdr.next_header;
+			} else {
+				/* Reset for inner layer. */
+				next_protocol = 0xff;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			ret = mlx5_flow_validate_item_tcp
 						(items, item_flags,
@@ -6527,6 +6664,57 @@ struct field_modify_info modify_tcp[] = {
 }
 
 /**
+ * Add IPV6 fragment extension item to matcher and to the value.
+ *
+ * @param[in, out] matcher
+ *   Flow matcher.
+ * @param[in, out] key
+ *   Flow matcher value.
+ * @param[in] item
+ *   Flow pattern to translate.
+ * @param[in] inner
+ *   Item is inner pattern.
+ */
+static void
+flow_dv_translate_item_ipv6_frag_ext(void *matcher, void *key,
+				     const struct rte_flow_item *item,
+				     int inner)
+{
+	const struct rte_flow_item_ipv6_frag_ext *ipv6_frag_ext_m = item->mask;
+	const struct rte_flow_item_ipv6_frag_ext *ipv6_frag_ext_v = item->spec;
+	const struct rte_flow_item_ipv6_frag_ext nic_mask = {
+		.hdr = {
+			.next_header = 0xff,
+			.frag_data = RTE_BE16(0xffff),
+		},
+	};
+	void *headers_m;
+	void *headers_v;
+
+	if (inner) {
+		headers_m = MLX5_ADDR_OF(fte_match_param, matcher,
+					 inner_headers);
+		headers_v = MLX5_ADDR_OF(fte_match_param, key, inner_headers);
+	} else {
+		headers_m = MLX5_ADDR_OF(fte_match_param, matcher,
+					 outer_headers);
+		headers_v = MLX5_ADDR_OF(fte_match_param, key, outer_headers);
+	}
+	/* IPv6 fragment extension item exists, so packet is IP fragment. */
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 1);
+	if (!ipv6_frag_ext_v)
+		return;
+	if (!ipv6_frag_ext_m)
+		ipv6_frag_ext_m = &nic_mask;
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol,
+		 ipv6_frag_ext_m->hdr.next_header);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
+		 ipv6_frag_ext_v->hdr.next_header &
+		 ipv6_frag_ext_m->hdr.next_header);
+}
+
+/**
  * Add TCP item to matcher and to the value.
  *
  * @param[in, out] matcher
@@ -8868,6 +9056,27 @@ struct field_modify_info modify_tcp[] = {
 				next_protocol = 0xff;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT:
+			flow_dv_translate_item_ipv6_frag_ext(match_mask,
+							     match_value,
+							     items, tunnel);
+			last_item = tunnel ?
+					MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT :
+					MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT;
+			if (items->mask != NULL &&
+			    ((const struct rte_flow_item_ipv6_frag_ext *)
+			     items->mask)->hdr.next_header) {
+				next_protocol =
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->spec)->hdr.next_header;
+				next_protocol &=
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->mask)->hdr.next_header;
+			} else {
+				/* Reset for inner layer. */
+				next_protocol = 0xff;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			flow_dv_translate_item_tcp(match_mask, match_value,
 						   items, tunnel);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 10/11] doc: update release notes for MLX5 L3 frag support
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
                     ` (8 preceding siblings ...)
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
@ 2020-10-01 21:15   ` Dekel Peled
  2020-10-04 13:55     ` Ori Kam
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:15 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates 20.11 release notes with the changes included in
patches of this series:
1) MLX5 support of matching on IPv4/IPv6 fragmented/non-fragmented
   packets.
2) ABI change in ethdev struct rte_flow_item_ipv6.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 doc/guides/rel_notes/release_20_11.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 7f9d0dd..91e1773 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -90,6 +90,11 @@ New Features
 
   * Added support for 200G PAM4 link speed.
 
+* **Updated Mellanox mlx5 driver.**
+
+  Updated Mellanox mlx5 driver with new features and improvements, including:
+
+  * Added support for matching on fragmented/non-fragmented IPv4/IPv6 packets.
 
 Removed Items
 -------------
@@ -215,6 +220,11 @@ ABI Changes
 
   * ``ethdev`` internal functions are marked with ``__rte_internal`` tag.
 
+  * Added extensions' attributes to struct ``rte_flow_item_ipv6``.
+    A set of additional values added to struct, indicating the existence of
+    every defined extension header type.
+    Applications should use the new values for identification of existing
+    extensions in the packet header.
 
 Known Issues
 ------------
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v2 11/11] net/mlx5: enforce limitation on IPv6 next proto
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
                     ` (9 preceding siblings ...)
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
@ 2020-10-01 21:15   ` Dekel Peled
  2020-10-04 13:55     ` Ori Kam
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-01 21:15 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

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>
---
 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 211c0c5..e6ca5e1 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -311,6 +311,13 @@ Limitations
     for some NICs (such as ConnectX-6 Dx and BlueField 2).
     The capability bit ``scatter_fcs_w_decap_disable`` shows NIC support.
 
+- 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 906741f..7a438cf 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1645,9 +1645,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,
@@ -1655,6 +1655,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


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v2 02/11] ethdev: add IPv6 fragment extension header item
  2020-10-01 21:14   ` [dpdk-dev] [PATCH v2 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-10-01 21:27     ` Stephen Hemminger
  0 siblings, 0 replies; 101+ messages in thread
From: Stephen Hemminger @ 2020-10-01 21:27 UTC (permalink / raw)
  To: Dekel Peled
  Cc: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo, dev

On Fri,  2 Oct 2020 00:14:59 +0300
Dekel Peled <dekelp@nvidia.com> wrote:

> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index 5b5bed2..1443e6a 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -368,6 +368,13 @@ enum rte_flow_item_type {
>  	RTE_FLOW_ITEM_TYPE_IPV6_EXT,
>  
>  	/**
> +	 * Matches the presence of IPv6 fragment extension header.
> +	 *
> +	 * See struct rte_flow_item_ipv6_frag_ext.
> +	 */
> +	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
> +
> +	/**
>  	 * Matches any ICMPv6 header.
>  	 *
>  	 * See struct rte_flow_item_icmp6

Putting new enum value in the middle of existing list will renumber
the ones below. This causes an ABI breakage.

Since the ABI breakage was not preannounced, this patch needs to
be revised or approved by the TAB.

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v2 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-01 21:14   ` [dpdk-dev] [PATCH v2 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-10-04 13:45     ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-04 13:45 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev

Hi

> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Friday, October 2, 2020 12:15 AM
> Subject: [PATCH v2 01/11] ethdev: add extensions attributes to IPv6 item
> 
> Using the current implementation of DPDK, an application cannot match on
> IPv6 packets, based on the existing extension headers, in a simple way.
> 
> Field 'Next Header' in IPv6 header indicates type of the first extension
> header only. Following extension headers can't be identified by
> inspecting the IPv6 header.
> As a result, the existence or absence of specific extension headers
> can't be used for packet matching.
> 
> For example, fragmented IPv6 packets contain a dedicated extension header
> (which is implemented in a later patch of this series).
> Non-fragmented packets don't contain the fragment extension header.
> For an application to match on non-fragmented IPv6 packets, the current
> implementation doesn't provide a suitable solution.
> Matching on the Next Header field is not sufficient, since additional
> extension headers might be present in the same packet.
> To match on fragmented IPv6 packets, the same difficulty exists.
> 
> This patch implements the update as detailed in RFC [1].
> A set of additional values will be added to IPv6 header struct.
> These values will indicate the existence of every defined extension
> header type, providing simple means for identification of existing
> extensions in the packet header.
> Continuing the above example, fragmented packets can be identified using
> the specific value indicating existence of fragment extension header.
> 
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmails.dp
> dk.org%2Farchives%2Fdev%2F2020-
> August%2F177257.html&amp;data=02%7C01%7Corika%40nvidia.com%7C1a92
> 82d24518485dd37508d8664f2634%7C43083d15727340c1b7db39efd9ccc17a%7
> C0%7C0%7C637371837412802968&amp;sdata=7Jdz3yt3nsSrWYei69BwWro7cZ
> 0VwdnKZ0sfcD8MglQ%3D&amp;reserved=0
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---

Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v2 05/11] app/testpmd: support IPv6 fragment extension item
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
@ 2020-10-04 13:47     ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-04 13:47 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev

Hi 

> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Friday, October 2, 2020 12:15 AM
> Subject: [PATCH v2 05/11] app/testpmd: support IPv6 fragment extension item
> 
> rte_flow update, following RFC [1], added to ethdev the rte_flow item
> ipv6_frag_ext.
> This patch updates testpmd CLI to support the new item and its fields.
> 
> To match on fragmented IPv6 packets, this item is added to pattern:
> ... ipv6 / ipv6_frag_ext ...
> 
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmails.dpd
> k.org%2Farchives%2Fdev%2F2020-
> March%2F160255.html&amp;data=02%7C01%7Corika%40nvidia.com%7C05088
> 1c489164e37c32008d8664f2d9f%7C43083d15727340c1b7db39efd9ccc17a%7C
> 0%7C0%7C637371837539734661&amp;sdata=WQyqN0fQMH%2BuGGcR9OU7
> wp7yQMaup0dXGN4UCUG6B%2BA%3D&amp;reserved=0
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---


Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v2 03/11] app/testpmd: support IPv4 fragments
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 03/11] app/testpmd: support IPv4 fragments Dekel Peled
@ 2020-10-04 13:47     ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-04 13:47 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev



> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Friday, October 2, 2020 12:15 AM
> Subject: [PATCH v2 03/11] app/testpmd: support IPv4 fragments
> 
> This patch updates testpmd CLI to support fragment_offset field of
> IPv4 header item.
> 
> To match on non-fragmented IPv4 packets, need to use pattern:
> ... ipv4 fragment_offset spec 0 fragment_offset mask 0x3fff ...
> To match on fragmented IPv4 packets, need to use pattern:
> ... ipv4 fragment_offset spec 1 fragment_offset last 0x3fff
> fragment_offset mask 0x3fff ...
> (Use the full available range 1 to 0x3fff to include all possible
> values.)
> To match on any IPv4 packets, fragmented and non-fragmented,
> the fragment_offset field should not be specified for match.
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---



Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v2 07/11] net/mlx5: support match on IPv4 fragment packets
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
@ 2020-10-04 13:48     ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-04 13:48 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev

Hi

> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Friday, October 2, 2020 12:15 AM
> Subject: [PATCH v2 07/11] net/mlx5: support match on IPv4 fragment packets
> 
> This patch adds to MLX5 PMD the support of matching on IPv4
> fragmented and non-fragmented packets, using the IPv4 header
> fragment_offset field.
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---


Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v2 04/11] app/testpmd: support IPv6 fragments
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 04/11] app/testpmd: support IPv6 fragments Dekel Peled
@ 2020-10-04 13:49     ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-04 13:49 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev

Hi

> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Friday, October 2, 2020 12:15 AM
> Subject: [PATCH v2 04/11] app/testpmd: support IPv6 fragments
> 
> rte_flow update, following RFC [1], introduced frag_ext_exist field for
> IPv6 header item, used to indicate match on fragmented/non-fragmented
> packets.
> This patch updates testpmd CLI to support the new field.
> 
> To match on non-fragmented IPv6 packets, need to use pattern:
> ... ipv6 frag_ext_exist spec 0 frag_ext_exist mask 1 ...
> To match on fragmented IPv6 packets, need to use pattern:
> ... ipv6 frag_ext_exist spec 1 frag_ext_exist mask 1 ...
> To match on any IPv6 packets, the frag_ext_exist field should
> not be specified for match.
> 
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmails.dp
> dk.org%2Farchives%2Fdev%2F2020-
> August%2F177257.html&amp;data=02%7C01%7Corika%40nvidia.com%7C52c00
> 2b1122645c54b6308d8664f3da6%7C43083d15727340c1b7db39efd9ccc17a%7C
> 0%7C0%7C637371837807355091&amp;sdata=mTtFnZKwQ8Cs6XBjbikK76W8Vx
> TOHD6ZVwRK%2BMZizvg%3D&amp;reserved=0
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---


Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v2 06/11] net/mlx5: remove handling of ICMP fragmented packets
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
@ 2020-10-04 13:49     ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-04 13:49 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev

Hi

> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Friday, October 2, 2020 12:15 AM
> Subject: [PATCH v2 06/11] net/mlx5: remove handling of ICMP fragmented
> packets
> 
> Commit [1] forced setting of match on 'frag' bit mask 1 and value 0.
> Previous patch in this series added support of match on fragmented and
> non-fragmented packets on L3 items, so this setting is now redundant.
> 
> This patch removes the changes done in [1].
> 
> [1] commit 85407db9f60d ("net/mlx5: fix matching for ICMP fragments")
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 12 ------------
>  1 file changed, 12 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index 79fdf34..0a0a5a4 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -7345,12 +7345,6 @@ struct field_modify_info modify_tcp[] = {
>  		return;
>  	if (!icmp6_m)
>  		icmp6_m = &rte_flow_item_icmp6_mask;
> -	/*
> -	 * Force flow only to match the non-fragmented IPv6 ICMPv6 packets.
> -	 * If only the protocol is specified, no need to match the frag.
> -	 */
> -	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
> -	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
>  	MLX5_SET(fte_match_set_misc3, misc3_m, icmpv6_type, icmp6_m-
> >type);
>  	MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type,
>  		 icmp6_v->type & icmp6_m->type);
> @@ -7398,12 +7392,6 @@ struct field_modify_info modify_tcp[] = {
>  		return;
>  	if (!icmp_m)
>  		icmp_m = &rte_flow_item_icmp_mask;
> -	/*
> -	 * Force flow only to match the non-fragmented IPv4 ICMP packets.
> -	 * If only the protocol is specified, no need to match the frag.
> -	 */
> -	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
> -	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
>  	MLX5_SET(fte_match_set_misc3, misc3_m, icmp_type,
>  		 icmp_m->hdr.icmp_type);
>  	MLX5_SET(fte_match_set_misc3, misc3_v, icmp_type,
> --
> 1.8.3.1


Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v2 09/11] net/mlx5: support match on IPv6 fragment ext. item
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
@ 2020-10-04 13:51     ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-04 13:51 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev

Hi

> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Friday, October 2, 2020 12:15 AM
> Subject: [PATCH v2 09/11] net/mlx5: support match on IPv6 fragment ext. item
> 
> rte_flow update, following RFC [1], added to ethdev the rte_flow item
> ipv6_frag_ext.
> This patch adds to MLX5 PMD the option to match on this item type.
> 
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmails.dpd
> k.org%2Farchives%2Fdev%2F2020-
> March%2F160255.html&amp;data=02%7C01%7Corika%40nvidia.com%7C93b63
> 53b89ee433d65b408d8664f4f70%7C43083d15727340c1b7db39efd9ccc17a%7C
> 0%7C1%7C637371838110046254&amp;sdata=2kZqkNxjkTaK4c3uGSF5SeMcL9R
> C%2FXMvaWj2k1N3%2BzQ%3D&amp;reserved=0
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---


Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v2 11/11] net/mlx5: enforce limitation on IPv6 next proto
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
@ 2020-10-04 13:55     ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-04 13:55 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev

Hi

> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Friday, October 2, 2020 12:15 AM
> Subject: [PATCH v2 11/11] net/mlx5: enforce limitation on IPv6 next proto
> 
> 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>
> ---
>  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 211c0c5..e6ca5e1 100644
> --- a/doc/guides/nics/mlx5.rst
> +++ b/doc/guides/nics/mlx5.rst
> @@ -311,6 +311,13 @@ Limitations
>      for some NICs (such as ConnectX-6 Dx and BlueField 2).
>      The capability bit ``scatter_fcs_w_decap_disable`` shows NIC support.
> 
> +- 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 906741f..7a438cf 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -1645,9 +1645,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,
> @@ -1655,6 +1655,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


Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v2 10/11] doc: update release notes for MLX5 L3 frag support
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
@ 2020-10-04 13:55     ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-04 13:55 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev

Hi

> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Friday, October 2, 2020 12:15 AM
> Subject: [PATCH v2 10/11] doc: update release notes for MLX5 L3 frag support
> 
> This patch updates 20.11 release notes with the changes included in
> patches of this series:
> 1) MLX5 support of matching on IPv4/IPv6 fragmented/non-fragmented
>    packets.
> 2) ABI change in ethdev struct rte_flow_item_ipv6.
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---
>  doc/guides/rel_notes/release_20_11.rst | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/doc/guides/rel_notes/release_20_11.rst
> b/doc/guides/rel_notes/release_20_11.rst
> index 7f9d0dd..91e1773 100644
> --- a/doc/guides/rel_notes/release_20_11.rst
> +++ b/doc/guides/rel_notes/release_20_11.rst
> @@ -90,6 +90,11 @@ New Features
> 
>    * Added support for 200G PAM4 link speed.
> 
> +* **Updated Mellanox mlx5 driver.**
> +
> +  Updated Mellanox mlx5 driver with new features and improvements,
> including:
> +
> +  * Added support for matching on fragmented/non-fragmented IPv4/IPv6
> packets.
> 
>  Removed Items
>  -------------
> @@ -215,6 +220,11 @@ ABI Changes
> 
>    * ``ethdev`` internal functions are marked with ``__rte_internal`` tag.
> 
> +  * Added extensions' attributes to struct ``rte_flow_item_ipv6``.
> +    A set of additional values added to struct, indicating the existence of
> +    every defined extension header type.
> +    Applications should use the new values for identification of existing
> +    extensions in the packet header.
> 
>  Known Issues
>  ------------
> --
> 1.8.3.1


Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori

^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
                     ` (10 preceding siblings ...)
  2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
@ 2020-10-05  8:35   ` Dekel Peled
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
                       ` (11 more replies)
  11 siblings, 12 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This series implements support of matching on packets based on the
fragmentation attribute of the packet, i.e. if packet is a fragment
of a larger packet, or the opposite - packet is not a fragment.

In ethdev, add API to support IPv6 extension headers, and specifically
the IPv6 fragment extension header item.
In MLX5 PMD, support match on IPv4 fragmented packets, IPv6 fragmented
packets, and IPv6 fragment extension header item.
Testpmd CLI is updated accordingly.
Documentation is updated accordingly.

---
v2: add patch 'net/mlx5: enforce limitation on IPv6 next proto'
v3: update patch 'ethdev: add IPv6 fragment extension header item' to avoid ABI breakage.
---

Dekel Peled (11):
  ethdev: add extensions attributes to IPv6 item
  ethdev: add IPv6 fragment extension header item
  app/testpmd: support IPv4 fragments
  app/testpmd: support IPv6 fragments
  app/testpmd: support IPv6 fragment extension item
  net/mlx5: remove handling of ICMP fragmented packets
  net/mlx5: support match on IPv4 fragment packets
  net/mlx5: support match on IPv6 fragment packets
  net/mlx5: support match on IPv6 fragment ext. item
  doc: update release notes for MLX5 L3 frag support
  net/mlx5: enforce limitation on IPv6 next proto

 app/test-pmd/cmdline_flow.c            |  53 +++++
 doc/guides/nics/mlx5.rst               |   7 +
 doc/guides/prog_guide/rte_flow.rst     |  28 ++-
 doc/guides/rel_notes/release_20_11.rst |  10 +
 drivers/net/mlx5/mlx5_flow.c           |  62 ++++--
 drivers/net/mlx5/mlx5_flow.h           |  14 ++
 drivers/net/mlx5/mlx5_flow_dv.c        | 382 +++++++++++++++++++++++++++++----
 drivers/net/mlx5/mlx5_flow_verbs.c     |   9 +-
 lib/librte_ethdev/rte_flow.c           |   1 +
 lib/librte_ethdev/rte_flow.h           |  45 +++-
 lib/librte_ip_frag/rte_ip_frag.h       |  26 +--
 lib/librte_net/rte_ip.h                |  26 ++-
 12 files changed, 573 insertions(+), 90 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
@ 2020-10-05  8:35     ` Dekel Peled
  2020-10-06 23:43       ` Ajit Khaparde
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
                       ` (10 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Using the current implementation of DPDK, an application cannot match on
IPv6 packets, based on the existing extension headers, in a simple way.

Field 'Next Header' in IPv6 header indicates type of the first extension
header only. Following extension headers can't be identified by
inspecting the IPv6 header.
As a result, the existence or absence of specific extension headers
can't be used for packet matching.

For example, fragmented IPv6 packets contain a dedicated extension header
(which is implemented in a later patch of this series).
Non-fragmented packets don't contain the fragment extension header.
For an application to match on non-fragmented IPv6 packets, the current
implementation doesn't provide a suitable solution.
Matching on the Next Header field is not sufficient, since additional
extension headers might be present in the same packet.
To match on fragmented IPv6 packets, the same difficulty exists.

This patch implements the update as detailed in RFC [1].
A set of additional values will be added to IPv6 header struct.
These values will indicate the existence of every defined extension
header type, providing simple means for identification of existing
extensions in the packet header.
Continuing the above example, fragmented packets can be identified using
the specific value indicating existence of fragment extension header.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 16 +++++++++++++---
 lib/librte_ethdev/rte_flow.h       | 25 +++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 119b128..0b476da 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -946,11 +946,21 @@ Item: ``IPV6``
 
 Matches an IPv6 header.
 
-Note: IPv6 options are handled by dedicated pattern items, see `Item:
-IPV6_EXT`_.
+Dedicated flags indicate existence of specific extension headers.
+Every type of extension header can use a dedicated pattern item, or
+the generic `Item: IPV6_EXT`_.
 
 - ``hdr``: IPv6 header definition (``rte_ip.h``).
-- Default ``mask`` matches source and destination addresses only.
+- ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
+- ``rout_ext_exist``: Routing extension header exists.
+- ``frag_ext_exist``: Fragment extension header exists.
+- ``auth_ext_exist``: Authentication extension header exists.
+- ``esp_ext_exist``: Encapsulation Security Payload extension header exists.
+- ``dest_ext_exist``: Destination Options extension header exists.
+- ``mobil_ext_exist``: Mobility extension header exists.
+- ``hip_ext_exist``: Host Identity Protocol extension header exists.
+- ``shim6_ext_exist``: Shim6 Protocol extension header exists.
+- Default ``mask`` matches ``hdr`` source and destination addresses only.
 
 Item: ``ICMP``
 ^^^^^^^^^^^^^^
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index da8bfa5..5b5bed2 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -792,11 +792,32 @@ struct rte_flow_item_ipv4 {
  *
  * Matches an IPv6 header.
  *
- * Note: IPv6 options are handled by dedicated pattern items, see
- * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
+ * Dedicated flags indicate existence of specific extension headers.
+ * Every type of extension header can use a dedicated pattern item, or
+ * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.
  */
 struct rte_flow_item_ipv6 {
 	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
+	uint32_t hop_ext_exist:1;
+	/**< Hop-by-Hop Options extension header exists. */
+	uint32_t rout_ext_exist:1;
+	/**< Routing extension header exists. */
+	uint32_t frag_ext_exist:1;
+	/**< Fragment extension header exists. */
+	uint32_t auth_ext_exist:1;
+	/**< Authentication extension header exists. */
+	uint32_t esp_ext_exist:1;
+	/**< Encapsulation Security Payload extension header exists. */
+	uint32_t dest_ext_exist:1;
+	/**< Destination Options extension header exists. */
+	uint32_t mobil_ext_exist:1;
+	/**< Mobility extension header exists. */
+	uint32_t hip_ext_exist:1;
+	/**< Host Identity Protocol extension header exists. */
+	uint32_t shim6_ext_exist:1;
+	/**< Shim6 Protocol extension header exists. */
+	uint32_t reserved:23;
+	/**< Reserved for future extension headers, must be zero. */
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 02/11] ethdev: add IPv6 fragment extension header item
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-10-05  8:35     ` Dekel Peled
  2020-10-05  8:50       ` Ori Kam
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 03/11] app/testpmd: support IPv4 fragments Dekel Peled
                       ` (9 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Applications handling fragmented IPv6 packets need to match on IPv6
fragment extension header, in order to identify the fragments order
and location in the packet.
This patch introduces the IPv6 fragment extension header item,
proposed in [1].

Relevant definitions are moved from lib/librte_ip_frag/rte_ip_frag.h
to lib/librte_net/rte_ip.h, as they are needed for IPv6 header handling.
struct ipv6_extension_fragment renamed to rte_ipv6_fragment_ext to
adapt it to the common naming convention.

Default mask is not defined, since all fields are optional.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 16 ++++++++++++++--
 lib/librte_ethdev/rte_flow.c       |  1 +
 lib/librte_ethdev/rte_flow.h       | 20 ++++++++++++++++++++
 lib/librte_ip_frag/rte_ip_frag.h   | 26 ++------------------------
 lib/librte_net/rte_ip.h            | 26 ++++++++++++++++++++++++--
 5 files changed, 61 insertions(+), 28 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 0b476da..826e45d 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -947,8 +947,8 @@ Item: ``IPV6``
 Matches an IPv6 header.
 
 Dedicated flags indicate existence of specific extension headers.
-Every type of extension header can use a dedicated pattern item, or
-the generic `Item: IPV6_EXT`_.
+Every type of extension header can use a dedicated pattern item,
+for example `Item: IPV6_FRAG_EXT`_, or the generic `Item: IPV6_EXT`_.
 
 - ``hdr``: IPv6 header definition (``rte_ip.h``).
 - ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
@@ -1187,6 +1187,18 @@ Normally preceded by any of:
 - `Item: IPV6`_
 - `Item: IPV6_EXT`_
 
+Item: ``IPV6_FRAG_EXT``
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches the presence of IPv6 fragment extension header.
+
+- ``hdr``: IPv6 fragment extension header definition (``rte_ip.h``).
+
+Normally preceded by any of:
+
+- `Item: IPV6`_
+- `Item: IPV6_EXT`_
+
 Item: ``ICMP6``
 ^^^^^^^^^^^^^^^
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index f8fdd68..c1f3132 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -72,6 +72,7 @@ struct rte_flow_desc_data {
 	MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)),
 	MK_FLOW_ITEM(ARP_ETH_IPV4, sizeof(struct rte_flow_item_arp_eth_ipv4)),
 	MK_FLOW_ITEM(IPV6_EXT, sizeof(struct rte_flow_item_ipv6_ext)),
+	MK_FLOW_ITEM(IPV6_FRAG_EXT, sizeof(struct rte_flow_item_ipv6_frag_ext)),
 	MK_FLOW_ITEM(ICMP6, sizeof(struct rte_flow_item_icmp6)),
 	MK_FLOW_ITEM(ICMP6_ND_NS, sizeof(struct rte_flow_item_icmp6_nd_ns)),
 	MK_FLOW_ITEM(ICMP6_ND_NA, sizeof(struct rte_flow_item_icmp6_nd_na)),
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 5b5bed2..85376a3 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -537,6 +537,12 @@ enum rte_flow_item_type {
 	 */
 	RTE_FLOW_ITEM_TYPE_ECPRI,
 
+	/**
+	 * Matches the presence of IPv6 fragment extension header.
+	 *
+	 * See struct rte_flow_item_ipv6_frag_ext.
+	 */
+	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
 };
 
 /**
@@ -1188,6 +1194,20 @@ struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
 #endif
 
 /**
+ * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
+ *
+ * Matches the presence of IPv6 fragment extension header.
+ *
+ * Preceded by any of:
+ *
+ * - RTE_FLOW_ITEM_TYPE_IPV6
+ * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
+ */
+struct rte_flow_item_ipv6_frag_ext {
+	struct rte_ipv6_fragment_ext hdr;
+};
+
+/**
  * RTE_FLOW_ITEM_TYPE_ICMP6
  *
  * Matches any ICMPv6 header.
diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h
index 66edd7e..0bfe64b 100644
--- a/lib/librte_ip_frag/rte_ip_frag.h
+++ b/lib/librte_ip_frag/rte_ip_frag.h
@@ -110,30 +110,8 @@ struct rte_ip_frag_tbl {
 	__extension__ struct ip_frag_pkt pkt[0]; /**< hash table. */
 };
 
-/** IPv6 fragment extension header */
-#define	RTE_IPV6_EHDR_MF_SHIFT			0
-#define	RTE_IPV6_EHDR_MF_MASK			1
-#define	RTE_IPV6_EHDR_FO_SHIFT			3
-#define	RTE_IPV6_EHDR_FO_MASK			(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
-#define	RTE_IPV6_EHDR_FO_ALIGN			(1 << RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_FRAG_USED_MASK			\
-	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
-
-#define RTE_IPV6_GET_MF(x)				((x) & RTE_IPV6_EHDR_MF_MASK)
-#define RTE_IPV6_GET_FO(x)				((x) >> RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
-	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
-
-struct ipv6_extension_fragment {
-	uint8_t next_header;            /**< Next header type */
-	uint8_t reserved;               /**< Reserved */
-	uint16_t frag_data;             /**< All fragmentation data */
-	uint32_t id;                    /**< Packet ID */
-} __rte_packed;
-
-
+/* struct ipv6_extension_fragment moved to librte_net/rte_ip.h and renamed. */
+#define ipv6_extension_fragment	rte_ipv6_fragment_ext
 
 /**
  * Create a new IP fragmentation table.
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index fcd1eb3..3081c46 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -456,8 +456,30 @@ struct rte_ipv6_hdr {
 	return (uint16_t)cksum;
 }
 
-/* IPv6 fragmentation header size */
-#define RTE_IPV6_FRAG_HDR_SIZE 8
+/** IPv6 fragment extension header. */
+#define	RTE_IPV6_EHDR_MF_SHIFT	0
+#define	RTE_IPV6_EHDR_MF_MASK	1
+#define	RTE_IPV6_EHDR_FO_SHIFT	3
+#define	RTE_IPV6_EHDR_FO_MASK	(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
+#define	RTE_IPV6_EHDR_FO_ALIGN	(1 << RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_FRAG_USED_MASK	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
+
+#define RTE_IPV6_GET_MF(x)	((x) & RTE_IPV6_EHDR_MF_MASK)
+#define RTE_IPV6_GET_FO(x)	((x) >> RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
+	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
+
+struct rte_ipv6_fragment_ext {
+	uint8_t next_header;	/**< Next header type */
+	uint8_t reserved;	/**< Reserved */
+	rte_be16_t frag_data;	/**< All fragmentation data */
+	rte_be32_t id;		/**< Packet ID */
+} __rte_packed;
+
+/* IPv6 fragment extension header size */
+#define RTE_IPV6_FRAG_HDR_SIZE	sizeof(struct rte_ipv6_fragment_ext)
 
 /**
  * Parse next IPv6 header extension
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 03/11] app/testpmd: support IPv4 fragments
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-10-05  8:35     ` Dekel Peled
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 04/11] app/testpmd: support IPv6 fragments Dekel Peled
                       ` (8 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates testpmd CLI to support fragment_offset field of
IPv4 header item.

To match on non-fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 0 fragment_offset mask 0x3fff ...
To match on fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 1 fragment_offset last 0x3fff
fragment_offset mask 0x3fff ...
(Use the full available range 1 to 0x3fff to include all possible
values.)
To match on any IPv4 packets, fragmented and non-fragmented,
the fragment_offset field should not be specified for match.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 6e04d53..a9bf29f 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -129,6 +129,7 @@ enum index {
 	ITEM_VLAN_INNER_TYPE,
 	ITEM_IPV4,
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -873,6 +874,7 @@ struct parse_action_priv {
 
 static const enum index item_ipv4[] = {
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -2097,6 +2099,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
 					     hdr.type_of_service)),
 	},
+	[ITEM_IPV4_FRAGMENT_OFFSET] = {
+		.name = "fragment_offset",
+		.help = "fragmentation flags and fragment offset",
+		.next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
+					     hdr.fragment_offset)),
+	},
 	[ITEM_IPV4_TTL] = {
 		.name = "ttl",
 		.help = "time to live",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 04/11] app/testpmd: support IPv6 fragments
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
                       ` (2 preceding siblings ...)
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 03/11] app/testpmd: support IPv4 fragments Dekel Peled
@ 2020-10-05  8:35     ` Dekel Peled
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
                       ` (7 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], introduced frag_ext_exist field for
IPv6 header item, used to indicate match on fragmented/non-fragmented
packets.
This patch updates testpmd CLI to support the new field.

To match on non-fragmented IPv6 packets, need to use pattern:
... ipv6 frag_ext_exist spec 0 frag_ext_exist mask 1 ...
To match on fragmented IPv6 packets, need to use pattern:
... ipv6 frag_ext_exist spec 1 frag_ext_exist mask 1 ...
To match on any IPv6 packets, the frag_ext_exist field should
not be specified for match.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index a9bf29f..b078095 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -141,6 +141,7 @@ enum index {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_FRAG_EXT_EXIST,
 	ITEM_ICMP,
 	ITEM_ICMP_TYPE,
 	ITEM_ICMP_CODE,
@@ -890,6 +891,7 @@ struct parse_action_priv {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_FRAG_EXT_EXIST,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2185,6 +2187,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6,
 					     hdr.dst_addr)),
 	},
+	[ITEM_IPV6_FRAG_EXT_EXIST] = {
+		.name = "frag_ext_exist",
+		.help = "fragment packet attribute",
+		.next = NEXT(item_ipv6, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_ipv6,
+					   frag_ext_exist, 1)),
+	},
 	[ITEM_ICMP] = {
 		.name = "icmp",
 		.help = "match ICMP header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 05/11] app/testpmd: support IPv6 fragment extension item
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
                       ` (3 preceding siblings ...)
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 04/11] app/testpmd: support IPv6 fragments Dekel Peled
@ 2020-10-05  8:35     ` Dekel Peled
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
                       ` (6 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch updates testpmd CLI to support the new item and its fields.

To match on fragmented IPv6 packets, this item is added to pattern:
... ipv6 / ipv6_frag_ext ...

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b078095..1f800eb 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -195,6 +195,9 @@ enum index {
 	ITEM_ARP_ETH_IPV4_TPA,
 	ITEM_IPV6_EXT,
 	ITEM_IPV6_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT,
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
 	ITEM_ICMP6,
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -786,6 +789,7 @@ struct parse_action_priv {
 	ITEM_VXLAN_GPE,
 	ITEM_ARP_ETH_IPV4,
 	ITEM_IPV6_EXT,
+	ITEM_IPV6_FRAG_EXT,
 	ITEM_ICMP6,
 	ITEM_ICMP6_ND_NS,
 	ITEM_ICMP6_ND_NA,
@@ -1007,6 +1011,13 @@ struct parse_action_priv {
 	ZERO,
 };
 
+static const enum index item_ipv6_frag_ext[] = {
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_icmp6[] = {
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -2578,6 +2589,30 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_ext,
 					     next_hdr)),
 	},
+	[ITEM_IPV6_FRAG_EXT] = {
+		.name = "ipv6_frag_ext",
+		.help = "match presence of IPv6 fragment extension header",
+		.priv = PRIV_ITEM(IPV6_FRAG_EXT,
+				sizeof(struct rte_flow_item_ipv6_frag_ext)),
+		.next = NEXT(item_ipv6_frag_ext),
+		.call = parse_vc,
+	},
+	[ITEM_IPV6_FRAG_EXT_NEXT_HDR] = {
+		.name = "next_hdr",
+		.help = "next header",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_ipv6_frag_ext,
+					hdr.next_header)),
+	},
+	[ITEM_IPV6_FRAG_EXT_FRAG_DATA] = {
+		.name = "frag_data",
+		.help = "Fragment flags and offset",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_frag_ext,
+					     hdr.frag_data)),
+	},
 	[ITEM_ICMP6] = {
 		.name = "icmp6",
 		.help = "match any ICMPv6 header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 06/11] net/mlx5: remove handling of ICMP fragmented packets
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
                       ` (4 preceding siblings ...)
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
@ 2020-10-05  8:35     ` Dekel Peled
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
                       ` (5 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Commit [1] forced setting of match on 'frag' bit mask 1 and value 0.
Previous patch in this series added support of match on fragmented and
non-fragmented packets on L3 items, so this setting is now redundant.

This patch removes the changes done in [1].

[1] commit 85407db9f60d ("net/mlx5: fix matching for ICMP fragments")

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 79fdf34..0a0a5a4 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7345,12 +7345,6 @@ struct field_modify_info modify_tcp[] = {
 		return;
 	if (!icmp6_m)
 		icmp6_m = &rte_flow_item_icmp6_mask;
-	/*
-	 * Force flow only to match the non-fragmented IPv6 ICMPv6 packets.
-	 * If only the protocol is specified, no need to match the frag.
-	 */
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmpv6_type, icmp6_m->type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type,
 		 icmp6_v->type & icmp6_m->type);
@@ -7398,12 +7392,6 @@ struct field_modify_info modify_tcp[] = {
 		return;
 	if (!icmp_m)
 		icmp_m = &rte_flow_item_icmp_mask;
-	/*
-	 * Force flow only to match the non-fragmented IPv4 ICMP packets.
-	 * If only the protocol is specified, no need to match the frag.
-	 */
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmp_type,
 		 icmp_m->hdr.icmp_type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmp_type,
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 07/11] net/mlx5: support match on IPv4 fragment packets
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
                       ` (5 preceding siblings ...)
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
@ 2020-10-05  8:35     ` Dekel Peled
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 08/11] net/mlx5: support match on IPv6 " Dekel Peled
                       ` (4 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch adds to MLX5 PMD the support of matching on IPv4
fragmented and non-fragmented packets, using the IPv4 header
fragment_offset field.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c       |  48 ++++++++----
 drivers/net/mlx5/mlx5_flow.h       |  10 +++
 drivers/net/mlx5/mlx5_flow_dv.c    | 156 +++++++++++++++++++++++++++++++------
 drivers/net/mlx5/mlx5_flow_verbs.c |   9 ++-
 4 files changed, 178 insertions(+), 45 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index ffa7646..906741f 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -474,6 +474,8 @@ struct mlx5_flow_tunnel_info {
  *   Bit-masks covering supported fields by the NIC to compare with user mask.
  * @param[in] size
  *   Bit-masks size in bytes.
+ * @param[in] range_accepted
+ *   True if range of values is accepted for specific fields, false otherwise.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -485,6 +487,7 @@ struct mlx5_flow_tunnel_info {
 			  const uint8_t *mask,
 			  const uint8_t *nic_mask,
 			  unsigned int size,
+			  bool range_accepted,
 			  struct rte_flow_error *error)
 {
 	unsigned int i;
@@ -502,7 +505,7 @@ struct mlx5_flow_tunnel_info {
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "mask/last without a spec is not"
 					  " supported");
-	if (item->spec && item->last) {
+	if (item->spec && item->last && !range_accepted) {
 		uint8_t spec[size];
 		uint8_t last[size];
 		unsigned int i;
@@ -1277,7 +1280,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_icmp6_mask,
-		 sizeof(struct rte_flow_item_icmp6), error);
+		 sizeof(struct rte_flow_item_icmp6),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1329,7 +1333,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_icmp_mask,
-		 sizeof(struct rte_flow_item_icmp), error);
+		 sizeof(struct rte_flow_item_icmp),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1384,7 +1389,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_eth),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -1438,7 +1443,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_vlan),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!tunnel && mask->tci != RTE_BE16(0x0fff)) {
@@ -1502,6 +1507,7 @@ struct mlx5_flow_tunnel_info {
 			     uint64_t last_item,
 			     uint16_t ether_type,
 			     const struct rte_flow_item_ipv4 *acc_mask,
+			     bool range_accepted,
 			     struct rte_flow_error *error)
 {
 	const struct rte_flow_item_ipv4 *mask = item->mask;
@@ -1572,7 +1578,7 @@ struct mlx5_flow_tunnel_info {
 					acc_mask ? (const uint8_t *)acc_mask
 						 : (const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_ipv4),
-					error);
+					range_accepted, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1592,6 +1598,8 @@ struct mlx5_flow_tunnel_info {
  * @param[in] acc_mask
  *   Acceptable mask, if NULL default internal default mask
  *   will be used to check whether item fields are supported.
+ * @param[in] range_accepted
+ *   True if range of values is accepted for specific fields, false otherwise.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -1671,7 +1679,7 @@ struct mlx5_flow_tunnel_info {
 					acc_mask ? (const uint8_t *)acc_mask
 						 : (const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_ipv6),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1726,7 +1734,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_udp_mask,
-		 sizeof(struct rte_flow_item_udp), error);
+		 sizeof(struct rte_flow_item_udp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1781,7 +1790,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)flow_mask,
-		 sizeof(struct rte_flow_item_tcp), error);
+		 sizeof(struct rte_flow_item_tcp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1835,7 +1845,7 @@ struct mlx5_flow_tunnel_info {
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_vxlan_mask,
 		 sizeof(struct rte_flow_item_vxlan),
-		 error);
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (spec) {
@@ -1906,7 +1916,7 @@ struct mlx5_flow_tunnel_info {
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_vxlan_gpe_mask,
 		 sizeof(struct rte_flow_item_vxlan_gpe),
-		 error);
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (spec) {
@@ -1980,7 +1990,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&gre_key_default_mask,
-		 sizeof(rte_be32_t), error);
+		 sizeof(rte_be32_t), MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -2032,7 +2042,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&nic_mask,
-		 sizeof(struct rte_flow_item_gre), error);
+		 sizeof(struct rte_flow_item_gre), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 #ifndef HAVE_MLX5DV_DR
@@ -2107,7 +2118,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 				  (item, (const uint8_t *)mask,
 				   (const uint8_t *)&nic_mask,
-				   sizeof(struct rte_flow_item_geneve), error);
+				   sizeof(struct rte_flow_item_geneve),
+				   MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (spec) {
@@ -2190,7 +2202,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_mpls_mask,
-		 sizeof(struct rte_flow_item_mpls), error);
+		 sizeof(struct rte_flow_item_mpls),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2245,7 +2258,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_nvgre_mask,
-		 sizeof(struct rte_flow_item_nvgre), error);
+		 sizeof(struct rte_flow_item_nvgre),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2339,7 +2353,7 @@ struct mlx5_flow_tunnel_info {
 					 acc_mask ? (const uint8_t *)acc_mask
 						  : (const uint8_t *)&nic_mask,
 					 sizeof(struct rte_flow_item_ecpri),
-					 error);
+					 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 }
 
 /* Allocate unique ID for the split Q/RSS subflows. */
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 279daf2..1e30c93 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -330,6 +330,14 @@ enum mlx5_feature_name {
 #define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \
 					  sizeof(struct rte_flow_item_ipv4))
 
+/* IPv4 fragment_offset field contains relevant data in bits 2 to 15. */
+#define MLX5_IPV4_FRAG_OFFSET_MASK \
+		(RTE_IPV4_HDR_OFFSET_MASK | RTE_IPV4_HDR_MF_FLAG)
+
+/* Specific item's fields can accept a range of values (using spec and last). */
+#define MLX5_ITEM_RANGE_NOT_ACCEPTED	false
+#define MLX5_ITEM_RANGE_ACCEPTED	true
+
 /* Software header modify action numbers of a flow. */
 #define MLX5_ACT_NUM_MDF_IPV4		1
 #define MLX5_ACT_NUM_MDF_IPV6		4
@@ -985,6 +993,7 @@ int mlx5_flow_item_acceptable(const struct rte_flow_item *item,
 			      const uint8_t *mask,
 			      const uint8_t *nic_mask,
 			      unsigned int size,
+			      bool range_accepted,
 			      struct rte_flow_error *error);
 int mlx5_flow_validate_item_eth(const struct rte_flow_item *item,
 				uint64_t item_flags,
@@ -1002,6 +1011,7 @@ int mlx5_flow_validate_item_ipv4(const struct rte_flow_item *item,
 				 uint64_t last_item,
 				 uint16_t ether_type,
 				 const struct rte_flow_item_ipv4 *acc_mask,
+				 bool range_accepted,
 				 struct rte_flow_error *error);
 int mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
 				 uint64_t item_flags,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 0a0a5a4..3379caf 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1418,7 +1418,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_mark),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1494,7 +1494,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_meta),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -1547,7 +1547,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_tag),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (mask->index != 0xff)
@@ -1618,7 +1618,7 @@ struct field_modify_info modify_tcp[] = {
 				(item, (const uint8_t *)mask,
 				 (const uint8_t *)&rte_flow_item_port_id_mask,
 				 sizeof(struct rte_flow_item_port_id),
-				 error);
+				 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!spec)
@@ -1691,7 +1691,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_vlan),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!tunnel && mask->tci != RTE_BE16(0x0fff)) {
@@ -1778,11 +1778,126 @@ struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "Match is supported for GTP"
 					  " flags only");
-	return mlx5_flow_item_acceptable
-		(item, (const uint8_t *)mask,
-		 (const uint8_t *)&nic_mask,
-		 sizeof(struct rte_flow_item_gtp),
-		 error);
+	return mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
+					 (const uint8_t *)&nic_mask,
+					 sizeof(struct rte_flow_item_gtp),
+					 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
+}
+
+/**
+ * Validate IPV4 item.
+ * Use existing validation function mlx5_flow_validate_item_ipv4(), and
+ * add specific validation of fragment_offset field,
+ *
+ * @param[in] item
+ *   Item specification.
+ * @param[in] item_flags
+ *   Bit-fields that holds the items detected until now.
+ * @param[out] error
+ *   Pointer to error structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+flow_dv_validate_item_ipv4(const struct rte_flow_item *item,
+			   uint64_t item_flags,
+			   uint64_t last_item,
+			   uint16_t ether_type,
+			   struct rte_flow_error *error)
+{
+	int ret;
+	const struct rte_flow_item_ipv4 *spec = item->spec;
+	const struct rte_flow_item_ipv4 *last = item->last;
+	const struct rte_flow_item_ipv4 *mask = item->mask;
+	rte_be16_t fragment_offset_spec = 0;
+	rte_be16_t fragment_offset_last = 0;
+	const struct rte_flow_item_ipv4 nic_ipv4_mask = {
+		.hdr = {
+			.src_addr = RTE_BE32(0xffffffff),
+			.dst_addr = RTE_BE32(0xffffffff),
+			.type_of_service = 0xff,
+			.fragment_offset = RTE_BE16(0xffff),
+			.next_proto_id = 0xff,
+			.time_to_live = 0xff,
+		},
+	};
+
+	ret = mlx5_flow_validate_item_ipv4(item, item_flags, last_item,
+					   ether_type, &nic_ipv4_mask,
+					   MLX5_ITEM_RANGE_ACCEPTED, error);
+	if (ret < 0)
+		return ret;
+	if (spec && mask)
+		fragment_offset_spec = spec->hdr.fragment_offset &
+				       mask->hdr.fragment_offset;
+	if (!fragment_offset_spec)
+		return 0;
+	/*
+	 * spec and mask are valid, enforce using full mask to make sure the
+	 * complete value is used correctly.
+	 */
+	if ((mask->hdr.fragment_offset & RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+			!= RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM_MASK,
+					  item, "must use full mask for"
+					  " fragment_offset");
+	/*
+	 * Match on fragment_offset 0x2000 means MF is 1 and frag-offset is 0,
+	 * indicating this is 1st fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(RTE_IPV4_HDR_MF_FLAG))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "match on first fragment not "
+					  "supported");
+	if (fragment_offset_spec && !last)
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "specified value not supported");
+	/* spec and last are valid, validate the specified range. */
+	fragment_offset_last = last->hdr.fragment_offset &
+			       mask->hdr.fragment_offset;
+	/*
+	 * Match on fragment_offset spec 0x2001 and last 0x3fff
+	 * means MF is 1 and frag-offset is > 0.
+	 * This packet is fragment 2nd and onward, excluding last.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(RTE_IPV4_HDR_MF_FLAG + 1) &&
+	    fragment_offset_last == RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on following "
+					  "fragments not supported");
+	/*
+	 * Match on fragment_offset spec 0x0001 and last 0x1fff
+	 * means MF is 0 and frag-offset is > 0.
+	 * This packet is last fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(1) &&
+	    fragment_offset_last == RTE_BE16(RTE_IPV4_HDR_OFFSET_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on last "
+					  "fragment not supported");
+	/*
+	 * Match on fragment_offset spec 0x0001 and last 0x3fff
+	 * means MF and/or frag-offset is not 0.
+	 * This is a fragmented packet.
+	 * Other range values are invalid and rejected.
+	 */
+	if (!(fragment_offset_spec == RTE_BE16(1) &&
+	      fragment_offset_last == RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK)))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST, last,
+					  "specified range not supported");
+	return 0;
 }
 
 /**
@@ -5084,15 +5199,6 @@ struct field_modify_info modify_tcp[] = {
 			.dst_port = RTE_BE16(UINT16_MAX),
 		}
 	};
-	const struct rte_flow_item_ipv4 nic_ipv4_mask = {
-		.hdr = {
-			.src_addr = RTE_BE32(0xffffffff),
-			.dst_addr = RTE_BE32(0xffffffff),
-			.type_of_service = 0xff,
-			.next_proto_id = 0xff,
-			.time_to_live = 0xff,
-		},
-	};
 	const struct rte_flow_item_ipv6 nic_ipv6_mask = {
 		.hdr = {
 			.src_addr =
@@ -5192,11 +5298,9 @@ struct field_modify_info modify_tcp[] = {
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			mlx5_flow_tunnel_ip_check(items, next_protocol,
 						  &item_flags, &tunnel);
-			ret = mlx5_flow_validate_item_ipv4(items, item_flags,
-							   last_item,
-							   ether_type,
-							   &nic_ipv4_mask,
-							   error);
+			ret = flow_dv_validate_item_ipv4(items, item_flags,
+							 last_item, ether_type,
+							 error);
 			if (ret < 0)
 				return ret;
 			last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :
@@ -6296,6 +6400,10 @@ struct field_modify_info modify_tcp[] = {
 		 ipv4_m->hdr.time_to_live);
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ttl_hoplimit,
 		 ipv4_v->hdr.time_to_live & ipv4_m->hdr.time_to_live);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag,
+		 !!(ipv4_m->hdr.fragment_offset));
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
+		 !!(ipv4_v->hdr.fragment_offset & ipv4_m->hdr.fragment_offset));
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 62c18b8..276bcb5 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1312,10 +1312,11 @@
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
-			ret = mlx5_flow_validate_item_ipv4(items, item_flags,
-							   last_item,
-							   ether_type, NULL,
-							   error);
+			ret = mlx5_flow_validate_item_ipv4
+						(items, item_flags,
+						 last_item, ether_type, NULL,
+						 MLX5_ITEM_RANGE_NOT_ACCEPTED,
+						 error);
 			if (ret < 0)
 				return ret;
 			last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 08/11] net/mlx5: support match on IPv6 fragment packets
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
                       ` (6 preceding siblings ...)
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
@ 2020-10-05  8:35     ` Dekel Peled
  2020-10-05  8:51       ` Ori Kam
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
                       ` (3 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch adds to MLX5 PMD the support of matching on IPv6
fragmented and non-fragmented packets, using the new field
frag_ext_exist, added to rte_flow following RFC [1].

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 3379caf..4403abc 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5211,6 +5211,7 @@ struct field_modify_info modify_tcp[] = {
 			.proto = 0xff,
 			.hop_limits = 0xff,
 		},
+		.frag_ext_exist = 1,
 	};
 	const struct rte_flow_item_ecpri nic_ecpri_mask = {
 		.hdr = {
@@ -6519,6 +6520,10 @@ struct field_modify_info modify_tcp[] = {
 		 ipv6_m->hdr.hop_limits);
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ttl_hoplimit,
 		 ipv6_v->hdr.hop_limits & ipv6_m->hdr.hop_limits);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag,
+		 !!(ipv6_m->frag_ext_exist));
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
+		 !!(ipv6_v->frag_ext_exist & ipv6_m->frag_ext_exist));
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 09/11] net/mlx5: support match on IPv6 fragment ext. item
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
                       ` (7 preceding siblings ...)
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 08/11] net/mlx5: support match on IPv6 " Dekel Peled
@ 2020-10-05  8:35     ` Dekel Peled
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
                       ` (2 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch adds to MLX5 PMD the option to match on this item type.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.h    |   4 +
 drivers/net/mlx5/mlx5_flow_dv.c | 209 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 213 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 1e30c93..376519f 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -122,6 +122,10 @@ enum mlx5_feature_name {
 /* Pattern eCPRI Layer bit. */
 #define MLX5_FLOW_LAYER_ECPRI (UINT64_C(1) << 29)
 
+/* IPv6 Fragment Extension Header bit. */
+#define MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT (1u << 30)
+#define MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT (1u << 31)
+
 /* Outer Masks. */
 #define MLX5_FLOW_LAYER_OUTER_L3 \
 	(MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 4403abc..eb1db12 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1901,6 +1901,120 @@ struct field_modify_info modify_tcp[] = {
 }
 
 /**
+ * Validate IPV6 fragment extension item.
+ *
+ * @param[in] item
+ *   Item specification.
+ * @param[in] item_flags
+ *   Bit-fields that holds the items detected until now.
+ * @param[out] error
+ *   Pointer to error structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+flow_dv_validate_item_ipv6_frag_ext(const struct rte_flow_item *item,
+				    uint64_t item_flags,
+				    struct rte_flow_error *error)
+{
+	const struct rte_flow_item_ipv6_frag_ext *spec = item->spec;
+	const struct rte_flow_item_ipv6_frag_ext *last = item->last;
+	const struct rte_flow_item_ipv6_frag_ext *mask = item->mask;
+	rte_be16_t frag_data_spec = 0;
+	rte_be16_t frag_data_last = 0;
+	const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
+	const uint64_t l4m = tunnel ? MLX5_FLOW_LAYER_INNER_L4 :
+				      MLX5_FLOW_LAYER_OUTER_L4;
+	int ret = 0;
+	struct rte_flow_item_ipv6_frag_ext nic_mask = {
+		.hdr = {
+			.next_header = 0xff,
+			.frag_data = RTE_BE16(0xffff),
+		},
+	};
+
+	if (item_flags & l4m)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "ipv6 fragment extension item cannot "
+					  "follow L4 item.");
+	if ((tunnel && !(item_flags & MLX5_FLOW_LAYER_INNER_L3_IPV6)) ||
+	    (!tunnel && !(item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV6)))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "ipv6 fragment extension item must "
+					  "follow ipv6 item");
+	if (spec && mask)
+		frag_data_spec = spec->hdr.frag_data & mask->hdr.frag_data;
+	if (!frag_data_spec)
+		return 0;
+	/*
+	 * spec and mask are valid, enforce using full mask to make sure the
+	 * complete value is used correctly.
+	 */
+	if ((mask->hdr.frag_data & RTE_BE16(RTE_IPV6_FRAG_USED_MASK)) !=
+				RTE_BE16(RTE_IPV6_FRAG_USED_MASK))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM_MASK,
+					  item, "must use full mask for"
+					  " frag_data");
+	/*
+	 * Match on frag_data 0x00001 means M is 1 and frag-offset is 0.
+	 * This is 1st fragment of fragmented packet.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_MF_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "match on first fragment not "
+					  "supported");
+	if (frag_data_spec && !last)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "specified value not supported");
+	ret = mlx5_flow_item_acceptable
+				(item, (const uint8_t *)mask,
+				 (const uint8_t *)&nic_mask,
+				 sizeof(struct rte_flow_item_ipv6_frag_ext),
+				 MLX5_ITEM_RANGE_ACCEPTED, error);
+	if (ret)
+		return ret;
+	/* spec and last are valid, validate the specified range. */
+	frag_data_last = last->hdr.frag_data & mask->hdr.frag_data;
+	/*
+	 * Match on frag_data spec 0x0009 and last 0xfff9
+	 * means M is 1 and frag-offset is > 0.
+	 * This packet is fragment 2nd and onward, excluding last.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_FO_ALIGN |
+				       RTE_IPV6_EHDR_MF_MASK) &&
+	    frag_data_last == RTE_BE16(RTE_IPV6_FRAG_USED_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on following "
+					  "fragments not supported");
+	/*
+	 * Match on frag_data spec 0x0008 and last 0xfff8
+	 * means M is 0 and frag-offset is > 0.
+	 * This packet is last fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_FO_ALIGN) &&
+	    frag_data_last == RTE_BE16(RTE_IPV6_EHDR_FO_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on last "
+					  "fragment not supported");
+	/* Other range values are invalid and rejected. */
+	return rte_flow_error_set(error, EINVAL,
+				  RTE_FLOW_ERROR_TYPE_ITEM_LAST, last,
+				  "specified range not supported");
+}
+
+/**
  * Validate the pop VLAN action.
  *
  * @param[in] dev
@@ -5349,6 +5463,29 @@ struct field_modify_info modify_tcp[] = {
 				next_protocol = 0xff;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT:
+			ret = flow_dv_validate_item_ipv6_frag_ext(items,
+								  item_flags,
+								  error);
+			if (ret < 0)
+				return ret;
+			last_item = tunnel ?
+					MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT :
+					MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT;
+			if (items->mask != NULL &&
+			    ((const struct rte_flow_item_ipv6_frag_ext *)
+			     items->mask)->hdr.next_header) {
+				next_protocol =
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->spec)->hdr.next_header;
+				next_protocol &=
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->mask)->hdr.next_header;
+			} else {
+				/* Reset for inner layer. */
+				next_protocol = 0xff;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			ret = mlx5_flow_validate_item_tcp
 						(items, item_flags,
@@ -6527,6 +6664,57 @@ struct field_modify_info modify_tcp[] = {
 }
 
 /**
+ * Add IPV6 fragment extension item to matcher and to the value.
+ *
+ * @param[in, out] matcher
+ *   Flow matcher.
+ * @param[in, out] key
+ *   Flow matcher value.
+ * @param[in] item
+ *   Flow pattern to translate.
+ * @param[in] inner
+ *   Item is inner pattern.
+ */
+static void
+flow_dv_translate_item_ipv6_frag_ext(void *matcher, void *key,
+				     const struct rte_flow_item *item,
+				     int inner)
+{
+	const struct rte_flow_item_ipv6_frag_ext *ipv6_frag_ext_m = item->mask;
+	const struct rte_flow_item_ipv6_frag_ext *ipv6_frag_ext_v = item->spec;
+	const struct rte_flow_item_ipv6_frag_ext nic_mask = {
+		.hdr = {
+			.next_header = 0xff,
+			.frag_data = RTE_BE16(0xffff),
+		},
+	};
+	void *headers_m;
+	void *headers_v;
+
+	if (inner) {
+		headers_m = MLX5_ADDR_OF(fte_match_param, matcher,
+					 inner_headers);
+		headers_v = MLX5_ADDR_OF(fte_match_param, key, inner_headers);
+	} else {
+		headers_m = MLX5_ADDR_OF(fte_match_param, matcher,
+					 outer_headers);
+		headers_v = MLX5_ADDR_OF(fte_match_param, key, outer_headers);
+	}
+	/* IPv6 fragment extension item exists, so packet is IP fragment. */
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 1);
+	if (!ipv6_frag_ext_v)
+		return;
+	if (!ipv6_frag_ext_m)
+		ipv6_frag_ext_m = &nic_mask;
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol,
+		 ipv6_frag_ext_m->hdr.next_header);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
+		 ipv6_frag_ext_v->hdr.next_header &
+		 ipv6_frag_ext_m->hdr.next_header);
+}
+
+/**
  * Add TCP item to matcher and to the value.
  *
  * @param[in, out] matcher
@@ -8868,6 +9056,27 @@ struct field_modify_info modify_tcp[] = {
 				next_protocol = 0xff;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT:
+			flow_dv_translate_item_ipv6_frag_ext(match_mask,
+							     match_value,
+							     items, tunnel);
+			last_item = tunnel ?
+					MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT :
+					MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT;
+			if (items->mask != NULL &&
+			    ((const struct rte_flow_item_ipv6_frag_ext *)
+			     items->mask)->hdr.next_header) {
+				next_protocol =
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->spec)->hdr.next_header;
+				next_protocol &=
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->mask)->hdr.next_header;
+			} else {
+				/* Reset for inner layer. */
+				next_protocol = 0xff;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			flow_dv_translate_item_tcp(match_mask, match_value,
 						   items, tunnel);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 10/11] doc: update release notes for MLX5 L3 frag support
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
                       ` (8 preceding siblings ...)
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
@ 2020-10-05  8:35     ` Dekel Peled
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates 20.11 release notes with the changes included in
patches of this series:
1) MLX5 support of matching on IPv4/IPv6 fragmented/non-fragmented
   packets.
2) ABI change in ethdev struct rte_flow_item_ipv6.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 doc/guides/rel_notes/release_20_11.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 1a9945f..8a244fe 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -109,6 +109,11 @@ New Features
   * Extern objects and functions can be plugged into the pipeline.
   * Transaction-oriented table updates.
 
+* **Updated Mellanox mlx5 driver.**
+
+  Updated Mellanox mlx5 driver with new features and improvements, including:
+
+  * Added support for matching on fragmented/non-fragmented IPv4/IPv6 packets.
 
 Removed Items
 -------------
@@ -238,6 +243,11 @@ ABI Changes
 
   * ``ethdev`` internal functions are marked with ``__rte_internal`` tag.
 
+  * Added extensions' attributes to struct ``rte_flow_item_ipv6``.
+    A set of additional values added to struct, indicating the existence of
+    every defined extension header type.
+    Applications should use the new values for identification of existing
+    extensions in the packet header.
 
 Known Issues
 ------------
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v3 11/11] net/mlx5: enforce limitation on IPv6 next proto
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
                       ` (9 preceding siblings ...)
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
@ 2020-10-05  8:35     ` Dekel Peled
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-05  8:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

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 b0614ae..3c7b998 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -311,6 +311,13 @@ Limitations
     for some NICs (such as ConnectX-6 Dx and BlueField 2).
     The capability bit ``scatter_fcs_w_decap_disable`` shows NIC support.
 
+- 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 906741f..7a438cf 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1645,9 +1645,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,
@@ -1655,6 +1655,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


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v3 02/11] ethdev: add IPv6 fragment extension header item
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-10-05  8:50       ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-05  8:50 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev

Hi,


> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Monday, October 5, 2020 11:36 AM
> Subject: [PATCH v3 02/11] ethdev: add IPv6 fragment extension header item
> 
> Applications handling fragmented IPv6 packets need to match on IPv6
> fragment extension header, in order to identify the fragments order
> and location in the packet.
> This patch introduces the IPv6 fragment extension header item,
> proposed in [1].
> 
> Relevant definitions are moved from lib/librte_ip_frag/rte_ip_frag.h
> to lib/librte_net/rte_ip.h, as they are needed for IPv6 header handling.
> struct ipv6_extension_fragment renamed to rte_ipv6_fragment_ext to
> adapt it to the common naming convention.
> 
> Default mask is not defined, since all fields are optional.
> 
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmails.dpd
> k.org%2Farchives%2Fdev%2F2020-
> March%2F160255.html&amp;data=02%7C01%7Corika%40nvidia.com%7C96f18
> 79f1da24462291408d86909c793%7C43083d15727340c1b7db39efd9ccc17a%7C
> 0%7C1%7C637374838007797661&amp;sdata=AW5ZK%2BfqiCgto8SpVIUL1z0qJ
> Qd2Vhv2%2BTGNJoIturE%3D&amp;reserved=0
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---

Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v3 08/11] net/mlx5: support match on IPv6 fragment packets
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 08/11] net/mlx5: support match on IPv6 " Dekel Peled
@ 2020-10-05  8:51       ` Ori Kam
  0 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-05  8:51 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev

Hi

> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Monday, October 5, 2020 11:36 AM
> Subject: [PATCH v3 08/11] net/mlx5: support match on IPv6 fragment packets
> 
> This patch adds to MLX5 PMD the support of matching on IPv6
> fragmented and non-fragmented packets, using the new field
> frag_ext_exist, added to rte_flow following RFC [1].
> 
> [1]
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmails.dp
> dk.org%2Farchives%2Fdev%2F2020-
> August%2F177257.html&amp;data=02%7C01%7Corika%40nvidia.com%7Cbdd7c
> 0dab63e4dee1c5a08d86909f193%7C43083d15727340c1b7db39efd9ccc17a%7C
> 0%7C1%7C637374838713645970&amp;sdata=DqFljgZKStcjqIiwKYh63by%2FmC
> 1t9slR5bobh7jcM70%3D&amp;reserved=0
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index 3379caf..4403abc 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -5211,6 +5211,7 @@ struct field_modify_info modify_tcp[] = {
>  			.proto = 0xff,
>  			.hop_limits = 0xff,
>  		},
> +		.frag_ext_exist = 1,
>  	};
>  	const struct rte_flow_item_ecpri nic_ecpri_mask = {
>  		.hdr = {
> @@ -6519,6 +6520,10 @@ struct field_modify_info modify_tcp[] = {
>  		 ipv6_m->hdr.hop_limits);
>  	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ttl_hoplimit,
>  		 ipv6_v->hdr.hop_limits & ipv6_m->hdr.hop_limits);
> +	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag,
> +		 !!(ipv6_m->frag_ext_exist));
> +	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
> +		 !!(ipv6_v->frag_ext_exist & ipv6_m->frag_ext_exist));
>  }
> 
>  /**
> --
> 1.8.3.1

Acked-by: Ori Kam <orika@nvidia.com>
Thanks,
Ori

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v3 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-10-06 23:43       ` Ajit Khaparde
  2020-10-07  6:59         ` Dekel Peled
  0 siblings, 1 reply; 101+ messages in thread
From: Ajit Khaparde @ 2020-10-06 23:43 UTC (permalink / raw)
  To: Dekel Peled
  Cc: Ori Kam, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Ananyev, Konstantin, Olivier Matz, Wenzhuo Lu, Beilei Xing,
	Iremonger, Bernard, Matan Azrad, Shahaf Shuler, Slava Ovsiienko,
	dpdk-dev

On Mon, Oct 5, 2020 at 1:37 AM Dekel Peled <dekelp@nvidia.com> wrote:
>
> Using the current implementation of DPDK, an application cannot match on
> IPv6 packets, based on the existing extension headers, in a simple way.
>
> Field 'Next Header' in IPv6 header indicates type of the first extension
> header only. Following extension headers can't be identified by
> inspecting the IPv6 header.
> As a result, the existence or absence of specific extension headers
> can't be used for packet matching.
>
> For example, fragmented IPv6 packets contain a dedicated extension header
> (which is implemented in a later patch of this series).
> Non-fragmented packets don't contain the fragment extension header.
> For an application to match on non-fragmented IPv6 packets, the current
> implementation doesn't provide a suitable solution.
> Matching on the Next Header field is not sufficient, since additional
> extension headers might be present in the same packet.
> To match on fragmented IPv6 packets, the same difficulty exists.
>
> This patch implements the update as detailed in RFC [1].
> A set of additional values will be added to IPv6 header struct.
> These values will indicate the existence of every defined extension
> header type, providing simple means for identification of existing
> extensions in the packet header.
> Continuing the above example, fragmented packets can be identified using
> the specific value indicating existence of fragment extension header.
>
> [1] https://mails.dpdk.org/archives/dev/2020-August/177257.html
>
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> Acked-by: Ori Kam <orika@nvidia.com>
> ---
>  doc/guides/prog_guide/rte_flow.rst | 16 +++++++++++++---
>  lib/librte_ethdev/rte_flow.h       | 25 +++++++++++++++++++++++--
>  2 files changed, 36 insertions(+), 5 deletions(-)
>
> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index 119b128..0b476da 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -946,11 +946,21 @@ Item: ``IPV6``
>
>  Matches an IPv6 header.
>
> -Note: IPv6 options are handled by dedicated pattern items, see `Item:
> -IPV6_EXT`_.
> +Dedicated flags indicate existence of specific extension headers.
> +Every type of extension header can use a dedicated pattern item, or
> +the generic `Item: IPV6_EXT`_.

Can you add how the PMD should interpret if these flags are not set
by the application.
There is a mention of some of that in the testpmd commit log.
I think it is good to spell it out here.

>
>  - ``hdr``: IPv6 header definition (``rte_ip.h``).
> -- Default ``mask`` matches source and destination addresses only.
> +- ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
> +- ``rout_ext_exist``: Routing extension header exists.
> +- ``frag_ext_exist``: Fragment extension header exists.
> +- ``auth_ext_exist``: Authentication extension header exists.
> +- ``esp_ext_exist``: Encapsulation Security Payload extension header exists.
> +- ``dest_ext_exist``: Destination Options extension header exists.
> +- ``mobil_ext_exist``: Mobility extension header exists.
> +- ``hip_ext_exist``: Host Identity Protocol extension header exists.
> +- ``shim6_ext_exist``: Shim6 Protocol extension header exists.
> +- Default ``mask`` matches ``hdr`` source and destination addresses only.
>
>  Item: ``ICMP``
>  ^^^^^^^^^^^^^^
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index da8bfa5..5b5bed2 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -792,11 +792,32 @@ struct rte_flow_item_ipv4 {
>   *
>   * Matches an IPv6 header.
>   *
> - * Note: IPv6 options are handled by dedicated pattern items, see
> - * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
> + * Dedicated flags indicate existence of specific extension headers.
> + * Every type of extension header can use a dedicated pattern item, or
> + * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.
>   */
>  struct rte_flow_item_ipv6 {
>         struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
> +       uint32_t hop_ext_exist:1;
> +       /**< Hop-by-Hop Options extension header exists. */
> +       uint32_t rout_ext_exist:1;
> +       /**< Routing extension header exists. */
> +       uint32_t frag_ext_exist:1;
> +       /**< Fragment extension header exists. */
> +       uint32_t auth_ext_exist:1;
> +       /**< Authentication extension header exists. */
> +       uint32_t esp_ext_exist:1;
> +       /**< Encapsulation Security Payload extension header exists. */
> +       uint32_t dest_ext_exist:1;
> +       /**< Destination Options extension header exists. */
> +       uint32_t mobil_ext_exist:1;
> +       /**< Mobility extension header exists. */
> +       uint32_t hip_ext_exist:1;
> +       /**< Host Identity Protocol extension header exists. */
> +       uint32_t shim6_ext_exist:1;
> +       /**< Shim6 Protocol extension header exists. */
> +       uint32_t reserved:23;
> +       /**< Reserved for future extension headers, must be zero. */
>  };
>
>  /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
> --
> 1.8.3.1
>

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v3 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-06 23:43       ` Ajit Khaparde
@ 2020-10-07  6:59         ` Dekel Peled
  0 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07  6:59 UTC (permalink / raw)
  To: Ajit Khaparde
  Cc: Ori Kam, NBU-Contact-Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Ananyev, Konstantin, Olivier Matz, Wenzhuo Lu,
	Beilei Xing, Iremonger, Bernard, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko, dpdk-dev

Thanks, PSB.

> -----Original Message-----
> From: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Sent: Wednesday, October 7, 2020 2:44 AM
> To: Dekel Peled <dekelp@nvidia.com>
> Cc: Ori Kam <orika@nvidia.com>; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@intel.com>; Andrew
> Rybchenko <arybchenko@solarflare.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Olivier Matz <olivier.matz@6wind.com>;
> Wenzhuo Lu <wenzhuo.lu@intel.com>; Beilei Xing <beilei.xing@intel.com>;
> Iremonger, Bernard <bernard.iremonger@intel.com>; Matan Azrad
> <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>; dpdk-dev <dev@dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH v3 01/11] ethdev: add extensions attributes
> to IPv6 item
> 
> On Mon, Oct 5, 2020 at 1:37 AM Dekel Peled <dekelp@nvidia.com> wrote:
> >
> > Using the current implementation of DPDK, an application cannot match on
> > IPv6 packets, based on the existing extension headers, in a simple way.
> >
> > Field 'Next Header' in IPv6 header indicates type of the first extension
> > header only. Following extension headers can't be identified by
> > inspecting the IPv6 header.
> > As a result, the existence or absence of specific extension headers
> > can't be used for packet matching.
> >
> > For example, fragmented IPv6 packets contain a dedicated extension
> header
> > (which is implemented in a later patch of this series).
> > Non-fragmented packets don't contain the fragment extension header.
> > For an application to match on non-fragmented IPv6 packets, the current
> > implementation doesn't provide a suitable solution.
> > Matching on the Next Header field is not sufficient, since additional
> > extension headers might be present in the same packet.
> > To match on fragmented IPv6 packets, the same difficulty exists.
> >
> > This patch implements the update as detailed in RFC [1].
> > A set of additional values will be added to IPv6 header struct.
> > These values will indicate the existence of every defined extension
> > header type, providing simple means for identification of existing
> > extensions in the packet header.
> > Continuing the above example, fragmented packets can be identified using
> > the specific value indicating existence of fragment extension header.
> >
> > [1] https://mails.dpdk.org/archives/dev/2020-August/177257.html
> >
> > Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> > Acked-by: Ori Kam <orika@nvidia.com>
> > ---
> >  doc/guides/prog_guide/rte_flow.rst | 16 +++++++++++++---
> >  lib/librte_ethdev/rte_flow.h       | 25 +++++++++++++++++++++++--
> >  2 files changed, 36 insertions(+), 5 deletions(-)
> >
> > diff --git a/doc/guides/prog_guide/rte_flow.rst
> b/doc/guides/prog_guide/rte_flow.rst
> > index 119b128..0b476da 100644
> > --- a/doc/guides/prog_guide/rte_flow.rst
> > +++ b/doc/guides/prog_guide/rte_flow.rst
> > @@ -946,11 +946,21 @@ Item: ``IPV6``
> >
> >  Matches an IPv6 header.
> >
> > -Note: IPv6 options are handled by dedicated pattern items, see `Item:
> > -IPV6_EXT`_.
> > +Dedicated flags indicate existence of specific extension headers.
> > +Every type of extension header can use a dedicated pattern item, or
> > +the generic `Item: IPV6_EXT`_.
> 
> Can you add how the PMD should interpret if these flags are not set
> by the application.
> There is a mention of some of that in the testpmd commit log.
> I think it is good to spell it out here.

Agree, I will add it in the git log for next version.

> 
> >
> >  - ``hdr``: IPv6 header definition (``rte_ip.h``).
> > -- Default ``mask`` matches source and destination addresses only.
> > +- ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
> > +- ``rout_ext_exist``: Routing extension header exists.
> > +- ``frag_ext_exist``: Fragment extension header exists.
> > +- ``auth_ext_exist``: Authentication extension header exists.
> > +- ``esp_ext_exist``: Encapsulation Security Payload extension header
> exists.
> > +- ``dest_ext_exist``: Destination Options extension header exists.
> > +- ``mobil_ext_exist``: Mobility extension header exists.
> > +- ``hip_ext_exist``: Host Identity Protocol extension header exists.
> > +- ``shim6_ext_exist``: Shim6 Protocol extension header exists.
> > +- Default ``mask`` matches ``hdr`` source and destination addresses only.
> >
> >  Item: ``ICMP``
> >  ^^^^^^^^^^^^^^
> > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> > index da8bfa5..5b5bed2 100644
> > --- a/lib/librte_ethdev/rte_flow.h
> > +++ b/lib/librte_ethdev/rte_flow.h
> > @@ -792,11 +792,32 @@ struct rte_flow_item_ipv4 {
> >   *
> >   * Matches an IPv6 header.
> >   *
> > - * Note: IPv6 options are handled by dedicated pattern items, see
> > - * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
> > + * Dedicated flags indicate existence of specific extension headers.
> > + * Every type of extension header can use a dedicated pattern item, or
> > + * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.
> >   */
> >  struct rte_flow_item_ipv6 {
> >         struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
> > +       uint32_t hop_ext_exist:1;
> > +       /**< Hop-by-Hop Options extension header exists. */
> > +       uint32_t rout_ext_exist:1;
> > +       /**< Routing extension header exists. */
> > +       uint32_t frag_ext_exist:1;
> > +       /**< Fragment extension header exists. */
> > +       uint32_t auth_ext_exist:1;
> > +       /**< Authentication extension header exists. */
> > +       uint32_t esp_ext_exist:1;
> > +       /**< Encapsulation Security Payload extension header exists. */
> > +       uint32_t dest_ext_exist:1;
> > +       /**< Destination Options extension header exists. */
> > +       uint32_t mobil_ext_exist:1;
> > +       /**< Mobility extension header exists. */
> > +       uint32_t hip_ext_exist:1;
> > +       /**< Host Identity Protocol extension header exists. */
> > +       uint32_t shim6_ext_exist:1;
> > +       /**< Shim6 Protocol extension header exists. */
> > +       uint32_t reserved:23;
> > +       /**< Reserved for future extension headers, must be zero. */
> >  };
> >
> >  /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
> > --
> > 1.8.3.1
> >

^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets
  2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
                       ` (10 preceding siblings ...)
  2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
@ 2020-10-07 10:53     ` Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
                         ` (12 more replies)
  11 siblings, 13 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:53 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This series implements support of matching on packets based on the
fragmentation attribute of the packet, i.e. if packet is a fragment
of a larger packet, or the opposite - packet is not a fragment.

In ethdev, add API to support IPv6 extension headers, and specifically
the IPv6 fragment extension header item.
In MLX5 PMD, support match on IPv4 fragmented packets, IPv6 fragmented
packets, and IPv6 fragment extension header item.
Testpmd CLI is updated accordingly.
Documentation is updated accordingly.

---
v2: add patch 'net/mlx5: enforce limitation on IPv6 next proto'
v3: update patch 'ethdev: add IPv6 fragment extension header item' to avoid ABI breakage.
v4: update rte_flow documentation to clarify use of IPv6 extension header flags.
---

Dekel Peled (11):
  ethdev: add extensions attributes to IPv6 item
  ethdev: add IPv6 fragment extension header item
  app/testpmd: support IPv4 fragments
  app/testpmd: support IPv6 fragments
  app/testpmd: support IPv6 fragment extension item
  net/mlx5: remove handling of ICMP fragmented packets
  net/mlx5: support match on IPv4 fragment packets
  net/mlx5: support match on IPv6 fragment packets
  net/mlx5: support match on IPv6 fragment ext. item
  doc: update release notes for MLX5 L3 frag support
  net/mlx5: enforce limitation on IPv6 next proto

 app/test-pmd/cmdline_flow.c            |  53 +++++
 doc/guides/nics/mlx5.rst               |   7 +
 doc/guides/prog_guide/rte_flow.rst     |  34 ++-
 doc/guides/rel_notes/release_20_11.rst |  10 +
 drivers/net/mlx5/mlx5_flow.c           |  62 ++++--
 drivers/net/mlx5/mlx5_flow.h           |  14 ++
 drivers/net/mlx5/mlx5_flow_dv.c        | 382 +++++++++++++++++++++++++++++----
 drivers/net/mlx5/mlx5_flow_verbs.c     |   9 +-
 lib/librte_ethdev/rte_flow.c           |   1 +
 lib/librte_ethdev/rte_flow.h           |  45 +++-
 lib/librte_ip_frag/rte_ip_frag.h       |  26 +--
 lib/librte_net/rte_ip.h                |  26 ++-
 12 files changed, 579 insertions(+), 90 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
@ 2020-10-07 10:54       ` Dekel Peled
  2020-10-08  3:14         ` Ajit Khaparde
  2020-10-08 18:28         ` Ajit Khaparde
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
                         ` (11 subsequent siblings)
  12 siblings, 2 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:54 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Using the current implementation of DPDK, an application cannot match on
IPv6 packets, based on the existing extension headers, in a simple way.

Field 'Next Header' in IPv6 header indicates type of the first extension
header only. Following extension headers can't be identified by
inspecting the IPv6 header.
As a result, the existence or absence of specific extension headers
can't be used for packet matching.

For example, fragmented IPv6 packets contain a dedicated extension header
(which is implemented in a later patch of this series).
Non-fragmented packets don't contain the fragment extension header.
For an application to match on non-fragmented IPv6 packets, the current
implementation doesn't provide a suitable solution.
Matching on the Next Header field is not sufficient, since additional
extension headers might be present in the same packet.
To match on fragmented IPv6 packets, the same difficulty exists.

This patch implements the update as detailed in RFC [1].
A set of additional values will be added to IPv6 header struct.
These values will indicate the existence of every defined extension
header type, providing simple means for identification of existing
extensions in the packet header.
Continuing the above example, fragmented packets can be identified using
the specific value indicating existence of fragment extension header.
To match on non-fragmented IPv6 packets, need to use frag_ext_exist 0.
To match on fragmented IPv6 packets, need to use frag_ext_exist 1.
To match on any IPv6 packets, the frag_ext_exist field should
not be specified for match.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 22 +++++++++++++++++++---
 lib/librte_ethdev/rte_flow.h       | 25 +++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 119b128..ae090db 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -946,11 +946,27 @@ Item: ``IPV6``
 
 Matches an IPv6 header.
 
-Note: IPv6 options are handled by dedicated pattern items, see `Item:
-IPV6_EXT`_.
+Dedicated flags indicate existence of specific extension headers.
+Every type of extension header can use a dedicated pattern item, or
+the generic `Item: IPV6_EXT`_.
+To match on packets containing a specific extension header, an application
+should match on the dedicated flag set to 1.
+To match on packets not containing a specific extension header, an application
+should match on the dedicated flag clear to 0.
+In case application doesn't care about the existence of a specific extension
+header, it should not specify the dedicated flag for matching.
 
 - ``hdr``: IPv6 header definition (``rte_ip.h``).
-- Default ``mask`` matches source and destination addresses only.
+- ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
+- ``rout_ext_exist``: Routing extension header exists.
+- ``frag_ext_exist``: Fragment extension header exists.
+- ``auth_ext_exist``: Authentication extension header exists.
+- ``esp_ext_exist``: Encapsulation Security Payload extension header exists.
+- ``dest_ext_exist``: Destination Options extension header exists.
+- ``mobil_ext_exist``: Mobility extension header exists.
+- ``hip_ext_exist``: Host Identity Protocol extension header exists.
+- ``shim6_ext_exist``: Shim6 Protocol extension header exists.
+- Default ``mask`` matches ``hdr`` source and destination addresses only.
 
 Item: ``ICMP``
 ^^^^^^^^^^^^^^
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index da8bfa5..5b5bed2 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -792,11 +792,32 @@ struct rte_flow_item_ipv4 {
  *
  * Matches an IPv6 header.
  *
- * Note: IPv6 options are handled by dedicated pattern items, see
- * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
+ * Dedicated flags indicate existence of specific extension headers.
+ * Every type of extension header can use a dedicated pattern item, or
+ * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.
  */
 struct rte_flow_item_ipv6 {
 	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
+	uint32_t hop_ext_exist:1;
+	/**< Hop-by-Hop Options extension header exists. */
+	uint32_t rout_ext_exist:1;
+	/**< Routing extension header exists. */
+	uint32_t frag_ext_exist:1;
+	/**< Fragment extension header exists. */
+	uint32_t auth_ext_exist:1;
+	/**< Authentication extension header exists. */
+	uint32_t esp_ext_exist:1;
+	/**< Encapsulation Security Payload extension header exists. */
+	uint32_t dest_ext_exist:1;
+	/**< Destination Options extension header exists. */
+	uint32_t mobil_ext_exist:1;
+	/**< Mobility extension header exists. */
+	uint32_t hip_ext_exist:1;
+	/**< Host Identity Protocol extension header exists. */
+	uint32_t shim6_ext_exist:1;
+	/**< Shim6 Protocol extension header exists. */
+	uint32_t reserved:23;
+	/**< Reserved for future extension headers, must be zero. */
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 02/11] ethdev: add IPv6 fragment extension header item
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-10-07 10:54       ` Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 03/11] app/testpmd: support IPv4 fragments Dekel Peled
                         ` (10 subsequent siblings)
  12 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:54 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Applications handling fragmented IPv6 packets need to match on IPv6
fragment extension header, in order to identify the fragments order
and location in the packet.
This patch introduces the IPv6 fragment extension header item,
proposed in [1].

Relevant definitions are moved from lib/librte_ip_frag/rte_ip_frag.h
to lib/librte_net/rte_ip.h, as they are needed for IPv6 header handling.
struct ipv6_extension_fragment renamed to rte_ipv6_fragment_ext to
adapt it to the common naming convention.

Default mask is not defined, since all fields are optional.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 16 ++++++++++++++--
 lib/librte_ethdev/rte_flow.c       |  1 +
 lib/librte_ethdev/rte_flow.h       | 20 ++++++++++++++++++++
 lib/librte_ip_frag/rte_ip_frag.h   | 26 ++------------------------
 lib/librte_net/rte_ip.h            | 26 ++++++++++++++++++++++++--
 5 files changed, 61 insertions(+), 28 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index ae090db..02b1d58 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -947,8 +947,8 @@ Item: ``IPV6``
 Matches an IPv6 header.
 
 Dedicated flags indicate existence of specific extension headers.
-Every type of extension header can use a dedicated pattern item, or
-the generic `Item: IPV6_EXT`_.
+Every type of extension header can use a dedicated pattern item,
+for example `Item: IPV6_FRAG_EXT`_, or the generic `Item: IPV6_EXT`_.
 To match on packets containing a specific extension header, an application
 should match on the dedicated flag set to 1.
 To match on packets not containing a specific extension header, an application
@@ -1193,6 +1193,18 @@ Normally preceded by any of:
 - `Item: IPV6`_
 - `Item: IPV6_EXT`_
 
+Item: ``IPV6_FRAG_EXT``
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches the presence of IPv6 fragment extension header.
+
+- ``hdr``: IPv6 fragment extension header definition (``rte_ip.h``).
+
+Normally preceded by any of:
+
+- `Item: IPV6`_
+- `Item: IPV6_EXT`_
+
 Item: ``ICMP6``
 ^^^^^^^^^^^^^^^
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index f8fdd68..c1f3132 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -72,6 +72,7 @@ struct rte_flow_desc_data {
 	MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)),
 	MK_FLOW_ITEM(ARP_ETH_IPV4, sizeof(struct rte_flow_item_arp_eth_ipv4)),
 	MK_FLOW_ITEM(IPV6_EXT, sizeof(struct rte_flow_item_ipv6_ext)),
+	MK_FLOW_ITEM(IPV6_FRAG_EXT, sizeof(struct rte_flow_item_ipv6_frag_ext)),
 	MK_FLOW_ITEM(ICMP6, sizeof(struct rte_flow_item_icmp6)),
 	MK_FLOW_ITEM(ICMP6_ND_NS, sizeof(struct rte_flow_item_icmp6_nd_ns)),
 	MK_FLOW_ITEM(ICMP6_ND_NA, sizeof(struct rte_flow_item_icmp6_nd_na)),
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 5b5bed2..85376a3 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -537,6 +537,12 @@ enum rte_flow_item_type {
 	 */
 	RTE_FLOW_ITEM_TYPE_ECPRI,
 
+	/**
+	 * Matches the presence of IPv6 fragment extension header.
+	 *
+	 * See struct rte_flow_item_ipv6_frag_ext.
+	 */
+	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
 };
 
 /**
@@ -1188,6 +1194,20 @@ struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
 #endif
 
 /**
+ * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
+ *
+ * Matches the presence of IPv6 fragment extension header.
+ *
+ * Preceded by any of:
+ *
+ * - RTE_FLOW_ITEM_TYPE_IPV6
+ * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
+ */
+struct rte_flow_item_ipv6_frag_ext {
+	struct rte_ipv6_fragment_ext hdr;
+};
+
+/**
  * RTE_FLOW_ITEM_TYPE_ICMP6
  *
  * Matches any ICMPv6 header.
diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h
index 66edd7e..0bfe64b 100644
--- a/lib/librte_ip_frag/rte_ip_frag.h
+++ b/lib/librte_ip_frag/rte_ip_frag.h
@@ -110,30 +110,8 @@ struct rte_ip_frag_tbl {
 	__extension__ struct ip_frag_pkt pkt[0]; /**< hash table. */
 };
 
-/** IPv6 fragment extension header */
-#define	RTE_IPV6_EHDR_MF_SHIFT			0
-#define	RTE_IPV6_EHDR_MF_MASK			1
-#define	RTE_IPV6_EHDR_FO_SHIFT			3
-#define	RTE_IPV6_EHDR_FO_MASK			(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
-#define	RTE_IPV6_EHDR_FO_ALIGN			(1 << RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_FRAG_USED_MASK			\
-	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
-
-#define RTE_IPV6_GET_MF(x)				((x) & RTE_IPV6_EHDR_MF_MASK)
-#define RTE_IPV6_GET_FO(x)				((x) >> RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
-	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
-
-struct ipv6_extension_fragment {
-	uint8_t next_header;            /**< Next header type */
-	uint8_t reserved;               /**< Reserved */
-	uint16_t frag_data;             /**< All fragmentation data */
-	uint32_t id;                    /**< Packet ID */
-} __rte_packed;
-
-
+/* struct ipv6_extension_fragment moved to librte_net/rte_ip.h and renamed. */
+#define ipv6_extension_fragment	rte_ipv6_fragment_ext
 
 /**
  * Create a new IP fragmentation table.
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index fcd1eb3..3081c46 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -456,8 +456,30 @@ struct rte_ipv6_hdr {
 	return (uint16_t)cksum;
 }
 
-/* IPv6 fragmentation header size */
-#define RTE_IPV6_FRAG_HDR_SIZE 8
+/** IPv6 fragment extension header. */
+#define	RTE_IPV6_EHDR_MF_SHIFT	0
+#define	RTE_IPV6_EHDR_MF_MASK	1
+#define	RTE_IPV6_EHDR_FO_SHIFT	3
+#define	RTE_IPV6_EHDR_FO_MASK	(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
+#define	RTE_IPV6_EHDR_FO_ALIGN	(1 << RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_FRAG_USED_MASK	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
+
+#define RTE_IPV6_GET_MF(x)	((x) & RTE_IPV6_EHDR_MF_MASK)
+#define RTE_IPV6_GET_FO(x)	((x) >> RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
+	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
+
+struct rte_ipv6_fragment_ext {
+	uint8_t next_header;	/**< Next header type */
+	uint8_t reserved;	/**< Reserved */
+	rte_be16_t frag_data;	/**< All fragmentation data */
+	rte_be32_t id;		/**< Packet ID */
+} __rte_packed;
+
+/* IPv6 fragment extension header size */
+#define RTE_IPV6_FRAG_HDR_SIZE	sizeof(struct rte_ipv6_fragment_ext)
 
 /**
  * Parse next IPv6 header extension
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 03/11] app/testpmd: support IPv4 fragments
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-10-07 10:54       ` Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 04/11] app/testpmd: support IPv6 fragments Dekel Peled
                         ` (9 subsequent siblings)
  12 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:54 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates testpmd CLI to support fragment_offset field of
IPv4 header item.

To match on non-fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 0 fragment_offset mask 0x3fff ...
To match on fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 1 fragment_offset last 0x3fff
fragment_offset mask 0x3fff ...
(Use the full available range 1 to 0x3fff to include all possible
values.)
To match on any IPv4 packets, fragmented and non-fragmented,
the fragment_offset field should not be specified for match.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 6e04d53..a9bf29f 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -129,6 +129,7 @@ enum index {
 	ITEM_VLAN_INNER_TYPE,
 	ITEM_IPV4,
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -873,6 +874,7 @@ struct parse_action_priv {
 
 static const enum index item_ipv4[] = {
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -2097,6 +2099,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
 					     hdr.type_of_service)),
 	},
+	[ITEM_IPV4_FRAGMENT_OFFSET] = {
+		.name = "fragment_offset",
+		.help = "fragmentation flags and fragment offset",
+		.next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
+					     hdr.fragment_offset)),
+	},
 	[ITEM_IPV4_TTL] = {
 		.name = "ttl",
 		.help = "time to live",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 04/11] app/testpmd: support IPv6 fragments
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
                         ` (2 preceding siblings ...)
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 03/11] app/testpmd: support IPv4 fragments Dekel Peled
@ 2020-10-07 10:54       ` Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
                         ` (8 subsequent siblings)
  12 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:54 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], introduced frag_ext_exist field for
IPv6 header item, used to indicate match on fragmented/non-fragmented
packets.
This patch updates testpmd CLI to support the new field.

To match on non-fragmented IPv6 packets, need to use pattern:
... ipv6 frag_ext_exist spec 0 frag_ext_exist mask 1 ...
To match on fragmented IPv6 packets, need to use pattern:
... ipv6 frag_ext_exist spec 1 frag_ext_exist mask 1 ...
To match on any IPv6 packets, the frag_ext_exist field should
not be specified for match.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index a9bf29f..b078095 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -141,6 +141,7 @@ enum index {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_FRAG_EXT_EXIST,
 	ITEM_ICMP,
 	ITEM_ICMP_TYPE,
 	ITEM_ICMP_CODE,
@@ -890,6 +891,7 @@ struct parse_action_priv {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_FRAG_EXT_EXIST,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2185,6 +2187,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6,
 					     hdr.dst_addr)),
 	},
+	[ITEM_IPV6_FRAG_EXT_EXIST] = {
+		.name = "frag_ext_exist",
+		.help = "fragment packet attribute",
+		.next = NEXT(item_ipv6, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_ipv6,
+					   frag_ext_exist, 1)),
+	},
 	[ITEM_ICMP] = {
 		.name = "icmp",
 		.help = "match ICMP header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 05/11] app/testpmd: support IPv6 fragment extension item
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
                         ` (3 preceding siblings ...)
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 04/11] app/testpmd: support IPv6 fragments Dekel Peled
@ 2020-10-07 10:54       ` Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
                         ` (7 subsequent siblings)
  12 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:54 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch updates testpmd CLI to support the new item and its fields.

To match on fragmented IPv6 packets, this item is added to pattern:
... ipv6 / ipv6_frag_ext ...

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b078095..1f800eb 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -195,6 +195,9 @@ enum index {
 	ITEM_ARP_ETH_IPV4_TPA,
 	ITEM_IPV6_EXT,
 	ITEM_IPV6_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT,
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
 	ITEM_ICMP6,
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -786,6 +789,7 @@ struct parse_action_priv {
 	ITEM_VXLAN_GPE,
 	ITEM_ARP_ETH_IPV4,
 	ITEM_IPV6_EXT,
+	ITEM_IPV6_FRAG_EXT,
 	ITEM_ICMP6,
 	ITEM_ICMP6_ND_NS,
 	ITEM_ICMP6_ND_NA,
@@ -1007,6 +1011,13 @@ struct parse_action_priv {
 	ZERO,
 };
 
+static const enum index item_ipv6_frag_ext[] = {
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_icmp6[] = {
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -2578,6 +2589,30 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_ext,
 					     next_hdr)),
 	},
+	[ITEM_IPV6_FRAG_EXT] = {
+		.name = "ipv6_frag_ext",
+		.help = "match presence of IPv6 fragment extension header",
+		.priv = PRIV_ITEM(IPV6_FRAG_EXT,
+				sizeof(struct rte_flow_item_ipv6_frag_ext)),
+		.next = NEXT(item_ipv6_frag_ext),
+		.call = parse_vc,
+	},
+	[ITEM_IPV6_FRAG_EXT_NEXT_HDR] = {
+		.name = "next_hdr",
+		.help = "next header",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_ipv6_frag_ext,
+					hdr.next_header)),
+	},
+	[ITEM_IPV6_FRAG_EXT_FRAG_DATA] = {
+		.name = "frag_data",
+		.help = "Fragment flags and offset",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_frag_ext,
+					     hdr.frag_data)),
+	},
 	[ITEM_ICMP6] = {
 		.name = "icmp6",
 		.help = "match any ICMPv6 header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 06/11] net/mlx5: remove handling of ICMP fragmented packets
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
                         ` (4 preceding siblings ...)
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
@ 2020-10-07 10:54       ` Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
                         ` (6 subsequent siblings)
  12 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:54 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Commit [1] forced setting of match on 'frag' bit mask 1 and value 0.
Previous patch in this series added support of match on fragmented and
non-fragmented packets on L3 items, so this setting is now redundant.

This patch removes the changes done in [1].

[1] commit 85407db9f60d ("net/mlx5: fix matching for ICMP fragments")

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 79fdf34..0a0a5a4 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7345,12 +7345,6 @@ struct field_modify_info modify_tcp[] = {
 		return;
 	if (!icmp6_m)
 		icmp6_m = &rte_flow_item_icmp6_mask;
-	/*
-	 * Force flow only to match the non-fragmented IPv6 ICMPv6 packets.
-	 * If only the protocol is specified, no need to match the frag.
-	 */
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmpv6_type, icmp6_m->type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type,
 		 icmp6_v->type & icmp6_m->type);
@@ -7398,12 +7392,6 @@ struct field_modify_info modify_tcp[] = {
 		return;
 	if (!icmp_m)
 		icmp_m = &rte_flow_item_icmp_mask;
-	/*
-	 * Force flow only to match the non-fragmented IPv4 ICMP packets.
-	 * If only the protocol is specified, no need to match the frag.
-	 */
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmp_type,
 		 icmp_m->hdr.icmp_type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmp_type,
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 07/11] net/mlx5: support match on IPv4 fragment packets
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
                         ` (5 preceding siblings ...)
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
@ 2020-10-07 10:54       ` Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 08/11] net/mlx5: support match on IPv6 " Dekel Peled
                         ` (5 subsequent siblings)
  12 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:54 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch adds to MLX5 PMD the support of matching on IPv4
fragmented and non-fragmented packets, using the IPv4 header
fragment_offset field.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c       |  48 ++++++++----
 drivers/net/mlx5/mlx5_flow.h       |  10 +++
 drivers/net/mlx5/mlx5_flow_dv.c    | 156 +++++++++++++++++++++++++++++++------
 drivers/net/mlx5/mlx5_flow_verbs.c |   9 ++-
 4 files changed, 178 insertions(+), 45 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index a94f630..bce7c18 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -474,6 +474,8 @@ struct mlx5_flow_tunnel_info {
  *   Bit-masks covering supported fields by the NIC to compare with user mask.
  * @param[in] size
  *   Bit-masks size in bytes.
+ * @param[in] range_accepted
+ *   True if range of values is accepted for specific fields, false otherwise.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -485,6 +487,7 @@ struct mlx5_flow_tunnel_info {
 			  const uint8_t *mask,
 			  const uint8_t *nic_mask,
 			  unsigned int size,
+			  bool range_accepted,
 			  struct rte_flow_error *error)
 {
 	unsigned int i;
@@ -502,7 +505,7 @@ struct mlx5_flow_tunnel_info {
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "mask/last without a spec is not"
 					  " supported");
-	if (item->spec && item->last) {
+	if (item->spec && item->last && !range_accepted) {
 		uint8_t spec[size];
 		uint8_t last[size];
 		unsigned int i;
@@ -1277,7 +1280,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_icmp6_mask,
-		 sizeof(struct rte_flow_item_icmp6), error);
+		 sizeof(struct rte_flow_item_icmp6),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1329,7 +1333,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_icmp_mask,
-		 sizeof(struct rte_flow_item_icmp), error);
+		 sizeof(struct rte_flow_item_icmp),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1384,7 +1389,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_eth),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -1438,7 +1443,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_vlan),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!tunnel && mask->tci != RTE_BE16(0x0fff)) {
@@ -1502,6 +1507,7 @@ struct mlx5_flow_tunnel_info {
 			     uint64_t last_item,
 			     uint16_t ether_type,
 			     const struct rte_flow_item_ipv4 *acc_mask,
+			     bool range_accepted,
 			     struct rte_flow_error *error)
 {
 	const struct rte_flow_item_ipv4 *mask = item->mask;
@@ -1572,7 +1578,7 @@ struct mlx5_flow_tunnel_info {
 					acc_mask ? (const uint8_t *)acc_mask
 						 : (const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_ipv4),
-					error);
+					range_accepted, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1592,6 +1598,8 @@ struct mlx5_flow_tunnel_info {
  * @param[in] acc_mask
  *   Acceptable mask, if NULL default internal default mask
  *   will be used to check whether item fields are supported.
+ * @param[in] range_accepted
+ *   True if range of values is accepted for specific fields, false otherwise.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -1671,7 +1679,7 @@ struct mlx5_flow_tunnel_info {
 					acc_mask ? (const uint8_t *)acc_mask
 						 : (const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_ipv6),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1726,7 +1734,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_udp_mask,
-		 sizeof(struct rte_flow_item_udp), error);
+		 sizeof(struct rte_flow_item_udp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1781,7 +1790,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)flow_mask,
-		 sizeof(struct rte_flow_item_tcp), error);
+		 sizeof(struct rte_flow_item_tcp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1835,7 +1845,7 @@ struct mlx5_flow_tunnel_info {
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_vxlan_mask,
 		 sizeof(struct rte_flow_item_vxlan),
-		 error);
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (spec) {
@@ -1906,7 +1916,7 @@ struct mlx5_flow_tunnel_info {
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_vxlan_gpe_mask,
 		 sizeof(struct rte_flow_item_vxlan_gpe),
-		 error);
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (spec) {
@@ -1980,7 +1990,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&gre_key_default_mask,
-		 sizeof(rte_be32_t), error);
+		 sizeof(rte_be32_t), MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -2032,7 +2042,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&nic_mask,
-		 sizeof(struct rte_flow_item_gre), error);
+		 sizeof(struct rte_flow_item_gre), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 #ifndef HAVE_MLX5DV_DR
@@ -2107,7 +2118,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 				  (item, (const uint8_t *)mask,
 				   (const uint8_t *)&nic_mask,
-				   sizeof(struct rte_flow_item_geneve), error);
+				   sizeof(struct rte_flow_item_geneve),
+				   MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (spec) {
@@ -2190,7 +2202,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_mpls_mask,
-		 sizeof(struct rte_flow_item_mpls), error);
+		 sizeof(struct rte_flow_item_mpls),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2245,7 +2258,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_nvgre_mask,
-		 sizeof(struct rte_flow_item_nvgre), error);
+		 sizeof(struct rte_flow_item_nvgre),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2339,7 +2353,7 @@ struct mlx5_flow_tunnel_info {
 					 acc_mask ? (const uint8_t *)acc_mask
 						  : (const uint8_t *)&nic_mask,
 					 sizeof(struct rte_flow_item_ecpri),
-					 error);
+					 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 }
 
 /* Allocate unique ID for the split Q/RSS subflows. */
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 279daf2..1e30c93 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -330,6 +330,14 @@ enum mlx5_feature_name {
 #define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \
 					  sizeof(struct rte_flow_item_ipv4))
 
+/* IPv4 fragment_offset field contains relevant data in bits 2 to 15. */
+#define MLX5_IPV4_FRAG_OFFSET_MASK \
+		(RTE_IPV4_HDR_OFFSET_MASK | RTE_IPV4_HDR_MF_FLAG)
+
+/* Specific item's fields can accept a range of values (using spec and last). */
+#define MLX5_ITEM_RANGE_NOT_ACCEPTED	false
+#define MLX5_ITEM_RANGE_ACCEPTED	true
+
 /* Software header modify action numbers of a flow. */
 #define MLX5_ACT_NUM_MDF_IPV4		1
 #define MLX5_ACT_NUM_MDF_IPV6		4
@@ -985,6 +993,7 @@ int mlx5_flow_item_acceptable(const struct rte_flow_item *item,
 			      const uint8_t *mask,
 			      const uint8_t *nic_mask,
 			      unsigned int size,
+			      bool range_accepted,
 			      struct rte_flow_error *error);
 int mlx5_flow_validate_item_eth(const struct rte_flow_item *item,
 				uint64_t item_flags,
@@ -1002,6 +1011,7 @@ int mlx5_flow_validate_item_ipv4(const struct rte_flow_item *item,
 				 uint64_t last_item,
 				 uint16_t ether_type,
 				 const struct rte_flow_item_ipv4 *acc_mask,
+				 bool range_accepted,
 				 struct rte_flow_error *error);
 int mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
 				 uint64_t item_flags,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 0a0a5a4..3379caf 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1418,7 +1418,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_mark),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1494,7 +1494,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_meta),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -1547,7 +1547,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_tag),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (mask->index != 0xff)
@@ -1618,7 +1618,7 @@ struct field_modify_info modify_tcp[] = {
 				(item, (const uint8_t *)mask,
 				 (const uint8_t *)&rte_flow_item_port_id_mask,
 				 sizeof(struct rte_flow_item_port_id),
-				 error);
+				 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!spec)
@@ -1691,7 +1691,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_vlan),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!tunnel && mask->tci != RTE_BE16(0x0fff)) {
@@ -1778,11 +1778,126 @@ struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "Match is supported for GTP"
 					  " flags only");
-	return mlx5_flow_item_acceptable
-		(item, (const uint8_t *)mask,
-		 (const uint8_t *)&nic_mask,
-		 sizeof(struct rte_flow_item_gtp),
-		 error);
+	return mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
+					 (const uint8_t *)&nic_mask,
+					 sizeof(struct rte_flow_item_gtp),
+					 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
+}
+
+/**
+ * Validate IPV4 item.
+ * Use existing validation function mlx5_flow_validate_item_ipv4(), and
+ * add specific validation of fragment_offset field,
+ *
+ * @param[in] item
+ *   Item specification.
+ * @param[in] item_flags
+ *   Bit-fields that holds the items detected until now.
+ * @param[out] error
+ *   Pointer to error structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+flow_dv_validate_item_ipv4(const struct rte_flow_item *item,
+			   uint64_t item_flags,
+			   uint64_t last_item,
+			   uint16_t ether_type,
+			   struct rte_flow_error *error)
+{
+	int ret;
+	const struct rte_flow_item_ipv4 *spec = item->spec;
+	const struct rte_flow_item_ipv4 *last = item->last;
+	const struct rte_flow_item_ipv4 *mask = item->mask;
+	rte_be16_t fragment_offset_spec = 0;
+	rte_be16_t fragment_offset_last = 0;
+	const struct rte_flow_item_ipv4 nic_ipv4_mask = {
+		.hdr = {
+			.src_addr = RTE_BE32(0xffffffff),
+			.dst_addr = RTE_BE32(0xffffffff),
+			.type_of_service = 0xff,
+			.fragment_offset = RTE_BE16(0xffff),
+			.next_proto_id = 0xff,
+			.time_to_live = 0xff,
+		},
+	};
+
+	ret = mlx5_flow_validate_item_ipv4(item, item_flags, last_item,
+					   ether_type, &nic_ipv4_mask,
+					   MLX5_ITEM_RANGE_ACCEPTED, error);
+	if (ret < 0)
+		return ret;
+	if (spec && mask)
+		fragment_offset_spec = spec->hdr.fragment_offset &
+				       mask->hdr.fragment_offset;
+	if (!fragment_offset_spec)
+		return 0;
+	/*
+	 * spec and mask are valid, enforce using full mask to make sure the
+	 * complete value is used correctly.
+	 */
+	if ((mask->hdr.fragment_offset & RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+			!= RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM_MASK,
+					  item, "must use full mask for"
+					  " fragment_offset");
+	/*
+	 * Match on fragment_offset 0x2000 means MF is 1 and frag-offset is 0,
+	 * indicating this is 1st fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(RTE_IPV4_HDR_MF_FLAG))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "match on first fragment not "
+					  "supported");
+	if (fragment_offset_spec && !last)
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "specified value not supported");
+	/* spec and last are valid, validate the specified range. */
+	fragment_offset_last = last->hdr.fragment_offset &
+			       mask->hdr.fragment_offset;
+	/*
+	 * Match on fragment_offset spec 0x2001 and last 0x3fff
+	 * means MF is 1 and frag-offset is > 0.
+	 * This packet is fragment 2nd and onward, excluding last.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(RTE_IPV4_HDR_MF_FLAG + 1) &&
+	    fragment_offset_last == RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on following "
+					  "fragments not supported");
+	/*
+	 * Match on fragment_offset spec 0x0001 and last 0x1fff
+	 * means MF is 0 and frag-offset is > 0.
+	 * This packet is last fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(1) &&
+	    fragment_offset_last == RTE_BE16(RTE_IPV4_HDR_OFFSET_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on last "
+					  "fragment not supported");
+	/*
+	 * Match on fragment_offset spec 0x0001 and last 0x3fff
+	 * means MF and/or frag-offset is not 0.
+	 * This is a fragmented packet.
+	 * Other range values are invalid and rejected.
+	 */
+	if (!(fragment_offset_spec == RTE_BE16(1) &&
+	      fragment_offset_last == RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK)))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST, last,
+					  "specified range not supported");
+	return 0;
 }
 
 /**
@@ -5084,15 +5199,6 @@ struct field_modify_info modify_tcp[] = {
 			.dst_port = RTE_BE16(UINT16_MAX),
 		}
 	};
-	const struct rte_flow_item_ipv4 nic_ipv4_mask = {
-		.hdr = {
-			.src_addr = RTE_BE32(0xffffffff),
-			.dst_addr = RTE_BE32(0xffffffff),
-			.type_of_service = 0xff,
-			.next_proto_id = 0xff,
-			.time_to_live = 0xff,
-		},
-	};
 	const struct rte_flow_item_ipv6 nic_ipv6_mask = {
 		.hdr = {
 			.src_addr =
@@ -5192,11 +5298,9 @@ struct field_modify_info modify_tcp[] = {
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			mlx5_flow_tunnel_ip_check(items, next_protocol,
 						  &item_flags, &tunnel);
-			ret = mlx5_flow_validate_item_ipv4(items, item_flags,
-							   last_item,
-							   ether_type,
-							   &nic_ipv4_mask,
-							   error);
+			ret = flow_dv_validate_item_ipv4(items, item_flags,
+							 last_item, ether_type,
+							 error);
 			if (ret < 0)
 				return ret;
 			last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :
@@ -6296,6 +6400,10 @@ struct field_modify_info modify_tcp[] = {
 		 ipv4_m->hdr.time_to_live);
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ttl_hoplimit,
 		 ipv4_v->hdr.time_to_live & ipv4_m->hdr.time_to_live);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag,
+		 !!(ipv4_m->hdr.fragment_offset));
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
+		 !!(ipv4_v->hdr.fragment_offset & ipv4_m->hdr.fragment_offset));
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 62c18b8..276bcb5 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1312,10 +1312,11 @@
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
-			ret = mlx5_flow_validate_item_ipv4(items, item_flags,
-							   last_item,
-							   ether_type, NULL,
-							   error);
+			ret = mlx5_flow_validate_item_ipv4
+						(items, item_flags,
+						 last_item, ether_type, NULL,
+						 MLX5_ITEM_RANGE_NOT_ACCEPTED,
+						 error);
 			if (ret < 0)
 				return ret;
 			last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 08/11] net/mlx5: support match on IPv6 fragment packets
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
                         ` (6 preceding siblings ...)
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
@ 2020-10-07 10:54       ` Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
                         ` (4 subsequent siblings)
  12 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:54 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch adds to MLX5 PMD the support of matching on IPv6
fragmented and non-fragmented packets, using the new field
frag_ext_exist, added to rte_flow following RFC [1].

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 3379caf..4403abc 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5211,6 +5211,7 @@ struct field_modify_info modify_tcp[] = {
 			.proto = 0xff,
 			.hop_limits = 0xff,
 		},
+		.frag_ext_exist = 1,
 	};
 	const struct rte_flow_item_ecpri nic_ecpri_mask = {
 		.hdr = {
@@ -6519,6 +6520,10 @@ struct field_modify_info modify_tcp[] = {
 		 ipv6_m->hdr.hop_limits);
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ttl_hoplimit,
 		 ipv6_v->hdr.hop_limits & ipv6_m->hdr.hop_limits);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag,
+		 !!(ipv6_m->frag_ext_exist));
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
+		 !!(ipv6_v->frag_ext_exist & ipv6_m->frag_ext_exist));
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 09/11] net/mlx5: support match on IPv6 fragment ext. item
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
                         ` (7 preceding siblings ...)
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 08/11] net/mlx5: support match on IPv6 " Dekel Peled
@ 2020-10-07 10:54       ` Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
                         ` (3 subsequent siblings)
  12 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:54 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch adds to MLX5 PMD the option to match on this item type.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.h    |   4 +
 drivers/net/mlx5/mlx5_flow_dv.c | 209 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 213 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 1e30c93..376519f 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -122,6 +122,10 @@ enum mlx5_feature_name {
 /* Pattern eCPRI Layer bit. */
 #define MLX5_FLOW_LAYER_ECPRI (UINT64_C(1) << 29)
 
+/* IPv6 Fragment Extension Header bit. */
+#define MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT (1u << 30)
+#define MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT (1u << 31)
+
 /* Outer Masks. */
 #define MLX5_FLOW_LAYER_OUTER_L3 \
 	(MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 4403abc..eb1db12 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1901,6 +1901,120 @@ struct field_modify_info modify_tcp[] = {
 }
 
 /**
+ * Validate IPV6 fragment extension item.
+ *
+ * @param[in] item
+ *   Item specification.
+ * @param[in] item_flags
+ *   Bit-fields that holds the items detected until now.
+ * @param[out] error
+ *   Pointer to error structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+flow_dv_validate_item_ipv6_frag_ext(const struct rte_flow_item *item,
+				    uint64_t item_flags,
+				    struct rte_flow_error *error)
+{
+	const struct rte_flow_item_ipv6_frag_ext *spec = item->spec;
+	const struct rte_flow_item_ipv6_frag_ext *last = item->last;
+	const struct rte_flow_item_ipv6_frag_ext *mask = item->mask;
+	rte_be16_t frag_data_spec = 0;
+	rte_be16_t frag_data_last = 0;
+	const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
+	const uint64_t l4m = tunnel ? MLX5_FLOW_LAYER_INNER_L4 :
+				      MLX5_FLOW_LAYER_OUTER_L4;
+	int ret = 0;
+	struct rte_flow_item_ipv6_frag_ext nic_mask = {
+		.hdr = {
+			.next_header = 0xff,
+			.frag_data = RTE_BE16(0xffff),
+		},
+	};
+
+	if (item_flags & l4m)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "ipv6 fragment extension item cannot "
+					  "follow L4 item.");
+	if ((tunnel && !(item_flags & MLX5_FLOW_LAYER_INNER_L3_IPV6)) ||
+	    (!tunnel && !(item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV6)))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "ipv6 fragment extension item must "
+					  "follow ipv6 item");
+	if (spec && mask)
+		frag_data_spec = spec->hdr.frag_data & mask->hdr.frag_data;
+	if (!frag_data_spec)
+		return 0;
+	/*
+	 * spec and mask are valid, enforce using full mask to make sure the
+	 * complete value is used correctly.
+	 */
+	if ((mask->hdr.frag_data & RTE_BE16(RTE_IPV6_FRAG_USED_MASK)) !=
+				RTE_BE16(RTE_IPV6_FRAG_USED_MASK))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM_MASK,
+					  item, "must use full mask for"
+					  " frag_data");
+	/*
+	 * Match on frag_data 0x00001 means M is 1 and frag-offset is 0.
+	 * This is 1st fragment of fragmented packet.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_MF_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "match on first fragment not "
+					  "supported");
+	if (frag_data_spec && !last)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "specified value not supported");
+	ret = mlx5_flow_item_acceptable
+				(item, (const uint8_t *)mask,
+				 (const uint8_t *)&nic_mask,
+				 sizeof(struct rte_flow_item_ipv6_frag_ext),
+				 MLX5_ITEM_RANGE_ACCEPTED, error);
+	if (ret)
+		return ret;
+	/* spec and last are valid, validate the specified range. */
+	frag_data_last = last->hdr.frag_data & mask->hdr.frag_data;
+	/*
+	 * Match on frag_data spec 0x0009 and last 0xfff9
+	 * means M is 1 and frag-offset is > 0.
+	 * This packet is fragment 2nd and onward, excluding last.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_FO_ALIGN |
+				       RTE_IPV6_EHDR_MF_MASK) &&
+	    frag_data_last == RTE_BE16(RTE_IPV6_FRAG_USED_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on following "
+					  "fragments not supported");
+	/*
+	 * Match on frag_data spec 0x0008 and last 0xfff8
+	 * means M is 0 and frag-offset is > 0.
+	 * This packet is last fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_FO_ALIGN) &&
+	    frag_data_last == RTE_BE16(RTE_IPV6_EHDR_FO_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on last "
+					  "fragment not supported");
+	/* Other range values are invalid and rejected. */
+	return rte_flow_error_set(error, EINVAL,
+				  RTE_FLOW_ERROR_TYPE_ITEM_LAST, last,
+				  "specified range not supported");
+}
+
+/**
  * Validate the pop VLAN action.
  *
  * @param[in] dev
@@ -5349,6 +5463,29 @@ struct field_modify_info modify_tcp[] = {
 				next_protocol = 0xff;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT:
+			ret = flow_dv_validate_item_ipv6_frag_ext(items,
+								  item_flags,
+								  error);
+			if (ret < 0)
+				return ret;
+			last_item = tunnel ?
+					MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT :
+					MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT;
+			if (items->mask != NULL &&
+			    ((const struct rte_flow_item_ipv6_frag_ext *)
+			     items->mask)->hdr.next_header) {
+				next_protocol =
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->spec)->hdr.next_header;
+				next_protocol &=
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->mask)->hdr.next_header;
+			} else {
+				/* Reset for inner layer. */
+				next_protocol = 0xff;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			ret = mlx5_flow_validate_item_tcp
 						(items, item_flags,
@@ -6527,6 +6664,57 @@ struct field_modify_info modify_tcp[] = {
 }
 
 /**
+ * Add IPV6 fragment extension item to matcher and to the value.
+ *
+ * @param[in, out] matcher
+ *   Flow matcher.
+ * @param[in, out] key
+ *   Flow matcher value.
+ * @param[in] item
+ *   Flow pattern to translate.
+ * @param[in] inner
+ *   Item is inner pattern.
+ */
+static void
+flow_dv_translate_item_ipv6_frag_ext(void *matcher, void *key,
+				     const struct rte_flow_item *item,
+				     int inner)
+{
+	const struct rte_flow_item_ipv6_frag_ext *ipv6_frag_ext_m = item->mask;
+	const struct rte_flow_item_ipv6_frag_ext *ipv6_frag_ext_v = item->spec;
+	const struct rte_flow_item_ipv6_frag_ext nic_mask = {
+		.hdr = {
+			.next_header = 0xff,
+			.frag_data = RTE_BE16(0xffff),
+		},
+	};
+	void *headers_m;
+	void *headers_v;
+
+	if (inner) {
+		headers_m = MLX5_ADDR_OF(fte_match_param, matcher,
+					 inner_headers);
+		headers_v = MLX5_ADDR_OF(fte_match_param, key, inner_headers);
+	} else {
+		headers_m = MLX5_ADDR_OF(fte_match_param, matcher,
+					 outer_headers);
+		headers_v = MLX5_ADDR_OF(fte_match_param, key, outer_headers);
+	}
+	/* IPv6 fragment extension item exists, so packet is IP fragment. */
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 1);
+	if (!ipv6_frag_ext_v)
+		return;
+	if (!ipv6_frag_ext_m)
+		ipv6_frag_ext_m = &nic_mask;
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol,
+		 ipv6_frag_ext_m->hdr.next_header);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
+		 ipv6_frag_ext_v->hdr.next_header &
+		 ipv6_frag_ext_m->hdr.next_header);
+}
+
+/**
  * Add TCP item to matcher and to the value.
  *
  * @param[in, out] matcher
@@ -8868,6 +9056,27 @@ struct field_modify_info modify_tcp[] = {
 				next_protocol = 0xff;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT:
+			flow_dv_translate_item_ipv6_frag_ext(match_mask,
+							     match_value,
+							     items, tunnel);
+			last_item = tunnel ?
+					MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT :
+					MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT;
+			if (items->mask != NULL &&
+			    ((const struct rte_flow_item_ipv6_frag_ext *)
+			     items->mask)->hdr.next_header) {
+				next_protocol =
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->spec)->hdr.next_header;
+				next_protocol &=
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->mask)->hdr.next_header;
+			} else {
+				/* Reset for inner layer. */
+				next_protocol = 0xff;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			flow_dv_translate_item_tcp(match_mask, match_value,
 						   items, tunnel);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 10/11] doc: update release notes for MLX5 L3 frag support
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
                         ` (8 preceding siblings ...)
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
@ 2020-10-07 10:54       ` Dekel Peled
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
                         ` (2 subsequent siblings)
  12 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:54 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates 20.11 release notes with the changes included in
patches of this series:
1) MLX5 support of matching on IPv4/IPv6 fragmented/non-fragmented
   packets.
2) ABI change in ethdev struct rte_flow_item_ipv6.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 doc/guides/rel_notes/release_20_11.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 0b2a370..f39f13b 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -109,6 +109,11 @@ New Features
   * Extern objects and functions can be plugged into the pipeline.
   * Transaction-oriented table updates.
 
+* **Updated Mellanox mlx5 driver.**
+
+  Updated Mellanox mlx5 driver with new features and improvements, including:
+
+  * Added support for matching on fragmented/non-fragmented IPv4/IPv6 packets.
 
 Removed Items
 -------------
@@ -240,6 +245,11 @@ ABI Changes
 
   * ``ethdev`` internal functions are marked with ``__rte_internal`` tag.
 
+  * Added extensions' attributes to struct ``rte_flow_item_ipv6``.
+    A set of additional values added to struct, indicating the existence of
+    every defined extension header type.
+    Applications should use the new values for identification of existing
+    extensions in the packet header.
 
 Known Issues
 ------------
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v4 11/11] net/mlx5: enforce limitation on IPv6 next proto
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
                         ` (9 preceding siblings ...)
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
@ 2020-10-07 10:54       ` Dekel Peled
  2020-10-07 11:15       ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Ori Kam
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
  12 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-07 10:54 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

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 b0614ae..3c7b998 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -311,6 +311,13 @@ Limitations
     for some NICs (such as ConnectX-6 Dx and BlueField 2).
     The capability bit ``scatter_fcs_w_decap_disable`` shows NIC support.
 
+- 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 bce7c18..e411e42 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1645,9 +1645,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,
@@ -1655,6 +1655,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


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
                         ` (10 preceding siblings ...)
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
@ 2020-10-07 11:15       ` Ori Kam
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
  12 siblings, 0 replies; 101+ messages in thread
From: Ori Kam @ 2020-10-07 11:15 UTC (permalink / raw)
  To: Dekel Peled, NBU-Contact-Thomas Monjalon, ferruh.yigit,
	arybchenko, konstantin.ananyev, olivier.matz, wenzhuo.lu,
	beilei.xing, bernard.iremonger, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko
  Cc: dev

Hi Dekel,

> -----Original Message-----
> From: Dekel Peled <dekelp@nvidia.com>
> Sent: Wednesday, October 7, 2020 1:54 PM
> Subject: [PATCH v4 00/11] support match on L3 fragmented packets
> 
> This series implements support of matching on packets based on the
> fragmentation attribute of the packet, i.e. if packet is a fragment
> of a larger packet, or the opposite - packet is not a fragment.
> 
> In ethdev, add API to support IPv6 extension headers, and specifically
> the IPv6 fragment extension header item.
> In MLX5 PMD, support match on IPv4 fragmented packets, IPv6 fragmented
> packets, and IPv6 fragment extension header item.
> Testpmd CLI is updated accordingly.
> Documentation is updated accordingly.
> 
> ---
> v2: add patch 'net/mlx5: enforce limitation on IPv6 next proto'
> v3: update patch 'ethdev: add IPv6 fragment extension header item' to avoid
> ABI breakage.
> v4: update rte_flow documentation to clarify use of IPv6 extension header
> flags.
> ---
> 
> Dekel Peled (11):
>   ethdev: add extensions attributes to IPv6 item
>   ethdev: add IPv6 fragment extension header item
>   app/testpmd: support IPv4 fragments
>   app/testpmd: support IPv6 fragments
>   app/testpmd: support IPv6 fragment extension item
>   net/mlx5: remove handling of ICMP fragmented packets
>   net/mlx5: support match on IPv4 fragment packets
>   net/mlx5: support match on IPv6 fragment packets
>   net/mlx5: support match on IPv6 fragment ext. item
>   doc: update release notes for MLX5 L3 frag support
>   net/mlx5: enforce limitation on IPv6 next proto
> 
>  app/test-pmd/cmdline_flow.c            |  53 +++++
>  doc/guides/nics/mlx5.rst               |   7 +
>  doc/guides/prog_guide/rte_flow.rst     |  34 ++-
>  doc/guides/rel_notes/release_20_11.rst |  10 +
>  drivers/net/mlx5/mlx5_flow.c           |  62 ++++--
>  drivers/net/mlx5/mlx5_flow.h           |  14 ++
>  drivers/net/mlx5/mlx5_flow_dv.c        | 382
> +++++++++++++++++++++++++++++----
>  drivers/net/mlx5/mlx5_flow_verbs.c     |   9 +-
>  lib/librte_ethdev/rte_flow.c           |   1 +
>  lib/librte_ethdev/rte_flow.h           |  45 +++-
>  lib/librte_ip_frag/rte_ip_frag.h       |  26 +--
>  lib/librte_net/rte_ip.h                |  26 ++-
>  12 files changed, 579 insertions(+), 90 deletions(-)
> 
> --
> 1.8.3.1

Series-acked-by:  Ori Kam <orika@nvidia.com>
Thanks,
Ori


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v4 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-10-08  3:14         ` Ajit Khaparde
  2020-10-08  7:03           ` Dekel Peled
  2020-10-08 18:28         ` Ajit Khaparde
  1 sibling, 1 reply; 101+ messages in thread
From: Ajit Khaparde @ 2020-10-08  3:14 UTC (permalink / raw)
  To: Dekel Peled
  Cc: Ori Kam, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Ananyev, Konstantin, Olivier Matz, Wenzhuo Lu, Beilei Xing,
	Iremonger, Bernard, Matan Azrad, Shahaf Shuler, Slava Ovsiienko,
	dpdk-dev

On Wed, Oct 7, 2020 at 3:55 AM Dekel Peled <dekelp@nvidia.com> wrote:
>
> Using the current implementation of DPDK, an application cannot match on
> IPv6 packets, based on the existing extension headers, in a simple way.
>
> Field 'Next Header' in IPv6 header indicates type of the first extension
> header only. Following extension headers can't be identified by
> inspecting the IPv6 header.
> As a result, the existence or absence of specific extension headers
> can't be used for packet matching.
>
> For example, fragmented IPv6 packets contain a dedicated extension header
> (which is implemented in a later patch of this series).
> Non-fragmented packets don't contain the fragment extension header.
> For an application to match on non-fragmented IPv6 packets, the current
> implementation doesn't provide a suitable solution.
> Matching on the Next Header field is not sufficient, since additional
> extension headers might be present in the same packet.
> To match on fragmented IPv6 packets, the same difficulty exists.
>
> This patch implements the update as detailed in RFC [1].
> A set of additional values will be added to IPv6 header struct.
> These values will indicate the existence of every defined extension
> header type, providing simple means for identification of existing
> extensions in the packet header.
> Continuing the above example, fragmented packets can be identified using
> the specific value indicating existence of fragment extension header.
> To match on non-fragmented IPv6 packets, need to use frag_ext_exist 0.
Suggest:
"To match on non-fragmented IPv6 packets, applications should set
frag_ext_exist 0."

> To match on fragmented IPv6 packets, need to use frag_ext_exist 1.
Suggest:
To match on fragmented IPv6 packets, applications should set
frag_ext_exist to 1.


> To match on any IPv6 packets, the frag_ext_exist field should
> not be specified for match.
>
> [1] https://mails.dpdk.org/archives/dev/2020-August/177257.html
>
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> Acked-by: Ori Kam <orika@nvidia.com>
> ---
>  doc/guides/prog_guide/rte_flow.rst | 22 +++++++++++++++++++---
>  lib/librte_ethdev/rte_flow.h       | 25 +++++++++++++++++++++++--
>  2 files changed, 42 insertions(+), 5 deletions(-)
>
> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index 119b128..ae090db 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -946,11 +946,27 @@ Item: ``IPV6``
>
>  Matches an IPv6 header.
>
> -Note: IPv6 options are handled by dedicated pattern items, see `Item:
> -IPV6_EXT`_.
> +Dedicated flags indicate existence of specific extension headers.
> +Every type of extension header can use a dedicated pattern item, or
> +the generic `Item: IPV6_EXT`_.
> +To match on packets containing a specific extension header, an application
> +should match on the dedicated flag set to 1.
> +To match on packets not containing a specific extension header, an application
> +should match on the dedicated flag clear to 0.
> +In case application doesn't care about the existence of a specific extension
> +header, it should not specify the dedicated flag for matching.
>
>  - ``hdr``: IPv6 header definition (``rte_ip.h``).
> -- Default ``mask`` matches source and destination addresses only.
> +- ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
> +- ``rout_ext_exist``: Routing extension header exists.
> +- ``frag_ext_exist``: Fragment extension header exists.
> +- ``auth_ext_exist``: Authentication extension header exists.
> +- ``esp_ext_exist``: Encapsulation Security Payload extension header exists.
> +- ``dest_ext_exist``: Destination Options extension header exists.
> +- ``mobil_ext_exist``: Mobility extension header exists.
> +- ``hip_ext_exist``: Host Identity Protocol extension header exists.
> +- ``shim6_ext_exist``: Shim6 Protocol extension header exists.
> +- Default ``mask`` matches ``hdr`` source and destination addresses only.
>
>  Item: ``ICMP``
>  ^^^^^^^^^^^^^^
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index da8bfa5..5b5bed2 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -792,11 +792,32 @@ struct rte_flow_item_ipv4 {
>   *
>   * Matches an IPv6 header.
>   *
> - * Note: IPv6 options are handled by dedicated pattern items, see
> - * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
> + * Dedicated flags indicate existence of specific extension headers.
> + * Every type of extension header can use a dedicated pattern item, or
> + * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.
>   */
>  struct rte_flow_item_ipv6 {
>         struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
> +       uint32_t hop_ext_exist:1;
> +       /**< Hop-by-Hop Options extension header exists. */
> +       uint32_t rout_ext_exist:1;
> +       /**< Routing extension header exists. */
> +       uint32_t frag_ext_exist:1;
> +       /**< Fragment extension header exists. */
> +       uint32_t auth_ext_exist:1;
> +       /**< Authentication extension header exists. */
> +       uint32_t esp_ext_exist:1;
> +       /**< Encapsulation Security Payload extension header exists. */
> +       uint32_t dest_ext_exist:1;
> +       /**< Destination Options extension header exists. */
> +       uint32_t mobil_ext_exist:1;
> +       /**< Mobility extension header exists. */
> +       uint32_t hip_ext_exist:1;
> +       /**< Host Identity Protocol extension header exists. */
> +       uint32_t shim6_ext_exist:1;
> +       /**< Shim6 Protocol extension header exists. */
> +       uint32_t reserved:23;
> +       /**< Reserved for future extension headers, must be zero. */
>  };
>
>  /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
> --
> 1.8.3.1
>

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v4 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-08  3:14         ` Ajit Khaparde
@ 2020-10-08  7:03           ` Dekel Peled
  0 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-08  7:03 UTC (permalink / raw)
  To: Ajit Khaparde
  Cc: Ori Kam, NBU-Contact-Thomas Monjalon, Ferruh Yigit,
	Andrew Rybchenko, Ananyev, Konstantin, Olivier Matz, Wenzhuo Lu,
	Beilei Xing, Iremonger, Bernard, Matan Azrad, Shahaf Shuler,
	Slava Ovsiienko, dpdk-dev

Thanks, PSB.

> -----Original Message-----
> From: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Sent: Thursday, October 8, 2020 6:14 AM
> To: Dekel Peled <dekelp@nvidia.com>
> Cc: Ori Kam <orika@nvidia.com>; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@intel.com>; Andrew
> Rybchenko <arybchenko@solarflare.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>; Olivier Matz <olivier.matz@6wind.com>;
> Wenzhuo Lu <wenzhuo.lu@intel.com>; Beilei Xing <beilei.xing@intel.com>;
> Iremonger, Bernard <bernard.iremonger@intel.com>; Matan Azrad
> <matan@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>; dpdk-dev <dev@dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH v4 01/11] ethdev: add extensions attributes
> to IPv6 item
> 
> On Wed, Oct 7, 2020 at 3:55 AM Dekel Peled <dekelp@nvidia.com> wrote:
> >
> > Using the current implementation of DPDK, an application cannot match on
> > IPv6 packets, based on the existing extension headers, in a simple way.
> >
> > Field 'Next Header' in IPv6 header indicates type of the first extension
> > header only. Following extension headers can't be identified by
> > inspecting the IPv6 header.
> > As a result, the existence or absence of specific extension headers
> > can't be used for packet matching.
> >
> > For example, fragmented IPv6 packets contain a dedicated extension
> header
> > (which is implemented in a later patch of this series).
> > Non-fragmented packets don't contain the fragment extension header.
> > For an application to match on non-fragmented IPv6 packets, the current
> > implementation doesn't provide a suitable solution.
> > Matching on the Next Header field is not sufficient, since additional
> > extension headers might be present in the same packet.
> > To match on fragmented IPv6 packets, the same difficulty exists.
> >
> > This patch implements the update as detailed in RFC [1].
> > A set of additional values will be added to IPv6 header struct.
> > These values will indicate the existence of every defined extension
> > header type, providing simple means for identification of existing
> > extensions in the packet header.
> > Continuing the above example, fragmented packets can be identified using
> > the specific value indicating existence of fragment extension header.
> > To match on non-fragmented IPv6 packets, need to use frag_ext_exist 0.
> Suggest:
> "To match on non-fragmented IPv6 packets, applications should set
> frag_ext_exist 0."
> 
> > To match on fragmented IPv6 packets, need to use frag_ext_exist 1.
> Suggest:
> To match on fragmented IPv6 packets, applications should set
> frag_ext_exist to 1.

In the git log I abbreviated a little.
In the actual documentation rst file I wrote it clearly.

> 
> 
> > To match on any IPv6 packets, the frag_ext_exist field should
> > not be specified for match.
> >
> > [1] https://mails.dpdk.org/archives/dev/2020-August/177257.html
> >
> > Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> > Acked-by: Ori Kam <orika@nvidia.com>
> > ---
> >  doc/guides/prog_guide/rte_flow.rst | 22 +++++++++++++++++++---
> >  lib/librte_ethdev/rte_flow.h       | 25 +++++++++++++++++++++++--
> >  2 files changed, 42 insertions(+), 5 deletions(-)
> >
> > diff --git a/doc/guides/prog_guide/rte_flow.rst
> b/doc/guides/prog_guide/rte_flow.rst
> > index 119b128..ae090db 100644
> > --- a/doc/guides/prog_guide/rte_flow.rst
> > +++ b/doc/guides/prog_guide/rte_flow.rst
> > @@ -946,11 +946,27 @@ Item: ``IPV6``
> >
> >  Matches an IPv6 header.
> >
> > -Note: IPv6 options are handled by dedicated pattern items, see `Item:
> > -IPV6_EXT`_.
> > +Dedicated flags indicate existence of specific extension headers.
> > +Every type of extension header can use a dedicated pattern item, or
> > +the generic `Item: IPV6_EXT`_.
> > +To match on packets containing a specific extension header, an application
> > +should match on the dedicated flag set to 1.
> > +To match on packets not containing a specific extension header, an
> application
> > +should match on the dedicated flag clear to 0.
> > +In case application doesn't care about the existence of a specific
> extension
> > +header, it should not specify the dedicated flag for matching.
> >
> >  - ``hdr``: IPv6 header definition (``rte_ip.h``).
> > -- Default ``mask`` matches source and destination addresses only.
> > +- ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
> > +- ``rout_ext_exist``: Routing extension header exists.
> > +- ``frag_ext_exist``: Fragment extension header exists.
> > +- ``auth_ext_exist``: Authentication extension header exists.
> > +- ``esp_ext_exist``: Encapsulation Security Payload extension header
> exists.
> > +- ``dest_ext_exist``: Destination Options extension header exists.
> > +- ``mobil_ext_exist``: Mobility extension header exists.
> > +- ``hip_ext_exist``: Host Identity Protocol extension header exists.
> > +- ``shim6_ext_exist``: Shim6 Protocol extension header exists.
> > +- Default ``mask`` matches ``hdr`` source and destination addresses only.
> >
> >  Item: ``ICMP``
> >  ^^^^^^^^^^^^^^
> > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> > index da8bfa5..5b5bed2 100644
> > --- a/lib/librte_ethdev/rte_flow.h
> > +++ b/lib/librte_ethdev/rte_flow.h
> > @@ -792,11 +792,32 @@ struct rte_flow_item_ipv4 {
> >   *
> >   * Matches an IPv6 header.
> >   *
> > - * Note: IPv6 options are handled by dedicated pattern items, see
> > - * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
> > + * Dedicated flags indicate existence of specific extension headers.
> > + * Every type of extension header can use a dedicated pattern item, or
> > + * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.
> >   */
> >  struct rte_flow_item_ipv6 {
> >         struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
> > +       uint32_t hop_ext_exist:1;
> > +       /**< Hop-by-Hop Options extension header exists. */
> > +       uint32_t rout_ext_exist:1;
> > +       /**< Routing extension header exists. */
> > +       uint32_t frag_ext_exist:1;
> > +       /**< Fragment extension header exists. */
> > +       uint32_t auth_ext_exist:1;
> > +       /**< Authentication extension header exists. */
> > +       uint32_t esp_ext_exist:1;
> > +       /**< Encapsulation Security Payload extension header exists. */
> > +       uint32_t dest_ext_exist:1;
> > +       /**< Destination Options extension header exists. */
> > +       uint32_t mobil_ext_exist:1;
> > +       /**< Mobility extension header exists. */
> > +       uint32_t hip_ext_exist:1;
> > +       /**< Host Identity Protocol extension header exists. */
> > +       uint32_t shim6_ext_exist:1;
> > +       /**< Shim6 Protocol extension header exists. */
> > +       uint32_t reserved:23;
> > +       /**< Reserved for future extension headers, must be zero. */
> >  };
> >
> >  /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
> > --
> > 1.8.3.1
> >

^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v4 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
  2020-10-08  3:14         ` Ajit Khaparde
@ 2020-10-08 18:28         ` Ajit Khaparde
  1 sibling, 0 replies; 101+ messages in thread
From: Ajit Khaparde @ 2020-10-08 18:28 UTC (permalink / raw)
  To: Dekel Peled
  Cc: Ori Kam, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Ananyev, Konstantin, Olivier Matz, Wenzhuo Lu, Beilei Xing,
	Iremonger, Bernard, Matan Azrad, Shahaf Shuler, Slava Ovsiienko,
	dpdk-dev

On Wed, Oct 7, 2020 at 3:55 AM Dekel Peled <dekelp@nvidia.com> wrote:
>
> Using the current implementation of DPDK, an application cannot match on
> IPv6 packets, based on the existing extension headers, in a simple way.
>
> Field 'Next Header' in IPv6 header indicates type of the first extension
> header only. Following extension headers can't be identified by
> inspecting the IPv6 header.
> As a result, the existence or absence of specific extension headers
> can't be used for packet matching.
>
> For example, fragmented IPv6 packets contain a dedicated extension header
> (which is implemented in a later patch of this series).
> Non-fragmented packets don't contain the fragment extension header.
> For an application to match on non-fragmented IPv6 packets, the current
> implementation doesn't provide a suitable solution.
> Matching on the Next Header field is not sufficient, since additional
> extension headers might be present in the same packet.
> To match on fragmented IPv6 packets, the same difficulty exists.
>
> This patch implements the update as detailed in RFC [1].
> A set of additional values will be added to IPv6 header struct.
> These values will indicate the existence of every defined extension
> header type, providing simple means for identification of existing
> extensions in the packet header.
> Continuing the above example, fragmented packets can be identified using
> the specific value indicating existence of fragment extension header.
> To match on non-fragmented IPv6 packets, need to use frag_ext_exist 0.
> To match on fragmented IPv6 packets, need to use frag_ext_exist 1.
> To match on any IPv6 packets, the frag_ext_exist field should
> not be specified for match.
>
> [1] https://mails.dpdk.org/archives/dev/2020-August/177257.html
>
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> Acked-by: Ori Kam <orika@nvidia.com>

Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>


> ---
>  doc/guides/prog_guide/rte_flow.rst | 22 +++++++++++++++++++---
>  lib/librte_ethdev/rte_flow.h       | 25 +++++++++++++++++++++++--
>  2 files changed, 42 insertions(+), 5 deletions(-)
>
> diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
> index 119b128..ae090db 100644
> --- a/doc/guides/prog_guide/rte_flow.rst
> +++ b/doc/guides/prog_guide/rte_flow.rst
> @@ -946,11 +946,27 @@ Item: ``IPV6``
>
>  Matches an IPv6 header.
>
> -Note: IPv6 options are handled by dedicated pattern items, see `Item:
> -IPV6_EXT`_.
> +Dedicated flags indicate existence of specific extension headers.
> +Every type of extension header can use a dedicated pattern item, or
> +the generic `Item: IPV6_EXT`_.
> +To match on packets containing a specific extension header, an application
> +should match on the dedicated flag set to 1.
> +To match on packets not containing a specific extension header, an application
> +should match on the dedicated flag clear to 0.
> +In case application doesn't care about the existence of a specific extension
> +header, it should not specify the dedicated flag for matching.
>
>  - ``hdr``: IPv6 header definition (``rte_ip.h``).
> -- Default ``mask`` matches source and destination addresses only.
> +- ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
> +- ``rout_ext_exist``: Routing extension header exists.
> +- ``frag_ext_exist``: Fragment extension header exists.
> +- ``auth_ext_exist``: Authentication extension header exists.
> +- ``esp_ext_exist``: Encapsulation Security Payload extension header exists.
> +- ``dest_ext_exist``: Destination Options extension header exists.
> +- ``mobil_ext_exist``: Mobility extension header exists.
> +- ``hip_ext_exist``: Host Identity Protocol extension header exists.
> +- ``shim6_ext_exist``: Shim6 Protocol extension header exists.
> +- Default ``mask`` matches ``hdr`` source and destination addresses only.
>
>  Item: ``ICMP``
>  ^^^^^^^^^^^^^^
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index da8bfa5..5b5bed2 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -792,11 +792,32 @@ struct rte_flow_item_ipv4 {
>   *
>   * Matches an IPv6 header.
>   *
> - * Note: IPv6 options are handled by dedicated pattern items, see
> - * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
> + * Dedicated flags indicate existence of specific extension headers.
> + * Every type of extension header can use a dedicated pattern item, or
> + * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.
>   */
>  struct rte_flow_item_ipv6 {
>         struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
> +       uint32_t hop_ext_exist:1;
> +       /**< Hop-by-Hop Options extension header exists. */
> +       uint32_t rout_ext_exist:1;
> +       /**< Routing extension header exists. */
> +       uint32_t frag_ext_exist:1;
> +       /**< Fragment extension header exists. */
> +       uint32_t auth_ext_exist:1;
> +       /**< Authentication extension header exists. */
> +       uint32_t esp_ext_exist:1;
> +       /**< Encapsulation Security Payload extension header exists. */
> +       uint32_t dest_ext_exist:1;
> +       /**< Destination Options extension header exists. */
> +       uint32_t mobil_ext_exist:1;
> +       /**< Mobility extension header exists. */
> +       uint32_t hip_ext_exist:1;
> +       /**< Host Identity Protocol extension header exists. */
> +       uint32_t shim6_ext_exist:1;
> +       /**< Shim6 Protocol extension header exists. */
> +       uint32_t reserved:23;
> +       /**< Reserved for future extension headers, must be zero. */
>  };
>
>  /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
> --
> 1.8.3.1
>

^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 00/11] support match on L3 fragmented packets
  2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
                         ` (11 preceding siblings ...)
  2020-10-07 11:15       ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Ori Kam
@ 2020-10-12 10:42       ` Dekel Peled
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
                           ` (11 more replies)
  12 siblings, 12 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:42 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This series implements support of matching on packets based on the
fragmentation attribute of the packet, i.e. if packet is a fragment
of a larger packet, or the opposite - packet is not a fragment.

In ethdev, add API to support IPv6 extension headers, and specifically
the IPv6 fragment extension header item.
In MLX5 PMD, support match on IPv4 fragmented packets, IPv6 fragmented
packets, and IPv6 fragment extension header item.
Testpmd CLI is updated accordingly.
Documentation is updated accordingly.

---
v2: add patch 'net/mlx5: enforce limitation on IPv6 next proto'
v3: update patch 'ethdev: add IPv6 fragment extension header item' to avoid ABI breakage.
v4: update rte_flow documentation to clarify use of IPv6 extension header flags.
v5: update following rebase on recent ICMP changes.
---

Dekel Peled (11):
  ethdev: add extensions attributes to IPv6 item
  ethdev: add IPv6 fragment extension header item
  app/testpmd: support IPv4 fragments
  app/testpmd: support IPv6 fragments
  app/testpmd: support IPv6 fragment extension item
  net/mlx5: remove handling of ICMP fragmented packets
  net/mlx5: support match on IPv4 fragment packets
  net/mlx5: support match on IPv6 fragment packets
  net/mlx5: support match on IPv6 fragment ext. item
  doc: update release notes for MLX5 L3 frag support
  net/mlx5: enforce limitation on IPv6 next proto

 app/test-pmd/cmdline_flow.c            |  53 +++++
 doc/guides/nics/mlx5.rst               |   7 +
 doc/guides/prog_guide/rte_flow.rst     |  34 ++-
 doc/guides/rel_notes/release_20_11.rst |  10 +
 drivers/net/mlx5/mlx5_flow.c           |  62 ++++--
 drivers/net/mlx5/mlx5_flow.h           |  14 ++
 drivers/net/mlx5/mlx5_flow_dv.c        | 382 +++++++++++++++++++++++++++++----
 drivers/net/mlx5/mlx5_flow_verbs.c     |   9 +-
 lib/librte_ethdev/rte_flow.c           |   1 +
 lib/librte_ethdev/rte_flow.h           |  45 +++-
 lib/librte_ip_frag/rte_ip_frag.h       |  26 +--
 lib/librte_net/rte_ip.h                |  26 ++-
 12 files changed, 579 insertions(+), 90 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
@ 2020-10-12 10:43         ` Dekel Peled
  2020-10-12 20:41           ` Thomas Monjalon
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
                           ` (10 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:43 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Using the current implementation of DPDK, an application cannot match on
IPv6 packets, based on the existing extension headers, in a simple way.

Field 'Next Header' in IPv6 header indicates type of the first extension
header only. Following extension headers can't be identified by
inspecting the IPv6 header.
As a result, the existence or absence of specific extension headers
can't be used for packet matching.

For example, fragmented IPv6 packets contain a dedicated extension header
(which is implemented in a later patch of this series).
Non-fragmented packets don't contain the fragment extension header.
For an application to match on non-fragmented IPv6 packets, the current
implementation doesn't provide a suitable solution.
Matching on the Next Header field is not sufficient, since additional
extension headers might be present in the same packet.
To match on fragmented IPv6 packets, the same difficulty exists.

This patch implements the update as detailed in RFC [1].
A set of additional values will be added to IPv6 header struct.
These values will indicate the existence of every defined extension
header type, providing simple means for identification of existing
extensions in the packet header.
Continuing the above example, fragmented packets can be identified using
the specific value indicating existence of fragment extension header.
To match on non-fragmented IPv6 packets, need to use frag_ext_exist 0.
To match on fragmented IPv6 packets, need to use frag_ext_exist 1.
To match on any IPv6 packets, the frag_ext_exist field should
not be specified for match.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 22 +++++++++++++++++++---
 lib/librte_ethdev/rte_flow.h       | 25 +++++++++++++++++++++++--
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 119b128..ae090db 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -946,11 +946,27 @@ Item: ``IPV6``
 
 Matches an IPv6 header.
 
-Note: IPv6 options are handled by dedicated pattern items, see `Item:
-IPV6_EXT`_.
+Dedicated flags indicate existence of specific extension headers.
+Every type of extension header can use a dedicated pattern item, or
+the generic `Item: IPV6_EXT`_.
+To match on packets containing a specific extension header, an application
+should match on the dedicated flag set to 1.
+To match on packets not containing a specific extension header, an application
+should match on the dedicated flag clear to 0.
+In case application doesn't care about the existence of a specific extension
+header, it should not specify the dedicated flag for matching.
 
 - ``hdr``: IPv6 header definition (``rte_ip.h``).
-- Default ``mask`` matches source and destination addresses only.
+- ``hop_ext_exist``: Hop-by-Hop Options extension header exists.
+- ``rout_ext_exist``: Routing extension header exists.
+- ``frag_ext_exist``: Fragment extension header exists.
+- ``auth_ext_exist``: Authentication extension header exists.
+- ``esp_ext_exist``: Encapsulation Security Payload extension header exists.
+- ``dest_ext_exist``: Destination Options extension header exists.
+- ``mobil_ext_exist``: Mobility extension header exists.
+- ``hip_ext_exist``: Host Identity Protocol extension header exists.
+- ``shim6_ext_exist``: Shim6 Protocol extension header exists.
+- Default ``mask`` matches ``hdr`` source and destination addresses only.
 
 Item: ``ICMP``
 ^^^^^^^^^^^^^^
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index da8bfa5..5b5bed2 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -792,11 +792,32 @@ struct rte_flow_item_ipv4 {
  *
  * Matches an IPv6 header.
  *
- * Note: IPv6 options are handled by dedicated pattern items, see
- * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
+ * Dedicated flags indicate existence of specific extension headers.
+ * Every type of extension header can use a dedicated pattern item, or
+ * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.
  */
 struct rte_flow_item_ipv6 {
 	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
+	uint32_t hop_ext_exist:1;
+	/**< Hop-by-Hop Options extension header exists. */
+	uint32_t rout_ext_exist:1;
+	/**< Routing extension header exists. */
+	uint32_t frag_ext_exist:1;
+	/**< Fragment extension header exists. */
+	uint32_t auth_ext_exist:1;
+	/**< Authentication extension header exists. */
+	uint32_t esp_ext_exist:1;
+	/**< Encapsulation Security Payload extension header exists. */
+	uint32_t dest_ext_exist:1;
+	/**< Destination Options extension header exists. */
+	uint32_t mobil_ext_exist:1;
+	/**< Mobility extension header exists. */
+	uint32_t hip_ext_exist:1;
+	/**< Host Identity Protocol extension header exists. */
+	uint32_t shim6_ext_exist:1;
+	/**< Shim6 Protocol extension header exists. */
+	uint32_t reserved:23;
+	/**< Reserved for future extension headers, must be zero. */
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 02/11] ethdev: add IPv6 fragment extension header item
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-10-12 10:43         ` Dekel Peled
  2020-10-12 20:50           ` Thomas Monjalon
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 03/11] app/testpmd: support IPv4 fragments Dekel Peled
                           ` (9 subsequent siblings)
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:43 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Applications handling fragmented IPv6 packets need to match on IPv6
fragment extension header, in order to identify the fragments order
and location in the packet.
This patch introduces the IPv6 fragment extension header item,
proposed in [1].

Relevant definitions are moved from lib/librte_ip_frag/rte_ip_frag.h
to lib/librte_net/rte_ip.h, as they are needed for IPv6 header handling.
struct ipv6_extension_fragment renamed to rte_ipv6_fragment_ext to
adapt it to the common naming convention.

Default mask is not defined, since all fields are optional.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 16 ++++++++++++++--
 lib/librte_ethdev/rte_flow.c       |  1 +
 lib/librte_ethdev/rte_flow.h       | 20 ++++++++++++++++++++
 lib/librte_ip_frag/rte_ip_frag.h   | 26 ++------------------------
 lib/librte_net/rte_ip.h            | 26 ++++++++++++++++++++++++--
 5 files changed, 61 insertions(+), 28 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index ae090db..02b1d58 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -947,8 +947,8 @@ Item: ``IPV6``
 Matches an IPv6 header.
 
 Dedicated flags indicate existence of specific extension headers.
-Every type of extension header can use a dedicated pattern item, or
-the generic `Item: IPV6_EXT`_.
+Every type of extension header can use a dedicated pattern item,
+for example `Item: IPV6_FRAG_EXT`_, or the generic `Item: IPV6_EXT`_.
 To match on packets containing a specific extension header, an application
 should match on the dedicated flag set to 1.
 To match on packets not containing a specific extension header, an application
@@ -1193,6 +1193,18 @@ Normally preceded by any of:
 - `Item: IPV6`_
 - `Item: IPV6_EXT`_
 
+Item: ``IPV6_FRAG_EXT``
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches the presence of IPv6 fragment extension header.
+
+- ``hdr``: IPv6 fragment extension header definition (``rte_ip.h``).
+
+Normally preceded by any of:
+
+- `Item: IPV6`_
+- `Item: IPV6_EXT`_
+
 Item: ``ICMP6``
 ^^^^^^^^^^^^^^^
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 8d1b279..6239fbf 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -72,6 +72,7 @@ struct rte_flow_desc_data {
 	MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)),
 	MK_FLOW_ITEM(ARP_ETH_IPV4, sizeof(struct rte_flow_item_arp_eth_ipv4)),
 	MK_FLOW_ITEM(IPV6_EXT, sizeof(struct rte_flow_item_ipv6_ext)),
+	MK_FLOW_ITEM(IPV6_FRAG_EXT, sizeof(struct rte_flow_item_ipv6_frag_ext)),
 	MK_FLOW_ITEM(ICMP6, sizeof(struct rte_flow_item_icmp6)),
 	MK_FLOW_ITEM(ICMP6_ND_NS, sizeof(struct rte_flow_item_icmp6_nd_ns)),
 	MK_FLOW_ITEM(ICMP6_ND_NA, sizeof(struct rte_flow_item_icmp6_nd_na)),
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 5b5bed2..85376a3 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -537,6 +537,12 @@ enum rte_flow_item_type {
 	 */
 	RTE_FLOW_ITEM_TYPE_ECPRI,
 
+	/**
+	 * Matches the presence of IPv6 fragment extension header.
+	 *
+	 * See struct rte_flow_item_ipv6_frag_ext.
+	 */
+	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
 };
 
 /**
@@ -1188,6 +1194,20 @@ struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
 #endif
 
 /**
+ * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
+ *
+ * Matches the presence of IPv6 fragment extension header.
+ *
+ * Preceded by any of:
+ *
+ * - RTE_FLOW_ITEM_TYPE_IPV6
+ * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
+ */
+struct rte_flow_item_ipv6_frag_ext {
+	struct rte_ipv6_fragment_ext hdr;
+};
+
+/**
  * RTE_FLOW_ITEM_TYPE_ICMP6
  *
  * Matches any ICMPv6 header.
diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h
index 66edd7e..0bfe64b 100644
--- a/lib/librte_ip_frag/rte_ip_frag.h
+++ b/lib/librte_ip_frag/rte_ip_frag.h
@@ -110,30 +110,8 @@ struct rte_ip_frag_tbl {
 	__extension__ struct ip_frag_pkt pkt[0]; /**< hash table. */
 };
 
-/** IPv6 fragment extension header */
-#define	RTE_IPV6_EHDR_MF_SHIFT			0
-#define	RTE_IPV6_EHDR_MF_MASK			1
-#define	RTE_IPV6_EHDR_FO_SHIFT			3
-#define	RTE_IPV6_EHDR_FO_MASK			(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
-#define	RTE_IPV6_EHDR_FO_ALIGN			(1 << RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_FRAG_USED_MASK			\
-	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
-
-#define RTE_IPV6_GET_MF(x)				((x) & RTE_IPV6_EHDR_MF_MASK)
-#define RTE_IPV6_GET_FO(x)				((x) >> RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
-	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
-
-struct ipv6_extension_fragment {
-	uint8_t next_header;            /**< Next header type */
-	uint8_t reserved;               /**< Reserved */
-	uint16_t frag_data;             /**< All fragmentation data */
-	uint32_t id;                    /**< Packet ID */
-} __rte_packed;
-
-
+/* struct ipv6_extension_fragment moved to librte_net/rte_ip.h and renamed. */
+#define ipv6_extension_fragment	rte_ipv6_fragment_ext
 
 /**
  * Create a new IP fragmentation table.
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index bb55ebb..fbf5575 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -461,8 +461,30 @@ struct rte_ipv6_hdr {
 	return (uint16_t)cksum;
 }
 
-/* IPv6 fragmentation header size */
-#define RTE_IPV6_FRAG_HDR_SIZE 8
+/** IPv6 fragment extension header. */
+#define	RTE_IPV6_EHDR_MF_SHIFT	0
+#define	RTE_IPV6_EHDR_MF_MASK	1
+#define	RTE_IPV6_EHDR_FO_SHIFT	3
+#define	RTE_IPV6_EHDR_FO_MASK	(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
+#define	RTE_IPV6_EHDR_FO_ALIGN	(1 << RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_FRAG_USED_MASK	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
+
+#define RTE_IPV6_GET_MF(x)	((x) & RTE_IPV6_EHDR_MF_MASK)
+#define RTE_IPV6_GET_FO(x)	((x) >> RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
+	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
+
+struct rte_ipv6_fragment_ext {
+	uint8_t next_header;	/**< Next header type */
+	uint8_t reserved;	/**< Reserved */
+	rte_be16_t frag_data;	/**< All fragmentation data */
+	rte_be32_t id;		/**< Packet ID */
+} __rte_packed;
+
+/* IPv6 fragment extension header size */
+#define RTE_IPV6_FRAG_HDR_SIZE	sizeof(struct rte_ipv6_fragment_ext)
 
 /**
  * Parse next IPv6 header extension
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 03/11] app/testpmd: support IPv4 fragments
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-10-12 10:43         ` Dekel Peled
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 04/11] app/testpmd: support IPv6 fragments Dekel Peled
                           ` (8 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:43 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates testpmd CLI to support fragment_offset field of
IPv4 header item.

To match on non-fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 0 fragment_offset mask 0x3fff ...
To match on fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 1 fragment_offset last 0x3fff
fragment_offset mask 0x3fff ...
(Use the full available range 1 to 0x3fff to include all possible
values.)
To match on any IPv4 packets, fragmented and non-fragmented,
the fragment_offset field should not be specified for match.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 6e04d53..a9bf29f 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -129,6 +129,7 @@ enum index {
 	ITEM_VLAN_INNER_TYPE,
 	ITEM_IPV4,
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -873,6 +874,7 @@ struct parse_action_priv {
 
 static const enum index item_ipv4[] = {
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -2097,6 +2099,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
 					     hdr.type_of_service)),
 	},
+	[ITEM_IPV4_FRAGMENT_OFFSET] = {
+		.name = "fragment_offset",
+		.help = "fragmentation flags and fragment offset",
+		.next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
+					     hdr.fragment_offset)),
+	},
 	[ITEM_IPV4_TTL] = {
 		.name = "ttl",
 		.help = "time to live",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 04/11] app/testpmd: support IPv6 fragments
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
                           ` (2 preceding siblings ...)
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 03/11] app/testpmd: support IPv4 fragments Dekel Peled
@ 2020-10-12 10:43         ` Dekel Peled
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
                           ` (7 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:43 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], introduced frag_ext_exist field for
IPv6 header item, used to indicate match on fragmented/non-fragmented
packets.
This patch updates testpmd CLI to support the new field.

To match on non-fragmented IPv6 packets, need to use pattern:
... ipv6 frag_ext_exist spec 0 frag_ext_exist mask 1 ...
To match on fragmented IPv6 packets, need to use pattern:
... ipv6 frag_ext_exist spec 1 frag_ext_exist mask 1 ...
To match on any IPv6 packets, the frag_ext_exist field should
not be specified for match.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index a9bf29f..b078095 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -141,6 +141,7 @@ enum index {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_FRAG_EXT_EXIST,
 	ITEM_ICMP,
 	ITEM_ICMP_TYPE,
 	ITEM_ICMP_CODE,
@@ -890,6 +891,7 @@ struct parse_action_priv {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_FRAG_EXT_EXIST,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2185,6 +2187,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6,
 					     hdr.dst_addr)),
 	},
+	[ITEM_IPV6_FRAG_EXT_EXIST] = {
+		.name = "frag_ext_exist",
+		.help = "fragment packet attribute",
+		.next = NEXT(item_ipv6, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_ipv6,
+					   frag_ext_exist, 1)),
+	},
 	[ITEM_ICMP] = {
 		.name = "icmp",
 		.help = "match ICMP header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 05/11] app/testpmd: support IPv6 fragment extension item
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
                           ` (3 preceding siblings ...)
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 04/11] app/testpmd: support IPv6 fragments Dekel Peled
@ 2020-10-12 10:43         ` Dekel Peled
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
                           ` (6 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:43 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch updates testpmd CLI to support the new item and its fields.

To match on fragmented IPv6 packets, this item is added to pattern:
... ipv6 / ipv6_frag_ext ...

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index b078095..1f800eb 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -195,6 +195,9 @@ enum index {
 	ITEM_ARP_ETH_IPV4_TPA,
 	ITEM_IPV6_EXT,
 	ITEM_IPV6_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT,
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
 	ITEM_ICMP6,
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -786,6 +789,7 @@ struct parse_action_priv {
 	ITEM_VXLAN_GPE,
 	ITEM_ARP_ETH_IPV4,
 	ITEM_IPV6_EXT,
+	ITEM_IPV6_FRAG_EXT,
 	ITEM_ICMP6,
 	ITEM_ICMP6_ND_NS,
 	ITEM_ICMP6_ND_NA,
@@ -1007,6 +1011,13 @@ struct parse_action_priv {
 	ZERO,
 };
 
+static const enum index item_ipv6_frag_ext[] = {
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_icmp6[] = {
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -2578,6 +2589,30 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_ext,
 					     next_hdr)),
 	},
+	[ITEM_IPV6_FRAG_EXT] = {
+		.name = "ipv6_frag_ext",
+		.help = "match presence of IPv6 fragment extension header",
+		.priv = PRIV_ITEM(IPV6_FRAG_EXT,
+				sizeof(struct rte_flow_item_ipv6_frag_ext)),
+		.next = NEXT(item_ipv6_frag_ext),
+		.call = parse_vc,
+	},
+	[ITEM_IPV6_FRAG_EXT_NEXT_HDR] = {
+		.name = "next_hdr",
+		.help = "next header",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_ipv6_frag_ext,
+					hdr.next_header)),
+	},
+	[ITEM_IPV6_FRAG_EXT_FRAG_DATA] = {
+		.name = "frag_data",
+		.help = "Fragment flags and offset",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_frag_ext,
+					     hdr.frag_data)),
+	},
 	[ITEM_ICMP6] = {
 		.name = "icmp6",
 		.help = "match any ICMPv6 header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 06/11] net/mlx5: remove handling of ICMP fragmented packets
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
                           ` (4 preceding siblings ...)
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
@ 2020-10-12 10:43         ` Dekel Peled
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
                           ` (5 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:43 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Commit [1] forced setting of match on 'frag' bit mask 1 and value 0.
Previous patch in this series added support of match on fragmented and
non-fragmented packets on L3 items, so this setting is now redundant.

This patch removes the changes done in [1].

[1] commit 85407db9f60d ("net/mlx5: fix matching for ICMP fragments")

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 2bbfcea..c0fb311 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -7345,12 +7345,6 @@ struct field_modify_info modify_tcp[] = {
 		return;
 	if (!icmp6_m)
 		icmp6_m = &rte_flow_item_icmp6_mask;
-	/*
-	 * Force flow only to match the non-fragmented IPv6 ICMPv6 packets.
-	 * If only the protocol is specified, no need to match the frag.
-	 */
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmpv6_type, icmp6_m->type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmpv6_type,
 		 icmp6_v->type & icmp6_m->type);
@@ -7400,12 +7394,6 @@ struct field_modify_info modify_tcp[] = {
 		return;
 	if (!icmp_m)
 		icmp_m = &rte_flow_item_icmp_mask;
-	/*
-	 * Force flow only to match the non-fragmented IPv4 ICMP packets.
-	 * If only the protocol is specified, no need to match the frag.
-	 */
-	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
-	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 0);
 	MLX5_SET(fte_match_set_misc3, misc3_m, icmp_type,
 		 icmp_m->hdr.icmp_type);
 	MLX5_SET(fte_match_set_misc3, misc3_v, icmp_type,
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 07/11] net/mlx5: support match on IPv4 fragment packets
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
                           ` (5 preceding siblings ...)
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
@ 2020-10-12 10:43         ` Dekel Peled
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 08/11] net/mlx5: support match on IPv6 " Dekel Peled
                           ` (4 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:43 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch adds to MLX5 PMD the support of matching on IPv4
fragmented and non-fragmented packets, using the IPv4 header
fragment_offset field.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c       |  48 ++++++++----
 drivers/net/mlx5/mlx5_flow.h       |  10 +++
 drivers/net/mlx5/mlx5_flow_dv.c    | 156 +++++++++++++++++++++++++++++++------
 drivers/net/mlx5/mlx5_flow_verbs.c |   9 ++-
 4 files changed, 178 insertions(+), 45 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 0a54818..38cfd0f 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -800,6 +800,8 @@ struct mlx5_flow_tunnel_info {
  *   Bit-masks covering supported fields by the NIC to compare with user mask.
  * @param[in] size
  *   Bit-masks size in bytes.
+ * @param[in] range_accepted
+ *   True if range of values is accepted for specific fields, false otherwise.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -811,6 +813,7 @@ struct mlx5_flow_tunnel_info {
 			  const uint8_t *mask,
 			  const uint8_t *nic_mask,
 			  unsigned int size,
+			  bool range_accepted,
 			  struct rte_flow_error *error)
 {
 	unsigned int i;
@@ -828,7 +831,7 @@ struct mlx5_flow_tunnel_info {
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "mask/last without a spec is not"
 					  " supported");
-	if (item->spec && item->last) {
+	if (item->spec && item->last && !range_accepted) {
 		uint8_t spec[size];
 		uint8_t last[size];
 		unsigned int i;
@@ -1603,7 +1606,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_icmp6_mask,
-		 sizeof(struct rte_flow_item_icmp6), error);
+		 sizeof(struct rte_flow_item_icmp6),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1661,7 +1665,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&nic_mask,
-		 sizeof(struct rte_flow_item_icmp), error);
+		 sizeof(struct rte_flow_item_icmp),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1716,7 +1721,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_eth),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -1770,7 +1775,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_vlan),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!tunnel && mask->tci != RTE_BE16(0x0fff)) {
@@ -1822,6 +1827,8 @@ struct mlx5_flow_tunnel_info {
  * @param[in] acc_mask
  *   Acceptable mask, if NULL default internal default mask
  *   will be used to check whether item fields are supported.
+ * @param[in] range_accepted
+ *   True if range of values is accepted for specific fields, false otherwise.
  * @param[out] error
  *   Pointer to error structure.
  *
@@ -1834,6 +1841,7 @@ struct mlx5_flow_tunnel_info {
 			     uint64_t last_item,
 			     uint16_t ether_type,
 			     const struct rte_flow_item_ipv4 *acc_mask,
+			     bool range_accepted,
 			     struct rte_flow_error *error)
 {
 	const struct rte_flow_item_ipv4 *mask = item->mask;
@@ -1904,7 +1912,7 @@ struct mlx5_flow_tunnel_info {
 					acc_mask ? (const uint8_t *)acc_mask
 						 : (const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_ipv4),
-					error);
+					range_accepted, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2003,7 +2011,7 @@ struct mlx5_flow_tunnel_info {
 					acc_mask ? (const uint8_t *)acc_mask
 						 : (const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_ipv6),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2058,7 +2066,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_udp_mask,
-		 sizeof(struct rte_flow_item_udp), error);
+		 sizeof(struct rte_flow_item_udp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2113,7 +2122,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)flow_mask,
-		 sizeof(struct rte_flow_item_tcp), error);
+		 sizeof(struct rte_flow_item_tcp), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2167,7 +2177,7 @@ struct mlx5_flow_tunnel_info {
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_vxlan_mask,
 		 sizeof(struct rte_flow_item_vxlan),
-		 error);
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (spec) {
@@ -2238,7 +2248,7 @@ struct mlx5_flow_tunnel_info {
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_vxlan_gpe_mask,
 		 sizeof(struct rte_flow_item_vxlan_gpe),
-		 error);
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (spec) {
@@ -2312,7 +2322,7 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&gre_key_default_mask,
-		 sizeof(rte_be32_t), error);
+		 sizeof(rte_be32_t), MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -2364,7 +2374,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&nic_mask,
-		 sizeof(struct rte_flow_item_gre), error);
+		 sizeof(struct rte_flow_item_gre), MLX5_ITEM_RANGE_NOT_ACCEPTED,
+		 error);
 	if (ret < 0)
 		return ret;
 #ifndef HAVE_MLX5DV_DR
@@ -2439,7 +2450,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 				  (item, (const uint8_t *)mask,
 				   (const uint8_t *)&nic_mask,
-				   sizeof(struct rte_flow_item_geneve), error);
+				   sizeof(struct rte_flow_item_geneve),
+				   MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (spec) {
@@ -2522,7 +2534,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_mpls_mask,
-		 sizeof(struct rte_flow_item_mpls), error);
+		 sizeof(struct rte_flow_item_mpls),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2577,7 +2590,8 @@ struct mlx5_flow_tunnel_info {
 	ret = mlx5_flow_item_acceptable
 		(item, (const uint8_t *)mask,
 		 (const uint8_t *)&rte_flow_item_nvgre_mask,
-		 sizeof(struct rte_flow_item_nvgre), error);
+		 sizeof(struct rte_flow_item_nvgre),
+		 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -2671,7 +2685,7 @@ struct mlx5_flow_tunnel_info {
 					 acc_mask ? (const uint8_t *)acc_mask
 						  : (const uint8_t *)&nic_mask,
 					 sizeof(struct rte_flow_item_ecpri),
-					 error);
+					 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 }
 
 /* Allocate unique ID for the split Q/RSS subflows. */
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 279daf2..1e30c93 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -330,6 +330,14 @@ enum mlx5_feature_name {
 #define MLX5_ENCAPSULATION_DECISION_SIZE (sizeof(struct rte_flow_item_eth) + \
 					  sizeof(struct rte_flow_item_ipv4))
 
+/* IPv4 fragment_offset field contains relevant data in bits 2 to 15. */
+#define MLX5_IPV4_FRAG_OFFSET_MASK \
+		(RTE_IPV4_HDR_OFFSET_MASK | RTE_IPV4_HDR_MF_FLAG)
+
+/* Specific item's fields can accept a range of values (using spec and last). */
+#define MLX5_ITEM_RANGE_NOT_ACCEPTED	false
+#define MLX5_ITEM_RANGE_ACCEPTED	true
+
 /* Software header modify action numbers of a flow. */
 #define MLX5_ACT_NUM_MDF_IPV4		1
 #define MLX5_ACT_NUM_MDF_IPV6		4
@@ -985,6 +993,7 @@ int mlx5_flow_item_acceptable(const struct rte_flow_item *item,
 			      const uint8_t *mask,
 			      const uint8_t *nic_mask,
 			      unsigned int size,
+			      bool range_accepted,
 			      struct rte_flow_error *error);
 int mlx5_flow_validate_item_eth(const struct rte_flow_item *item,
 				uint64_t item_flags,
@@ -1002,6 +1011,7 @@ int mlx5_flow_validate_item_ipv4(const struct rte_flow_item *item,
 				 uint64_t last_item,
 				 uint16_t ether_type,
 				 const struct rte_flow_item_ipv4 *acc_mask,
+				 bool range_accepted,
 				 struct rte_flow_error *error);
 int mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
 				 uint64_t item_flags,
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index c0fb311..08e6f74 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1418,7 +1418,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_mark),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	return 0;
@@ -1494,7 +1494,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_meta),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	return ret;
 }
 
@@ -1547,7 +1547,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_tag),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret < 0)
 		return ret;
 	if (mask->index != 0xff)
@@ -1618,7 +1618,7 @@ struct field_modify_info modify_tcp[] = {
 				(item, (const uint8_t *)mask,
 				 (const uint8_t *)&rte_flow_item_port_id_mask,
 				 sizeof(struct rte_flow_item_port_id),
-				 error);
+				 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!spec)
@@ -1691,7 +1691,7 @@ struct field_modify_info modify_tcp[] = {
 	ret = mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
 					(const uint8_t *)&nic_mask,
 					sizeof(struct rte_flow_item_vlan),
-					error);
+					MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
 	if (ret)
 		return ret;
 	if (!tunnel && mask->tci != RTE_BE16(0x0fff)) {
@@ -1778,11 +1778,126 @@ struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "Match is supported for GTP"
 					  " flags only");
-	return mlx5_flow_item_acceptable
-		(item, (const uint8_t *)mask,
-		 (const uint8_t *)&nic_mask,
-		 sizeof(struct rte_flow_item_gtp),
-		 error);
+	return mlx5_flow_item_acceptable(item, (const uint8_t *)mask,
+					 (const uint8_t *)&nic_mask,
+					 sizeof(struct rte_flow_item_gtp),
+					 MLX5_ITEM_RANGE_NOT_ACCEPTED, error);
+}
+
+/**
+ * Validate IPV4 item.
+ * Use existing validation function mlx5_flow_validate_item_ipv4(), and
+ * add specific validation of fragment_offset field,
+ *
+ * @param[in] item
+ *   Item specification.
+ * @param[in] item_flags
+ *   Bit-fields that holds the items detected until now.
+ * @param[out] error
+ *   Pointer to error structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+flow_dv_validate_item_ipv4(const struct rte_flow_item *item,
+			   uint64_t item_flags,
+			   uint64_t last_item,
+			   uint16_t ether_type,
+			   struct rte_flow_error *error)
+{
+	int ret;
+	const struct rte_flow_item_ipv4 *spec = item->spec;
+	const struct rte_flow_item_ipv4 *last = item->last;
+	const struct rte_flow_item_ipv4 *mask = item->mask;
+	rte_be16_t fragment_offset_spec = 0;
+	rte_be16_t fragment_offset_last = 0;
+	const struct rte_flow_item_ipv4 nic_ipv4_mask = {
+		.hdr = {
+			.src_addr = RTE_BE32(0xffffffff),
+			.dst_addr = RTE_BE32(0xffffffff),
+			.type_of_service = 0xff,
+			.fragment_offset = RTE_BE16(0xffff),
+			.next_proto_id = 0xff,
+			.time_to_live = 0xff,
+		},
+	};
+
+	ret = mlx5_flow_validate_item_ipv4(item, item_flags, last_item,
+					   ether_type, &nic_ipv4_mask,
+					   MLX5_ITEM_RANGE_ACCEPTED, error);
+	if (ret < 0)
+		return ret;
+	if (spec && mask)
+		fragment_offset_spec = spec->hdr.fragment_offset &
+				       mask->hdr.fragment_offset;
+	if (!fragment_offset_spec)
+		return 0;
+	/*
+	 * spec and mask are valid, enforce using full mask to make sure the
+	 * complete value is used correctly.
+	 */
+	if ((mask->hdr.fragment_offset & RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+			!= RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM_MASK,
+					  item, "must use full mask for"
+					  " fragment_offset");
+	/*
+	 * Match on fragment_offset 0x2000 means MF is 1 and frag-offset is 0,
+	 * indicating this is 1st fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(RTE_IPV4_HDR_MF_FLAG))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "match on first fragment not "
+					  "supported");
+	if (fragment_offset_spec && !last)
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "specified value not supported");
+	/* spec and last are valid, validate the specified range. */
+	fragment_offset_last = last->hdr.fragment_offset &
+			       mask->hdr.fragment_offset;
+	/*
+	 * Match on fragment_offset spec 0x2001 and last 0x3fff
+	 * means MF is 1 and frag-offset is > 0.
+	 * This packet is fragment 2nd and onward, excluding last.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(RTE_IPV4_HDR_MF_FLAG + 1) &&
+	    fragment_offset_last == RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on following "
+					  "fragments not supported");
+	/*
+	 * Match on fragment_offset spec 0x0001 and last 0x1fff
+	 * means MF is 0 and frag-offset is > 0.
+	 * This packet is last fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (fragment_offset_spec == RTE_BE16(1) &&
+	    fragment_offset_last == RTE_BE16(RTE_IPV4_HDR_OFFSET_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on last "
+					  "fragment not supported");
+	/*
+	 * Match on fragment_offset spec 0x0001 and last 0x3fff
+	 * means MF and/or frag-offset is not 0.
+	 * This is a fragmented packet.
+	 * Other range values are invalid and rejected.
+	 */
+	if (!(fragment_offset_spec == RTE_BE16(1) &&
+	      fragment_offset_last == RTE_BE16(MLX5_IPV4_FRAG_OFFSET_MASK)))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST, last,
+					  "specified range not supported");
+	return 0;
 }
 
 /**
@@ -5084,15 +5199,6 @@ struct field_modify_info modify_tcp[] = {
 			.dst_port = RTE_BE16(UINT16_MAX),
 		}
 	};
-	const struct rte_flow_item_ipv4 nic_ipv4_mask = {
-		.hdr = {
-			.src_addr = RTE_BE32(0xffffffff),
-			.dst_addr = RTE_BE32(0xffffffff),
-			.type_of_service = 0xff,
-			.next_proto_id = 0xff,
-			.time_to_live = 0xff,
-		},
-	};
 	const struct rte_flow_item_ipv6 nic_ipv6_mask = {
 		.hdr = {
 			.src_addr =
@@ -5192,11 +5298,9 @@ struct field_modify_info modify_tcp[] = {
 		case RTE_FLOW_ITEM_TYPE_IPV4:
 			mlx5_flow_tunnel_ip_check(items, next_protocol,
 						  &item_flags, &tunnel);
-			ret = mlx5_flow_validate_item_ipv4(items, item_flags,
-							   last_item,
-							   ether_type,
-							   &nic_ipv4_mask,
-							   error);
+			ret = flow_dv_validate_item_ipv4(items, item_flags,
+							 last_item, ether_type,
+							 error);
 			if (ret < 0)
 				return ret;
 			last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :
@@ -6296,6 +6400,10 @@ struct field_modify_info modify_tcp[] = {
 		 ipv4_m->hdr.time_to_live);
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ttl_hoplimit,
 		 ipv4_v->hdr.time_to_live & ipv4_m->hdr.time_to_live);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag,
+		 !!(ipv4_m->hdr.fragment_offset));
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
+		 !!(ipv4_v->hdr.fragment_offset & ipv4_m->hdr.fragment_offset));
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 62c18b8..276bcb5 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -1312,10 +1312,11 @@
 			}
 			break;
 		case RTE_FLOW_ITEM_TYPE_IPV4:
-			ret = mlx5_flow_validate_item_ipv4(items, item_flags,
-							   last_item,
-							   ether_type, NULL,
-							   error);
+			ret = mlx5_flow_validate_item_ipv4
+						(items, item_flags,
+						 last_item, ether_type, NULL,
+						 MLX5_ITEM_RANGE_NOT_ACCEPTED,
+						 error);
 			if (ret < 0)
 				return ret;
 			last_item = tunnel ? MLX5_FLOW_LAYER_INNER_L3_IPV4 :
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 08/11] net/mlx5: support match on IPv6 fragment packets
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
                           ` (6 preceding siblings ...)
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
@ 2020-10-12 10:43         ` Dekel Peled
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
                           ` (3 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:43 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch adds to MLX5 PMD the support of matching on IPv6
fragmented and non-fragmented packets, using the new field
frag_ext_exist, added to rte_flow following RFC [1].

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 08e6f74..49bfa5f 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -5211,6 +5211,7 @@ struct field_modify_info modify_tcp[] = {
 			.proto = 0xff,
 			.hop_limits = 0xff,
 		},
+		.frag_ext_exist = 1,
 	};
 	const struct rte_flow_item_ecpri nic_ecpri_mask = {
 		.hdr = {
@@ -6519,6 +6520,10 @@ struct field_modify_info modify_tcp[] = {
 		 ipv6_m->hdr.hop_limits);
 	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_ttl_hoplimit,
 		 ipv6_v->hdr.hop_limits & ipv6_m->hdr.hop_limits);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag,
+		 !!(ipv6_m->frag_ext_exist));
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag,
+		 !!(ipv6_v->frag_ext_exist & ipv6_m->frag_ext_exist));
 }
 
 /**
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 09/11] net/mlx5: support match on IPv6 fragment ext. item
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
                           ` (7 preceding siblings ...)
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 08/11] net/mlx5: support match on IPv6 " Dekel Peled
@ 2020-10-12 10:43         ` Dekel Peled
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
                           ` (2 subsequent siblings)
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:43 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch adds to MLX5 PMD the option to match on this item type.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.h    |   4 +
 drivers/net/mlx5/mlx5_flow_dv.c | 209 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 213 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 1e30c93..376519f 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -122,6 +122,10 @@ enum mlx5_feature_name {
 /* Pattern eCPRI Layer bit. */
 #define MLX5_FLOW_LAYER_ECPRI (UINT64_C(1) << 29)
 
+/* IPv6 Fragment Extension Header bit. */
+#define MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT (1u << 30)
+#define MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT (1u << 31)
+
 /* Outer Masks. */
 #define MLX5_FLOW_LAYER_OUTER_L3 \
 	(MLX5_FLOW_LAYER_OUTER_L3_IPV4 | MLX5_FLOW_LAYER_OUTER_L3_IPV6)
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 49bfa5f..e298918 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1901,6 +1901,120 @@ struct field_modify_info modify_tcp[] = {
 }
 
 /**
+ * Validate IPV6 fragment extension item.
+ *
+ * @param[in] item
+ *   Item specification.
+ * @param[in] item_flags
+ *   Bit-fields that holds the items detected until now.
+ * @param[out] error
+ *   Pointer to error structure.
+ *
+ * @return
+ *   0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+static int
+flow_dv_validate_item_ipv6_frag_ext(const struct rte_flow_item *item,
+				    uint64_t item_flags,
+				    struct rte_flow_error *error)
+{
+	const struct rte_flow_item_ipv6_frag_ext *spec = item->spec;
+	const struct rte_flow_item_ipv6_frag_ext *last = item->last;
+	const struct rte_flow_item_ipv6_frag_ext *mask = item->mask;
+	rte_be16_t frag_data_spec = 0;
+	rte_be16_t frag_data_last = 0;
+	const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
+	const uint64_t l4m = tunnel ? MLX5_FLOW_LAYER_INNER_L4 :
+				      MLX5_FLOW_LAYER_OUTER_L4;
+	int ret = 0;
+	struct rte_flow_item_ipv6_frag_ext nic_mask = {
+		.hdr = {
+			.next_header = 0xff,
+			.frag_data = RTE_BE16(0xffff),
+		},
+	};
+
+	if (item_flags & l4m)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "ipv6 fragment extension item cannot "
+					  "follow L4 item.");
+	if ((tunnel && !(item_flags & MLX5_FLOW_LAYER_INNER_L3_IPV6)) ||
+	    (!tunnel && !(item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV6)))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "ipv6 fragment extension item must "
+					  "follow ipv6 item");
+	if (spec && mask)
+		frag_data_spec = spec->hdr.frag_data & mask->hdr.frag_data;
+	if (!frag_data_spec)
+		return 0;
+	/*
+	 * spec and mask are valid, enforce using full mask to make sure the
+	 * complete value is used correctly.
+	 */
+	if ((mask->hdr.frag_data & RTE_BE16(RTE_IPV6_FRAG_USED_MASK)) !=
+				RTE_BE16(RTE_IPV6_FRAG_USED_MASK))
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM_MASK,
+					  item, "must use full mask for"
+					  " frag_data");
+	/*
+	 * Match on frag_data 0x00001 means M is 1 and frag-offset is 0.
+	 * This is 1st fragment of fragmented packet.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_MF_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "match on first fragment not "
+					  "supported");
+	if (frag_data_spec && !last)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ITEM, item,
+					  "specified value not supported");
+	ret = mlx5_flow_item_acceptable
+				(item, (const uint8_t *)mask,
+				 (const uint8_t *)&nic_mask,
+				 sizeof(struct rte_flow_item_ipv6_frag_ext),
+				 MLX5_ITEM_RANGE_ACCEPTED, error);
+	if (ret)
+		return ret;
+	/* spec and last are valid, validate the specified range. */
+	frag_data_last = last->hdr.frag_data & mask->hdr.frag_data;
+	/*
+	 * Match on frag_data spec 0x0009 and last 0xfff9
+	 * means M is 1 and frag-offset is > 0.
+	 * This packet is fragment 2nd and onward, excluding last.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_FO_ALIGN |
+				       RTE_IPV6_EHDR_MF_MASK) &&
+	    frag_data_last == RTE_BE16(RTE_IPV6_FRAG_USED_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on following "
+					  "fragments not supported");
+	/*
+	 * Match on frag_data spec 0x0008 and last 0xfff8
+	 * means M is 0 and frag-offset is > 0.
+	 * This packet is last fragment of fragmented packet.
+	 * This is not yet supported in MLX5, return appropriate
+	 * error message.
+	 */
+	if (frag_data_spec == RTE_BE16(RTE_IPV6_EHDR_FO_ALIGN) &&
+	    frag_data_last == RTE_BE16(RTE_IPV6_EHDR_FO_MASK))
+		return rte_flow_error_set(error, ENOTSUP,
+					  RTE_FLOW_ERROR_TYPE_ITEM_LAST,
+					  last, "match on last "
+					  "fragment not supported");
+	/* Other range values are invalid and rejected. */
+	return rte_flow_error_set(error, EINVAL,
+				  RTE_FLOW_ERROR_TYPE_ITEM_LAST, last,
+				  "specified range not supported");
+}
+
+/**
  * Validate the pop VLAN action.
  *
  * @param[in] dev
@@ -5349,6 +5463,29 @@ struct field_modify_info modify_tcp[] = {
 				next_protocol = 0xff;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT:
+			ret = flow_dv_validate_item_ipv6_frag_ext(items,
+								  item_flags,
+								  error);
+			if (ret < 0)
+				return ret;
+			last_item = tunnel ?
+					MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT :
+					MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT;
+			if (items->mask != NULL &&
+			    ((const struct rte_flow_item_ipv6_frag_ext *)
+			     items->mask)->hdr.next_header) {
+				next_protocol =
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->spec)->hdr.next_header;
+				next_protocol &=
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->mask)->hdr.next_header;
+			} else {
+				/* Reset for inner layer. */
+				next_protocol = 0xff;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			ret = mlx5_flow_validate_item_tcp
 						(items, item_flags,
@@ -6527,6 +6664,57 @@ struct field_modify_info modify_tcp[] = {
 }
 
 /**
+ * Add IPV6 fragment extension item to matcher and to the value.
+ *
+ * @param[in, out] matcher
+ *   Flow matcher.
+ * @param[in, out] key
+ *   Flow matcher value.
+ * @param[in] item
+ *   Flow pattern to translate.
+ * @param[in] inner
+ *   Item is inner pattern.
+ */
+static void
+flow_dv_translate_item_ipv6_frag_ext(void *matcher, void *key,
+				     const struct rte_flow_item *item,
+				     int inner)
+{
+	const struct rte_flow_item_ipv6_frag_ext *ipv6_frag_ext_m = item->mask;
+	const struct rte_flow_item_ipv6_frag_ext *ipv6_frag_ext_v = item->spec;
+	const struct rte_flow_item_ipv6_frag_ext nic_mask = {
+		.hdr = {
+			.next_header = 0xff,
+			.frag_data = RTE_BE16(0xffff),
+		},
+	};
+	void *headers_m;
+	void *headers_v;
+
+	if (inner) {
+		headers_m = MLX5_ADDR_OF(fte_match_param, matcher,
+					 inner_headers);
+		headers_v = MLX5_ADDR_OF(fte_match_param, key, inner_headers);
+	} else {
+		headers_m = MLX5_ADDR_OF(fte_match_param, matcher,
+					 outer_headers);
+		headers_v = MLX5_ADDR_OF(fte_match_param, key, outer_headers);
+	}
+	/* IPv6 fragment extension item exists, so packet is IP fragment. */
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, frag, 1);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, frag, 1);
+	if (!ipv6_frag_ext_v)
+		return;
+	if (!ipv6_frag_ext_m)
+		ipv6_frag_ext_m = &nic_mask;
+	MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol,
+		 ipv6_frag_ext_m->hdr.next_header);
+	MLX5_SET(fte_match_set_lyr_2_4, headers_v, ip_protocol,
+		 ipv6_frag_ext_v->hdr.next_header &
+		 ipv6_frag_ext_m->hdr.next_header);
+}
+
+/**
  * Add TCP item to matcher and to the value.
  *
  * @param[in, out] matcher
@@ -8881,6 +9069,27 @@ struct field_modify_info modify_tcp[] = {
 				next_protocol = 0xff;
 			}
 			break;
+		case RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT:
+			flow_dv_translate_item_ipv6_frag_ext(match_mask,
+							     match_value,
+							     items, tunnel);
+			last_item = tunnel ?
+					MLX5_FLOW_LAYER_INNER_L3_IPV6_FRAG_EXT :
+					MLX5_FLOW_LAYER_OUTER_L3_IPV6_FRAG_EXT;
+			if (items->mask != NULL &&
+			    ((const struct rte_flow_item_ipv6_frag_ext *)
+			     items->mask)->hdr.next_header) {
+				next_protocol =
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->spec)->hdr.next_header;
+				next_protocol &=
+				((const struct rte_flow_item_ipv6_frag_ext *)
+				 items->mask)->hdr.next_header;
+			} else {
+				/* Reset for inner layer. */
+				next_protocol = 0xff;
+			}
+			break;
 		case RTE_FLOW_ITEM_TYPE_TCP:
 			flow_dv_translate_item_tcp(match_mask, match_value,
 						   items, tunnel);
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 10/11] doc: update release notes for MLX5 L3 frag support
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
                           ` (8 preceding siblings ...)
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
@ 2020-10-12 10:43         ` Dekel Peled
  2020-10-12 19:29           ` Thomas Monjalon
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
  2020-10-13 13:32         ` [dpdk-dev] [PATCH v6 0/5] support match on L3 fragmented packets Dekel Peled
  11 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:43 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates 20.11 release notes with the changes included in
patches of this series:
1) MLX5 support of matching on IPv4/IPv6 fragmented/non-fragmented
   packets.
2) ABI change in ethdev struct rte_flow_item_ipv6.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 doc/guides/rel_notes/release_20_11.rst | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 35dd938..9894ad6 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -148,6 +148,11 @@ New Features
   * Extern objects and functions can be plugged into the pipeline.
   * Transaction-oriented table updates.
 
+* **Updated Mellanox mlx5 driver.**
+
+  Updated Mellanox mlx5 driver with new features and improvements, including:
+
+  * Added support for matching on fragmented/non-fragmented IPv4/IPv6 packets.
 
 Removed Items
 -------------
@@ -300,6 +305,11 @@ ABI Changes
 
   * ``ethdev`` internal functions are marked with ``__rte_internal`` tag.
 
+  * Added extensions' attributes to struct ``rte_flow_item_ipv6``.
+    A set of additional values added to struct, indicating the existence of
+    every defined extension header type.
+    Applications should use the new values for identification of existing
+    extensions in the packet header.
 
 Known Issues
 ------------
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v5 11/11] net/mlx5: enforce limitation on IPv6 next proto
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
                           ` (9 preceding siblings ...)
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
@ 2020-10-12 10:43         ` Dekel Peled
  2020-10-13 13:32         ` [dpdk-dev] [PATCH v6 0/5] support match on L3 fragmented packets Dekel Peled
  11 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-12 10:43 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

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 a174cdd..b7a4dce 100644
--- a/doc/guides/nics/mlx5.rst
+++ b/doc/guides/nics/mlx5.rst
@@ -311,6 +311,13 @@ Limitations
     for some NICs (such as ConnectX-6 Dx and BlueField 2).
     The capability bit ``scatter_fcs_w_decap_disable`` shows NIC support.
 
+- 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 38cfd0f..84931a3 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


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v5 10/11] doc: update release notes for MLX5 L3 frag support
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
@ 2020-10-12 19:29           ` Thomas Monjalon
  0 siblings, 0 replies; 101+ messages in thread
From: Thomas Monjalon @ 2020-10-12 19:29 UTC (permalink / raw)
  To: Dekel Peled
  Cc: orika, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo, dev

12/10/2020 12:43, Dekel Peled:
> This patch updates 20.11 release notes with the changes included in
> patches of this series:
> 1) MLX5 support of matching on IPv4/IPv6 fragmented/non-fragmented
>    packets.
> 2) ABI change in ethdev struct rte_flow_item_ipv6.
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> Acked-by: Ori Kam <orika@nvidia.com>

Please merge the release notes changes with the code changes
in the appropriate patches.



^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v5 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-10-12 20:41           ` Thomas Monjalon
  2020-10-13  8:22             ` Dekel Peled
  0 siblings, 1 reply; 101+ messages in thread
From: Thomas Monjalon @ 2020-10-12 20:41 UTC (permalink / raw)
  To: orika, Dekel Peled
  Cc: ferruh.yigit, arybchenko, konstantin.ananyev, olivier.matz,
	wenzhuo.lu, beilei.xing, bernard.iremonger, matan, shahafs,
	viacheslavo, dev, asafp

12/10/2020 12:43, Dekel Peled:
> - * Note: IPv6 options are handled by dedicated pattern items, see
> - * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
> + * Dedicated flags indicate existence of specific extension headers.
> + * Every type of extension header can use a dedicated pattern item, or
> + * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.

I don't understand this last sentence.

>   */
>  struct rte_flow_item_ipv6 {
>  	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
> +	uint32_t hop_ext_exist:1;
> +	/**< Hop-by-Hop Options extension header exists. */
> +	uint32_t rout_ext_exist:1;

"rout" looks weird. Would be "route" appropriate?

> +	/**< Routing extension header exists. */
> +	uint32_t frag_ext_exist:1;
> +	/**< Fragment extension header exists. */
> +	uint32_t auth_ext_exist:1;
> +	/**< Authentication extension header exists. */
> +	uint32_t esp_ext_exist:1;
> +	/**< Encapsulation Security Payload extension header exists. */
> +	uint32_t dest_ext_exist:1;
> +	/**< Destination Options extension header exists. */
> +	uint32_t mobil_ext_exist:1;
> +	/**< Mobility extension header exists. */
> +	uint32_t hip_ext_exist:1;
> +	/**< Host Identity Protocol extension header exists. */
> +	uint32_t shim6_ext_exist:1;
> +	/**< Shim6 Protocol extension header exists. */

About the field names, the "_exist" suffix is pretty clear,
but without being able to say why, I feel it is a strange name.
I was thinking about renaming the fields with a "has_" prefix.
Does it look better?



^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v5 02/11] ethdev: add IPv6 fragment extension header item
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-10-12 20:50           ` Thomas Monjalon
  2020-10-13  8:11             ` Dekel Peled
  0 siblings, 1 reply; 101+ messages in thread
From: Thomas Monjalon @ 2020-10-12 20:50 UTC (permalink / raw)
  To: Dekel Peled
  Cc: orika, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo, dev

12/10/2020 12:43, Dekel Peled:
> --- a/lib/librte_ip_frag/rte_ip_frag.h
> +++ b/lib/librte_ip_frag/rte_ip_frag.h
> +/* struct ipv6_extension_fragment moved to librte_net/rte_ip.h and renamed. */
> +#define ipv6_extension_fragment	rte_ipv6_fragment_ext

This struct name did not have rte_ prefix,
so I suggest deprecating it during next year.
Please Dekel, could you propose a deprecation notice later?



^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v5 02/11] ethdev: add IPv6 fragment extension header item
  2020-10-12 20:50           ` Thomas Monjalon
@ 2020-10-13  8:11             ` Dekel Peled
  0 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-13  8:11 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon
  Cc: Ori Kam, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger,
	Matan Azrad, Shahaf Shuler, Slava Ovsiienko, dev

Yes, thanks.

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Monday, October 12, 2020 11:50 PM
> To: Dekel Peled <dekelp@nvidia.com>
> Cc: Ori Kam <orika@nvidia.com>; ferruh.yigit@intel.com;
> arybchenko@solarflare.com; konstantin.ananyev@intel.com;
> olivier.matz@6wind.com; wenzhuo.lu@intel.com; beilei.xing@intel.com;
> bernard.iremonger@intel.com; Matan Azrad <matan@nvidia.com>; Shahaf
> Shuler <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v5 02/11] ethdev: add IPv6 fragment
> extension header item
> 
> 12/10/2020 12:43, Dekel Peled:
> > --- a/lib/librte_ip_frag/rte_ip_frag.h
> > +++ b/lib/librte_ip_frag/rte_ip_frag.h
> > +/* struct ipv6_extension_fragment moved to librte_net/rte_ip.h and
> renamed. */
> > +#define ipv6_extension_fragment	rte_ipv6_fragment_ext
> 
> This struct name did not have rte_ prefix, so I suggest deprecating it during
> next year.
> Please Dekel, could you propose a deprecation notice later?
> 


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v5 01/11] ethdev: add extensions attributes to IPv6 item
  2020-10-12 20:41           ` Thomas Monjalon
@ 2020-10-13  8:22             ` Dekel Peled
  0 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-13  8:22 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon, Ori Kam
  Cc: ferruh.yigit, arybchenko, konstantin.ananyev, olivier.matz,
	wenzhuo.lu, beilei.xing, bernard.iremonger, Matan Azrad,
	Shahaf Shuler, Slava Ovsiienko, dev, Asaf Penso

Thanks, PSB.

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Monday, October 12, 2020 11:42 PM
> To: Ori Kam <orika@nvidia.com>; Dekel Peled <dekelp@nvidia.com>
> Cc: ferruh.yigit@intel.com; arybchenko@solarflare.com;
> konstantin.ananyev@intel.com; olivier.matz@6wind.com;
> wenzhuo.lu@intel.com; beilei.xing@intel.com;
> bernard.iremonger@intel.com; Matan Azrad <matan@nvidia.com>; Shahaf
> Shuler <shahafs@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> dev@dpdk.org; Asaf Penso <asafp@nvidia.com>
> Subject: Re: [dpdk-dev] [PATCH v5 01/11] ethdev: add extensions attributes
> to IPv6 item
> 
> 12/10/2020 12:43, Dekel Peled:
> > - * Note: IPv6 options are handled by dedicated pattern items, see
> > - * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
> > + * Dedicated flags indicate existence of specific extension headers.
> > + * Every type of extension header can use a dedicated pattern item,
> > + or
> > + * the generic item RTE_FLOW_ITEM_TYPE_IPV6_EXT.
> 
> I don't understand this last sentence.

I'll rephrase.

> 
> >   */
> >  struct rte_flow_item_ipv6 {
> >  	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
> > +	uint32_t hop_ext_exist:1;
> > +	/**< Hop-by-Hop Options extension header exists. */
> > +	uint32_t rout_ext_exist:1;
> 
> "rout" looks weird. Would be "route" appropriate?

I'll change to "route".

> 
> > +	/**< Routing extension header exists. */
> > +	uint32_t frag_ext_exist:1;
> > +	/**< Fragment extension header exists. */
> > +	uint32_t auth_ext_exist:1;
> > +	/**< Authentication extension header exists. */
> > +	uint32_t esp_ext_exist:1;
> > +	/**< Encapsulation Security Payload extension header exists. */
> > +	uint32_t dest_ext_exist:1;
> > +	/**< Destination Options extension header exists. */
> > +	uint32_t mobil_ext_exist:1;
> > +	/**< Mobility extension header exists. */
> > +	uint32_t hip_ext_exist:1;
> > +	/**< Host Identity Protocol extension header exists. */
> > +	uint32_t shim6_ext_exist:1;
> > +	/**< Shim6 Protocol extension header exists. */
> 
> About the field names, the "_exist" suffix is pretty clear, but without being
> able to say why, I feel it is a strange name.
> I was thinking about renaming the fields with a "has_" prefix.
> Does it look better?

I'm afraid a "has_" prefix doesn't look appropriate IMHO.
I still prefer the "_exist" suffix.

> 


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v6 0/5] support match on L3 fragmented packets
  2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
                           ` (10 preceding siblings ...)
  2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
@ 2020-10-13 13:32         ` Dekel Peled
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 1/5] ethdev: add extensions attributes to IPv6 item Dekel Peled
                             ` (4 more replies)
  11 siblings, 5 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-13 13:32 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This series implements support of matching on packets based on the
fragmentation attribute of the packet, i.e. if packet is a fragment
of a larger packet, or the opposite - packet is not a fragment.

In ethdev, add API to support IPv6 extension headers, and specifically
the IPv6 fragment extension header item.
Testpmd CLI is updated accordingly.
Documentation is updated accordingly.

---
v2: add patch 'net/mlx5: enforce limitation on IPv6 next proto'
v3: update patch 'ethdev: add IPv6 fragment extension header item' to avoid ABI breakage.
v4: update rte_flow documentation to clarify use of IPv6 extension header flags.
v5: update following rebase on recent ICMP changes.
v6: - move MLX5 PMD patches to separate series.
    - rename IPv6 extension flags for clarity (e.g. frag_ext_exist renamed to has_frag_ext).
---

*** BLURB HERE ***

Dekel Peled (5):
  ethdev: add extensions attributes to IPv6 item
  ethdev: add IPv6 fragment extension header item
  app/testpmd: support IPv4 fragments
  app/testpmd: support IPv6 fragments
  app/testpmd: support IPv6 fragment extension item

 app/test-pmd/cmdline_flow.c            | 53 ++++++++++++++++++++++++++++++++++
 doc/guides/prog_guide/rte_flow.rst     | 32 ++++++++++++++++++--
 doc/guides/rel_notes/release_20_11.rst |  5 ++++
 lib/librte_ethdev/rte_flow.c           |  1 +
 lib/librte_ethdev/rte_flow.h           | 43 +++++++++++++++++++++++++--
 lib/librte_ip_frag/rte_ip_frag.h       | 26 ++---------------
 lib/librte_net/rte_ip.h                | 26 +++++++++++++++--
 7 files changed, 155 insertions(+), 31 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v6 1/5] ethdev: add extensions attributes to IPv6 item
  2020-10-13 13:32         ` [dpdk-dev] [PATCH v6 0/5] support match on L3 fragmented packets Dekel Peled
@ 2020-10-13 13:32           ` Dekel Peled
  2020-10-14 10:36             ` Thomas Monjalon
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 2/5] ethdev: add IPv6 fragment extension header item Dekel Peled
                             ` (3 subsequent siblings)
  4 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-13 13:32 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Using the current implementation of DPDK, an application cannot match on
IPv6 packets, based on the existing extension headers, in a simple way.

Field 'Next Header' in IPv6 header indicates type of the first extension
header only. Following extension headers can't be identified by
inspecting the IPv6 header.
As a result, the existence or absence of specific extension headers
can't be used for packet matching.

For example, fragmented IPv6 packets contain a dedicated extension header
(which is implemented in a later patch of this series).
Non-fragmented packets don't contain the fragment extension header.
For an application to match on non-fragmented IPv6 packets, the current
implementation doesn't provide a suitable solution.
Matching on the Next Header field is not sufficient, since additional
extension headers might be present in the same packet.
To match on fragmented IPv6 packets, the same difficulty exists.

This patch implements the update as detailed in RFC [1].
A set of additional values will be added to IPv6 header struct.
These values will indicate the existence of every defined extension
header type, providing simple means for identification of existing
extensions in the packet header.
Continuing the above example, fragmented packets can be identified using
the specific value indicating existence of fragment extension header.
To match on non-fragmented IPv6 packets, need to use has_frag_ext 0.
To match on fragmented IPv6 packets, need to use has_frag_ext 1.
To match on any IPv6 packets, the has_frag_ext field should
not be specified for match.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 doc/guides/prog_guide/rte_flow.rst     | 20 +++++++++++++++++---
 doc/guides/rel_notes/release_20_11.rst |  5 +++++
 lib/librte_ethdev/rte_flow.h           | 23 +++++++++++++++++++++--
 3 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 119b128..e0d7f42 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -946,11 +946,25 @@ Item: ``IPV6``
 
 Matches an IPv6 header.
 
-Note: IPv6 options are handled by dedicated pattern items, see `Item:
-IPV6_EXT`_.
+Dedicated flags indicate if header contains specific extension headers.
+To match on packets containing a specific extension header, an application
+should match on the dedicated flag set to 1.
+To match on packets not containing a specific extension header, an application
+should match on the dedicated flag clear to 0.
+In case application doesn't care about the existence of a specific extension
+header, it should not specify the dedicated flag for matching.
 
 - ``hdr``: IPv6 header definition (``rte_ip.h``).
-- Default ``mask`` matches source and destination addresses only.
+- ``has_hop_ext``: header contains Hop-by-Hop Options extension header.
+- ``has_route_ext``: header contains Routing extension header.
+- ``has_frag_ext``: header contains Fragment extension header.
+- ``has_auth_ext``: header contains Authentication extension header.
+- ``has_esp_ext``: header contains Encapsulation Security Payload extension header.
+- ``has_dest_ext``: header contains Destination Options extension header.
+- ``has_mobil_ext``: header contains Mobility extension header.
+- ``has_hip_ext``: header contains Host Identity Protocol extension header.
+- ``has_shim6_ext``: header contains Shim6 Protocol extension header.
+- Default ``mask`` matches ``hdr`` source and destination addresses only.
 
 Item: ``ICMP``
 ^^^^^^^^^^^^^^
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index bcc0fc2..a01552c 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -314,6 +314,11 @@ ABI Changes
 
   * ``ethdev`` internal functions are marked with ``__rte_internal`` tag.
 
+  * Added extensions' attributes to struct ``rte_flow_item_ipv6``.
+    A set of additional values added to struct, indicating the existence of
+    every defined extension header type.
+    Applications should use the new values for identification of existing
+    extensions in the packet header.
 
 Known Issues
 ------------
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index da8bfa5..33d2e8f 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -792,11 +792,30 @@ struct rte_flow_item_ipv4 {
  *
  * Matches an IPv6 header.
  *
- * Note: IPv6 options are handled by dedicated pattern items, see
- * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
+ * Dedicated flags indicate if header contains specific extension headers.
  */
 struct rte_flow_item_ipv6 {
 	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
+	uint32_t has_hop_ext:1;
+	/**< Header contains Hop-by-Hop Options extension header. */
+	uint32_t has_route_ext:1;
+	/**< Header contains Routing extension header. */
+	uint32_t has_frag_ext:1;
+	/**< Header contains Fragment extension header. */
+	uint32_t has_auth_ext:1;
+	/**< Header contains Authentication extension header. */
+	uint32_t has_esp_ext:1;
+	/**< Header contains Encapsulation Security Payload extension header. */
+	uint32_t has_dest_ext:1;
+	/**< Header contains Destination Options extension header. */
+	uint32_t has_mobil_ext:1;
+	/**< Header contains Mobility extension header. */
+	uint32_t has_hip_ext:1;
+	/**< Header contains Host Identity Protocol extension header. */
+	uint32_t has_shim6_ext:1;
+	/**< Header contains Shim6 Protocol extension header. */
+	uint32_t reserved:23;
+	/**< Reserved for future extension headers, must be zero. */
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v6 2/5] ethdev: add IPv6 fragment extension header item
  2020-10-13 13:32         ` [dpdk-dev] [PATCH v6 0/5] support match on L3 fragmented packets Dekel Peled
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 1/5] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-10-13 13:32           ` Dekel Peled
  2020-10-14 10:37             ` Thomas Monjalon
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 3/5] app/testpmd: support IPv4 fragments Dekel Peled
                             ` (2 subsequent siblings)
  4 siblings, 1 reply; 101+ messages in thread
From: Dekel Peled @ 2020-10-13 13:32 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Applications handling fragmented IPv6 packets need to match on IPv6
fragment extension header, in order to identify the fragments order
and location in the packet.
This patch introduces the IPv6 fragment extension header item,
proposed in [1].

Relevant definitions are moved from lib/librte_ip_frag/rte_ip_frag.h
to lib/librte_net/rte_ip.h, as they are needed for IPv6 header handling.
struct ipv6_extension_fragment renamed to rte_ipv6_fragment_ext to
adapt it to the common naming convention.

Default mask is not defined, since all fields are optional.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++
 lib/librte_ethdev/rte_flow.c       |  1 +
 lib/librte_ethdev/rte_flow.h       | 20 ++++++++++++++++++++
 lib/librte_ip_frag/rte_ip_frag.h   | 26 ++------------------------
 lib/librte_net/rte_ip.h            | 26 ++++++++++++++++++++++++--
 5 files changed, 59 insertions(+), 26 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index e0d7f42..b7b9744 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1191,6 +1191,18 @@ Normally preceded by any of:
 - `Item: IPV6`_
 - `Item: IPV6_EXT`_
 
+Item: ``IPV6_FRAG_EXT``
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches the presence of IPv6 fragment extension header.
+
+- ``hdr``: IPv6 fragment extension header definition (``rte_ip.h``).
+
+Normally preceded by any of:
+
+- `Item: IPV6`_
+- `Item: IPV6_EXT`_
+
 Item: ``ICMP6``
 ^^^^^^^^^^^^^^^
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 8d1b279..6239fbf 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -72,6 +72,7 @@ struct rte_flow_desc_data {
 	MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)),
 	MK_FLOW_ITEM(ARP_ETH_IPV4, sizeof(struct rte_flow_item_arp_eth_ipv4)),
 	MK_FLOW_ITEM(IPV6_EXT, sizeof(struct rte_flow_item_ipv6_ext)),
+	MK_FLOW_ITEM(IPV6_FRAG_EXT, sizeof(struct rte_flow_item_ipv6_frag_ext)),
 	MK_FLOW_ITEM(ICMP6, sizeof(struct rte_flow_item_icmp6)),
 	MK_FLOW_ITEM(ICMP6_ND_NS, sizeof(struct rte_flow_item_icmp6_nd_ns)),
 	MK_FLOW_ITEM(ICMP6_ND_NA, sizeof(struct rte_flow_item_icmp6_nd_na)),
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 33d2e8f..9a686f7 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -537,6 +537,12 @@ enum rte_flow_item_type {
 	 */
 	RTE_FLOW_ITEM_TYPE_ECPRI,
 
+	/**
+	 * Matches the presence of IPv6 fragment extension header.
+	 *
+	 * See struct rte_flow_item_ipv6_frag_ext.
+	 */
+	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
 };
 
 /**
@@ -1186,6 +1192,20 @@ struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
 #endif
 
 /**
+ * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
+ *
+ * Matches the presence of IPv6 fragment extension header.
+ *
+ * Preceded by any of:
+ *
+ * - RTE_FLOW_ITEM_TYPE_IPV6
+ * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
+ */
+struct rte_flow_item_ipv6_frag_ext {
+	struct rte_ipv6_fragment_ext hdr;
+};
+
+/**
  * RTE_FLOW_ITEM_TYPE_ICMP6
  *
  * Matches any ICMPv6 header.
diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h
index 66edd7e..0bfe64b 100644
--- a/lib/librte_ip_frag/rte_ip_frag.h
+++ b/lib/librte_ip_frag/rte_ip_frag.h
@@ -110,30 +110,8 @@ struct rte_ip_frag_tbl {
 	__extension__ struct ip_frag_pkt pkt[0]; /**< hash table. */
 };
 
-/** IPv6 fragment extension header */
-#define	RTE_IPV6_EHDR_MF_SHIFT			0
-#define	RTE_IPV6_EHDR_MF_MASK			1
-#define	RTE_IPV6_EHDR_FO_SHIFT			3
-#define	RTE_IPV6_EHDR_FO_MASK			(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
-#define	RTE_IPV6_EHDR_FO_ALIGN			(1 << RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_FRAG_USED_MASK			\
-	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
-
-#define RTE_IPV6_GET_MF(x)				((x) & RTE_IPV6_EHDR_MF_MASK)
-#define RTE_IPV6_GET_FO(x)				((x) >> RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
-	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
-
-struct ipv6_extension_fragment {
-	uint8_t next_header;            /**< Next header type */
-	uint8_t reserved;               /**< Reserved */
-	uint16_t frag_data;             /**< All fragmentation data */
-	uint32_t id;                    /**< Packet ID */
-} __rte_packed;
-
-
+/* struct ipv6_extension_fragment moved to librte_net/rte_ip.h and renamed. */
+#define ipv6_extension_fragment	rte_ipv6_fragment_ext
 
 /**
  * Create a new IP fragmentation table.
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index bb55ebb..fbf5575 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -461,8 +461,30 @@ struct rte_ipv6_hdr {
 	return (uint16_t)cksum;
 }
 
-/* IPv6 fragmentation header size */
-#define RTE_IPV6_FRAG_HDR_SIZE 8
+/** IPv6 fragment extension header. */
+#define	RTE_IPV6_EHDR_MF_SHIFT	0
+#define	RTE_IPV6_EHDR_MF_MASK	1
+#define	RTE_IPV6_EHDR_FO_SHIFT	3
+#define	RTE_IPV6_EHDR_FO_MASK	(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
+#define	RTE_IPV6_EHDR_FO_ALIGN	(1 << RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_FRAG_USED_MASK	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
+
+#define RTE_IPV6_GET_MF(x)	((x) & RTE_IPV6_EHDR_MF_MASK)
+#define RTE_IPV6_GET_FO(x)	((x) >> RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
+	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
+
+struct rte_ipv6_fragment_ext {
+	uint8_t next_header;	/**< Next header type */
+	uint8_t reserved;	/**< Reserved */
+	rte_be16_t frag_data;	/**< All fragmentation data */
+	rte_be32_t id;		/**< Packet ID */
+} __rte_packed;
+
+/* IPv6 fragment extension header size */
+#define RTE_IPV6_FRAG_HDR_SIZE	sizeof(struct rte_ipv6_fragment_ext)
 
 /**
  * Parse next IPv6 header extension
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v6 3/5] app/testpmd: support IPv4 fragments
  2020-10-13 13:32         ` [dpdk-dev] [PATCH v6 0/5] support match on L3 fragmented packets Dekel Peled
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 1/5] ethdev: add extensions attributes to IPv6 item Dekel Peled
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 2/5] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-10-13 13:32           ` Dekel Peled
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 4/5] app/testpmd: support IPv6 fragments Dekel Peled
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 5/5] app/testpmd: support IPv6 fragment extension item Dekel Peled
  4 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-13 13:32 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates testpmd CLI to support fragment_offset field of
IPv4 header item.

To match on non-fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 0 fragment_offset mask 0x3fff ...
To match on fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 1 fragment_offset last 0x3fff
fragment_offset mask 0x3fff ...
(Use the full available range 1 to 0x3fff to include all possible
values.)
To match on any IPv4 packets, fragmented and non-fragmented,
the fragment_offset field should not be specified for match.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 761ac5a..cfbf57b 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -130,6 +130,7 @@ enum index {
 	ITEM_VLAN_INNER_TYPE,
 	ITEM_IPV4,
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -874,6 +875,7 @@ struct parse_action_priv {
 
 static const enum index item_ipv4[] = {
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -2098,6 +2100,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
 					     hdr.type_of_service)),
 	},
+	[ITEM_IPV4_FRAGMENT_OFFSET] = {
+		.name = "fragment_offset",
+		.help = "fragmentation flags and fragment offset",
+		.next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
+					     hdr.fragment_offset)),
+	},
 	[ITEM_IPV4_TTL] = {
 		.name = "ttl",
 		.help = "time to live",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v6 4/5] app/testpmd: support IPv6 fragments
  2020-10-13 13:32         ` [dpdk-dev] [PATCH v6 0/5] support match on L3 fragmented packets Dekel Peled
                             ` (2 preceding siblings ...)
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 3/5] app/testpmd: support IPv4 fragments Dekel Peled
@ 2020-10-13 13:32           ` Dekel Peled
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 5/5] app/testpmd: support IPv6 fragment extension item Dekel Peled
  4 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-13 13:32 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], introduced has_frag_ext field for
IPv6 header item, used to indicate match on fragmented/non-fragmented
packets.
This patch updates testpmd CLI to support the new field.

To match on non-fragmented IPv6 packets, need to use pattern:
... ipv6 has_frag_ext spec 0 has_frag_ext mask 1 ...
To match on fragmented IPv6 packets, need to use pattern:
... ipv6 has_frag_ext spec 1 has_frag_ext mask 1 ...
To match on any IPv6 packets, the has_frag_ext field should
not be specified for match.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index cfbf57b..d311b85 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -142,6 +142,7 @@ enum index {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_HAS_FRAG_EXT,
 	ITEM_ICMP,
 	ITEM_ICMP_TYPE,
 	ITEM_ICMP_CODE,
@@ -891,6 +892,7 @@ struct parse_action_priv {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_HAS_FRAG_EXT,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2186,6 +2188,13 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6,
 					     hdr.dst_addr)),
 	},
+	[ITEM_IPV6_HAS_FRAG_EXT] = {
+		.name = "has_frag_ext",
+		.help = "fragment packet attribute",
+		.next = NEXT(item_ipv6, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_ipv6,
+					   has_frag_ext, 1)),
+	},
 	[ITEM_ICMP] = {
 		.name = "icmp",
 		.help = "match ICMP header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v6 5/5] app/testpmd: support IPv6 fragment extension item
  2020-10-13 13:32         ` [dpdk-dev] [PATCH v6 0/5] support match on L3 fragmented packets Dekel Peled
                             ` (3 preceding siblings ...)
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 4/5] app/testpmd: support IPv6 fragments Dekel Peled
@ 2020-10-13 13:32           ` Dekel Peled
  4 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-13 13:32 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch updates testpmd CLI to support the new item and its fields.

To match on fragmented IPv6 packets, this item is added to pattern:
... ipv6 / ipv6_frag_ext ...

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index d311b85..75d2b56 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -196,6 +196,9 @@ enum index {
 	ITEM_ARP_ETH_IPV4_TPA,
 	ITEM_IPV6_EXT,
 	ITEM_IPV6_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT,
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
 	ITEM_ICMP6,
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -787,6 +790,7 @@ struct parse_action_priv {
 	ITEM_VXLAN_GPE,
 	ITEM_ARP_ETH_IPV4,
 	ITEM_IPV6_EXT,
+	ITEM_IPV6_FRAG_EXT,
 	ITEM_ICMP6,
 	ITEM_ICMP6_ND_NS,
 	ITEM_ICMP6_ND_NA,
@@ -1008,6 +1012,13 @@ struct parse_action_priv {
 	ZERO,
 };
 
+static const enum index item_ipv6_frag_ext[] = {
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_icmp6[] = {
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -2579,6 +2590,30 @@ static int comp_set_raw_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_ext,
 					     next_hdr)),
 	},
+	[ITEM_IPV6_FRAG_EXT] = {
+		.name = "ipv6_frag_ext",
+		.help = "match presence of IPv6 fragment extension header",
+		.priv = PRIV_ITEM(IPV6_FRAG_EXT,
+				sizeof(struct rte_flow_item_ipv6_frag_ext)),
+		.next = NEXT(item_ipv6_frag_ext),
+		.call = parse_vc,
+	},
+	[ITEM_IPV6_FRAG_EXT_NEXT_HDR] = {
+		.name = "next_hdr",
+		.help = "next header",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_ipv6_frag_ext,
+					hdr.next_header)),
+	},
+	[ITEM_IPV6_FRAG_EXT_FRAG_DATA] = {
+		.name = "frag_data",
+		.help = "Fragment flags and offset",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_frag_ext,
+					     hdr.frag_data)),
+	},
 	[ITEM_ICMP6] = {
 		.name = "icmp6",
 		.help = "match any ICMPv6 header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v6 1/5] ethdev: add extensions attributes to IPv6 item
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 1/5] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-10-14 10:36             ` Thomas Monjalon
  0 siblings, 0 replies; 101+ messages in thread
From: Thomas Monjalon @ 2020-10-14 10:36 UTC (permalink / raw)
  To: Dekel Peled
  Cc: orika, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo, dev

13/10/2020 15:32, Dekel Peled:
> --- a/doc/guides/rel_notes/release_20_11.rst
> +++ b/doc/guides/rel_notes/release_20_11.rst
> +  * Added extensions' attributes to struct ``rte_flow_item_ipv6``.
> +    A set of additional values added to struct, indicating the existence of
> +    every defined extension header type.
> +    Applications should use the new values for identification of existing
> +    extensions in the packet header.

You should remove the notice from doc/guides/rel_notes/deprecation.rst

With this change,
Acked-by: Thomas Monjalon <thomas@monjalon.net>



^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v6 2/5] ethdev: add IPv6 fragment extension header item
  2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 2/5] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-10-14 10:37             ` Thomas Monjalon
  0 siblings, 0 replies; 101+ messages in thread
From: Thomas Monjalon @ 2020-10-14 10:37 UTC (permalink / raw)
  To: Dekel Peled
  Cc: orika, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo, dev

13/10/2020 15:32, Dekel Peled:
> Applications handling fragmented IPv6 packets need to match on IPv6
> fragment extension header, in order to identify the fragments order
> and location in the packet.
> This patch introduces the IPv6 fragment extension header item,
> proposed in [1].
> 
> Relevant definitions are moved from lib/librte_ip_frag/rte_ip_frag.h
> to lib/librte_net/rte_ip.h, as they are needed for IPv6 header handling.
> struct ipv6_extension_fragment renamed to rte_ipv6_fragment_ext to
> adapt it to the common naming convention.
> 
> Default mask is not defined, since all fields are optional.
> 
> [1] http://mails.dpdk.org/archives/dev/2020-March/160255.html
> 
> Signed-off-by: Dekel Peled <dekelp@nvidia.com>
> Acked-by: Ori Kam <orika@nvidia.com>

Acked-by: Thomas Monjalon <thomas@monjalon.net>




^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets
  2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
                   ` (10 preceding siblings ...)
  2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
@ 2020-10-14 16:35 ` Dekel Peled
  2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 1/5] ethdev: add extensions attributes to IPv6 item Dekel Peled
                     ` (5 more replies)
  11 siblings, 6 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-14 16:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This series implements support of matching on packets based on the
fragmentation attribute of the packet, i.e. if packet is a fragment
of a larger packet, or the opposite - packet is not a fragment.

In ethdev, add API to support IPv6 extension headers, and specifically
the IPv6 fragment extension header item.
Testpmd CLI is updated accordingly.
Documentation is updated accordingly.

---
v2: add patch 'net/mlx5: enforce limitation on IPv6 next proto'
v3: update patch 'ethdev: add IPv6 fragment extension header item' to avoid ABI breakage.
v4: update rte_flow documentation to clarify use of IPv6 extension header flags.
v5: update following rebase on recent ICMP changes.
v6: - move MLX5 PMD patches to separate series.
    - rename IPv6 extension flags for clarity (e.g. frag_ext_exist renamed to has_frag_ext).
v7: remove the announcement from deprecation file.
---

Dekel Peled (5):
  ethdev: add extensions attributes to IPv6 item
  ethdev: add IPv6 fragment extension header item
  app/testpmd: support IPv4 fragments
  app/testpmd: support IPv6 fragments
  app/testpmd: support IPv6 fragment extension item

 app/test-pmd/cmdline_flow.c            | 53 ++++++++++++++++++++++++++++++++++
 doc/guides/prog_guide/rte_flow.rst     | 32 ++++++++++++++++++--
 doc/guides/rel_notes/deprecation.rst   |  5 ----
 doc/guides/rel_notes/release_20_11.rst |  5 ++++
 lib/librte_ethdev/rte_flow.c           |  1 +
 lib/librte_ethdev/rte_flow.h           | 43 +++++++++++++++++++++++++--
 lib/librte_ip_frag/rte_ip_frag.h       | 26 ++---------------
 lib/librte_net/rte_ip.h                | 26 +++++++++++++++--
 8 files changed, 155 insertions(+), 36 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v7 1/5] ethdev: add extensions attributes to IPv6 item
  2020-10-14 16:35 ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Dekel Peled
@ 2020-10-14 16:35   ` Dekel Peled
  2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 2/5] ethdev: add IPv6 fragment extension header item Dekel Peled
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-14 16:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Using the current implementation of DPDK, an application cannot match on
IPv6 packets, based on the existing extension headers, in a simple way.

Field 'Next Header' in IPv6 header indicates type of the first extension
header only. Following extension headers can't be identified by
inspecting the IPv6 header.
As a result, the existence or absence of specific extension headers
can't be used for packet matching.

For example, fragmented IPv6 packets contain a dedicated extension header
(which is implemented in a later patch of this series).
Non-fragmented packets don't contain the fragment extension header.
For an application to match on non-fragmented IPv6 packets, the current
implementation doesn't provide a suitable solution.
Matching on the Next Header field is not sufficient, since additional
extension headers might be present in the same packet.
To match on fragmented IPv6 packets, the same difficulty exists.

This patch implements the update as detailed in RFC [1].
A set of additional values will be added to IPv6 header struct.
These values will indicate the existence of every defined extension
header type, providing simple means for identification of existing
extensions in the packet header.
Continuing the above example, fragmented packets can be identified using
the specific value indicating existence of fragment extension header.
To match on non-fragmented IPv6 packets, need to use has_frag_ext 0.
To match on fragmented IPv6 packets, need to use has_frag_ext 1.
To match on any IPv6 packets, the has_frag_ext field should
not be specified for match.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
---
 doc/guides/prog_guide/rte_flow.rst     | 20 +++++++++++++++++---
 doc/guides/rel_notes/deprecation.rst   |  5 -----
 doc/guides/rel_notes/release_20_11.rst |  5 +++++
 lib/librte_ethdev/rte_flow.h           | 23 +++++++++++++++++++++--
 4 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index f26a6c2..97fdf2a 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -946,11 +946,25 @@ Item: ``IPV6``
 
 Matches an IPv6 header.
 
-Note: IPv6 options are handled by dedicated pattern items, see `Item:
-IPV6_EXT`_.
+Dedicated flags indicate if header contains specific extension headers.
+To match on packets containing a specific extension header, an application
+should match on the dedicated flag set to 1.
+To match on packets not containing a specific extension header, an application
+should match on the dedicated flag clear to 0.
+In case application doesn't care about the existence of a specific extension
+header, it should not specify the dedicated flag for matching.
 
 - ``hdr``: IPv6 header definition (``rte_ip.h``).
-- Default ``mask`` matches source and destination addresses only.
+- ``has_hop_ext``: header contains Hop-by-Hop Options extension header.
+- ``has_route_ext``: header contains Routing extension header.
+- ``has_frag_ext``: header contains Fragment extension header.
+- ``has_auth_ext``: header contains Authentication extension header.
+- ``has_esp_ext``: header contains Encapsulation Security Payload extension header.
+- ``has_dest_ext``: header contains Destination Options extension header.
+- ``has_mobil_ext``: header contains Mobility extension header.
+- ``has_hip_ext``: header contains Host Identity Protocol extension header.
+- ``has_shim6_ext``: header contains Shim6 Protocol extension header.
+- Default ``mask`` matches ``hdr`` source and destination addresses only.
 
 Item: ``ICMP``
 ^^^^^^^^^^^^^^
diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst
index 584e720..87a7c44 100644
--- a/doc/guides/rel_notes/deprecation.rst
+++ b/doc/guides/rel_notes/deprecation.rst
@@ -159,11 +159,6 @@ Deprecation Notices
   or absence of a VLAN header following the current header, as proposed in RFC
   https://mails.dpdk.org/archives/dev/2020-August/177536.html.
 
-* ethdev: The ``struct rte_flow_item_ipv6`` struct will be modified to include
-  additional values, indicating existence or absence of IPv6 extension headers
-  following the IPv6 header, as proposed in RFC
-  https://mails.dpdk.org/archives/dev/2020-August/177257.html.
-
 * security: The API ``rte_security_session_create`` takes only single mempool
   for session and session private data. So the application need to create
   mempool for twice the number of sessions needed and will also lead to
diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst
index 30db8f2..730e9df 100644
--- a/doc/guides/rel_notes/release_20_11.rst
+++ b/doc/guides/rel_notes/release_20_11.rst
@@ -351,6 +351,11 @@ ABI Changes
 
   * ``ethdev`` internal functions are marked with ``__rte_internal`` tag.
 
+  * Added extensions' attributes to struct ``rte_flow_item_ipv6``.
+    A set of additional values added to struct, indicating the existence of
+    every defined extension header type.
+    Applications should use the new values for identification of existing
+    extensions in the packet header.
 
 Known Issues
 ------------
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 3d5fb09..aa18925 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -792,11 +792,30 @@ struct rte_flow_item_ipv4 {
  *
  * Matches an IPv6 header.
  *
- * Note: IPv6 options are handled by dedicated pattern items, see
- * RTE_FLOW_ITEM_TYPE_IPV6_EXT.
+ * Dedicated flags indicate if header contains specific extension headers.
  */
 struct rte_flow_item_ipv6 {
 	struct rte_ipv6_hdr hdr; /**< IPv6 header definition. */
+	uint32_t has_hop_ext:1;
+	/**< Header contains Hop-by-Hop Options extension header. */
+	uint32_t has_route_ext:1;
+	/**< Header contains Routing extension header. */
+	uint32_t has_frag_ext:1;
+	/**< Header contains Fragment extension header. */
+	uint32_t has_auth_ext:1;
+	/**< Header contains Authentication extension header. */
+	uint32_t has_esp_ext:1;
+	/**< Header contains Encapsulation Security Payload extension header. */
+	uint32_t has_dest_ext:1;
+	/**< Header contains Destination Options extension header. */
+	uint32_t has_mobil_ext:1;
+	/**< Header contains Mobility extension header. */
+	uint32_t has_hip_ext:1;
+	/**< Header contains Host Identity Protocol extension header. */
+	uint32_t has_shim6_ext:1;
+	/**< Header contains Shim6 Protocol extension header. */
+	uint32_t reserved:23;
+	/**< Reserved for future extension headers, must be zero. */
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_IPV6. */
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v7 2/5] ethdev: add IPv6 fragment extension header item
  2020-10-14 16:35 ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Dekel Peled
  2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 1/5] ethdev: add extensions attributes to IPv6 item Dekel Peled
@ 2020-10-14 16:35   ` Dekel Peled
  2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 3/5] app/testpmd: support IPv4 fragments Dekel Peled
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-14 16:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

Applications handling fragmented IPv6 packets need to match on IPv6
fragment extension header, in order to identify the fragments order
and location in the packet.
This patch introduces the IPv6 fragment extension header item,
proposed in [1].

Relevant definitions are moved from lib/librte_ip_frag/rte_ip_frag.h
to lib/librte_net/rte_ip.h, as they are needed for IPv6 header handling.
struct ipv6_extension_fragment renamed to rte_ipv6_fragment_ext to
adapt it to the common naming convention.

Default mask is not defined, since all fields are optional.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
---
 doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++
 lib/librte_ethdev/rte_flow.c       |  1 +
 lib/librte_ethdev/rte_flow.h       | 20 ++++++++++++++++++++
 lib/librte_ip_frag/rte_ip_frag.h   | 26 ++------------------------
 lib/librte_net/rte_ip.h            | 26 ++++++++++++++++++++++++--
 5 files changed, 59 insertions(+), 26 deletions(-)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 97fdf2a..6c8fc0c 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1191,6 +1191,18 @@ Normally preceded by any of:
 - `Item: IPV6`_
 - `Item: IPV6_EXT`_
 
+Item: ``IPV6_FRAG_EXT``
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches the presence of IPv6 fragment extension header.
+
+- ``hdr``: IPv6 fragment extension header definition (``rte_ip.h``).
+
+Normally preceded by any of:
+
+- `Item: IPV6`_
+- `Item: IPV6_EXT`_
+
 Item: ``ICMP6``
 ^^^^^^^^^^^^^^^
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 0a8a7a2..e5ce82e 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -72,6 +72,7 @@ struct rte_flow_desc_data {
 	MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)),
 	MK_FLOW_ITEM(ARP_ETH_IPV4, sizeof(struct rte_flow_item_arp_eth_ipv4)),
 	MK_FLOW_ITEM(IPV6_EXT, sizeof(struct rte_flow_item_ipv6_ext)),
+	MK_FLOW_ITEM(IPV6_FRAG_EXT, sizeof(struct rte_flow_item_ipv6_frag_ext)),
 	MK_FLOW_ITEM(ICMP6, sizeof(struct rte_flow_item_icmp6)),
 	MK_FLOW_ITEM(ICMP6_ND_NS, sizeof(struct rte_flow_item_icmp6_nd_ns)),
 	MK_FLOW_ITEM(ICMP6_ND_NA, sizeof(struct rte_flow_item_icmp6_nd_na)),
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index aa18925..71d42f6 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -537,6 +537,12 @@ enum rte_flow_item_type {
 	 */
 	RTE_FLOW_ITEM_TYPE_ECPRI,
 
+	/**
+	 * Matches the presence of IPv6 fragment extension header.
+	 *
+	 * See struct rte_flow_item_ipv6_frag_ext.
+	 */
+	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
 };
 
 /**
@@ -1186,6 +1192,20 @@ struct rte_flow_item_ipv6_ext rte_flow_item_ipv6_ext_mask = {
 #endif
 
 /**
+ * RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT
+ *
+ * Matches the presence of IPv6 fragment extension header.
+ *
+ * Preceded by any of:
+ *
+ * - RTE_FLOW_ITEM_TYPE_IPV6
+ * - RTE_FLOW_ITEM_TYPE_IPV6_EXT
+ */
+struct rte_flow_item_ipv6_frag_ext {
+	struct rte_ipv6_fragment_ext hdr;
+};
+
+/**
  * RTE_FLOW_ITEM_TYPE_ICMP6
  *
  * Matches any ICMPv6 header.
diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h
index 66edd7e..0bfe64b 100644
--- a/lib/librte_ip_frag/rte_ip_frag.h
+++ b/lib/librte_ip_frag/rte_ip_frag.h
@@ -110,30 +110,8 @@ struct rte_ip_frag_tbl {
 	__extension__ struct ip_frag_pkt pkt[0]; /**< hash table. */
 };
 
-/** IPv6 fragment extension header */
-#define	RTE_IPV6_EHDR_MF_SHIFT			0
-#define	RTE_IPV6_EHDR_MF_MASK			1
-#define	RTE_IPV6_EHDR_FO_SHIFT			3
-#define	RTE_IPV6_EHDR_FO_MASK			(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
-#define	RTE_IPV6_EHDR_FO_ALIGN			(1 << RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_FRAG_USED_MASK			\
-	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
-
-#define RTE_IPV6_GET_MF(x)				((x) & RTE_IPV6_EHDR_MF_MASK)
-#define RTE_IPV6_GET_FO(x)				((x) >> RTE_IPV6_EHDR_FO_SHIFT)
-
-#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
-	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
-
-struct ipv6_extension_fragment {
-	uint8_t next_header;            /**< Next header type */
-	uint8_t reserved;               /**< Reserved */
-	uint16_t frag_data;             /**< All fragmentation data */
-	uint32_t id;                    /**< Packet ID */
-} __rte_packed;
-
-
+/* struct ipv6_extension_fragment moved to librte_net/rte_ip.h and renamed. */
+#define ipv6_extension_fragment	rte_ipv6_fragment_ext
 
 /**
  * Create a new IP fragmentation table.
diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index 8382d0f..21dd6fc 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -464,8 +464,30 @@ struct rte_ipv6_hdr {
 	return (uint16_t)cksum;
 }
 
-/* IPv6 fragmentation header size */
-#define RTE_IPV6_FRAG_HDR_SIZE 8
+/** IPv6 fragment extension header. */
+#define	RTE_IPV6_EHDR_MF_SHIFT	0
+#define	RTE_IPV6_EHDR_MF_MASK	1
+#define	RTE_IPV6_EHDR_FO_SHIFT	3
+#define	RTE_IPV6_EHDR_FO_MASK	(~((1 << RTE_IPV6_EHDR_FO_SHIFT) - 1))
+#define	RTE_IPV6_EHDR_FO_ALIGN	(1 << RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_FRAG_USED_MASK	(RTE_IPV6_EHDR_MF_MASK | RTE_IPV6_EHDR_FO_MASK)
+
+#define RTE_IPV6_GET_MF(x)	((x) & RTE_IPV6_EHDR_MF_MASK)
+#define RTE_IPV6_GET_FO(x)	((x) >> RTE_IPV6_EHDR_FO_SHIFT)
+
+#define RTE_IPV6_SET_FRAG_DATA(fo, mf)	\
+	(((fo) & RTE_IPV6_EHDR_FO_MASK) | ((mf) & RTE_IPV6_EHDR_MF_MASK))
+
+struct rte_ipv6_fragment_ext {
+	uint8_t next_header;	/**< Next header type */
+	uint8_t reserved;	/**< Reserved */
+	rte_be16_t frag_data;	/**< All fragmentation data */
+	rte_be32_t id;		/**< Packet ID */
+} __rte_packed;
+
+/* IPv6 fragment extension header size */
+#define RTE_IPV6_FRAG_HDR_SIZE	sizeof(struct rte_ipv6_fragment_ext)
 
 /**
  * Parse next IPv6 header extension
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v7 3/5] app/testpmd: support IPv4 fragments
  2020-10-14 16:35 ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Dekel Peled
  2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 1/5] ethdev: add extensions attributes to IPv6 item Dekel Peled
  2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 2/5] ethdev: add IPv6 fragment extension header item Dekel Peled
@ 2020-10-14 16:35   ` Dekel Peled
  2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 4/5] app/testpmd: support IPv6 fragments Dekel Peled
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-14 16:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

This patch updates testpmd CLI to support fragment_offset field of
IPv4 header item.

To match on non-fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 0 fragment_offset mask 0x3fff ...
To match on fragmented IPv4 packets, need to use pattern:
... ipv4 fragment_offset spec 1 fragment_offset last 0x3fff
fragment_offset mask 0x3fff ...
(Use the full available range 1 to 0x3fff to include all possible
values.)
To match on any IPv4 packets, fragmented and non-fragmented,
the fragment_offset field should not be specified for match.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 32a9214..5c224d6 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -132,6 +132,7 @@ enum index {
 	ITEM_VLAN_INNER_TYPE,
 	ITEM_IPV4,
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -898,6 +899,7 @@ struct parse_action_priv {
 
 static const enum index item_ipv4[] = {
 	ITEM_IPV4_TOS,
+	ITEM_IPV4_FRAGMENT_OFFSET,
 	ITEM_IPV4_TTL,
 	ITEM_IPV4_PROTO,
 	ITEM_IPV4_SRC,
@@ -2154,6 +2156,13 @@ static int comp_set_sample_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
 					     hdr.type_of_service)),
 	},
+	[ITEM_IPV4_FRAGMENT_OFFSET] = {
+		.name = "fragment_offset",
+		.help = "fragmentation flags and fragment offset",
+		.next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4,
+					     hdr.fragment_offset)),
+	},
 	[ITEM_IPV4_TTL] = {
 		.name = "ttl",
 		.help = "time to live",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v7 4/5] app/testpmd: support IPv6 fragments
  2020-10-14 16:35 ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Dekel Peled
                     ` (2 preceding siblings ...)
  2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 3/5] app/testpmd: support IPv4 fragments Dekel Peled
@ 2020-10-14 16:35   ` Dekel Peled
  2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 5/5] app/testpmd: support IPv6 fragment extension item Dekel Peled
  2020-10-14 17:18   ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Ferruh Yigit
  5 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-14 16:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], introduced has_frag_ext field for
IPv6 header item, used to indicate match on fragmented/non-fragmented
packets.
This patch updates testpmd CLI to support the new field.

To match on non-fragmented IPv6 packets, need to use pattern:
... ipv6 has_frag_ext spec 0 has_frag_ext mask 1 ...
To match on fragmented IPv6 packets, need to use pattern:
... ipv6 has_frag_ext spec 1 has_frag_ext mask 1 ...
To match on any IPv6 packets, the has_frag_ext field should
not be specified for match.

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 5c224d6..9be1f64 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -144,6 +144,7 @@ enum index {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_HAS_FRAG_EXT,
 	ITEM_ICMP,
 	ITEM_ICMP_TYPE,
 	ITEM_ICMP_CODE,
@@ -915,6 +916,7 @@ struct parse_action_priv {
 	ITEM_IPV6_HOP,
 	ITEM_IPV6_SRC,
 	ITEM_IPV6_DST,
+	ITEM_IPV6_HAS_FRAG_EXT,
 	ITEM_NEXT,
 	ZERO,
 };
@@ -2242,6 +2244,13 @@ static int comp_set_sample_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6,
 					     hdr.dst_addr)),
 	},
+	[ITEM_IPV6_HAS_FRAG_EXT] = {
+		.name = "has_frag_ext",
+		.help = "fragment packet attribute",
+		.next = NEXT(item_ipv6, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_BF(struct rte_flow_item_ipv6,
+					   has_frag_ext, 1)),
+	},
 	[ITEM_ICMP] = {
 		.name = "icmp",
 		.help = "match ICMP header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* [dpdk-dev] [PATCH v7 5/5] app/testpmd: support IPv6 fragment extension item
  2020-10-14 16:35 ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Dekel Peled
                     ` (3 preceding siblings ...)
  2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 4/5] app/testpmd: support IPv6 fragments Dekel Peled
@ 2020-10-14 16:35   ` Dekel Peled
  2020-10-14 17:18   ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Ferruh Yigit
  5 siblings, 0 replies; 101+ messages in thread
From: Dekel Peled @ 2020-10-14 16:35 UTC (permalink / raw)
  To: orika, thomas, ferruh.yigit, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch updates testpmd CLI to support the new item and its fields.

To match on fragmented IPv6 packets, this item is added to pattern:
... ipv6 / ipv6_frag_ext ...

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 9be1f64..c4796c3 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -198,6 +198,9 @@ enum index {
 	ITEM_ARP_ETH_IPV4_TPA,
 	ITEM_IPV6_EXT,
 	ITEM_IPV6_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT,
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
 	ITEM_ICMP6,
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -811,6 +814,7 @@ struct parse_action_priv {
 	ITEM_VXLAN_GPE,
 	ITEM_ARP_ETH_IPV4,
 	ITEM_IPV6_EXT,
+	ITEM_IPV6_FRAG_EXT,
 	ITEM_ICMP6,
 	ITEM_ICMP6_ND_NS,
 	ITEM_ICMP6_ND_NA,
@@ -1032,6 +1036,13 @@ struct parse_action_priv {
 	ZERO,
 };
 
+static const enum index item_ipv6_frag_ext[] = {
+	ITEM_IPV6_FRAG_EXT_NEXT_HDR,
+	ITEM_IPV6_FRAG_EXT_FRAG_DATA,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index item_icmp6[] = {
 	ITEM_ICMP6_TYPE,
 	ITEM_ICMP6_CODE,
@@ -2635,6 +2646,30 @@ static int comp_set_sample_index(struct context *, const struct token *,
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_ext,
 					     next_hdr)),
 	},
+	[ITEM_IPV6_FRAG_EXT] = {
+		.name = "ipv6_frag_ext",
+		.help = "match presence of IPv6 fragment extension header",
+		.priv = PRIV_ITEM(IPV6_FRAG_EXT,
+				sizeof(struct rte_flow_item_ipv6_frag_ext)),
+		.next = NEXT(item_ipv6_frag_ext),
+		.call = parse_vc,
+	},
+	[ITEM_IPV6_FRAG_EXT_NEXT_HDR] = {
+		.name = "next_hdr",
+		.help = "next header",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_ipv6_frag_ext,
+					hdr.next_header)),
+	},
+	[ITEM_IPV6_FRAG_EXT_FRAG_DATA] = {
+		.name = "frag_data",
+		.help = "Fragment flags and offset",
+		.next = NEXT(item_ipv6_frag_ext, NEXT_ENTRY(UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6_frag_ext,
+					     hdr.frag_data)),
+	},
 	[ITEM_ICMP6] = {
 		.name = "icmp6",
 		.help = "match any ICMPv6 header",
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 101+ messages in thread

* Re: [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets
  2020-10-14 16:35 ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Dekel Peled
                     ` (4 preceding siblings ...)
  2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 5/5] app/testpmd: support IPv6 fragment extension item Dekel Peled
@ 2020-10-14 17:18   ` Ferruh Yigit
  5 siblings, 0 replies; 101+ messages in thread
From: Ferruh Yigit @ 2020-10-14 17:18 UTC (permalink / raw)
  To: Dekel Peled, orika, thomas, arybchenko, konstantin.ananyev,
	olivier.matz, wenzhuo.lu, beilei.xing, bernard.iremonger, matan,
	shahafs, viacheslavo
  Cc: dev

On 10/14/2020 5:35 PM, Dekel Peled wrote:
> This series implements support of matching on packets based on the
> fragmentation attribute of the packet, i.e. if packet is a fragment
> of a larger packet, or the opposite - packet is not a fragment.
> 
> In ethdev, add API to support IPv6 extension headers, and specifically
> the IPv6 fragment extension header item.
> Testpmd CLI is updated accordingly.
> Documentation is updated accordingly.
> 
> ---
> v2: add patch 'net/mlx5: enforce limitation on IPv6 next proto'
> v3: update patch 'ethdev: add IPv6 fragment extension header item' to avoid ABI breakage.
> v4: update rte_flow documentation to clarify use of IPv6 extension header flags.
> v5: update following rebase on recent ICMP changes.
> v6: - move MLX5 PMD patches to separate series.
>      - rename IPv6 extension flags for clarity (e.g. frag_ext_exist renamed to has_frag_ext).
> v7: remove the announcement from deprecation file.
> ---
> 
> Dekel Peled (5):
>    ethdev: add extensions attributes to IPv6 item
>    ethdev: add IPv6 fragment extension header item
>    app/testpmd: support IPv4 fragments
>    app/testpmd: support IPv6 fragments
>    app/testpmd: support IPv6 fragment extension item
> 

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 101+ messages in thread

end of thread, other threads:[~2020-10-14 17:19 UTC | newest]

Thread overview: 101+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30 14:10 [dpdk-dev] [PATCH 00/10] support match on L3 fragmented packets Dekel Peled
2020-09-30 14:10 ` [dpdk-dev] [PATCH 01/10] ethdev: add extensions attributes to IPv6 item Dekel Peled
2020-09-30 14:54   ` Ori Kam
2020-09-30 14:10 ` [dpdk-dev] [PATCH 02/10] ethdev: add IPv6 fragment extension header item Dekel Peled
2020-09-30 14:55   ` Ori Kam
2020-09-30 14:10 ` [dpdk-dev] [PATCH 03/10] app/testpmd: support IPv4 fragments Dekel Peled
2020-09-30 14:54   ` Ori Kam
2020-09-30 14:10 ` [dpdk-dev] [PATCH 04/10] app/testpmd: support IPv6 fragments Dekel Peled
2020-09-30 14:10 ` [dpdk-dev] [PATCH 05/10] app/testpmd: support IPv6 fragment extension item Dekel Peled
2020-09-30 14:56   ` Ori Kam
2020-09-30 14:10 ` [dpdk-dev] [PATCH 06/10] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
2020-09-30 14:10 ` [dpdk-dev] [PATCH 07/10] net/mlx5: support match on IPv4 fragment packets Dekel Peled
2020-09-30 14:10 ` [dpdk-dev] [PATCH 08/10] net/mlx5: support match on IPv6 " Dekel Peled
2020-09-30 14:10 ` [dpdk-dev] [PATCH 09/10] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
2020-09-30 14:10 ` [dpdk-dev] [PATCH 10/10] doc: update release notes for MLX5 L3 frag support Dekel Peled
2020-10-01 21:14 ` [dpdk-dev] [PATCH v2 00/11] support match on L3 fragmented packets Dekel Peled
2020-10-01 21:14   ` [dpdk-dev] [PATCH v2 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
2020-10-04 13:45     ` Ori Kam
2020-10-01 21:14   ` [dpdk-dev] [PATCH v2 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
2020-10-01 21:27     ` Stephen Hemminger
2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 03/11] app/testpmd: support IPv4 fragments Dekel Peled
2020-10-04 13:47     ` Ori Kam
2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 04/11] app/testpmd: support IPv6 fragments Dekel Peled
2020-10-04 13:49     ` Ori Kam
2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
2020-10-04 13:47     ` Ori Kam
2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
2020-10-04 13:49     ` Ori Kam
2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
2020-10-04 13:48     ` Ori Kam
2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 08/11] net/mlx5: support match on IPv6 " Dekel Peled
2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
2020-10-04 13:51     ` Ori Kam
2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
2020-10-04 13:55     ` Ori Kam
2020-10-01 21:15   ` [dpdk-dev] [PATCH v2 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
2020-10-04 13:55     ` Ori Kam
2020-10-05  8:35   ` [dpdk-dev] [PATCH v3 00/11] support match on L3 fragmented packets Dekel Peled
2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
2020-10-06 23:43       ` Ajit Khaparde
2020-10-07  6:59         ` Dekel Peled
2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
2020-10-05  8:50       ` Ori Kam
2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 03/11] app/testpmd: support IPv4 fragments Dekel Peled
2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 04/11] app/testpmd: support IPv6 fragments Dekel Peled
2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 08/11] net/mlx5: support match on IPv6 " Dekel Peled
2020-10-05  8:51       ` Ori Kam
2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
2020-10-05  8:35     ` [dpdk-dev] [PATCH v3 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
2020-10-07 10:53     ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Dekel Peled
2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
2020-10-08  3:14         ` Ajit Khaparde
2020-10-08  7:03           ` Dekel Peled
2020-10-08 18:28         ` Ajit Khaparde
2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 03/11] app/testpmd: support IPv4 fragments Dekel Peled
2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 04/11] app/testpmd: support IPv6 fragments Dekel Peled
2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 08/11] net/mlx5: support match on IPv6 " Dekel Peled
2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
2020-10-07 10:54       ` [dpdk-dev] [PATCH v4 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
2020-10-07 11:15       ` [dpdk-dev] [PATCH v4 00/11] support match on L3 fragmented packets Ori Kam
2020-10-12 10:42       ` [dpdk-dev] [PATCH v5 " Dekel Peled
2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 01/11] ethdev: add extensions attributes to IPv6 item Dekel Peled
2020-10-12 20:41           ` Thomas Monjalon
2020-10-13  8:22             ` Dekel Peled
2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 02/11] ethdev: add IPv6 fragment extension header item Dekel Peled
2020-10-12 20:50           ` Thomas Monjalon
2020-10-13  8:11             ` Dekel Peled
2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 03/11] app/testpmd: support IPv4 fragments Dekel Peled
2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 04/11] app/testpmd: support IPv6 fragments Dekel Peled
2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 05/11] app/testpmd: support IPv6 fragment extension item Dekel Peled
2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 06/11] net/mlx5: remove handling of ICMP fragmented packets Dekel Peled
2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 07/11] net/mlx5: support match on IPv4 fragment packets Dekel Peled
2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 08/11] net/mlx5: support match on IPv6 " Dekel Peled
2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 09/11] net/mlx5: support match on IPv6 fragment ext. item Dekel Peled
2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 10/11] doc: update release notes for MLX5 L3 frag support Dekel Peled
2020-10-12 19:29           ` Thomas Monjalon
2020-10-12 10:43         ` [dpdk-dev] [PATCH v5 11/11] net/mlx5: enforce limitation on IPv6 next proto Dekel Peled
2020-10-13 13:32         ` [dpdk-dev] [PATCH v6 0/5] support match on L3 fragmented packets Dekel Peled
2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 1/5] ethdev: add extensions attributes to IPv6 item Dekel Peled
2020-10-14 10:36             ` Thomas Monjalon
2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 2/5] ethdev: add IPv6 fragment extension header item Dekel Peled
2020-10-14 10:37             ` Thomas Monjalon
2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 3/5] app/testpmd: support IPv4 fragments Dekel Peled
2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 4/5] app/testpmd: support IPv6 fragments Dekel Peled
2020-10-13 13:32           ` [dpdk-dev] [PATCH v6 5/5] app/testpmd: support IPv6 fragment extension item Dekel Peled
2020-10-14 16:35 ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Dekel Peled
2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 1/5] ethdev: add extensions attributes to IPv6 item Dekel Peled
2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 2/5] ethdev: add IPv6 fragment extension header item Dekel Peled
2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 3/5] app/testpmd: support IPv4 fragments Dekel Peled
2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 4/5] app/testpmd: support IPv6 fragments Dekel Peled
2020-10-14 16:35   ` [dpdk-dev] [PATCH v7 5/5] app/testpmd: support IPv6 fragment extension item Dekel Peled
2020-10-14 17:18   ` [dpdk-dev] [PATCH v7 0/5] support match on L3 fragmented packets Ferruh Yigit

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).