ethdev: add GTP extension header to flow API
[dpdk.git] / lib / librte_ethdev / rte_flow.h
index 1bf748d..eab87a5 100644 (file)
@@ -421,6 +421,28 @@ enum rte_flow_item_type {
         * See struct rte_flow_item_meta.
         */
        RTE_FLOW_ITEM_TYPE_META,
+
+       /**
+        * Matches a GRE optional key field.
+        *
+        * The value should a big-endian 32bit integer.
+        *
+        * When this item present the K bit is implicitly matched as "1"
+        * in the default mask.
+        *
+        * @p spec/mask type:
+        * @code rte_be32_t * @endcode
+        */
+       RTE_FLOW_ITEM_TYPE_GRE_KEY,
+
+       /**
+        * Matches a GTP extension header: PDU session container.
+        *
+        * Configure flow for GTP packets with extension header type 0x85.
+        *
+        * See struct rte_flow_item_gtp_psc.
+        */
+       RTE_FLOW_ITEM_TYPE_GTP_PSC,
 };
 
 /**
@@ -692,7 +714,7 @@ static const struct rte_flow_item_icmp rte_flow_item_icmp_mask = {
  * Matches a UDP header.
  */
 struct rte_flow_item_udp {
-       struct udp_hdr hdr; /**< UDP header definition. */
+       struct rte_udp_hdr hdr; /**< UDP header definition. */
 };
 
 /** Default mask for RTE_FLOW_ITEM_TYPE_UDP. */
@@ -922,7 +944,7 @@ struct rte_flow_item_esp {
 #ifndef __cplusplus
 static const struct rte_flow_item_esp rte_flow_item_esp_mask = {
        .hdr = {
-               .spi = 0xffffffff,
+               .spi = RTE_BE32(0xffffffff),
        },
 };
 #endif
@@ -1179,6 +1201,24 @@ static const struct rte_flow_item_meta rte_flow_item_meta_mask = {
 };
 #endif
 
+/**
+ * RTE_FLOW_ITEM_TYPE_GTP_PSC.
+ *
+ * Matches a GTP PDU extension header with type 0x85.
+ */
+struct rte_flow_item_gtp_psc {
+       uint8_t pdu_type; /**< PDU type. */
+       uint8_t qfi; /**< QoS flow identifier. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */
+#ifndef __cplusplus
+static const struct rte_flow_item_gtp_psc
+rte_flow_item_gtp_psc_mask = {
+       .qfi = 0x3f,
+};
+#endif
+
 /**
  * @warning
  * @b EXPERIMENTAL: this structure may change without prior notice
@@ -1244,9 +1284,10 @@ struct rte_flow_item {
 /**
  * Action types.
  *
- * Each possible action is represented by a type. Some have associated
- * configuration structures. Several actions combined in a list can be
- * assigned to a flow rule and are performed in order.
+ * Each possible action is represented by a type.
+ * An action can have an associated configuration object.
+ * Several actions combined in a list can be assigned
+ * to a flow rule and are performed in order.
  *
  * They fall in three categories:
  *
@@ -1650,6 +1691,62 @@ enum rte_flow_action_type {
         * See struct rte_flow_action_set_mac.
         */
        RTE_FLOW_ACTION_TYPE_SET_MAC_DST,
+
+       /**
+        * Increase sequence number in the outermost TCP header.
+        *
+        * Action configuration specifies the value to increase
+        * TCP sequence number as a big-endian 32 bit integer.
+        *
+        * @p conf type:
+        * @code rte_be32_t * @endcode
+        *
+        * Using this action on non-matching traffic will result in
+        * undefined behavior.
+        */
+       RTE_FLOW_ACTION_TYPE_INC_TCP_SEQ,
+
+       /**
+        * Decrease sequence number in the outermost TCP header.
+        *
+        * Action configuration specifies the value to decrease
+        * TCP sequence number as a big-endian 32 bit integer.
+        *
+        * @p conf type:
+        * @code rte_be32_t * @endcode
+        *
+        * Using this action on non-matching traffic will result in
+        * undefined behavior.
+        */
+       RTE_FLOW_ACTION_TYPE_DEC_TCP_SEQ,
+
+       /**
+        * Increase acknowledgment number in the outermost TCP header.
+        *
+        * Action configuration specifies the value to increase
+        * TCP acknowledgment number as a big-endian 32 bit integer.
+        *
+        * @p conf type:
+        * @code rte_be32_t * @endcode
+
+        * Using this action on non-matching traffic will result in
+        * undefined behavior.
+        */
+       RTE_FLOW_ACTION_TYPE_INC_TCP_ACK,
+
+       /**
+        * Decrease acknowledgment number in the outermost TCP header.
+        *
+        * Action configuration specifies the value to decrease
+        * TCP acknowledgment number as a big-endian 32 bit integer.
+        *
+        * @p conf type:
+        * @code rte_be32_t * @endcode
+        *
+        * Using this action on non-matching traffic will result in
+        * undefined behavior.
+        */
+       RTE_FLOW_ACTION_TYPE_DEC_TCP_ACK,
 };
 
 /**
@@ -2136,11 +2233,11 @@ struct rte_flow_action_set_mac {
  *
  * A list of actions is terminated by a END action.
  *
- * For simple actions without a configuration structure, conf remains NULL.
+ * For simple actions without a configuration object, conf remains NULL.
  */
 struct rte_flow_action {
        enum rte_flow_action_type type; /**< Action type. */
-       const void *conf; /**< Pointer to action configuration structure. */
+       const void *conf; /**< Pointer to action configuration object. */
 };
 
 /**