[v2] ethdev: add generic MAC address rewrite actions

Message ID 20180830065412.26680-1-jackmin@mellanox.com (mailing list archive)
State Superseded, archived
Headers
Series [v2] ethdev: add generic MAC address rewrite actions |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Xiaoyu Min Aug. 30, 2018, 6:54 a.m. UTC
  There is a need to offload rewrite outermost MAC address for both
destination and source from the matched flow

The proposed actions could make above easily achieved

Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
---
v2:
- Updated description about the MAC address is the outermost one

 lib/librte_ethdev/rte_flow.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
  

Comments

Xiaoyu Min Aug. 30, 2018, 7:40 a.m. UTC | #1
Sorry, A wrong title. Please ignore this one.

-Jack

On Thu, Aug 30, 2018 at 02:54:12PM +0800, Xiaoyu Min wrote:
> There is a need to offload rewrite outermost MAC address for both
> destination and source from the matched flow
> 
> The proposed actions could make above easily achieved
> 
> Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
> ---
> v2:
> - Updated description about the MAC address is the outermost one
> 
>  lib/librte_ethdev/rte_flow.h | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
> index f8ba71cdb..c9cce1049 100644
> --- a/lib/librte_ethdev/rte_flow.h
> +++ b/lib/librte_ethdev/rte_flow.h
> @@ -1505,6 +1505,26 @@ enum rte_flow_action_type {
>  	 * error.
>  	 */
>  	RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
> +
> +	/**
> +	 * Set outermost 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 outermost 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,
>  };
>  
>  /**
> @@ -1868,6 +1888,18 @@ 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_MAC
> + *
> + * Set outermost MAC address from the matched flow
> + */
> +struct rte_flow_action_set_mac {
> +	uint8_t mac_addr[ETHER_ADDR_LEN];
> +};
> +
>  /*
>   * Definition of a single action.
>   *
> -- 
> 2.17.1
>
  

Patch

diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index f8ba71cdb..c9cce1049 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -1505,6 +1505,26 @@  enum rte_flow_action_type {
 	 * error.
 	 */
 	RTE_FLOW_ACTION_TYPE_NVGRE_DECAP,
+
+	/**
+	 * Set outermost 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 outermost 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,
 };
 
 /**
@@ -1868,6 +1888,18 @@  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_MAC
+ *
+ * Set outermost MAC address from the matched flow
+ */
+struct rte_flow_action_set_mac {
+	uint8_t mac_addr[ETHER_ADDR_LEN];
+};
+
 /*
  * Definition of a single action.
  *