linux/drivers/net/macvlan.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (c) 2007 Patrick McHardy <[email protected]>
 *
 * The code this is based on carried the following copyright notice:
 * ---
 * (C) Copyright 2001-2006
 * Alex Zeffertt, Cambridge Broadband Ltd, [email protected]
 * Re-worked by Ben Greear <[email protected]>
 * ---
 */
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/rculist.h>
#include <linux/notifier.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/net_tstamp.h>
#include <linux/ethtool.h>
#include <linux/if_arp.h>
#include <linux/if_vlan.h>
#include <linux/if_link.h>
#include <linux/if_macvlan.h>
#include <linux/hash.h>
#include <linux/workqueue.h>
#include <net/rtnetlink.h>
#include <net/xfrm.h>
#include <linux/netpoll.h>
#include <linux/phy.h>

#define MACVLAN_HASH_BITS
#define MACVLAN_HASH_SIZE
#define MACVLAN_DEFAULT_BC_QUEUE_LEN

#define MACVLAN_F_PASSTHRU
#define MACVLAN_F_ADDRCHANGE

struct macvlan_port {};

struct macvlan_source_entry {};

struct macvlan_skb_cb {};

#define MACVLAN_SKB_CB(__skb)

static void macvlan_port_destroy(struct net_device *dev);
static void update_port_bc_queue_len(struct macvlan_port *port);

static inline bool macvlan_passthru(const struct macvlan_port *port)
{}

static inline void macvlan_set_passthru(struct macvlan_port *port)
{}

static inline bool macvlan_addr_change(const struct macvlan_port *port)
{}

static inline void macvlan_set_addr_change(struct macvlan_port *port)
{}

static inline void macvlan_clear_addr_change(struct macvlan_port *port)
{}

/* Hash Ethernet address */
static u32 macvlan_eth_hash(const unsigned char *addr)
{}

static struct macvlan_port *macvlan_port_get_rcu(const struct net_device *dev)
{}

static struct macvlan_port *macvlan_port_get_rtnl(const struct net_device *dev)
{}

static struct macvlan_dev *macvlan_hash_lookup(const struct macvlan_port *port,
					       const unsigned char *addr)
{}

static struct macvlan_source_entry *macvlan_hash_lookup_source(
	const struct macvlan_dev *vlan,
	const unsigned char *addr)
{}

static int macvlan_hash_add_source(struct macvlan_dev *vlan,
				   const unsigned char *addr)
{}

static void macvlan_hash_add(struct macvlan_dev *vlan)
{}

static void macvlan_hash_del_source(struct macvlan_source_entry *entry)
{}

static void macvlan_hash_del(struct macvlan_dev *vlan, bool sync)
{}

static void macvlan_hash_change_addr(struct macvlan_dev *vlan,
					const unsigned char *addr)
{}

static bool macvlan_addr_busy(const struct macvlan_port *port,
			      const unsigned char *addr)
{}


static int macvlan_broadcast_one(struct sk_buff *skb,
				 const struct macvlan_dev *vlan,
				 const struct ethhdr *eth, bool local)
{}

static u32 macvlan_hash_mix(const struct macvlan_dev *vlan)
{}


static unsigned int mc_hash(const struct macvlan_dev *vlan,
			    const unsigned char *addr)
{}

static void macvlan_broadcast(struct sk_buff *skb,
			      const struct macvlan_port *port,
			      struct net_device *src,
			      enum macvlan_mode mode)
{}

static void macvlan_multicast_rx(const struct macvlan_port *port,
				 const struct macvlan_dev *src,
				 struct sk_buff *skb)
{}

static void macvlan_process_broadcast(struct work_struct *w)
{}

static void macvlan_broadcast_enqueue(struct macvlan_port *port,
				      const struct macvlan_dev *src,
				      struct sk_buff *skb)
{}

static void macvlan_flush_sources(struct macvlan_port *port,
				  struct macvlan_dev *vlan)
{}

static void macvlan_forward_source_one(struct sk_buff *skb,
				       struct macvlan_dev *vlan)
{}

static bool macvlan_forward_source(struct sk_buff *skb,
				   struct macvlan_port *port,
				   const unsigned char *addr)
{}

/* called under rcu_read_lock() from netif_receive_skb */
static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
{}

static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
{}

static inline netdev_tx_t macvlan_netpoll_send_skb(struct macvlan_dev *vlan, struct sk_buff *skb)
{}

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

static int macvlan_hard_header(struct sk_buff *skb, struct net_device *dev,
			       unsigned short type, const void *daddr,
			       const void *saddr, unsigned len)
{}

static const struct header_ops macvlan_hard_header_ops =;

static int macvlan_open(struct net_device *dev)
{}

static int macvlan_stop(struct net_device *dev)
{}

static int macvlan_sync_address(struct net_device *dev,
				const unsigned char *addr)
{}

static int macvlan_set_mac_address(struct net_device *dev, void *p)
{}

static void macvlan_change_rx_flags(struct net_device *dev, int change)
{}

static void macvlan_compute_filter(unsigned long *mc_filter,
				   struct net_device *dev,
				   struct macvlan_dev *vlan, int cutoff)
{}

static void macvlan_recompute_bc_filter(struct macvlan_dev *vlan)
{}

static void macvlan_set_mac_lists(struct net_device *dev)
{}

static void update_port_bc_cutoff(struct macvlan_dev *vlan, int cutoff)
{}

static int macvlan_change_mtu(struct net_device *dev, int new_mtu)
{}

static int macvlan_hwtstamp_get(struct net_device *dev,
				struct kernel_hwtstamp_config *cfg)
{}

static int macvlan_hwtstamp_set(struct net_device *dev,
				struct kernel_hwtstamp_config *cfg,
				struct netlink_ext_ack *extack)
{}

/*
 * macvlan network devices have devices nesting below it and are a special
 * "super class" of normal network devices; split their locks off into a
 * separate class since they always nest.
 */
static struct lock_class_key macvlan_netdev_addr_lock_key;

#define ALWAYS_ON_OFFLOADS

#define ALWAYS_ON_FEATURES

#define MACVLAN_FEATURES

#define MACVLAN_STATE_MASK

static void macvlan_set_lockdep_class(struct net_device *dev)
{}

static int macvlan_init(struct net_device *dev)
{}

static void macvlan_uninit(struct net_device *dev)
{}

static void macvlan_dev_get_stats64(struct net_device *dev,
				    struct rtnl_link_stats64 *stats)
{}

static int macvlan_vlan_rx_add_vid(struct net_device *dev,
				   __be16 proto, u16 vid)
{}

static int macvlan_vlan_rx_kill_vid(struct net_device *dev,
				    __be16 proto, u16 vid)
{}

static int macvlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
			   struct net_device *dev,
			   const unsigned char *addr, u16 vid,
			   u16 flags,
			   struct netlink_ext_ack *extack)
{}

static int macvlan_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
			   struct net_device *dev,
			   const unsigned char *addr, u16 vid,
			   struct netlink_ext_ack *extack)
{}

static void macvlan_ethtool_get_drvinfo(struct net_device *dev,
					struct ethtool_drvinfo *drvinfo)
{}

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

static int macvlan_ethtool_get_ts_info(struct net_device *dev,
				       struct kernel_ethtool_ts_info *info)
{}

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

#ifdef CONFIG_NET_POLL_CONTROLLER
static void macvlan_dev_poll_controller(struct net_device *dev)
{}

static int macvlan_dev_netpoll_setup(struct net_device *dev, struct netpoll_info *npinfo)
{}

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

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

static const struct ethtool_ops macvlan_ethtool_ops =;

static const struct net_device_ops macvlan_netdev_ops =;

static void macvlan_dev_free(struct net_device *dev)
{}

void macvlan_common_setup(struct net_device *dev)
{}
EXPORT_SYMBOL_GPL();

static void macvlan_setup(struct net_device *dev)
{}

static int macvlan_port_create(struct net_device *dev)
{}

static void macvlan_port_destroy(struct net_device *dev)
{}

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

/*
 * reconfigure list of remote source mac address
 * (only for macvlan devices in source mode)
 * Note regarding alignment: all netlink data is aligned to 4 Byte, which
 * suffices for both ether_addr_copy and ether_addr_equal_64bits usage.
 */
static int macvlan_changelink_sources(struct macvlan_dev *vlan, u32 mode,
				      struct nlattr *data[])
{}

int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
			   struct nlattr *tb[], struct nlattr *data[],
			   struct netlink_ext_ack *extack)
{}
EXPORT_SYMBOL_GPL();

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

void macvlan_dellink(struct net_device *dev, struct list_head *head)
{}
EXPORT_SYMBOL_GPL();

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

static size_t macvlan_get_size_mac(const struct macvlan_dev *vlan)
{}

static size_t macvlan_get_size(const struct net_device *dev)
{}

static int macvlan_fill_info_macaddr(struct sk_buff *skb,
				     const struct macvlan_dev *vlan,
				     const int i)
{}

static int macvlan_fill_info(struct sk_buff *skb,
				const struct net_device *dev)
{}

static const struct nla_policy macvlan_policy[IFLA_MACVLAN_MAX + 1] =;

int macvlan_link_register(struct rtnl_link_ops *ops)
{
	/* common fields */
	ops->validate		= macvlan_validate;
	ops->maxtype		= IFLA_MACVLAN_MAX;
	ops->policy		= macvlan_policy;
	ops->changelink		= macvlan_changelink;
	ops->get_size		= macvlan_get_size;
	ops->fill_info		= macvlan_fill_info;

	return rtnl_link_register(ops);
};
EXPORT_SYMBOL_GPL();

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

static struct rtnl_link_ops macvlan_link_ops =;

static void update_port_bc_queue_len(struct macvlan_port *port)
{}

static int macvlan_device_event(struct notifier_block *unused,
				unsigned long event, void *ptr)
{}

static struct notifier_block macvlan_notifier_block __read_mostly =;

static int __init macvlan_init_module(void)
{}

static void __exit macvlan_cleanup_module(void)
{}

module_init();
module_exit(macvlan_cleanup_module);

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