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 bool
9 tc_act_can_offload_trap(struct mlx5e_tc_act_parse_state *parse_state,
10 			const struct flow_action_entry *act,
11 			int act_index,
12 			struct mlx5_flow_attr *attr)
13 {
14 	return true;
15 }
16 
17 static int
18 tc_act_parse_trap(struct mlx5e_tc_act_parse_state *parse_state,
19 		  const struct flow_action_entry *act,
20 		  struct mlx5e_priv *priv,
21 		  struct mlx5_flow_attr *attr)
22 {
23 	attr->action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST;
24 	attr->dest_ft = mlx5_eswitch_get_slow_fdb(priv->mdev->priv.eswitch);
25 
26 	return 0;
27 }
28 
29 struct mlx5e_tc_act mlx5e_tc_act_trap = {
30 	.can_offload = tc_act_can_offload_trap,
31 	.parse_action = tc_act_parse_trap,
32 };
33