10d9f9647SVlad Buslov /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
20d9f9647SVlad Buslov /* Copyright (c) 2021 Mellanox Technologies. */
30d9f9647SVlad Buslov 
40d9f9647SVlad Buslov #ifndef __MLX5_EN_TC_TUN_ENCAP_H__
50d9f9647SVlad Buslov #define __MLX5_EN_TC_TUN_ENCAP_H__
60d9f9647SVlad Buslov 
70d9f9647SVlad Buslov #include "tc_priv.h"
80d9f9647SVlad Buslov 
90d9f9647SVlad Buslov void mlx5e_detach_encap(struct mlx5e_priv *priv,
10c118ebc9SRoi Dayan 			struct mlx5e_tc_flow *flow,
11c118ebc9SRoi Dayan 			struct mlx5_flow_attr *attr,
12c118ebc9SRoi Dayan 			int out_index);
130d9f9647SVlad Buslov 
140d9f9647SVlad Buslov int mlx5e_attach_encap(struct mlx5e_priv *priv,
150d9f9647SVlad Buslov 		       struct mlx5e_tc_flow *flow,
16c118ebc9SRoi Dayan 		       struct mlx5_flow_attr *attr,
170d9f9647SVlad Buslov 		       struct net_device *mirred_dev,
180d9f9647SVlad Buslov 		       int out_index,
190d9f9647SVlad Buslov 		       struct netlink_ext_ack *extack,
20f3774220SChris Mi 		       struct net_device **encap_dev);
21c118ebc9SRoi Dayan 
220d9f9647SVlad Buslov int mlx5e_attach_decap(struct mlx5e_priv *priv,
230d9f9647SVlad Buslov 		       struct mlx5e_tc_flow *flow,
240d9f9647SVlad Buslov 		       struct netlink_ext_ack *extack);
250d9f9647SVlad Buslov void mlx5e_detach_decap(struct mlx5e_priv *priv,
260d9f9647SVlad Buslov 			struct mlx5e_tc_flow *flow);
270d9f9647SVlad Buslov 
28777bb800SVlad Buslov int mlx5e_attach_decap_route(struct mlx5e_priv *priv,
29777bb800SVlad Buslov 			     struct mlx5e_tc_flow *flow);
30777bb800SVlad Buslov void mlx5e_detach_decap_route(struct mlx5e_priv *priv,
31777bb800SVlad Buslov 			      struct mlx5e_tc_flow *flow);
32777bb800SVlad Buslov 
33*e2ab5aa1SChris Mi int mlx5e_tc_tun_encap_dests_set(struct mlx5e_priv *priv,
34*e2ab5aa1SChris Mi 				 struct mlx5e_tc_flow *flow,
35*e2ab5aa1SChris Mi 				 struct mlx5_flow_attr *attr,
36*e2ab5aa1SChris Mi 				 struct netlink_ext_ack *extack,
37*e2ab5aa1SChris Mi 				 bool *vf_tun);
38*e2ab5aa1SChris Mi void mlx5e_tc_tun_encap_dests_unset(struct mlx5e_priv *priv,
39*e2ab5aa1SChris Mi 				    struct mlx5e_tc_flow *flow,
40*e2ab5aa1SChris Mi 				    struct mlx5_flow_attr *attr);
41*e2ab5aa1SChris Mi 
420d9f9647SVlad Buslov struct ip_tunnel_info *mlx5e_dup_tun_info(const struct ip_tunnel_info *tun_info);
430d9f9647SVlad Buslov 
440d9f9647SVlad Buslov int mlx5e_tc_set_attr_rx_tun(struct mlx5e_tc_flow *flow,
450d9f9647SVlad Buslov 			     struct mlx5_flow_spec *spec);
460d9f9647SVlad Buslov 
478914add2SVlad Buslov struct mlx5e_tc_tun_encap *mlx5e_tc_tun_init(struct mlx5e_priv *priv);
488914add2SVlad Buslov void mlx5e_tc_tun_cleanup(struct mlx5e_tc_tun_encap *encap);
498914add2SVlad Buslov 
500d9f9647SVlad Buslov #endif /* __MLX5_EN_TC_TUN_ENCAP_H__ */
51