xref: /linux/drivers/net/ethernet/mellanox/mlx5/core/en/tc/act/trap.c (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
2 // Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 
4 #include "act.h"
5 #include "en/tc_priv.h"
6 #include "eswitch.h"
7 
8 static int
tc_act_parse_trap(struct mlx5e_tc_act_parse_state * parse_state,const struct flow_action_entry * act,struct mlx5e_priv * priv,struct mlx5_flow_attr * attr)9 tc_act_parse_trap(struct mlx5e_tc_act_parse_state *parse_state,
10 		  const struct flow_action_entry *act,
11 		  struct mlx5e_priv *priv,
12 		  struct mlx5_flow_attr *attr)
13 {
14 	attr->action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
15 	attr->dest_ft = mlx5_eswitch_get_slow_fdb(priv->mdev->priv.eswitch);
16 
17 	return 0;
18 }
19 
20 struct mlx5e_tc_act mlx5e_tc_act_trap = {
21 	.parse_action = tc_act_parse_trap,
22 };
23