Skip to contentSkip to conversation

net/mlx5: example of modify field rte flow action

PATCH New Alexander Kozyrev 1 participant 1 message Jan 18, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: example of modify field rte flow action

This patch is a draft for upcoming full-fledged support for newly added modify_field RTE Flow action.

The example shows how to use the modify_field API to set a source or destination MAC address with an immediate value specified by a user:

flow create 0 ingress group 0 pattern eth / end
actions modify_field op set dst_type mac_dst src_type value src_value 12345678 width 32 / rss /end

---
 drivers/net/mlx5/mlx5_flow.h    |   4 +-
 drivers/net/mlx5/mlx5_flow_dv.c | 120 ++++++++++++++++++++++++++++++++
 2 files changed, 123 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_flow.h +3 -1
index eb9f97a278..27862edcd1 100644
@@ -218,6 +218,7 @@ enum mlx5_feature_name {
 #define MLX5_FLOW_ACTION_SAMPLE (1ull << 36)
 #define MLX5_FLOW_ACTION_TUNNEL_SET (1ull << 37)
 #define MLX5_FLOW_ACTION_TUNNEL_MATCH (1ull << 38)
+#define MLX5_FLOW_ACTION_MODIFY_FIELD (1ull << 39)
 
 #define MLX5_FLOW_FATE_ACTIONS \
 	(MLX5_FLOW_ACTION_DROP | MLX5_FLOW_ACTION_QUEUE | \
@@ -248,7 +249,8 @@ enum mlx5_feature_name {
 				      MLX5_FLOW_ACTION_MARK_EXT | \
 				      MLX5_FLOW_ACTION_SET_META | \
 				      MLX5_FLOW_ACTION_SET_IPV4_DSCP | \
-				      MLX5_FLOW_ACTION_SET_IPV6_DSCP)
+				      MLX5_FLOW_ACTION_SET_IPV6_DSCP | \
+				      MLX5_FLOW_ACTION_MODIFY_FIELD)
 
 #define MLX5_FLOW_VLAN_ACTIONS (MLX5_FLOW_ACTION_OF_POP_VLAN | \
 				MLX5_FLOW_ACTION_OF_PUSH_VLAN)
drivers/net/mlx5/mlx5_flow_dv.c +120 -0

144 lines not on this page · raw message

Signature · 1 line
2.24.1