1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2021 Mellanox Technologies. */
3 
4 #ifndef __MLX5_EN_TC_TUN_ENCAP_H__
5 #define __MLX5_EN_TC_TUN_ENCAP_H__
6 
7 #include "tc_priv.h"
8 
9 void mlx5e_detach_encap(struct mlx5e_priv *priv,
10 			struct mlx5e_tc_flow *flow,
11 			struct mlx5_flow_attr *attr,
12 			int out_index);
13 
14 int mlx5e_attach_encap(struct mlx5e_priv *priv,
15 		       struct mlx5e_tc_flow *flow,
16 		       struct mlx5_flow_attr *attr,
17 		       struct net_device *mirred_dev,
18 		       int out_index,
19 		       struct netlink_ext_ack *extack,
20 		       struct net_device **encap_dev);
21 
22 int mlx5e_attach_decap(struct mlx5e_priv *priv,
23 		       struct mlx5e_tc_flow *flow,
24 		       struct netlink_ext_ack *extack);
25 void mlx5e_detach_decap(struct mlx5e_priv *priv,
26 			struct mlx5e_tc_flow *flow);
27 
28 int mlx5e_attach_decap_route(struct mlx5e_priv *priv,
29 			     struct mlx5e_tc_flow *flow);
30 void mlx5e_detach_decap_route(struct mlx5e_priv *priv,
31 			      struct mlx5e_tc_flow *flow);
32 
33 int mlx5e_tc_tun_encap_dests_set(struct mlx5e_priv *priv,
34 				 struct mlx5e_tc_flow *flow,
35 				 struct mlx5_flow_attr *attr,
36 				 struct netlink_ext_ack *extack,
37 				 bool *vf_tun);
38 void mlx5e_tc_tun_encap_dests_unset(struct mlx5e_priv *priv,
39 				    struct mlx5e_tc_flow *flow,
40 				    struct mlx5_flow_attr *attr);
41 
42 struct ip_tunnel_info *mlx5e_dup_tun_info(const struct ip_tunnel_info *tun_info);
43 
44 int mlx5e_tc_set_attr_rx_tun(struct mlx5e_tc_flow *flow,
45 			     struct mlx5_flow_spec *spec);
46 
47 struct mlx5e_tc_tun_encap *mlx5e_tc_tun_init(struct mlx5e_priv *priv);
48 void mlx5e_tc_tun_cleanup(struct mlx5e_tc_tun_encap *encap);
49 
50 #endif /* __MLX5_EN_TC_TUN_ENCAP_H__ */
51