Changes in 4.9.264 net: fec: ptp: avoid register access when ipg clock is disabled powerpc/4xx: Fix build errors from mfdcr() atm: eni: dont release is never initialized atm: lanai: dont run lanai_dev_close if not open ixgbe: Fix memleak in ixgbe_configure_clsu32 net: tehuti: fix error return code in bdx_probe() sun/niu: fix wrong RXMAC_BC_FRM_CNT_COUNT count nfs: fix PNFS_FLEXFILE_LAYOUT Kconfig default NFS: Correct size calculation for create reply length net: wan: fix error return code of uhdlc_init() atm: uPD98402: fix incorrect allocation atm: idt77252: fix null-ptr-dereference u64_stats,lockdep: Fix u64_stats_init() vs lockdep nfs: we don't support removing system.nfs4_acl ia64: fix ia64_syscall_get_set_arguments() for break-based syscalls ia64: fix ptrace(PTRACE_SYSCALL_INFO_EXIT) sign x86/tlb: Flush global mappings when KAISER is disabled squashfs: fix inode lookup sanity checks squashfs: fix xattr id and id lookup sanity checks arm64: dts: ls1043a: mark crypto engine dma coherent bus: omap_l3_noc: mark l3 irqs as IRQF_NO_THREAD macvlan: macvlan_count_rx() needs to be aware of preemption net: dsa: bcm_sf2: Qualify phydev->dev_flags based on port e1000e: add rtnl_lock() to e1000_reset_task e1000e: Fix error handling in e1000_set_d0_lplu_state_82571 net/qlcnic: Fix a use after free in qlcnic_83xx_get_minidump_template can: c_can_pci: c_can_pci_remove(): fix use-after-free can: c_can: move runtime PM enable/disable to c_can_platform can: m_can: m_can_do_rx_poll(): fix extraneous msg loss warning mac80211: fix rate mask reset net: cdc-phonet: fix data-interface release on probe failure RDMA/cxgb4: Fix adapter LE hash errors while destroying ipv6 listening server ACPI: scan: Rearrange memory allocation in acpi_device_add() ACPI: scan: Use unique number for instance_no perf auxtrace: Fix auxtrace queue conflict idr: add ida_is_empty futex: Use smp_store_release() in mark_wake_futex() futex,rt_mutex: Introduce rt_mutex_init_waiter() futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock() futex: Drop hb->lock before enqueueing on the rtmutex futex: Avoid freeing an active timer futex,rt_mutex: Fix rt_mutex_cleanup_proxy_lock() futex: Handle early deadlock return correctly futex: Fix (possible) missed wakeup locking/futex: Allow low-level atomic operations to return -EAGAIN arm64: futex: Bound number of LDXR/STXR loops in FUTEX_WAKE_OP futex: Prevent robust futex exit race futex: Fix incorrect should_fail_futex() handling futex: Handle transient "ownerless" rtmutex state correctly can: dev: Move device back to init netns on owning netns delete net: sched: validate stab values net: qrtr: fix a kernel-infoleak in qrtr_recvmsg() mac80211: fix double free in ibss_leave xen-blkback: don't leak persistent grants from xen_blkbk_map() Linux 4.9.264 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I8c5617c1f82aa378e3ba19d43879065e15457edd
117 lines
2.9 KiB
C
117 lines
2.9 KiB
C
#ifndef _LINUX_IF_MACVLAN_H
|
|
#define _LINUX_IF_MACVLAN_H
|
|
|
|
#include <linux/if_link.h>
|
|
#include <linux/if_vlan.h>
|
|
#include <linux/list.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/netlink.h>
|
|
#include <net/netlink.h>
|
|
#include <linux/u64_stats_sync.h>
|
|
|
|
#if IS_ENABLED(CONFIG_MACVTAP)
|
|
struct socket *macvtap_get_socket(struct file *);
|
|
#else
|
|
#include <linux/err.h>
|
|
#include <linux/errno.h>
|
|
struct file;
|
|
struct socket;
|
|
static inline struct socket *macvtap_get_socket(struct file *f)
|
|
{
|
|
return ERR_PTR(-EINVAL);
|
|
}
|
|
#endif /* CONFIG_MACVTAP */
|
|
|
|
struct macvlan_port;
|
|
struct macvtap_queue;
|
|
|
|
/*
|
|
* Maximum times a macvtap device can be opened. This can be used to
|
|
* configure the number of receive queue, e.g. for multiqueue virtio.
|
|
*/
|
|
#define MAX_MACVTAP_QUEUES 256
|
|
|
|
#define MACVLAN_MC_FILTER_BITS 8
|
|
#define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS)
|
|
|
|
struct macvlan_dev {
|
|
struct net_device *dev;
|
|
struct list_head list;
|
|
struct hlist_node hlist;
|
|
struct macvlan_port *port;
|
|
struct net_device *lowerdev;
|
|
void *fwd_priv;
|
|
struct vlan_pcpu_stats __percpu *pcpu_stats;
|
|
|
|
DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ);
|
|
|
|
netdev_features_t set_features;
|
|
enum macvlan_mode mode;
|
|
u16 flags;
|
|
/* This array tracks active taps. */
|
|
struct macvtap_queue __rcu *taps[MAX_MACVTAP_QUEUES];
|
|
/* This list tracks all taps (both enabled and disabled) */
|
|
struct list_head queue_list;
|
|
int numvtaps;
|
|
int numqueues;
|
|
netdev_features_t tap_features;
|
|
int minor;
|
|
int nest_level;
|
|
#ifdef CONFIG_NET_POLL_CONTROLLER
|
|
struct netpoll *netpoll;
|
|
#endif
|
|
unsigned int macaddr_count;
|
|
};
|
|
|
|
static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
|
|
unsigned int len, bool success,
|
|
bool multicast)
|
|
{
|
|
if (likely(success)) {
|
|
struct vlan_pcpu_stats *pcpu_stats;
|
|
|
|
pcpu_stats = get_cpu_ptr(vlan->pcpu_stats);
|
|
u64_stats_update_begin(&pcpu_stats->syncp);
|
|
pcpu_stats->rx_packets++;
|
|
pcpu_stats->rx_bytes += len;
|
|
if (multicast)
|
|
pcpu_stats->rx_multicast++;
|
|
u64_stats_update_end(&pcpu_stats->syncp);
|
|
put_cpu_ptr(vlan->pcpu_stats);
|
|
} else {
|
|
this_cpu_inc(vlan->pcpu_stats->rx_errors);
|
|
}
|
|
}
|
|
|
|
extern void macvlan_common_setup(struct net_device *dev);
|
|
|
|
extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
|
|
struct nlattr *tb[], struct nlattr *data[]);
|
|
|
|
extern void macvlan_count_rx(const struct macvlan_dev *vlan,
|
|
unsigned int len, bool success,
|
|
bool multicast);
|
|
|
|
extern void macvlan_dellink(struct net_device *dev, struct list_head *head);
|
|
|
|
extern int macvlan_link_register(struct rtnl_link_ops *ops);
|
|
|
|
#if IS_ENABLED(CONFIG_MACVLAN)
|
|
static inline struct net_device *
|
|
macvlan_dev_real_dev(const struct net_device *dev)
|
|
{
|
|
struct macvlan_dev *macvlan = netdev_priv(dev);
|
|
|
|
return macvlan->lowerdev;
|
|
}
|
|
#else
|
|
static inline struct net_device *
|
|
macvlan_dev_real_dev(const struct net_device *dev)
|
|
{
|
|
BUG();
|
|
return NULL;
|
|
}
|
|
#endif
|
|
|
|
#endif /* _LINUX_IF_MACVLAN_H */
|