1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2018 Mellanox Technologies. */
3 
4 #ifndef __MLX5_EN_TC_TUNNEL_H__
5 #define __MLX5_EN_TC_TUNNEL_H__
6 
7 #include <linux/netdevice.h>
8 #include <linux/mlx5/fs.h>
9 #include <net/pkt_cls.h>
10 #include <linux/netlink.h>
11 #include "en.h"
12 #include "en_rep.h"
13 
14 enum {
15 	MLX5E_TC_TUNNEL_TYPE_UNKNOWN,
16 	MLX5E_TC_TUNNEL_TYPE_VXLAN,
17 	MLX5E_TC_TUNNEL_TYPE_GRETAP
18 };
19 
20 int mlx5e_tc_tun_init_encap_attr(struct net_device *tunnel_dev,
21 				 struct mlx5e_priv *priv,
22 				 struct mlx5e_encap_entry *e,
23 				 struct netlink_ext_ack *extack);
24 
25 int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
26 				    struct net_device *mirred_dev,
27 				    struct mlx5e_encap_entry *e);
28 
29 int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
30 				    struct net_device *mirred_dev,
31 				    struct mlx5e_encap_entry *e);
32 
33 int mlx5e_tc_tun_get_type(struct net_device *tunnel_dev);
34 bool mlx5e_tc_tun_device_to_offload(struct mlx5e_priv *priv,
35 				    struct net_device *netdev);
36 
37 int mlx5e_tc_tun_parse(struct net_device *filter_dev,
38 		       struct mlx5e_priv *priv,
39 		       struct mlx5_flow_spec *spec,
40 		       struct tc_cls_flower_offload *f,
41 		       void *headers_c,
42 		       void *headers_v, u8 *match_level);
43 
44 #endif //__MLX5_EN_TC_TUNNEL_H__
45