diff options
author | Jiri Pirko <jpirko@redhat.com> | 2011-12-07 23:11:18 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-08 19:52:42 -0500 |
commit | 5b9ea6e022e9ba0fe39cb349ac40361f78d5da5b (patch) | |
tree | 11f0de492ee799fd4174f79ac6aae4c3533beb25 /include | |
parent | 87002b03baabd2b8f6281ab6411ed88d24958de1 (diff) |
vlan: introduce vid list with reference counting
This allows to keep track of vids needed to be in rx vlan filters of
devices even if they are used in bond/team etc.
vlan_info as well as vlan_group previously was, is allocated when first
vid is added and dealocated whan last vid is deleted.
vlan_group definition is moved to private header.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/if_vlan.h | 17 | ||||
-rw-r--r-- | include/linux/netdevice.h | 3 |
2 files changed, 2 insertions, 18 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 71168a6f3347..0c9691305298 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -74,22 +74,7 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) | |||
74 | /* found in socket.c */ | 74 | /* found in socket.c */ |
75 | extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); | 75 | extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); |
76 | 76 | ||
77 | /* if this changes, algorithm will have to be reworked because this | 77 | struct vlan_info; |
78 | * depends on completely exhausting the VLAN identifier space. Thus | ||
79 | * it gives constant time look-up, but in many cases it wastes memory. | ||
80 | */ | ||
81 | #define VLAN_GROUP_ARRAY_SPLIT_PARTS 8 | ||
82 | #define VLAN_GROUP_ARRAY_PART_LEN (VLAN_N_VID/VLAN_GROUP_ARRAY_SPLIT_PARTS) | ||
83 | |||
84 | struct vlan_group { | ||
85 | struct net_device *real_dev; /* The ethernet(like) device | ||
86 | * the vlan is attached to. | ||
87 | */ | ||
88 | unsigned int nr_vlans; | ||
89 | struct hlist_node hlist; /* linked list */ | ||
90 | struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; | ||
91 | struct rcu_head rcu; | ||
92 | }; | ||
93 | 78 | ||
94 | static inline int is_vlan_dev(struct net_device *dev) | 79 | static inline int is_vlan_dev(struct net_device *dev) |
95 | { | 80 | { |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index f7bff9615728..603730804da5 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -55,7 +55,6 @@ | |||
55 | 55 | ||
56 | #include <linux/netdev_features.h> | 56 | #include <linux/netdev_features.h> |
57 | 57 | ||
58 | struct vlan_group; | ||
59 | struct netpoll_info; | 58 | struct netpoll_info; |
60 | struct phy_device; | 59 | struct phy_device; |
61 | /* 802.11 specific */ | 60 | /* 802.11 specific */ |
@@ -1096,7 +1095,7 @@ struct net_device { | |||
1096 | /* Protocol specific pointers */ | 1095 | /* Protocol specific pointers */ |
1097 | 1096 | ||
1098 | #if IS_ENABLED(CONFIG_VLAN_8021Q) | 1097 | #if IS_ENABLED(CONFIG_VLAN_8021Q) |
1099 | struct vlan_group __rcu *vlgrp; /* VLAN group */ | 1098 | struct vlan_info __rcu *vlan_info; /* VLAN info */ |
1100 | #endif | 1099 | #endif |
1101 | #if IS_ENABLED(CONFIG_NET_DSA) | 1100 | #if IS_ENABLED(CONFIG_NET_DSA) |
1102 | struct dsa_switch_tree *dsa_ptr; /* dsa specific data */ | 1101 | struct dsa_switch_tree *dsa_ptr; /* dsa specific data */ |