diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2011-07-25 13:59:46 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-07-25 14:53:52 -0400 |
commit | 5f00bcb38ef9a980a33c6dbdc0044964b05f22dd (patch) | |
tree | 3175fb9375aecb50bde1be0bf4fa8aa8155131d6 /net/8021q/vlan.h | |
parent | 34006cee28f7344f9557a4be3816c7891b1bbab1 (diff) | |
parent | b6844e8f64920cdee620157252169ba63afb0c89 (diff) |
Merge branch 'master' into devel and apply fixup from Stephen Rothwell:
vfs/nfs: fixup for nfs_open_context change
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/8021q/vlan.h')
-rw-r--r-- | net/8021q/vlan.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index 9da07e30d1a2..9fd45f3571f9 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h | |||
@@ -74,6 +74,37 @@ static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev) | |||
74 | return netdev_priv(dev); | 74 | return netdev_priv(dev); |
75 | } | 75 | } |
76 | 76 | ||
77 | static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, | ||
78 | u16 vlan_id) | ||
79 | { | ||
80 | struct net_device **array; | ||
81 | array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; | ||
82 | return array ? array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] : NULL; | ||
83 | } | ||
84 | |||
85 | static inline void vlan_group_set_device(struct vlan_group *vg, | ||
86 | u16 vlan_id, | ||
87 | struct net_device *dev) | ||
88 | { | ||
89 | struct net_device **array; | ||
90 | if (!vg) | ||
91 | return; | ||
92 | array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; | ||
93 | array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] = dev; | ||
94 | } | ||
95 | |||
96 | /* Must be invoked with rcu_read_lock or with RTNL. */ | ||
97 | static inline struct net_device *vlan_find_dev(struct net_device *real_dev, | ||
98 | u16 vlan_id) | ||
99 | { | ||
100 | struct vlan_group *grp = rcu_dereference_rtnl(real_dev->vlgrp); | ||
101 | |||
102 | if (grp) | ||
103 | return vlan_group_get_device(grp, vlan_id); | ||
104 | |||
105 | return NULL; | ||
106 | } | ||
107 | |||
77 | /* found in vlan_dev.c */ | 108 | /* found in vlan_dev.c */ |
78 | void vlan_dev_set_ingress_priority(const struct net_device *dev, | 109 | void vlan_dev_set_ingress_priority(const struct net_device *dev, |
79 | u32 skb_prio, u16 vlan_prio); | 110 | u32 skb_prio, u16 vlan_prio); |