#include <linux/bpf.h>
#include <linux/bpf_verifier.h>
#include <linux/debugfs.h>
#include <linux/kernel.h>
#include <linux/mutex.h>
#include <linux/rtnetlink.h>
#include <net/pkt_cls.h>
#include "netdevsim.h"
#define pr_vlog(env, fmt, ...) …
struct nsim_bpf_bound_prog { … };
#define NSIM_BPF_MAX_KEYS …
struct nsim_bpf_bound_map { … };
static int nsim_bpf_string_show(struct seq_file *file, void *data)
{ … }
DEFINE_SHOW_ATTRIBUTE(…);
static int
nsim_bpf_verify_insn(struct bpf_verifier_env *env, int insn_idx, int prev_insn)
{ … }
static int nsim_bpf_finalize(struct bpf_verifier_env *env)
{ … }
static bool nsim_xdp_offload_active(struct netdevsim *ns)
{ … }
static void nsim_prog_set_loaded(struct bpf_prog *prog, bool loaded)
{ … }
static int
nsim_bpf_offload(struct netdevsim *ns, struct bpf_prog *prog, bool oldprog)
{ … }
int nsim_bpf_setup_tc_block_cb(enum tc_setup_type type,
void *type_data, void *cb_priv)
{ … }
int nsim_bpf_disable_tc(struct netdevsim *ns)
{ … }
static int nsim_xdp_offload_prog(struct netdevsim *ns, struct netdev_bpf *bpf)
{ … }
static int
nsim_xdp_set_prog(struct netdevsim *ns, struct netdev_bpf *bpf,
struct xdp_attachment_info *xdp)
{ … }
static int nsim_bpf_create_prog(struct nsim_dev *nsim_dev,
struct bpf_prog *prog)
{ … }
static int nsim_bpf_verifier_prep(struct bpf_prog *prog)
{ … }
static int nsim_bpf_translate(struct bpf_prog *prog)
{ … }
static void nsim_bpf_destroy_prog(struct bpf_prog *prog)
{ … }
static const struct bpf_prog_offload_ops nsim_bpf_dev_ops = …;
static int nsim_setup_prog_checks(struct netdevsim *ns, struct netdev_bpf *bpf)
{ … }
static int
nsim_setup_prog_hw_checks(struct netdevsim *ns, struct netdev_bpf *bpf)
{ … }
static bool
nsim_map_key_match(struct bpf_map *map, struct nsim_map_entry *e, void *key)
{ … }
static int nsim_map_key_find(struct bpf_offloaded_map *offmap, void *key)
{ … }
static int
nsim_map_alloc_elem(struct bpf_offloaded_map *offmap, unsigned int idx)
{ … }
static int
nsim_map_get_next_key(struct bpf_offloaded_map *offmap,
void *key, void *next_key)
{ … }
static int
nsim_map_lookup_elem(struct bpf_offloaded_map *offmap, void *key, void *value)
{ … }
static int
nsim_map_update_elem(struct bpf_offloaded_map *offmap,
void *key, void *value, u64 flags)
{ … }
static int nsim_map_delete_elem(struct bpf_offloaded_map *offmap, void *key)
{ … }
static const struct bpf_map_dev_ops nsim_bpf_map_ops = …;
static int
nsim_bpf_map_alloc(struct netdevsim *ns, struct bpf_offloaded_map *offmap)
{ … }
static void nsim_bpf_map_free(struct bpf_offloaded_map *offmap)
{ … }
int nsim_bpf(struct net_device *dev, struct netdev_bpf *bpf)
{ … }
int nsim_bpf_dev_init(struct nsim_dev *nsim_dev)
{ … }
void nsim_bpf_dev_exit(struct nsim_dev *nsim_dev)
{ … }
int nsim_bpf_init(struct netdevsim *ns)
{ … }
void nsim_bpf_uninit(struct netdevsim *ns)
{ … }