linux/drivers/net/veth.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 *  drivers/net/veth.c
 *
 *  Copyright (C) 2007 OpenVZ http://openvz.org, SWsoft Inc
 *
 * Author: Pavel Emelianov <[email protected]>
 * Ethtool interface from: Eric W. Biederman <[email protected]>
 *
 */

#include <linux/netdevice.h>
#include <linux/slab.h>
#include <linux/ethtool.h>
#include <linux/etherdevice.h>
#include <linux/u64_stats_sync.h>

#include <net/rtnetlink.h>
#include <net/dst.h>
#include <net/xfrm.h>
#include <net/xdp.h>
#include <linux/veth.h>
#include <linux/module.h>
#include <linux/bpf.h>
#include <linux/filter.h>
#include <linux/ptr_ring.h>
#include <linux/bpf_trace.h>
#include <linux/net_tstamp.h>
#include <linux/skbuff_ref.h>
#include <net/page_pool/helpers.h>

#define DRV_NAME
#define DRV_VERSION

#define VETH_XDP_FLAG
#define VETH_RING_SIZE
#define VETH_XDP_HEADROOM

#define VETH_XDP_TX_BULK_SIZE
#define VETH_XDP_BATCH

struct veth_stats {};

struct veth_rq_stats {};

struct veth_rq {};

struct veth_priv {};

struct veth_xdp_tx_bq {};

/*
 * ethtool interface
 */

struct veth_q_stat_desc {};

#define VETH_RQ_STAT(m)

static const struct veth_q_stat_desc veth_rq_stats_desc[] =;

#define VETH_RQ_STATS_LEN

static const struct veth_q_stat_desc veth_tq_stats_desc[] =;

#define VETH_TQ_STATS_LEN

static struct {} ethtool_stats_keys[] =;

struct veth_xdp_buff {};

static int veth_get_link_ksettings(struct net_device *dev,
				   struct ethtool_link_ksettings *cmd)
{}

static void veth_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{}

static void veth_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
{}

static int veth_get_sset_count(struct net_device *dev, int sset)
{}

static void veth_get_page_pool_stats(struct net_device *dev, u64 *data)
{}

static void veth_get_ethtool_stats(struct net_device *dev,
		struct ethtool_stats *stats, u64 *data)
{}

static void veth_get_channels(struct net_device *dev,
			      struct ethtool_channels *channels)
{}

static int veth_set_channels(struct net_device *dev,
			     struct ethtool_channels *ch);

static const struct ethtool_ops veth_ethtool_ops =;

/* general routines */

static bool veth_is_xdp_frame(void *ptr)
{}

static struct xdp_frame *veth_ptr_to_xdp(void *ptr)
{}

static void *veth_xdp_to_ptr(struct xdp_frame *xdp)
{}

static void veth_ptr_free(void *ptr)
{}

static void __veth_xdp_flush(struct veth_rq *rq)
{}

static int veth_xdp_rx(struct veth_rq *rq, struct sk_buff *skb)
{}

static int veth_forward_skb(struct net_device *dev, struct sk_buff *skb,
			    struct veth_rq *rq, bool xdp)
{}

/* return true if the specified skb has chances of GRO aggregation
 * Don't strive for accuracy, but try to avoid GRO overhead in the most
 * common scenarios.
 * When XDP is enabled, all traffic is considered eligible, as the xmit
 * device has TSO off.
 * When TSO is enabled on the xmit device, we are likely interested only
 * in UDP aggregation, explicitly check for that if the skb is suspected
 * - the sock_wfree destructor is used by UDP, ICMP and XDP sockets -
 * to belong to locally generated UDP traffic.
 */
static bool veth_skb_is_eligible_for_gro(const struct net_device *dev,
					 const struct net_device *rcv,
					 const struct sk_buff *skb)
{}

static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
{}

static void veth_stats_rx(struct veth_stats *result, struct net_device *dev)
{}

static void veth_get_stats64(struct net_device *dev,
			     struct rtnl_link_stats64 *tot)
{}

/* fake multicast ability */
static void veth_set_multicast_list(struct net_device *dev)
{}

static int veth_select_rxq(struct net_device *dev)
{}

static struct net_device *veth_peer_dev(struct net_device *dev)
{}

static int veth_xdp_xmit(struct net_device *dev, int n,
			 struct xdp_frame **frames,
			 u32 flags, bool ndo_xmit)
{}

static int veth_ndo_xdp_xmit(struct net_device *dev, int n,
			     struct xdp_frame **frames, u32 flags)
{}

static void veth_xdp_flush_bq(struct veth_rq *rq, struct veth_xdp_tx_bq *bq)
{}

static void veth_xdp_flush(struct veth_rq *rq, struct veth_xdp_tx_bq *bq)
{}

static int veth_xdp_tx(struct veth_rq *rq, struct xdp_buff *xdp,
		       struct veth_xdp_tx_bq *bq)
{}

static struct xdp_frame *veth_xdp_rcv_one(struct veth_rq *rq,
					  struct xdp_frame *frame,
					  struct veth_xdp_tx_bq *bq,
					  struct veth_stats *stats)
{}

/* frames array contains VETH_XDP_BATCH at most */
static void veth_xdp_rcv_bulk_skb(struct veth_rq *rq, void **frames,
				  int n_xdpf, struct veth_xdp_tx_bq *bq,
				  struct veth_stats *stats)
{}

static void veth_xdp_get(struct xdp_buff *xdp)
{}

static int veth_convert_skb_to_xdp_buff(struct veth_rq *rq,
					struct xdp_buff *xdp,
					struct sk_buff **pskb)
{}

static struct sk_buff *veth_xdp_rcv_skb(struct veth_rq *rq,
					struct sk_buff *skb,
					struct veth_xdp_tx_bq *bq,
					struct veth_stats *stats)
{}

static int veth_xdp_rcv(struct veth_rq *rq, int budget,
			struct veth_xdp_tx_bq *bq,
			struct veth_stats *stats)
{}

static int veth_poll(struct napi_struct *napi, int budget)
{}

static int veth_create_page_pool(struct veth_rq *rq)
{}

static int __veth_napi_enable_range(struct net_device *dev, int start, int end)
{}

static int __veth_napi_enable(struct net_device *dev)
{}

static void veth_napi_del_range(struct net_device *dev, int start, int end)
{}

static void veth_napi_del(struct net_device *dev)
{}

static bool veth_gro_requested(const struct net_device *dev)
{}

static int veth_enable_xdp_range(struct net_device *dev, int start, int end,
				 bool napi_already_on)
{}

static void veth_disable_xdp_range(struct net_device *dev, int start, int end,
				   bool delete_napi)
{}

static int veth_enable_xdp(struct net_device *dev)
{}

static void veth_disable_xdp(struct net_device *dev)
{}

static int veth_napi_enable_range(struct net_device *dev, int start, int end)
{}

static int veth_napi_enable(struct net_device *dev)
{}

static void veth_disable_range_safe(struct net_device *dev, int start, int end)
{}

static int veth_enable_range_safe(struct net_device *dev, int start, int end)
{}

static void veth_set_xdp_features(struct net_device *dev)
{}

static int veth_set_channels(struct net_device *dev,
			     struct ethtool_channels *ch)
{}

static int veth_open(struct net_device *dev)
{}

static int veth_close(struct net_device *dev)
{}

static int is_valid_veth_mtu(int mtu)
{}

static int veth_alloc_queues(struct net_device *dev)
{}

static void veth_free_queues(struct net_device *dev)
{}

static int veth_dev_init(struct net_device *dev)
{}

static void veth_dev_free(struct net_device *dev)
{}

#ifdef CONFIG_NET_POLL_CONTROLLER
static void veth_poll_controller(struct net_device *dev)
{}
#endif	/* CONFIG_NET_POLL_CONTROLLER */

static int veth_get_iflink(const struct net_device *dev)
{}

static netdev_features_t veth_fix_features(struct net_device *dev,
					   netdev_features_t features)
{}

static int veth_set_features(struct net_device *dev,
			     netdev_features_t features)
{}

static void veth_set_rx_headroom(struct net_device *dev, int new_hr)
{}

static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog,
			struct netlink_ext_ack *extack)
{}

static int veth_xdp(struct net_device *dev, struct netdev_bpf *xdp)
{}

static int veth_xdp_rx_timestamp(const struct xdp_md *ctx, u64 *timestamp)
{}

static int veth_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash,
			    enum xdp_rss_hash_type *rss_type)
{}

static int veth_xdp_rx_vlan_tag(const struct xdp_md *ctx, __be16 *vlan_proto,
				u16 *vlan_tci)
{}

static const struct net_device_ops veth_netdev_ops =;

static const struct xdp_metadata_ops veth_xdp_metadata_ops =;

#define VETH_FEATURES

static void veth_setup(struct net_device *dev)
{}

/*
 * netlink interface
 */

static int veth_validate(struct nlattr *tb[], struct nlattr *data[],
			 struct netlink_ext_ack *extack)
{}

static struct rtnl_link_ops veth_link_ops;

static void veth_disable_gro(struct net_device *dev)
{}

static int veth_init_queues(struct net_device *dev, struct nlattr *tb[])
{}

static int veth_newlink(struct net *src_net, struct net_device *dev,
			struct nlattr *tb[], struct nlattr *data[],
			struct netlink_ext_ack *extack)
{}

static void veth_dellink(struct net_device *dev, struct list_head *head)
{}

static const struct nla_policy veth_policy[VETH_INFO_MAX + 1] =;

static struct net *veth_get_link_net(const struct net_device *dev)
{}

static unsigned int veth_get_num_queues(void)
{}

static struct rtnl_link_ops veth_link_ops =;

/*
 * init/fini
 */

static __init int veth_init(void)
{}

static __exit void veth_exit(void)
{}

module_init();
module_exit(veth_exit);

MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_ALIAS_RTNL_LINK();