]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: support GRE optional fields
authorSean Zhang <xiazhang@nvidia.com>
Fri, 11 Feb 2022 01:45:28 +0000 (03:45 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 11 Feb 2022 15:51:59 +0000 (16:51 +0100)
Add flow pattern items and header format for matching optional fields
(checksum/key/sequence) in GRE header. And the flags in gre item should
be correspondingly set with the new added items.

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
doc/guides/prog_guide/rte_flow.rst
doc/guides/rel_notes/release_22_03.rst
lib/ethdev/rte_flow.c
lib/ethdev/rte_flow.h

index b4aa9c47c20e575ef7f166c1ccd4e643fa564178..0e475019a62a8f8635f6c68ed5e15f91aaa46223 100644 (file)
@@ -1106,6 +1106,7 @@ Matches a GRE header.
 
 Item: ``GRE_KEY``
 ^^^^^^^^^^^^^^^^^
+This action is deprecated. Consider `Item: GRE_OPTION`.
 
 Matches a GRE key field.
 This should be preceded by item ``GRE``.
@@ -1113,6 +1114,22 @@ This should be preceded by item ``GRE``.
 - Value to be matched is a big-endian 32 bit integer.
 - When this item present it implicitly match K bit in default mask as "1"
 
+Item: ``GRE_OPTION``
+^^^^^^^^^^^^^^^^^^^^
+
+Matches a GRE optional fields (checksum/key/sequence).
+This should be preceded by item ``GRE``.
+
+- ``checksum``: checksum.
+- ``key``: key.
+- ``sequence``: sequence.
+- The items in GRE_OPTION do not change bit flags(c_bit/k_bit/s_bit) in GRE
+  item. The bit flags need be set with GRE item by application. When the items
+  present, the corresponding bits in GRE spec and mask should be set "1" by
+  application, it means to match specified value of the fields. When the items
+  no present, but the corresponding bits in GRE spec and mask is "1", it means
+  to match any value of the fields.
+
 Item: ``FUZZY``
 ^^^^^^^^^^^^^^^
 
index 3b24affb9917e9601f3daaef7a32197127a0ede7..6ca70ffe32b0c88b8caad1a90b15c64167b6d046 100644 (file)
@@ -71,6 +71,11 @@ New Features
     - ``rte_ipv6_udptcp_cksum_mbuf()``
     - ``rte_ipv6_udptcp_cksum_mbuf_verify()``
 
+* **Added rte_flow support for matching GRE optional fields.**
+
+  Added ``gre_option`` item in rte_flow to support checksum/key/sequence
+  matching in GRE packets.
+
 * **Added new RSS offload types for L2TPv2 in RSS flow.**
 
   Added macro RTE_ETH_RSS_L2TPV2, now L2TPv2 session ID field can be used as
index a93f68abbc1634fa90654917cc92bd47cfddce1c..7f93900bc8252a4ad05314ded9cf317a079982ad 100644 (file)
@@ -139,6 +139,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
        MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)),
        MK_FLOW_ITEM(TAG, sizeof(struct rte_flow_item_tag)),
        MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)),
+       MK_FLOW_ITEM(GRE_OPTION, sizeof(struct rte_flow_item_gre_opt)),
        MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)),
        MK_FLOW_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)),
        MK_FLOW_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)),
index 1031fb246b8bf0529633b1b9530542ac3a921f57..765beb3e524267b16e28f9d9025446e216908439 100644 (file)
@@ -37,6 +37,7 @@
 #include <rte_gtp.h>
 #include <rte_l2tpv2.h>
 #include <rte_ppp.h>
+#include <rte_gre.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -660,6 +661,13 @@ enum rte_flow_item_type {
         * See struct rte_flow_item_ppp.
         */
        RTE_FLOW_ITEM_TYPE_PPP,
+
+       /**
+        * Matches GRE optional fields.
+        *
+        * See struct rte_flow_item_gre_opt.
+        */
+       RTE_FLOW_ITEM_TYPE_GRE_OPTION,
 };
 
 /**
@@ -1195,6 +1203,17 @@ static const struct rte_flow_item_gre rte_flow_item_gre_mask = {
 };
 #endif
 
+/**
+ * RTE_FLOW_ITEM_TYPE_GRE_OPTION.
+ *
+ * Matches GRE optional fields in header.
+ */
+struct rte_flow_item_gre_opt {
+       struct rte_gre_hdr_opt_checksum_rsvd checksum_rsvd;
+       struct rte_gre_hdr_opt_key key;
+       struct rte_gre_hdr_opt_sequence sequence;
+};
+
 /**
  * RTE_FLOW_ITEM_TYPE_FUZZY
  *