1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2020, Mellanox Technologies */
3 
4 #ifndef __MLX5E_TRAP_H__
5 #define __MLX5E_TRAP_H__
6 
7 #include "../en.h"
8 #include "../devlink.h"
9 
10 struct mlx5e_trap {
11 	/* data path */
12 	struct mlx5e_rq            rq;
13 	struct mlx5e_tir           tir;
14 	struct napi_struct         napi;
15 	struct device             *pdev;
16 	struct net_device         *netdev;
17 	__be32                     mkey_be;
18 
19 	/* data path - accessed per napi poll */
20 	struct mlx5e_ch_stats     *stats;
21 
22 	/* control */
23 	struct mlx5e_priv         *priv;
24 	struct mlx5_core_dev      *mdev;
25 	struct hwtstamp_config    *tstamp;
26 	DECLARE_BITMAP(state, MLX5E_CHANNEL_NUM_STATES);
27 
28 	struct mlx5e_params        params;
29 	struct mlx5e_rq_param      rq_param;
30 };
31 
32 void mlx5e_close_trap(struct mlx5e_trap *trap);
33 void mlx5e_deactivate_trap(struct mlx5e_priv *priv);
34 int mlx5e_handle_trap_event(struct mlx5e_priv *priv, struct mlx5_trap_ctx *trap_ctx);
35 int mlx5e_apply_traps(struct mlx5e_priv *priv, bool enable);
36 
37 #endif
38