Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 332924
b: refs/heads/master
c: 48cc32d
h: refs/heads/master
v: v3
  • Loading branch information
Florian Zumbiehl authored and David S. Miller committed Oct 8, 2012
1 parent 1f423ae commit add99ec
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2e71a6f8084e7ac87166dd77d99c44190fb844fc
refs/heads/master: 48cc32d38a52d0b68f91a171a8d00531edc6a46e
8 changes: 4 additions & 4 deletions trunk/include/linux/if_vlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ static inline int is_vlan_dev(struct net_device *dev)
}

#define vlan_tx_tag_present(__skb) ((__skb)->vlan_tci & VLAN_TAG_PRESENT)
#define vlan_tx_nonzero_tag_present(__skb) \
(vlan_tx_tag_present(__skb) && ((__skb)->vlan_tci & VLAN_VID_MASK))
#define vlan_tx_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)

#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
Expand All @@ -89,7 +91,7 @@ extern struct net_device *__vlan_find_dev_deep(struct net_device *real_dev,
extern struct net_device *vlan_dev_real_dev(const struct net_device *dev);
extern u16 vlan_dev_vlan_id(const struct net_device *dev);

extern bool vlan_do_receive(struct sk_buff **skb, bool last_handler);
extern bool vlan_do_receive(struct sk_buff **skb);
extern struct sk_buff *vlan_untag(struct sk_buff *skb);

extern int vlan_vid_add(struct net_device *dev, unsigned short vid);
Expand Down Expand Up @@ -120,10 +122,8 @@ static inline u16 vlan_dev_vlan_id(const struct net_device *dev)
return 0;
}

static inline bool vlan_do_receive(struct sk_buff **skb, bool last_handler)
static inline bool vlan_do_receive(struct sk_buff **skb)
{
if (((*skb)->vlan_tci & VLAN_VID_MASK) && last_handler)
(*skb)->pkt_type = PACKET_OTHERHOST;
return false;
}

Expand Down
10 changes: 2 additions & 8 deletions trunk/net/8021q/vlan_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,16 @@
#include <linux/export.h>
#include "vlan.h"

bool vlan_do_receive(struct sk_buff **skbp, bool last_handler)
bool vlan_do_receive(struct sk_buff **skbp)
{
struct sk_buff *skb = *skbp;
u16 vlan_id = skb->vlan_tci & VLAN_VID_MASK;
struct net_device *vlan_dev;
struct vlan_pcpu_stats *rx_stats;

vlan_dev = vlan_find_dev(skb->dev, vlan_id);
if (!vlan_dev) {
/* Only the last call to vlan_do_receive() should change
* pkt_type to PACKET_OTHERHOST
*/
if (vlan_id && last_handler)
skb->pkt_type = PACKET_OTHERHOST;
if (!vlan_dev)
return false;
}

skb = *skbp = skb_share_check(skb, GFP_ATOMIC);
if (unlikely(!skb))
Expand Down
7 changes: 5 additions & 2 deletions trunk/net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -3300,18 +3300,18 @@ static int __netif_receive_skb(struct sk_buff *skb)
&& !skb_pfmemalloc_protocol(skb))
goto drop;

rx_handler = rcu_dereference(skb->dev->rx_handler);
if (vlan_tx_tag_present(skb)) {
if (pt_prev) {
ret = deliver_skb(skb, pt_prev, orig_dev);
pt_prev = NULL;
}
if (vlan_do_receive(&skb, !rx_handler))
if (vlan_do_receive(&skb))
goto another_round;
else if (unlikely(!skb))
goto unlock;
}

rx_handler = rcu_dereference(skb->dev->rx_handler);
if (rx_handler) {
if (pt_prev) {
ret = deliver_skb(skb, pt_prev, orig_dev);
Expand All @@ -3331,6 +3331,9 @@ static int __netif_receive_skb(struct sk_buff *skb)
}
}

if (vlan_tx_nonzero_tag_present(skb))
skb->pkt_type = PACKET_OTHERHOST;

/* deliver only exact match when indicated */
null_or_dev = deliver_exact ? skb->dev : NULL;

Expand Down

0 comments on commit add99ec

Please sign in to comment.