#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/ethtool.h>
#include <linux/if_ether.h>
#include <net/tcp.h>
#include <linux/udp.h>
#include <linux/moduleparam.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <net/ip.h>
#include <linux/bpf.h>
#include <net/page_pool/types.h>
#include <linux/bpf_trace.h>
#include <xen/xen.h>
#include <xen/xenbus.h>
#include <xen/events.h>
#include <xen/page.h>
#include <xen/platform_pci.h>
#include <xen/grant_table.h>
#include <xen/interface/io/netif.h>
#include <xen/interface/memory.h>
#include <xen/interface/grant_table.h>
#define MAX_QUEUES_DEFAULT …
static unsigned int xennet_max_queues;
module_param_named(max_queues, xennet_max_queues, uint, 0644);
MODULE_PARM_DESC(…) …;
static bool __read_mostly xennet_trusted = …;
module_param_named(trusted, xennet_trusted, bool, 0644);
MODULE_PARM_DESC(…) …;
#define XENNET_TIMEOUT …
static const struct ethtool_ops xennet_ethtool_ops;
struct netfront_cb { … };
#define NETFRONT_SKB_CB(skb) …
#define RX_COPY_THRESHOLD …
#define NET_TX_RING_SIZE …
#define NET_RX_RING_SIZE …
#define NET_RX_SLOTS_MIN …
#define QUEUE_NAME_SIZE …
#define IRQ_NAME_SIZE …
static DECLARE_WAIT_QUEUE_HEAD(module_wq);
struct netfront_stats { … };
struct netfront_info;
struct netfront_queue { … };
struct netfront_info { … };
struct netfront_rx_info { … };
static void add_id_to_list(unsigned *head, unsigned short *list,
unsigned short id)
{ … }
static unsigned short get_id_from_list(unsigned *head, unsigned short *list)
{ … }
static int xennet_rxidx(RING_IDX idx)
{ … }
static struct sk_buff *xennet_get_rx_skb(struct netfront_queue *queue,
RING_IDX ri)
{ … }
static grant_ref_t xennet_get_rx_ref(struct netfront_queue *queue,
RING_IDX ri)
{ … }
#ifdef CONFIG_SYSFS
static const struct attribute_group xennet_dev_group;
#endif
static bool xennet_can_sg(struct net_device *dev)
{ … }
static void rx_refill_timeout(struct timer_list *t)
{ … }
static int netfront_tx_slot_available(struct netfront_queue *queue)
{ … }
static void xennet_maybe_wake_tx(struct netfront_queue *queue)
{ … }
static struct sk_buff *xennet_alloc_one_rx_buffer(struct netfront_queue *queue)
{ … }
static void xennet_alloc_rx_buffers(struct netfront_queue *queue)
{ … }
static int xennet_open(struct net_device *dev)
{ … }
static bool xennet_tx_buf_gc(struct netfront_queue *queue)
{ … }
struct xennet_gnttab_make_txreq { … };
static void xennet_tx_setup_grant(unsigned long gfn, unsigned int offset,
unsigned int len, void *data)
{ … }
static struct xen_netif_tx_request *xennet_make_first_txreq(
struct xennet_gnttab_make_txreq *info,
unsigned int offset, unsigned int len)
{ … }
static void xennet_make_one_txreq(unsigned long gfn, unsigned int offset,
unsigned int len, void *data)
{ … }
static void xennet_make_txreqs(
struct xennet_gnttab_make_txreq *info,
struct page *page,
unsigned int offset, unsigned int len)
{ … }
static int xennet_count_skb_slots(struct sk_buff *skb)
{ … }
static u16 xennet_select_queue(struct net_device *dev, struct sk_buff *skb,
struct net_device *sb_dev)
{ … }
static void xennet_mark_tx_pending(struct netfront_queue *queue)
{ … }
static int xennet_xdp_xmit_one(struct net_device *dev,
struct netfront_queue *queue,
struct xdp_frame *xdpf)
{ … }
static int xennet_xdp_xmit(struct net_device *dev, int n,
struct xdp_frame **frames, u32 flags)
{ … }
static struct sk_buff *bounce_skb(const struct sk_buff *skb)
{ … }
#define MAX_XEN_SKB_FRAGS …
static netdev_tx_t xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ … }
static int xennet_close(struct net_device *dev)
{ … }
static void xennet_destroy_queues(struct netfront_info *info)
{ … }
static void xennet_uninit(struct net_device *dev)
{ … }
static void xennet_set_rx_rsp_cons(struct netfront_queue *queue, RING_IDX val)
{ … }
static void xennet_move_rx_slot(struct netfront_queue *queue, struct sk_buff *skb,
grant_ref_t ref)
{ … }
static int xennet_get_extras(struct netfront_queue *queue,
struct xen_netif_extra_info *extras,
RING_IDX rp)
{ … }
static u32 xennet_run_xdp(struct netfront_queue *queue, struct page *pdata,
struct xen_netif_rx_response *rx, struct bpf_prog *prog,
struct xdp_buff *xdp, bool *need_xdp_flush)
{ … }
static int xennet_get_responses(struct netfront_queue *queue,
struct netfront_rx_info *rinfo, RING_IDX rp,
struct sk_buff_head *list,
bool *need_xdp_flush)
{ … }
static int xennet_set_skb_gso(struct sk_buff *skb,
struct xen_netif_extra_info *gso)
{ … }
static int xennet_fill_frags(struct netfront_queue *queue,
struct sk_buff *skb,
struct sk_buff_head *list)
{ … }
static int checksum_setup(struct net_device *dev, struct sk_buff *skb)
{ … }
static int handle_incoming_queue(struct netfront_queue *queue,
struct sk_buff_head *rxq)
{ … }
static int xennet_poll(struct napi_struct *napi, int budget)
{ … }
static int xennet_change_mtu(struct net_device *dev, int mtu)
{ … }
static void xennet_get_stats64(struct net_device *dev,
struct rtnl_link_stats64 *tot)
{ … }
static void xennet_release_tx_bufs(struct netfront_queue *queue)
{ … }
static void xennet_release_rx_bufs(struct netfront_queue *queue)
{ … }
static netdev_features_t xennet_fix_features(struct net_device *dev,
netdev_features_t features)
{ … }
static int xennet_set_features(struct net_device *dev,
netdev_features_t features)
{ … }
static bool xennet_handle_tx(struct netfront_queue *queue, unsigned int *eoi)
{ … }
static irqreturn_t xennet_tx_interrupt(int irq, void *dev_id)
{ … }
static bool xennet_handle_rx(struct netfront_queue *queue, unsigned int *eoi)
{ … }
static irqreturn_t xennet_rx_interrupt(int irq, void *dev_id)
{ … }
static irqreturn_t xennet_interrupt(int irq, void *dev_id)
{ … }
#ifdef CONFIG_NET_POLL_CONTROLLER
static void xennet_poll_controller(struct net_device *dev)
{ … }
#endif
#define NETBACK_XDP_HEADROOM_DISABLE …
#define NETBACK_XDP_HEADROOM_ENABLE …
static int talk_to_netback_xdp(struct netfront_info *np, int xdp)
{ … }
static int xennet_xdp_set(struct net_device *dev, struct bpf_prog *prog,
struct netlink_ext_ack *extack)
{ … }
static int xennet_xdp(struct net_device *dev, struct netdev_bpf *xdp)
{ … }
static const struct net_device_ops xennet_netdev_ops = …;
static void xennet_free_netdev(struct net_device *netdev)
{ … }
static struct net_device *xennet_create_dev(struct xenbus_device *dev)
{ … }
static int netfront_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id)
{ … }
static void xennet_end_access(int ref, void *page)
{ … }
static void xennet_disconnect_backend(struct netfront_info *info)
{ … }
static int netfront_resume(struct xenbus_device *dev)
{ … }
static int xen_net_read_mac(struct xenbus_device *dev, u8 mac[])
{ … }
static int setup_netfront_single(struct netfront_queue *queue)
{ … }
static int setup_netfront_split(struct netfront_queue *queue)
{ … }
static int setup_netfront(struct xenbus_device *dev,
struct netfront_queue *queue, unsigned int feature_split_evtchn)
{ … }
static int xennet_init_queue(struct netfront_queue *queue)
{ … }
static int write_queue_xenstore_keys(struct netfront_queue *queue,
struct xenbus_transaction *xbt, int write_hierarchical)
{ … }
static int xennet_create_page_pool(struct netfront_queue *queue)
{ … }
static int xennet_create_queues(struct netfront_info *info,
unsigned int *num_queues)
{ … }
static int talk_to_netback(struct xenbus_device *dev,
struct netfront_info *info)
{ … }
static int xennet_connect(struct net_device *dev)
{ … }
static void netback_changed(struct xenbus_device *dev,
enum xenbus_state backend_state)
{ … }
static const struct xennet_stat { … } xennet_stats[] = …;
static int xennet_get_sset_count(struct net_device *dev, int string_set)
{ … }
static void xennet_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 * data)
{ … }
static void xennet_get_strings(struct net_device *dev, u32 stringset, u8 * data)
{ … }
static const struct ethtool_ops xennet_ethtool_ops = …;
#ifdef CONFIG_SYSFS
static ssize_t show_rxbuf(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static ssize_t store_rxbuf(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t len)
{ … }
static DEVICE_ATTR(rxbuf_min, 0644, show_rxbuf, store_rxbuf);
static DEVICE_ATTR(rxbuf_max, 0644, show_rxbuf, store_rxbuf);
static DEVICE_ATTR(rxbuf_cur, 0444, show_rxbuf, NULL);
static struct attribute *xennet_dev_attrs[] = …;
static const struct attribute_group xennet_dev_group = …;
#endif
static void xennet_bus_close(struct xenbus_device *dev)
{ … }
static void xennet_remove(struct xenbus_device *dev)
{ … }
static const struct xenbus_device_id netfront_ids[] = …;
static struct xenbus_driver netfront_driver = …;
static int __init netif_init(void)
{ … }
module_init(…) …;
static void __exit netif_exit(void)
{ … }
module_exit(netif_exit);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;
MODULE_ALIAS(…) …;