#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/inetdevice.h>
#include <net/inet_dscp.h>
#include <net/switchdev.h>
#include <linux/rhashtable.h>
#include <net/nexthop.h>
#include <net/arp.h>
#include <linux/if_vlan.h>
#include <linux/if_macvlan.h>
#include <net/netevent.h>
#include "prestera.h"
#include "prestera_router_hw.h"
#define PRESTERA_IMPLICITY_RESOLVE_DEAD_NEIGH
#define PRESTERA_NH_PROBE_INTERVAL …
struct prestera_kern_neigh_cache_key { … };
struct prestera_kern_neigh_cache { … };
struct prestera_kern_fib_cache_key { … };
struct prestera_kern_fib_cache { … };
static const struct rhashtable_params __prestera_kern_neigh_cache_ht_params = …;
static const struct rhashtable_params __prestera_kern_fib_cache_ht_params = …;
static u32 prestera_fix_tb_id(u32 tb_id)
{ … }
static void
prestera_util_fen_info2fib_cache_key(struct fib_notifier_info *info,
struct prestera_kern_fib_cache_key *key)
{ … }
static int prestera_util_nhc2nc_key(struct prestera_switch *sw,
struct fib_nh_common *nhc,
struct prestera_kern_neigh_cache_key *nk)
{ … }
static void
prestera_util_nc_key2nh_key(struct prestera_kern_neigh_cache_key *ck,
struct prestera_nh_neigh_key *nk)
{ … }
static bool
prestera_util_nhc_eq_n_cache_key(struct prestera_switch *sw,
struct fib_nh_common *nhc,
struct prestera_kern_neigh_cache_key *nk)
{ … }
static int
prestera_util_neigh2nc_key(struct prestera_switch *sw, struct neighbour *n,
struct prestera_kern_neigh_cache_key *key)
{ … }
static bool __prestera_fi_is_direct(struct fib_info *fi)
{ … }
static bool prestera_fi_is_direct(struct fib_info *fi)
{ … }
static bool prestera_fi_is_nh(struct fib_info *fi)
{ … }
static bool __prestera_fi6_is_direct(struct fib6_info *fi)
{ … }
static bool prestera_fi6_is_direct(struct fib6_info *fi)
{ … }
static bool prestera_fi6_is_nh(struct fib6_info *fi)
{ … }
static bool prestera_fib_info_is_direct(struct fib_notifier_info *info)
{ … }
static bool prestera_fib_info_is_nh(struct fib_notifier_info *info)
{ … }
static int prestera_util_kern_get_route(struct fib_result *res, u32 tb_id,
__be32 *addr)
{ … }
static bool
__prestera_util_kern_n_is_reachable_v4(u32 tb_id, __be32 *addr,
struct net_device *dev)
{ … }
static bool
prestera_util_kern_n_is_reachable(u32 tb_id,
struct prestera_ip_addr *addr,
struct net_device *dev)
{ … }
static void prestera_util_kern_set_neigh_offload(struct neighbour *n,
bool offloaded)
{ … }
static void
prestera_util_kern_set_nh_offload(struct fib_nh_common *nhc, bool offloaded, bool trap)
{ … }
static struct fib_nh_common *
prestera_kern_fib_info_nhc(struct fib_notifier_info *info, int n)
{ … }
static int prestera_kern_fib_info_nhs(struct fib_notifier_info *info)
{ … }
static unsigned char
prestera_kern_fib_info_type(struct fib_notifier_info *info)
{ … }
static bool
prestera_fib_node_util_is_neighbour(struct prestera_fib_node *fib_node)
{ … }
static int prestera_dev_if_type(const struct net_device *dev)
{ … }
static int
prestera_neigh_iface_init(struct prestera_switch *sw,
struct prestera_iface *iface,
struct neighbour *n)
{ … }
static struct prestera_kern_neigh_cache *
prestera_kern_neigh_cache_find(struct prestera_switch *sw,
struct prestera_kern_neigh_cache_key *key)
{ … }
static void
__prestera_kern_neigh_cache_destruct(struct prestera_switch *sw,
struct prestera_kern_neigh_cache *n_cache)
{ … }
static void
__prestera_kern_neigh_cache_destroy(struct prestera_switch *sw,
struct prestera_kern_neigh_cache *n_cache)
{ … }
static struct prestera_kern_neigh_cache *
__prestera_kern_neigh_cache_create(struct prestera_switch *sw,
struct prestera_kern_neigh_cache_key *key)
{ … }
static struct prestera_kern_neigh_cache *
prestera_kern_neigh_cache_get(struct prestera_switch *sw,
struct prestera_kern_neigh_cache_key *key)
{ … }
static struct prestera_kern_neigh_cache *
prestera_kern_neigh_cache_put(struct prestera_switch *sw,
struct prestera_kern_neigh_cache *n_cache)
{ … }
static struct prestera_kern_fib_cache *
prestera_kern_fib_cache_find(struct prestera_switch *sw,
struct prestera_kern_fib_cache_key *key)
{ … }
static void
__prestera_kern_fib_cache_destruct(struct prestera_switch *sw,
struct prestera_kern_fib_cache *fib_cache)
{ … }
static void
prestera_kern_fib_cache_destroy(struct prestera_switch *sw,
struct prestera_kern_fib_cache *fib_cache)
{ … }
static int
__prestera_kern_fib_cache_create_nhs(struct prestera_switch *sw,
struct prestera_kern_fib_cache *fc)
{ … }
static struct prestera_kern_fib_cache *
prestera_kern_fib_cache_create(struct prestera_switch *sw,
struct prestera_kern_fib_cache_key *key,
struct fib_notifier_info *info)
{ … }
static void
__prestera_k_arb_fib_nh_offload_set(struct prestera_switch *sw,
struct prestera_kern_fib_cache *fibc,
struct prestera_kern_neigh_cache *nc,
bool offloaded, bool trap)
{ … }
static void
__prestera_k_arb_n_offload_set(struct prestera_switch *sw,
struct prestera_kern_neigh_cache *nc,
bool offloaded)
{ … }
static void
__prestera_k_arb_fib_lpm_offload_set(struct prestera_switch *sw,
struct prestera_kern_fib_cache *fc,
bool fail, bool offload, bool trap)
{ … }
static void
__prestera_k_arb_n_lpm_set(struct prestera_switch *sw,
struct prestera_kern_neigh_cache *n_cache,
bool enabled)
{ … }
static void
__prestera_k_arb_nc_kern_fib_fetch(struct prestera_switch *sw,
struct prestera_kern_neigh_cache *nc)
{ … }
static void
__prestera_k_arb_nc_kern_n_fetch(struct prestera_switch *sw,
struct prestera_kern_neigh_cache *nc)
{ … }
static void
__prestera_k_arb_nc_apply(struct prestera_switch *sw,
struct prestera_kern_neigh_cache *nc)
{ … }
static int
__prestera_pr_k_arb_fc_lpm_info_calc(struct prestera_switch *sw,
struct prestera_kern_fib_cache *fc)
{ … }
static int __prestera_k_arb_f_lpm_set(struct prestera_switch *sw,
struct prestera_kern_fib_cache *fc,
bool enabled)
{ … }
static int __prestera_k_arb_fc_apply(struct prestera_switch *sw,
struct prestera_kern_fib_cache *fc)
{ … }
static struct prestera_kern_fib_cache *
__prestera_k_arb_util_fib_overlaps(struct prestera_switch *sw,
struct prestera_kern_fib_cache *fc)
{ … }
static struct prestera_kern_fib_cache *
__prestera_k_arb_util_fib_overlapped(struct prestera_switch *sw,
struct prestera_kern_fib_cache *fc)
{ … }
static void __prestera_k_arb_hw_state_upd(struct prestera_switch *sw,
struct prestera_kern_neigh_cache *nc)
{ … }
static void prestera_k_arb_hw_evt(struct prestera_switch *sw)
{ … }
static void prestera_k_arb_n_evt(struct prestera_switch *sw,
struct neighbour *n)
{ … }
static void __prestera_k_arb_fib_evt2nc(struct prestera_switch *sw)
{ … }
static int
prestera_k_arb_fib_evt(struct prestera_switch *sw,
bool replace,
struct fib_notifier_info *info)
{ … }
static void __prestera_k_arb_abort_neigh_ht_cb(void *ptr, void *arg)
{ … }
static void __prestera_k_arb_abort_fib_ht_cb(void *ptr, void *arg)
{ … }
static void prestera_k_arb_abort(struct prestera_switch *sw)
{ … }
static int __prestera_inetaddr_port_event(struct net_device *port_dev,
unsigned long event,
struct netlink_ext_ack *extack)
{ … }
static int __prestera_inetaddr_event(struct prestera_switch *sw,
struct net_device *dev,
unsigned long event,
struct netlink_ext_ack *extack)
{ … }
static int __prestera_inetaddr_cb(struct notifier_block *nb,
unsigned long event, void *ptr)
{ … }
static int __prestera_inetaddr_valid_cb(struct notifier_block *nb,
unsigned long event, void *ptr)
{ … }
struct prestera_fib_event_work { … };
static void __prestera_router_fib_event_work(struct work_struct *work)
{ … }
static int __prestera_router_fib_event(struct notifier_block *nb,
unsigned long event, void *ptr)
{ … }
struct prestera_netevent_work { … };
static void prestera_router_neigh_event_work(struct work_struct *work)
{ … }
static int prestera_router_netevent_event(struct notifier_block *nb,
unsigned long event, void *ptr)
{ … }
static void prestera_router_update_neighs_work(struct work_struct *work)
{ … }
static int prestera_neigh_work_init(struct prestera_switch *sw)
{ … }
static void prestera_neigh_work_fini(struct prestera_switch *sw)
{ … }
int prestera_router_init(struct prestera_switch *sw)
{ … }
void prestera_router_fini(struct prestera_switch *sw)
{ … }