mlx5: implement ethtool::get_fec_stats
[sfrench/cifs-2.6.git] / drivers / net / ethernet / mellanox / mlx5 / core / esw / sample.h
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 "en.h"
8 #include "eswitch.h"
9
10 struct mlx5e_priv;
11 struct mlx5_flow_attr;
12 struct mlx5_esw_psample;
13
14 struct mlx5_sample_attr {
15         u32 group_num;
16         u32 rate;
17         u32 trunc_size;
18         u32 restore_obj_id;
19         u32 sampler_id;
20         struct mlx5_flow_table *sample_default_tbl;
21         struct mlx5_sample_flow *sample_flow;
22 };
23
24 void mlx5_esw_sample_skb(struct sk_buff *skb, struct mlx5_mapped_obj *mapped_obj);
25
26 struct mlx5_flow_handle *
27 mlx5_esw_sample_offload(struct mlx5_esw_psample *sample_priv,
28                         struct mlx5_flow_spec *spec,
29                         struct mlx5_flow_attr *attr);
30
31 void
32 mlx5_esw_sample_unoffload(struct mlx5_esw_psample *sample_priv,
33                           struct mlx5_flow_handle *rule,
34                           struct mlx5_flow_attr *attr);
35
36 struct mlx5_esw_psample *
37 mlx5_esw_sample_init(struct mlx5e_priv *priv);
38
39 void
40 mlx5_esw_sample_cleanup(struct mlx5_esw_psample *esw_psample);
41
42 #endif /* __MLX5_EN_TC_SAMPLE_H__ */