#include <net/fib_notifier.h>
#include <net/nexthop.h>
#include <net/ip_tunnels.h>
#include "tc_tun_encap.h"
#include "en_tc.h"
#include "tc_tun.h"
#include "rep/tc.h"
#include "diag/en_tc_tracepoint.h"
enum { … };
static int mlx5e_set_int_port_tunnel(struct mlx5e_priv *priv,
struct mlx5_flow_attr *attr,
struct mlx5e_encap_entry *e,
int out_index)
{ … }
struct mlx5e_route_key { … };
struct mlx5e_route_entry { … };
struct mlx5e_tc_tun_encap { … };
static bool mlx5e_route_entry_valid(struct mlx5e_route_entry *r)
{ … }
int mlx5e_tc_set_attr_rx_tun(struct mlx5e_tc_flow *flow,
struct mlx5_flow_spec *spec)
{ … }
static bool mlx5e_tc_flow_all_encaps_valid(struct mlx5_esw_flow_attr *esw_attr)
{ … }
void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
struct mlx5e_encap_entry *e,
struct list_head *flow_list)
{ … }
void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv,
struct mlx5e_encap_entry *e,
struct list_head *flow_list)
{ … }
static void mlx5e_take_tmp_flow(struct mlx5e_tc_flow *flow,
struct list_head *flow_list,
int index)
{ … }
void mlx5e_take_all_encap_flows(struct mlx5e_encap_entry *e, struct list_head *flow_list)
{ … }
static void mlx5e_take_all_route_decap_flows(struct mlx5e_route_entry *r,
struct list_head *flow_list)
{ … }
match_cb;
static struct mlx5e_encap_entry *
mlx5e_get_next_matching_encap(struct mlx5e_neigh_hash_entry *nhe,
struct mlx5e_encap_entry *e,
match_cb match)
{ … }
static bool mlx5e_encap_valid(struct mlx5e_encap_entry *e)
{ … }
static struct mlx5e_encap_entry *
mlx5e_get_next_valid_encap(struct mlx5e_neigh_hash_entry *nhe,
struct mlx5e_encap_entry *e)
{ … }
static bool mlx5e_encap_initialized(struct mlx5e_encap_entry *e)
{ … }
struct mlx5e_encap_entry *
mlx5e_get_next_init_encap(struct mlx5e_neigh_hash_entry *nhe,
struct mlx5e_encap_entry *e)
{ … }
void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe)
{ … }
static void mlx5e_encap_dealloc(struct mlx5e_priv *priv, struct mlx5e_encap_entry *e)
{ … }
static void mlx5e_decap_dealloc(struct mlx5e_priv *priv,
struct mlx5e_decap_entry *d)
{ … }
void mlx5e_encap_put(struct mlx5e_priv *priv, struct mlx5e_encap_entry *e)
{ … }
static void mlx5e_encap_put_locked(struct mlx5e_priv *priv, struct mlx5e_encap_entry *e)
{ … }
static void mlx5e_decap_put(struct mlx5e_priv *priv, struct mlx5e_decap_entry *d)
{ … }
static void mlx5e_detach_encap_route(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
int out_index);
void mlx5e_detach_encap(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
struct mlx5_flow_attr *attr,
int out_index)
{ … }
void mlx5e_detach_decap(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow)
{ … }
bool mlx5e_tc_tun_encap_info_equal_generic(struct mlx5e_encap_key *a,
struct mlx5e_encap_key *b)
{ … }
bool mlx5e_tc_tun_encap_info_equal_options(struct mlx5e_encap_key *a,
struct mlx5e_encap_key *b,
u32 tun_type)
{ … }
static int cmp_decap_info(struct mlx5e_decap_key *a,
struct mlx5e_decap_key *b)
{ … }
static int hash_encap_info(struct mlx5e_encap_key *key)
{ … }
static int hash_decap_info(struct mlx5e_decap_key *key)
{ … }
bool mlx5e_encap_take(struct mlx5e_encap_entry *e)
{ … }
static bool mlx5e_decap_take(struct mlx5e_decap_entry *e)
{ … }
static struct mlx5e_encap_entry *
mlx5e_encap_get(struct mlx5e_priv *priv, struct mlx5e_encap_key *key,
uintptr_t hash_key)
{ … }
static struct mlx5e_decap_entry *
mlx5e_decap_get(struct mlx5e_priv *priv, struct mlx5e_decap_key *key,
uintptr_t hash_key)
{ … }
struct ip_tunnel_info *mlx5e_dup_tun_info(const struct ip_tunnel_info *tun_info)
{ … }
static bool is_duplicated_encap_entry(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
int out_index,
struct mlx5e_encap_entry *e,
struct netlink_ext_ack *extack)
{ … }
static int mlx5e_set_vf_tunnel(struct mlx5_eswitch *esw,
struct mlx5_flow_attr *attr,
struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts,
struct net_device *out_dev,
int route_dev_ifindex,
int out_index)
{ … }
static int mlx5e_update_vf_tunnel(struct mlx5_eswitch *esw,
struct mlx5_esw_flow_attr *attr,
struct mlx5e_tc_mod_hdr_acts *mod_hdr_acts,
struct net_device *out_dev,
int route_dev_ifindex,
int out_index)
{ … }
static unsigned int mlx5e_route_tbl_get_last_update(struct mlx5e_priv *priv)
{ … }
static int mlx5e_attach_encap_route(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
struct mlx5_flow_attr *attr,
struct mlx5e_encap_entry *e,
bool new_encap_entry,
unsigned long tbl_time_before,
int out_index);
int mlx5e_attach_encap(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
struct mlx5_flow_attr *attr,
struct net_device *mirred_dev,
int out_index,
struct netlink_ext_ack *extack,
struct net_device **encap_dev)
{ … }
int mlx5e_attach_decap(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
struct netlink_ext_ack *extack)
{ … }
int mlx5e_tc_tun_encap_dests_set(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
struct mlx5_flow_attr *attr,
struct netlink_ext_ack *extack,
bool *vf_tun)
{ … }
void mlx5e_tc_tun_encap_dests_unset(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
struct mlx5_flow_attr *attr)
{ … }
static int cmp_route_info(struct mlx5e_route_key *a,
struct mlx5e_route_key *b)
{ … }
static u32 hash_route_info(struct mlx5e_route_key *key)
{ … }
static void mlx5e_route_dealloc(struct mlx5e_priv *priv,
struct mlx5e_route_entry *r)
{ … }
static void mlx5e_route_put(struct mlx5e_priv *priv, struct mlx5e_route_entry *r)
{ … }
static void mlx5e_route_put_locked(struct mlx5e_priv *priv, struct mlx5e_route_entry *r)
{ … }
static struct mlx5e_route_entry *
mlx5e_route_get(struct mlx5e_tc_tun_encap *encap, struct mlx5e_route_key *key,
u32 hash_key)
{ … }
static struct mlx5e_route_entry *
mlx5e_route_get_create(struct mlx5e_priv *priv,
struct mlx5e_route_key *key,
int tunnel_dev_index,
unsigned long *route_tbl_change_time)
{ … }
static struct mlx5e_route_entry *
mlx5e_route_lookup_for_update(struct mlx5e_tc_tun_encap *encap, struct mlx5e_route_key *key)
{ … }
struct mlx5e_tc_fib_event_data { … };
static void mlx5e_tc_fib_event_work(struct work_struct *work);
static struct mlx5e_tc_fib_event_data *
mlx5e_tc_init_fib_work(unsigned long event, struct net_device *ul_dev, gfp_t flags)
{ … }
static int
mlx5e_route_enqueue_update(struct mlx5e_priv *priv,
struct mlx5e_route_entry *r,
unsigned long event)
{ … }
int mlx5e_attach_decap_route(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow)
{ … }
static int mlx5e_attach_encap_route(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
struct mlx5_flow_attr *attr,
struct mlx5e_encap_entry *e,
bool new_encap_entry,
unsigned long tbl_time_before,
int out_index)
{ … }
void mlx5e_detach_decap_route(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow)
{ … }
static void mlx5e_detach_encap_route(struct mlx5e_priv *priv,
struct mlx5e_tc_flow *flow,
int out_index)
{ … }
static void mlx5e_invalidate_encap(struct mlx5e_priv *priv,
struct mlx5e_encap_entry *e,
struct list_head *encap_flows)
{ … }
static void mlx5e_reoffload_encap(struct mlx5e_priv *priv,
struct net_device *tunnel_dev,
struct mlx5e_encap_entry *e,
struct list_head *encap_flows)
{ … }
static int mlx5e_update_route_encaps(struct mlx5e_priv *priv,
struct mlx5e_route_entry *r,
struct list_head *flow_list,
bool replace)
{ … }
static void mlx5e_unoffload_flow_list(struct mlx5e_priv *priv,
struct list_head *flow_list)
{ … }
static void mlx5e_reoffload_decap(struct mlx5e_priv *priv,
struct list_head *decap_flows)
{ … }
static int mlx5e_update_route_decap_flows(struct mlx5e_priv *priv,
struct mlx5e_route_entry *r,
struct list_head *flow_list,
bool replace)
{ … }
static void mlx5e_tc_fib_event_work(struct work_struct *work)
{ … }
static struct mlx5e_tc_fib_event_data *
mlx5e_init_fib_work_ipv4(struct mlx5e_priv *priv,
struct net_device *ul_dev,
struct mlx5e_tc_tun_encap *encap,
unsigned long event,
struct fib_notifier_info *info)
{ … }
static struct mlx5e_tc_fib_event_data *
mlx5e_init_fib_work_ipv6(struct mlx5e_priv *priv,
struct net_device *ul_dev,
struct mlx5e_tc_tun_encap *encap,
unsigned long event,
struct fib_notifier_info *info)
{ … }
static int mlx5e_tc_tun_fib_event(struct notifier_block *nb, unsigned long event, void *ptr)
{ … }
struct mlx5e_tc_tun_encap *mlx5e_tc_tun_init(struct mlx5e_priv *priv)
{ … }
void mlx5e_tc_tun_cleanup(struct mlx5e_tc_tun_encap *encap)
{ … }