ethdev: introduce new tunnel VXLAN-GPE
[dpdk.git] / lib / librte_ether / rte_flow.h
index 58b75e9..eecd1f5 100644 (file)
@@ -179,6 +179,16 @@ enum rte_flow_item_type {
         */
        RTE_FLOW_ITEM_TYPE_PHY_PORT,
 
+       /**
+        * [META]
+        *
+        * Matches traffic originating from (ingress) or going to (egress) a
+        * given DPDK port ID.
+        *
+        * See struct rte_flow_item_port_id.
+        */
+       RTE_FLOW_ITEM_TYPE_PORT_ID,
+
        /**
         * Matches a byte string of a given length at a given offset.
         *
@@ -329,6 +339,13 @@ enum rte_flow_item_type {
         * See struct rte_flow_item_geneve.
         */
        RTE_FLOW_ITEM_TYPE_GENEVE,
+
+       /**
+        * Matches a VXLAN-GPE header.
+        *
+        * See struct rte_flow_item_vxlan_gpe.
+        */
+       RTE_FLOW_ITEM_TYPE_VXLAN_GPE,
 };
 
 /**
@@ -413,6 +430,32 @@ static const struct rte_flow_item_phy_port rte_flow_item_phy_port_mask = {
 };
 #endif
 
+/**
+ * RTE_FLOW_ITEM_TYPE_PORT_ID
+ *
+ * Matches traffic originating from (ingress) or going to (egress) a given
+ * DPDK port ID.
+ *
+ * Normally only supported if the port ID in question is known by the
+ * underlying PMD and related to the device the flow rule is created
+ * against.
+ *
+ * This must not be confused with @p PHY_PORT which refers to the physical
+ * port of a device, whereas @p PORT_ID refers to a struct rte_eth_dev
+ * object on the application side (also known as "port representor"
+ * depending on the kind of underlying device).
+ */
+struct rte_flow_item_port_id {
+       uint32_t id; /**< DPDK port ID. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_PORT_ID. */
+#ifndef __cplusplus
+static const struct rte_flow_item_port_id rte_flow_item_port_id_mask = {
+       .id = 0xffffffff,
+};
+#endif
+
 /**
  * RTE_FLOW_ITEM_TYPE_RAW
  *
@@ -831,6 +874,26 @@ static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
 };
 #endif
 
+/**
+ * RTE_FLOW_ITEM_TYPE_VXLAN_GPE (draft-ietf-nvo3-vxlan-gpe-05).
+ *
+ * Matches a VXLAN-GPE header.
+ */
+struct rte_flow_item_vxlan_gpe {
+       uint8_t flags; /**< Normally 0x0c (I and P flags). */
+       uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */
+       uint8_t protocol; /**< Protocol type. */
+       uint8_t vni[3]; /**< VXLAN identifier. */
+       uint8_t rsvd1; /**< Reserved, normally 0x00. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */
+#ifndef __cplusplus
+static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = {
+       .vni = "\xff\xff\xff",
+};
+#endif
+
 /**
  * Matching pattern item definition.
  *
@@ -996,6 +1059,13 @@ enum rte_flow_action_type {
         */
        RTE_FLOW_ACTION_TYPE_PHY_PORT,
 
+       /**
+        * Directs matching traffic to a given DPDK port ID.
+        *
+        * See struct rte_flow_action_port_id.
+        */
+       RTE_FLOW_ACTION_TYPE_PORT_ID,
+
        /**
         * Traffic metering and policing (MTR).
         *
@@ -1133,6 +1203,19 @@ struct rte_flow_action_phy_port {
        uint32_t index; /**< Physical port index. */
 };
 
+/**
+ * RTE_FLOW_ACTION_TYPE_PORT_ID
+ *
+ * Directs matching traffic to a given DPDK port ID.
+ *
+ * @see RTE_FLOW_ITEM_TYPE_PORT_ID
+ */
+struct rte_flow_action_port_id {
+       uint32_t original:1; /**< Use original DPDK port ID if possible. */
+       uint32_t reserved:31; /**< Reserved, must be zero. */
+       uint32_t id; /**< DPDK port ID. */
+};
+
 /**
  * RTE_FLOW_ACTION_TYPE_METER
  *