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