root/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   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_GENEVE,
  18         MLX5E_TC_TUNNEL_TYPE_GRETAP,
  19 };
  20 
  21 struct mlx5e_tc_tunnel {
  22         int tunnel_type;
  23         enum mlx5_flow_match_level match_level;
  24 
  25         bool (*can_offload)(struct mlx5e_priv *priv);
  26         int (*calc_hlen)(struct mlx5e_encap_entry *e);
  27         int (*init_encap_attr)(struct net_device *tunnel_dev,
  28                                struct mlx5e_priv *priv,
  29                                struct mlx5e_encap_entry *e,
  30                                struct netlink_ext_ack *extack);
  31         int (*generate_ip_tun_hdr)(char buf[],
  32                                    __u8 *ip_proto,
  33                                    struct mlx5e_encap_entry *e);
  34         int (*parse_udp_ports)(struct mlx5e_priv *priv,
  35                                struct mlx5_flow_spec *spec,
  36                                struct flow_cls_offload *f,
  37                                void *headers_c,
  38                                void *headers_v);
  39         int (*parse_tunnel)(struct mlx5e_priv *priv,
  40                             struct mlx5_flow_spec *spec,
  41                             struct flow_cls_offload *f,
  42                             void *headers_c,
  43                             void *headers_v);
  44 };
  45 
  46 extern struct mlx5e_tc_tunnel vxlan_tunnel;
  47 extern struct mlx5e_tc_tunnel geneve_tunnel;
  48 extern struct mlx5e_tc_tunnel gre_tunnel;
  49 
  50 struct mlx5e_tc_tunnel *mlx5e_get_tc_tun(struct net_device *tunnel_dev);
  51 
  52 int mlx5e_tc_tun_init_encap_attr(struct net_device *tunnel_dev,
  53                                  struct mlx5e_priv *priv,
  54                                  struct mlx5e_encap_entry *e,
  55                                  struct netlink_ext_ack *extack);
  56 
  57 int mlx5e_tc_tun_create_header_ipv4(struct mlx5e_priv *priv,
  58                                     struct net_device *mirred_dev,
  59                                     struct mlx5e_encap_entry *e);
  60 
  61 int mlx5e_tc_tun_create_header_ipv6(struct mlx5e_priv *priv,
  62                                     struct net_device *mirred_dev,
  63                                     struct mlx5e_encap_entry *e);
  64 
  65 bool mlx5e_tc_tun_device_to_offload(struct mlx5e_priv *priv,
  66                                     struct net_device *netdev);
  67 
  68 int mlx5e_tc_tun_parse(struct net_device *filter_dev,
  69                        struct mlx5e_priv *priv,
  70                        struct mlx5_flow_spec *spec,
  71                        struct flow_cls_offload *f,
  72                        void *headers_c,
  73                        void *headers_v, u8 *match_level);
  74 
  75 int mlx5e_tc_tun_parse_udp_ports(struct mlx5e_priv *priv,
  76                                  struct mlx5_flow_spec *spec,
  77                                  struct flow_cls_offload *f,
  78                                  void *headers_c,
  79                                  void *headers_v);
  80 
  81 #endif //__MLX5_EN_TC_TUNNEL_H__

/* [<][>][^][v][top][bottom][index][help] */