linux/drivers/net/netdevsim/fib.c

/*
 * Copyright (c) 2018 Cumulus Networks. All rights reserved.
 * Copyright (c) 2018 David Ahern <[email protected]>
 *
 * This software is licensed under the GNU General License Version 2,
 * June 1991 as shown in the file COPYING in the top-level directory of this
 * source tree.
 *
 * THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
 * OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME
 * THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 */

#include <linux/bitmap.h>
#include <linux/in6.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/rhashtable.h>
#include <linux/spinlock_types.h>
#include <linux/types.h>
#include <net/fib_notifier.h>
#include <net/inet_dscp.h>
#include <net/ip_fib.h>
#include <net/ip6_fib.h>
#include <net/fib_rules.h>
#include <net/net_namespace.h>
#include <net/nexthop.h>
#include <linux/debugfs.h>

#include "netdevsim.h"

struct nsim_fib_entry {};

struct nsim_per_fib_data {};

struct nsim_fib_data {};

struct nsim_fib_rt_key {};

struct nsim_fib_rt {};

struct nsim_fib4_rt {};

struct nsim_fib6_rt {};

struct nsim_fib6_rt_nh {};

struct nsim_fib6_event {};

struct nsim_fib_event {};

static const struct rhashtable_params nsim_fib_rt_ht_params =;

struct nsim_nexthop {};

static const struct rhashtable_params nsim_nexthop_ht_params =;

u64 nsim_fib_get_val(struct nsim_fib_data *fib_data,
		     enum nsim_resource_id res_id, bool max)
{}

static void nsim_fib_set_max(struct nsim_fib_data *fib_data,
			     enum nsim_resource_id res_id, u64 val)
{}

static int nsim_fib_rule_account(struct nsim_fib_entry *entry, bool add,
				 struct netlink_ext_ack *extack)
{}

static int nsim_fib_rule_event(struct nsim_fib_data *data,
			       struct fib_notifier_info *info, bool add)
{}

static int nsim_fib_account(struct nsim_fib_entry *entry, bool add)
{}

static void nsim_fib_rt_init(struct nsim_fib_data *data,
			     struct nsim_fib_rt *fib_rt, const void *addr,
			     size_t addr_len, unsigned int prefix_len,
			     int family, u32 tb_id)
{}

static void nsim_fib_rt_fini(struct nsim_fib_rt *fib_rt)
{}

static struct nsim_fib_rt *nsim_fib_rt_lookup(struct rhashtable *fib_rt_ht,
					      const void *addr, size_t addr_len,
					      unsigned int prefix_len,
					      int family, u32 tb_id)
{}

static struct nsim_fib4_rt *
nsim_fib4_rt_create(struct nsim_fib_data *data,
		    struct fib_entry_notifier_info *fen_info)
{}

static void nsim_fib4_rt_destroy(struct nsim_fib4_rt *fib4_rt)
{}

static struct nsim_fib4_rt *
nsim_fib4_rt_lookup(struct rhashtable *fib_rt_ht,
		    const struct fib_entry_notifier_info *fen_info)
{}

static void
nsim_fib4_rt_offload_failed_flag_set(struct net *net,
				     struct fib_entry_notifier_info *fen_info)
{}

static void nsim_fib4_rt_hw_flags_set(struct net *net,
				      const struct nsim_fib4_rt *fib4_rt,
				      bool trap)
{}

static int nsim_fib4_rt_add(struct nsim_fib_data *data,
			    struct nsim_fib4_rt *fib4_rt)
{}

static int nsim_fib4_rt_replace(struct nsim_fib_data *data,
				struct nsim_fib4_rt *fib4_rt,
				struct nsim_fib4_rt *fib4_rt_old)
{}

static int nsim_fib4_rt_insert(struct nsim_fib_data *data,
			       struct fib_entry_notifier_info *fen_info)
{}

static void nsim_fib4_rt_remove(struct nsim_fib_data *data,
				const struct fib_entry_notifier_info *fen_info)
{}

static int nsim_fib4_event(struct nsim_fib_data *data,
			   struct fib_entry_notifier_info *fen_info,
			   unsigned long event)
{}

static struct nsim_fib6_rt_nh *
nsim_fib6_rt_nh_find(const struct nsim_fib6_rt *fib6_rt,
		     const struct fib6_info *rt)
{}

static int nsim_fib6_rt_nh_add(struct nsim_fib6_rt *fib6_rt,
			       struct fib6_info *rt)
{}

#if IS_ENABLED(CONFIG_IPV6)
static void nsim_rt6_release(struct fib6_info *rt)
{}
#else
static void nsim_rt6_release(struct fib6_info *rt)
{
}
#endif

static void nsim_fib6_rt_nh_del(struct nsim_fib6_rt *fib6_rt,
				const struct fib6_info *rt)
{}

static struct nsim_fib6_rt *
nsim_fib6_rt_create(struct nsim_fib_data *data,
		    struct fib6_info **rt_arr, unsigned int nrt6)
{}

static void nsim_fib6_rt_destroy(struct nsim_fib6_rt *fib6_rt)
{}

static struct nsim_fib6_rt *
nsim_fib6_rt_lookup(struct rhashtable *fib_rt_ht, const struct fib6_info *rt)
{}

static int nsim_fib6_rt_append(struct nsim_fib_data *data,
			       struct nsim_fib6_event *fib6_event)
{}

#if IS_ENABLED(CONFIG_IPV6)
static void nsim_fib6_rt_offload_failed_flag_set(struct nsim_fib_data *data,
						 struct fib6_info **rt_arr,
						 unsigned int nrt6)

{}
#else
static void nsim_fib6_rt_offload_failed_flag_set(struct nsim_fib_data *data,
						 struct fib6_info **rt_arr,
						 unsigned int nrt6)
{
}
#endif

#if IS_ENABLED(CONFIG_IPV6)
static void nsim_fib6_rt_hw_flags_set(struct nsim_fib_data *data,
				      const struct nsim_fib6_rt *fib6_rt,
				      bool trap)
{}
#else
static void nsim_fib6_rt_hw_flags_set(struct nsim_fib_data *data,
				      const struct nsim_fib6_rt *fib6_rt,
				      bool trap)
{
}
#endif

static int nsim_fib6_rt_add(struct nsim_fib_data *data,
			    struct nsim_fib6_rt *fib6_rt)
{}

static int nsim_fib6_rt_replace(struct nsim_fib_data *data,
				struct nsim_fib6_rt *fib6_rt,
				struct nsim_fib6_rt *fib6_rt_old)
{}

static int nsim_fib6_rt_insert(struct nsim_fib_data *data,
			       struct nsim_fib6_event *fib6_event)
{}

static void nsim_fib6_rt_remove(struct nsim_fib_data *data,
				struct nsim_fib6_event *fib6_event)
{}

static int nsim_fib6_event_init(struct nsim_fib6_event *fib6_event,
				struct fib6_entry_notifier_info *fen6_info)
{}

static void nsim_fib6_event_fini(struct nsim_fib6_event *fib6_event)
{}

static int nsim_fib6_event(struct nsim_fib_data *data,
			   struct nsim_fib6_event *fib6_event,
			   unsigned long event)
{}

static void nsim_fib_event(struct nsim_fib_event *fib_event)
{}

static int nsim_fib4_prepare_event(struct fib_notifier_info *info,
				   struct nsim_fib_event *fib_event,
				   unsigned long event)
{}

static int nsim_fib6_prepare_event(struct fib_notifier_info *info,
				   struct nsim_fib_event *fib_event,
				   unsigned long event)
{}

static int nsim_fib_event_schedule_work(struct nsim_fib_data *data,
					struct fib_notifier_info *info,
					unsigned long event)
{}

static int nsim_fib_event_nb(struct notifier_block *nb, unsigned long event,
			     void *ptr)
{}

static void nsim_fib4_rt_free(struct nsim_fib_rt *fib_rt,
			      struct nsim_fib_data *data)
{}

static void nsim_fib6_rt_free(struct nsim_fib_rt *fib_rt,
			      struct nsim_fib_data *data)
{}

static void nsim_fib_rt_free(void *ptr, void *arg)
{}

/* inconsistent dump, trying again */
static void nsim_fib_dump_inconsistent(struct notifier_block *nb)
{}

static struct nsim_nexthop *nsim_nexthop_create(struct nsim_fib_data *data,
						struct nh_notifier_info *info)
{}

static void nsim_nexthop_destroy(struct nsim_nexthop *nexthop)
{}

static int nsim_nexthop_account(struct nsim_fib_data *data, u64 occ,
				bool add, struct netlink_ext_ack *extack)
{}

static void nsim_nexthop_hw_flags_set(struct net *net,
				      const struct nsim_nexthop *nexthop,
				      bool trap)
{}

static int nsim_nexthop_add(struct nsim_fib_data *data,
			    struct nsim_nexthop *nexthop,
			    struct netlink_ext_ack *extack)
{}

static int nsim_nexthop_replace(struct nsim_fib_data *data,
				struct nsim_nexthop *nexthop,
				struct nsim_nexthop *nexthop_old,
				struct netlink_ext_ack *extack)
{}

static int nsim_nexthop_insert(struct nsim_fib_data *data,
			       struct nh_notifier_info *info)
{}

static void nsim_nexthop_remove(struct nsim_fib_data *data,
				struct nh_notifier_info *info)
{}

static int nsim_nexthop_res_table_pre_replace(struct nsim_fib_data *data,
					      struct nh_notifier_info *info)
{}

static int nsim_nexthop_bucket_replace(struct nsim_fib_data *data,
				       struct nh_notifier_info *info)
{}

static int nsim_nexthop_event_nb(struct notifier_block *nb, unsigned long event,
				 void *ptr)
{}

static void nsim_nexthop_free(void *ptr, void *arg)
{}

static ssize_t nsim_nexthop_bucket_activity_write(struct file *file,
						  const char __user *user_buf,
						  size_t size, loff_t *ppos)
{}

static const struct file_operations nsim_nexthop_bucket_activity_fops =;

static u64 nsim_fib_ipv4_resource_occ_get(void *priv)
{}

static u64 nsim_fib_ipv4_rules_res_occ_get(void *priv)
{}

static u64 nsim_fib_ipv6_resource_occ_get(void *priv)
{}

static u64 nsim_fib_ipv6_rules_res_occ_get(void *priv)
{}

static u64 nsim_fib_nexthops_res_occ_get(void *priv)
{}

static void nsim_fib_set_max_all(struct nsim_fib_data *data,
				 struct devlink *devlink)
{}

static void nsim_fib_event_work(struct work_struct *work)
{}

static void nsim_fib_flush_work(struct work_struct *work)
{}

static int
nsim_fib_debugfs_init(struct nsim_fib_data *data, struct nsim_dev *nsim_dev)
{}

static void nsim_fib_debugfs_exit(struct nsim_fib_data *data)
{}

struct nsim_fib_data *nsim_fib_create(struct devlink *devlink,
				      struct netlink_ext_ack *extack)
{}

void nsim_fib_destroy(struct devlink *devlink, struct nsim_fib_data *data)
{}