ethdev: introduce GENEVE header TLV option item
authorShiri Kuzin <shirik@nvidia.com>
Sun, 17 Jan 2021 10:21:15 +0000 (12:21 +0200)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 19 Jan 2021 02:30:15 +0000 (03:30 +0100)
The Geneve tunneling protocol is designed to allow the
user to specify some data context on the packet.
The GENEVE TLV (Type-Length-Variable) Option
is the mean intended to present the user data.

In order to support GENEVE TLV Option the new rte_flow
item "rte_flow_item_geneve_opt" is added.
The new item contains the values and masks for the
following fields:
-option class
-option type
-length
-data

New item will be added to testpmd to support match and
raw encap/decap actions.

Signed-off-by: Shiri Kuzin <shirik@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
doc/guides/rel_notes/release_21_02.rst
lib/librte_ethdev/rte_flow.c
lib/librte_ethdev/rte_flow.h

index fa630b8..5a9317a 100644 (file)
@@ -60,6 +60,10 @@ New Features
   Added ``rte_eth_get_monitor_addr()``, to be used in conjunction with
   ``rte_power_monitor()`` to enable automatic power management for PMDs.
 
+* **Added GENEVE TLV option in rte_flow.**
+
+  Added support for matching and raw encap/decap of GENEVE TLV option.
+
 * **Updated Broadcom bnxt driver.**
 
   Updated the Broadcom bnxt driver with fixes and improvements, including:
index a06f64c..2af7d96 100644 (file)
@@ -97,6 +97,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
        MK_FLOW_ITEM(L2TPV3OIP, sizeof(struct rte_flow_item_l2tpv3oip)),
        MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
        MK_FLOW_ITEM(ECPRI, sizeof(struct rte_flow_item_ecpri)),
+       MK_FLOW_ITEM(GENEVE_OPT, sizeof(struct rte_flow_item_geneve_opt)),
 };
 
 /** Generate flow_action[] entry. */
index 0977a78..151e4d2 100644 (file)
@@ -543,6 +543,13 @@ enum rte_flow_item_type {
         * See struct rte_flow_item_ipv6_frag_ext.
         */
        RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
+
+       /**
+        * Matches Geneve Variable Length Option
+        *
+        * See struct rte_flow_item_geneve_opt
+        */
+       RTE_FLOW_ITEM_TYPE_GENEVE_OPT,
 };
 
 /**
@@ -1627,6 +1634,26 @@ static const struct rte_flow_item_ecpri rte_flow_item_ecpri_mask = {
 };
 #endif
 
+/**
+ * RTE_FLOW_ITEM_TYPE_GENEVE_OPT
+ *
+ * Matches a GENEVE Variable Length Option
+ */
+struct rte_flow_item_geneve_opt {
+       rte_be16_t option_class;
+       uint8_t option_type;
+       uint8_t option_len;
+       uint32_t *data;
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE_OPT. */
+#ifndef __cplusplus
+static const struct rte_flow_item_geneve_opt
+rte_flow_item_geneve_opt_mask = {
+       .option_type = 0xff,
+};
+#endif
+
 /**
  * Matching pattern item definition.
  *