Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256549
b: refs/heads/master
c: cec9c13
h: refs/heads/master
i:
  256547: b3feeef
v: v3
  • Loading branch information
Jiri Pirko authored and David S. Miller committed Jul 21, 2011
1 parent 285b3af commit 650934d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f605234066852b11096ab071124e3fe415e94420
refs/heads/master: cec9c133631039f82e4a5ff3bf47b3eba14ff1aa
8 changes: 8 additions & 0 deletions trunk/include/linux/if_vlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ static inline int is_vlan_dev(struct net_device *dev)

#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)

extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
u16 vlan_id);
extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
extern u16 vlan_dev_vlan_id(const struct net_device *dev);

Expand All @@ -135,6 +137,12 @@ vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
unsigned int vlan_tci);

#else
static inline struct net_device *
__vlan_find_dev_deep(struct net_device *real_dev, u16 vlan_id)
{
return NULL;
}

static inline struct net_device *vlan_dev_real_dev(const struct net_device *dev)
{
BUG();
Expand Down
21 changes: 21 additions & 0 deletions trunk/net/8021q/vlan_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,27 @@ bool vlan_do_receive(struct sk_buff **skbp)
return true;
}

/* Must be invoked with rcu_read_lock or with RTNL. */
struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
u16 vlan_id)
{
struct vlan_group *grp = rcu_dereference_rtnl(real_dev->vlgrp);

if (grp) {
return vlan_group_get_device(grp, vlan_id);
} else {
/*
* Bonding slaves do not have grp assigned to themselves.
* Grp is assigned to bonding master instead.
*/
if (netif_is_bond_slave(real_dev))
return __vlan_find_dev_deep(real_dev->master, vlan_id);
}

return NULL;
}
EXPORT_SYMBOL(__vlan_find_dev_deep);

struct net_device *vlan_dev_real_dev(const struct net_device *dev)
{
return vlan_dev_info(dev)->real_dev;
Expand Down

0 comments on commit 650934d

Please sign in to comment.