ethdev: add generic MAC address rewrite actions
[dpdk.git] / lib / librte_ethdev / rte_flow.h
index f062ffe..26e2fcf 100644 (file)
@@ -1506,6 +1506,113 @@ enum rte_flow_action_type {
         * error.
         */
        RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
+
+       /**
+        * Modify IPv4 source address in the outermost IPv4 header.
+        *
+        * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
+        * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
+        *
+        * See struct rte_flow_action_set_ipv4.
+        */
+       RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC,
+
+       /**
+        * Modify IPv4 destination address in the outermost IPv4 header.
+        *
+        * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4,
+        * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
+        *
+        * See struct rte_flow_action_set_ipv4.
+        */
+       RTE_FLOW_ACTION_TYPE_SET_IPV4_DST,
+
+       /**
+        * Modify IPv6 source address in the outermost IPv6 header.
+        *
+        * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
+        * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
+        *
+        * See struct rte_flow_action_set_ipv6.
+        */
+       RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC,
+
+       /**
+        * Modify IPv6 destination address in the outermost IPv6 header.
+        *
+        * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6,
+        * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
+        *
+        * See struct rte_flow_action_set_ipv6.
+        */
+       RTE_FLOW_ACTION_TYPE_SET_IPV6_DST,
+
+       /**
+        * Modify source port number in the outermost TCP/UDP header.
+        *
+        * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
+        * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
+        * RTE_FLOW_ERROR_TYPE_ACTION error.
+        *
+        * See struct rte_flow_action_set_tp.
+        */
+       RTE_FLOW_ACTION_TYPE_SET_TP_SRC,
+
+       /**
+        * Modify destination port number in the outermost TCP/UDP header.
+        *
+        * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP
+        * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a
+        * RTE_FLOW_ERROR_TYPE_ACTION error.
+        *
+        * See struct rte_flow_action_set_tp.
+        */
+       RTE_FLOW_ACTION_TYPE_SET_TP_DST,
+
+       /**
+        * Swap the source and destination MAC addresses in the outermost
+        * Ethernet header.
+        *
+        * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
+        * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
+        *
+        * No associated configuration structure.
+        */
+       RTE_FLOW_ACTION_TYPE_MAC_SWAP,
+
+       /**
+        * Decrease TTL value directly
+        *
+        * No associated configuration structure.
+        */
+       RTE_FLOW_ACTION_TYPE_DEC_TTL,
+
+       /**
+        * Set TTL value
+        *
+        * See struct rte_flow_action_set_ttl
+        */
+       RTE_FLOW_ACTION_TYPE_SET_TTL,
+
+       /**
+        * Set source MAC address from matched flow.
+        *
+        * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
+        * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
+        *
+        * See struct rte_flow_action_set_mac.
+        */
+       RTE_FLOW_ACTION_TYPE_SET_MAC_SRC,
+
+       /**
+        * Set destination MAC address from matched flow.
+        *
+        * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH,
+        * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error.
+        *
+        * See struct rte_flow_action_set_mac.
+        */
+       RTE_FLOW_ACTION_TYPE_SET_MAC_DST,
 };
 
 /**
@@ -1869,6 +1976,69 @@ struct rte_flow_action_nvgre_encap {
        struct rte_flow_item *definition;
 };
 
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC
+ * RTE_FLOW_ACTION_TYPE_SET_IPV4_DST
+ *
+ * Allows modification of IPv4 source (RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC)
+ * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV4_DST) in the
+ * specified outermost IPv4 header.
+ */
+struct rte_flow_action_set_ipv4 {
+       rte_be32_t ipv4_addr;
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC
+ * RTE_FLOW_ACTION_TYPE_SET_IPV6_DST
+ *
+ * Allows modification of IPv6 source (RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC)
+ * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) in the
+ * specified outermost IPv6 header.
+ */
+struct rte_flow_action_set_ipv6 {
+       uint8_t ipv6_addr[16];
+};
+
+/**
+ * @warning
+ * @b EXPERIMENTAL: this structure may change without prior notice
+ *
+ * RTE_FLOW_ACTION_TYPE_SET_TP_SRC
+ * RTE_FLOW_ACTION_TYPE_SET_TP_DST
+ *
+ * Allows modification of source (RTE_FLOW_ACTION_TYPE_SET_TP_SRC)
+ * and destination (RTE_FLOW_ACTION_TYPE_SET_TP_DST) port numbers
+ * in the specified outermost TCP/UDP header.
+ */
+struct rte_flow_action_set_tp {
+       rte_be16_t port;
+};
+
+/**
+ * RTE_FLOW_ACTION_TYPE_SET_TTL
+ *
+ * Set the TTL value directly for IPv4 or IPv6
+ */
+struct rte_flow_action_set_ttl {
+       uint8_t ttl_value;
+};
+
+/**
+ * RTE_FLOW_ACTION_TYPE_SET_MAC
+ *
+ * Set MAC address from the matched flow
+ */
+struct rte_flow_action_set_mac {
+       uint8_t mac_addr[ETHER_ADDR_LEN];
+};
+
 /*
  * Definition of a single action.
  *