Blame view
include/linux/if_macvlan.h
2.83 KB
b863ceb7d
|
1 2 |
#ifndef _LINUX_IF_MACVLAN_H #define _LINUX_IF_MACVLAN_H |
fc0663d6b
|
3 |
#include <linux/if_link.h> |
cdf3e274c
|
4 |
#include <linux/if_vlan.h> |
fc0663d6b
|
5 6 7 8 |
#include <linux/list.h> #include <linux/netdevice.h> #include <linux/netlink.h> #include <net/netlink.h> |
bc66154ef
|
9 |
#include <linux/u64_stats_sync.h> |
fc0663d6b
|
10 |
|
1d2f41ed2
|
11 |
#if IS_ENABLED(CONFIG_MACVTAP) |
501c774cb
|
12 13 14 15 16 17 18 19 20 21 22 |
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 */ |
fc0663d6b
|
23 24 |
struct macvlan_port; struct macvtap_queue; |
1565c7c1c
|
25 26 27 28 |
/* * Maximum times a macvtap device can be opened. This can be used to * configure the number of receive queue, e.g. for multiqueue virtio. */ |
f0afce01a
|
29 |
#define MAX_MACVTAP_QUEUES 16 |
1565c7c1c
|
30 |
|
cd431e738
|
31 32 |
#define MACVLAN_MC_FILTER_BITS 8 #define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS) |
fc0663d6b
|
33 34 35 36 37 38 |
struct macvlan_dev { struct net_device *dev; struct list_head list; struct hlist_node hlist; struct macvlan_port *port; struct net_device *lowerdev; |
a6cc0cfa7
|
39 |
void *fwd_priv; |
cdf3e274c
|
40 |
struct vlan_pcpu_stats __percpu *pcpu_stats; |
cd431e738
|
41 42 |
DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ); |
2be5c7679
|
43 |
netdev_features_t set_features; |
fc0663d6b
|
44 |
enum macvlan_mode mode; |
df8ef8f3a
|
45 |
u16 flags; |
815f236d6
|
46 |
/* This array tracks active taps. */ |
d9a90a310
|
47 |
struct macvtap_queue __rcu *taps[MAX_MACVTAP_QUEUES]; |
815f236d6
|
48 49 |
/* This list tracks all taps (both enabled and disabled) */ struct list_head queue_list; |
1565c7c1c
|
50 |
int numvtaps; |
815f236d6
|
51 |
int numqueues; |
2be5c7679
|
52 |
netdev_features_t tap_features; |
e09eff7fc
|
53 |
int minor; |
c674ac30c
|
54 |
int nest_level; |
688cea83f
|
55 56 57 |
#ifdef CONFIG_NET_POLL_CONTROLLER struct netpoll *netpoll; #endif |
79cf79abc
|
58 |
unsigned int macaddr_count; |
fc0663d6b
|
59 60 61 62 63 64 |
}; static inline void macvlan_count_rx(const struct macvlan_dev *vlan, unsigned int len, bool success, bool multicast) { |
fc0663d6b
|
65 |
if (likely(success)) { |
cdf3e274c
|
66 |
struct vlan_pcpu_stats *pcpu_stats; |
8ffab51b3
|
67 68 69 70 71 |
pcpu_stats = this_cpu_ptr(vlan->pcpu_stats); u64_stats_update_begin(&pcpu_stats->syncp); pcpu_stats->rx_packets++; pcpu_stats->rx_bytes += len; |
fc0663d6b
|
72 |
if (multicast) |
8ffab51b3
|
73 74 |
pcpu_stats->rx_multicast++; u64_stats_update_end(&pcpu_stats->syncp); |
fc0663d6b
|
75 |
} else { |
8ffab51b3
|
76 |
this_cpu_inc(vlan->pcpu_stats->rx_errors); |
fc0663d6b
|
77 78 |
} } |
8a35747a5
|
79 |
extern void macvlan_common_setup(struct net_device *dev); |
fc0663d6b
|
80 |
extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev, |
2f6a1b660
|
81 |
struct nlattr *tb[], struct nlattr *data[]); |
fc0663d6b
|
82 83 84 85 86 87 88 89 |
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); |
be9eac482
|
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
#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 |
b863ceb7d
|
106 |
#endif /* _LINUX_IF_MACVLAN_H */ |