1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2019 Mellanox Technologies. */
3 
4 #ifndef __MLX5_PORT_TUN_H__
5 #define __MLX5_PORT_TUN_H__
6 
7 #include <linux/mlx5/driver.h>
8 
9 struct mlx5_tun_entropy {
10 	struct mlx5_core_dev *mdev;
11 	u32 num_enabling_entries;
12 	u32 num_disabling_entries;
13 	u8  enabled;
14 	struct mutex lock;	/* lock the entropy fields */
15 };
16 
17 void mlx5_init_port_tun_entropy(struct mlx5_tun_entropy *tun_entropy,
18 				struct mlx5_core_dev *mdev);
19 int mlx5_tun_entropy_refcount_inc(struct mlx5_tun_entropy *tun_entropy,
20 				  int reformat_type);
21 void mlx5_tun_entropy_refcount_dec(struct mlx5_tun_entropy *tun_entropy,
22 				   int reformat_type);
23 
24 #endif /* __MLX5_PORT_TUN_H__ */
25