1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2021 Mellanox Technologies. */
3 
4 #ifndef __MLX5_EN_TC_SAMPLE_H__
5 #define __MLX5_EN_TC_SAMPLE_H__
6 
7 #include "eswitch.h"
8 
9 struct mlx5_flow_attr;
10 struct mlx5e_tc_psample;
11 struct mlx5e_post_act;
12 
13 struct mlx5e_sample_attr {
14 	u32 group_num;
15 	u32 rate;
16 	u32 trunc_size;
17 	u32 restore_obj_id;
18 	u32 sampler_id;
19 	struct mlx5e_sample_flow *sample_flow;
20 };
21 
22 void mlx5e_tc_sample_skb(struct sk_buff *skb, struct mlx5_mapped_obj *mapped_obj);
23 
24 struct mlx5_flow_handle *
25 mlx5e_tc_sample_offload(struct mlx5e_tc_psample *sample_priv,
26 			struct mlx5_flow_spec *spec,
27 			struct mlx5_flow_attr *attr,
28 			u32 tunnel_id);
29 
30 void
31 mlx5e_tc_sample_unoffload(struct mlx5e_tc_psample *sample_priv,
32 			  struct mlx5_flow_handle *rule,
33 			  struct mlx5_flow_attr *attr);
34 
35 struct mlx5e_tc_psample *
36 mlx5e_tc_sample_init(struct mlx5_eswitch *esw, struct mlx5e_post_act *post_act);
37 
38 void
39 mlx5e_tc_sample_cleanup(struct mlx5e_tc_psample *tc_psample);
40 
41 #endif /* __MLX5_EN_TC_SAMPLE_H__ */
42