#include <linux/debugfs.h>
#include <linux/etherdevice.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/netdevice.h>
#include <linux/slab.h>
#include <net/netdev_queues.h>
#include <net/page_pool/helpers.h>
#include <net/netlink.h>
#include <net/pkt_cls.h>
#include <net/rtnetlink.h>
#include <net/udp_tunnel.h>
#include "netdevsim.h"
#define NSIM_RING_SIZE …
static int nsim_napi_rx(struct nsim_rq *rq, struct sk_buff *skb)
{ … }
static int nsim_forward_skb(struct net_device *dev, struct sk_buff *skb,
struct nsim_rq *rq)
{ … }
static netdev_tx_t nsim_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ … }
static void nsim_set_rx_mode(struct net_device *dev)
{ … }
static int nsim_change_mtu(struct net_device *dev, int new_mtu)
{ … }
static void
nsim_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{ … }
static int
nsim_setup_tc_block_cb(enum tc_setup_type type, void *type_data, void *cb_priv)
{ … }
static int nsim_set_vf_mac(struct net_device *dev, int vf, u8 *mac)
{ … }
static int nsim_set_vf_vlan(struct net_device *dev, int vf,
u16 vlan, u8 qos, __be16 vlan_proto)
{ … }
static int nsim_set_vf_rate(struct net_device *dev, int vf, int min, int max)
{ … }
static int nsim_set_vf_spoofchk(struct net_device *dev, int vf, bool val)
{ … }
static int nsim_set_vf_rss_query_en(struct net_device *dev, int vf, bool val)
{ … }
static int nsim_set_vf_trust(struct net_device *dev, int vf, bool val)
{ … }
static int
nsim_get_vf_config(struct net_device *dev, int vf, struct ifla_vf_info *ivi)
{ … }
static int nsim_set_vf_link_state(struct net_device *dev, int vf, int state)
{ … }
static void nsim_taprio_stats(struct tc_taprio_qopt_stats *stats)
{ … }
static int nsim_setup_tc_taprio(struct net_device *dev,
struct tc_taprio_qopt_offload *offload)
{ … }
static LIST_HEAD(nsim_block_cb_list);
static int
nsim_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data)
{ … }
static int
nsim_set_features(struct net_device *dev, netdev_features_t features)
{ … }
static int nsim_get_iflink(const struct net_device *dev)
{ … }
static int nsim_rcv(struct nsim_rq *rq, int budget)
{ … }
static int nsim_poll(struct napi_struct *napi, int budget)
{ … }
static int nsim_create_page_pool(struct nsim_rq *rq)
{ … }
static int nsim_init_napi(struct netdevsim *ns)
{ … }
static void nsim_enable_napi(struct netdevsim *ns)
{ … }
static int nsim_open(struct net_device *dev)
{ … }
static void nsim_del_napi(struct netdevsim *ns)
{ … }
static int nsim_stop(struct net_device *dev)
{ … }
static const struct net_device_ops nsim_netdev_ops = …;
static const struct net_device_ops nsim_vf_netdev_ops = …;
static void nsim_get_queue_stats_rx(struct net_device *dev, int idx,
struct netdev_queue_stats_rx *stats)
{ … }
static void nsim_get_queue_stats_tx(struct net_device *dev, int idx,
struct netdev_queue_stats_tx *stats)
{ … }
static void nsim_get_base_stats(struct net_device *dev,
struct netdev_queue_stats_rx *rx,
struct netdev_queue_stats_tx *tx)
{ … }
static const struct netdev_stat_ops nsim_stat_ops = …;
static ssize_t
nsim_pp_hold_read(struct file *file, char __user *data,
size_t count, loff_t *ppos)
{ … }
static ssize_t
nsim_pp_hold_write(struct file *file, const char __user *data,
size_t count, loff_t *ppos)
{ … }
static const struct file_operations nsim_pp_hold_fops = …;
static void nsim_setup(struct net_device *dev)
{ … }
static int nsim_queue_init(struct netdevsim *ns)
{ … }
static void nsim_queue_free(struct netdevsim *ns)
{ … }
static int nsim_init_netdevsim(struct netdevsim *ns)
{ … }
static int nsim_init_netdevsim_vf(struct netdevsim *ns)
{ … }
static void nsim_exit_netdevsim(struct netdevsim *ns)
{ … }
struct netdevsim *
nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port)
{ … }
void nsim_destroy(struct netdevsim *ns)
{ … }
bool netdev_is_nsim(struct net_device *dev)
{ … }
static int nsim_validate(struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static struct rtnl_link_ops nsim_link_ops __read_mostly = …;
static int __init nsim_module_init(void)
{ … }
static void __exit nsim_module_exit(void)
{ … }
module_init(…) …;
module_exit(nsim_module_exit);
MODULE_LICENSE(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_ALIAS_RTNL_LINK(…);