Blame view
include/linux/if_macvlan.h
2.58 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
b863ceb7d [NET]: Add macvla... |
2 3 |
#ifndef _LINUX_IF_MACVLAN_H #define _LINUX_IF_MACVLAN_H |
fc0663d6b macvlan: allow mu... |
4 |
#include <linux/if_link.h> |
cdf3e274c macvlan: unify ma... |
5 |
#include <linux/if_vlan.h> |
fc0663d6b macvlan: allow mu... |
6 7 8 9 |
#include <linux/list.h> #include <linux/netdevice.h> #include <linux/netlink.h> #include <net/netlink.h> |
bc66154ef macvlan: 64 bit r... |
10 |
#include <linux/u64_stats_sync.h> |
fc0663d6b macvlan: allow mu... |
11 12 13 |
struct macvlan_port; struct macvtap_queue; |
1565c7c1c macvtap: Implemen... |
14 15 16 17 |
/* * Maximum times a macvtap device can be opened. This can be used to * configure the number of receive queue, e.g. for multiqueue virtio. */ |
635b8c8ec tap: Renaming tap... |
18 |
#define MAX_TAP_QUEUES 256 |
1565c7c1c macvtap: Implemen... |
19 |
|
cd431e738 macvlan: add mult... |
20 21 |
#define MACVLAN_MC_FILTER_BITS 8 #define MACVLAN_MC_FILTER_SZ (1 << MACVLAN_MC_FILTER_BITS) |
fc0663d6b macvlan: allow mu... |
22 23 24 25 26 27 |
struct macvlan_dev { struct net_device *dev; struct list_head list; struct hlist_node hlist; struct macvlan_port *port; struct net_device *lowerdev; |
a6cc0cfa7 net: Add layer 2 ... |
28 |
void *fwd_priv; |
cdf3e274c macvlan: unify ma... |
29 |
struct vlan_pcpu_stats __percpu *pcpu_stats; |
cd431e738 macvlan: add mult... |
30 31 |
DECLARE_BITMAP(mc_filter, MACVLAN_MC_FILTER_SZ); |
2be5c7679 macvtap: Let TUNS... |
32 |
netdev_features_t set_features; |
fc0663d6b macvlan: allow mu... |
33 |
enum macvlan_mode mode; |
df8ef8f3a macvlan: add FDB ... |
34 |
u16 flags; |
815f236d6 macvtap: add TUNS... |
35 |
/* This array tracks active taps. */ |
635b8c8ec tap: Renaming tap... |
36 |
struct tap_queue __rcu *taps[MAX_TAP_QUEUES]; |
815f236d6 macvtap: add TUNS... |
37 38 |
/* This list tracks all taps (both enabled and disabled) */ struct list_head queue_list; |
1565c7c1c macvtap: Implemen... |
39 |
int numvtaps; |
815f236d6 macvtap: add TUNS... |
40 |
int numqueues; |
2be5c7679 macvtap: Let TUNS... |
41 |
netdev_features_t tap_features; |
e09eff7fc macvtap: Fix the ... |
42 |
int minor; |
c674ac30c macvlan: Fix lock... |
43 |
int nest_level; |
688cea83f macvlan: add netp... |
44 45 46 |
#ifdef CONFIG_NET_POLL_CONTROLLER struct netpoll *netpoll; #endif |
79cf79abc macvlan: add sour... |
47 |
unsigned int macaddr_count; |
fc0663d6b macvlan: allow mu... |
48 49 50 51 52 53 |
}; static inline void macvlan_count_rx(const struct macvlan_dev *vlan, unsigned int len, bool success, bool multicast) { |
fc0663d6b macvlan: allow mu... |
54 |
if (likely(success)) { |
cdf3e274c macvlan: unify ma... |
55 |
struct vlan_pcpu_stats *pcpu_stats; |
8ffab51b3 macvlan: lockless... |
56 57 58 59 60 |
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 macvlan: allow mu... |
61 |
if (multicast) |
8ffab51b3 macvlan: lockless... |
62 63 |
pcpu_stats->rx_multicast++; u64_stats_update_end(&pcpu_stats->syncp); |
fc0663d6b macvlan: allow mu... |
64 |
} else { |
8ffab51b3 macvlan: lockless... |
65 |
this_cpu_inc(vlan->pcpu_stats->rx_errors); |
fc0663d6b macvlan: allow mu... |
66 67 |
} } |
8a35747a5 macvtap: Limit pa... |
68 |
extern void macvlan_common_setup(struct net_device *dev); |
fc0663d6b macvlan: allow mu... |
69 |
extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev, |
2f6a1b660 macvlan: Remove c... |
70 |
struct nlattr *tb[], struct nlattr *data[]); |
fc0663d6b macvlan: allow mu... |
71 72 73 74 75 76 77 78 |
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 macvlan: introduc... |
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
#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 [NET]: Add macvla... |
95 |
#endif /* _LINUX_IF_MACVLAN_H */ |