linux/drivers/net/ethernet/marvell/prestera/prestera_router.c

// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/* Copyright (c) 2019-2021 Marvell International Ltd. All rights reserved */

#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 {};

/* Subscribing on neighbours in kernel */
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 =;

/* This util to be used, to convert kernel rules for default vr in hw_vr */
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)
{}

/* must be called with rcu_read_lock() */
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)
{}

/* Check if neigh route is reachable */
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)
{}

/* Decided, that uc_nh route with key==nh is obviously neighbour route */
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)
{}

/* Operations on fi (offload, etc) must be wrapped in utils.
 * This function just create storage.
 */
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)
{}

/* Kernel neighbour -> neigh_cache info */
static void
__prestera_k_arb_nc_kern_n_fetch(struct prestera_switch *sw,
				 struct prestera_kern_neigh_cache *nc)
{}

/* neigh_cache info -> lpm update */
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)
{}

/* Propagate hw state to kernel */
static void prestera_k_arb_hw_evt(struct prestera_switch *sw)
{}

/* Propagate kernel event to hw */
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, /* replace or del */
		       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)
{}

/* Called with rcu_read_lock() */
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)
{}