[dpdk-dev] [RFC] ethdev: add IPv6 fragment extension header item

Dekel Peled dekelp at mellanox.com
Wed Mar 18 17:46:00 CET 2020


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 RFC introduced the IPv6 fragment extension header item.


Signed-off-by: Dekel Peled <dekelp at mellanox.com<mailto:dekelp at mellanox.com>>

---
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 41c1479..fd8d5b7 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1170,6 +1170,19 @@ 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_frag.h``).
+- Default ``mask`` matches next_header and frag_data fields only.
+
+Preceded by any of:
+
+- `Item: IPV6`_
+- `Item: IPV6_EXT`_
+
 Item: ``ICMP6``
 ^^^^^^^^^^^^^^^

diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index b43238b..7f30a09 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -30,6 +30,7 @@
 #include <rte_higig.h>
 #include <rte_mbuf.h>
 #include <rte_mbuf_dyn.h>
+#include <rte_ip_frag.h>

 #ifdef __cplusplus
 extern "C" {
@@ -367,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.
@@ -1149,6 +1157,31 @@ 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 ipv6_extension_fragment hdr;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT. */
+#ifndef __cplusplus
+static const
+struct rte_flow_item_ipv6_frag_ext rte_flow_item_ipv6_frag_ext_mask = {
+       .hdr = {
+               .next_header = 0xff,
+               .frag_data = RTE_BE16(0xffff),
+       },
+};
+#endif
+
+/**
  * RTE_FLOW_ITEM_TYPE_ICMP6
  *
  * Matches any ICMPv6 header.


More information about the dev mailing list