diff options
author | David S. Miller <davem@davemloft.net> | 2011-06-21 01:29:08 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-21 01:29:08 -0400 |
commit | 9f6ec8d697c08963d83880ccd35c13c5ace716ea (patch) | |
tree | ad8d93cf6fcdd09b86ade09f5fcbbc66cdb1cca2 /net/8021q | |
parent | 4aa3a715551c93eda32d79bd52042ce500bd5383 (diff) | |
parent | 56299378726d5f2ba8d3c8cbbd13cb280ba45e4f (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
drivers/net/wireless/rtlwifi/pci.c
net/netfilter/ipvs/ip_vs_core.c
Diffstat (limited to 'net/8021q')
-rw-r--r-- | net/8021q/vlan.c | 2 | ||||
-rw-r--r-- | net/8021q/vlan_core.c | 60 |
2 files changed, 34 insertions, 28 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index cfa9afe9b11e..d24c4644b930 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -207,7 +207,7 @@ int register_vlan_dev(struct net_device *dev) | |||
207 | grp->nr_vlans++; | 207 | grp->nr_vlans++; |
208 | 208 | ||
209 | if (ngrp) { | 209 | if (ngrp) { |
210 | if (ops->ndo_vlan_rx_register) | 210 | if (ops->ndo_vlan_rx_register && (real_dev->features & NETIF_F_HW_VLAN_RX)) |
211 | ops->ndo_vlan_rx_register(real_dev, ngrp); | 211 | ops->ndo_vlan_rx_register(real_dev, ngrp); |
212 | rcu_assign_pointer(real_dev->vlgrp, ngrp); | 212 | rcu_assign_pointer(real_dev->vlgrp, ngrp); |
213 | } | 213 | } |
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 41495dc2a4c9..fcc684678af6 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c | |||
@@ -23,6 +23,31 @@ bool vlan_do_receive(struct sk_buff **skbp) | |||
23 | return false; | 23 | return false; |
24 | 24 | ||
25 | skb->dev = vlan_dev; | 25 | skb->dev = vlan_dev; |
26 | if (skb->pkt_type == PACKET_OTHERHOST) { | ||
27 | /* Our lower layer thinks this is not local, let's make sure. | ||
28 | * This allows the VLAN to have a different MAC than the | ||
29 | * underlying device, and still route correctly. */ | ||
30 | if (!compare_ether_addr(eth_hdr(skb)->h_dest, | ||
31 | vlan_dev->dev_addr)) | ||
32 | skb->pkt_type = PACKET_HOST; | ||
33 | } | ||
34 | |||
35 | if (!(vlan_dev_info(vlan_dev)->flags & VLAN_FLAG_REORDER_HDR)) { | ||
36 | unsigned int offset = skb->data - skb_mac_header(skb); | ||
37 | |||
38 | /* | ||
39 | * vlan_insert_tag expect skb->data pointing to mac header. | ||
40 | * So change skb->data before calling it and change back to | ||
41 | * original position later | ||
42 | */ | ||
43 | skb_push(skb, offset); | ||
44 | skb = *skbp = vlan_insert_tag(skb, skb->vlan_tci); | ||
45 | if (!skb) | ||
46 | return false; | ||
47 | skb_pull(skb, offset + VLAN_HLEN); | ||
48 | skb_reset_mac_len(skb); | ||
49 | } | ||
50 | |||
26 | skb->priority = vlan_get_ingress_priority(vlan_dev, skb->vlan_tci); | 51 | skb->priority = vlan_get_ingress_priority(vlan_dev, skb->vlan_tci); |
27 | skb->vlan_tci = 0; | 52 | skb->vlan_tci = 0; |
28 | 53 | ||
@@ -31,22 +56,8 @@ bool vlan_do_receive(struct sk_buff **skbp) | |||
31 | u64_stats_update_begin(&rx_stats->syncp); | 56 | u64_stats_update_begin(&rx_stats->syncp); |
32 | rx_stats->rx_packets++; | 57 | rx_stats->rx_packets++; |
33 | rx_stats->rx_bytes += skb->len; | 58 | rx_stats->rx_bytes += skb->len; |
34 | 59 | if (skb->pkt_type == PACKET_MULTICAST) | |
35 | switch (skb->pkt_type) { | ||
36 | case PACKET_BROADCAST: | ||
37 | break; | ||
38 | case PACKET_MULTICAST: | ||
39 | rx_stats->rx_multicast++; | 60 | rx_stats->rx_multicast++; |
40 | break; | ||
41 | case PACKET_OTHERHOST: | ||
42 | /* Our lower layer thinks this is not local, let's make sure. | ||
43 | * This allows the VLAN to have a different MAC than the | ||
44 | * underlying device, and still route correctly. */ | ||
45 | if (!compare_ether_addr(eth_hdr(skb)->h_dest, | ||
46 | vlan_dev->dev_addr)) | ||
47 | skb->pkt_type = PACKET_HOST; | ||
48 | break; | ||
49 | } | ||
50 | u64_stats_update_end(&rx_stats->syncp); | 61 | u64_stats_update_end(&rx_stats->syncp); |
51 | 62 | ||
52 | return true; | 63 | return true; |
@@ -89,18 +100,13 @@ gro_result_t vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp, | |||
89 | } | 100 | } |
90 | EXPORT_SYMBOL(vlan_gro_frags); | 101 | EXPORT_SYMBOL(vlan_gro_frags); |
91 | 102 | ||
92 | static struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb) | 103 | static struct sk_buff *vlan_reorder_header(struct sk_buff *skb) |
93 | { | 104 | { |
94 | if (vlan_dev_info(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) { | 105 | if (skb_cow(skb, skb_headroom(skb)) < 0) |
95 | if (skb_cow(skb, skb_headroom(skb)) < 0) | 106 | return NULL; |
96 | skb = NULL; | 107 | memmove(skb->data - ETH_HLEN, skb->data - VLAN_ETH_HLEN, 2 * ETH_ALEN); |
97 | if (skb) { | 108 | skb->mac_header += VLAN_HLEN; |
98 | /* Lifted from Gleb's VLAN code... */ | 109 | skb_reset_mac_len(skb); |
99 | memmove(skb->data - ETH_HLEN, | ||
100 | skb->data - VLAN_ETH_HLEN, 12); | ||
101 | skb->mac_header += VLAN_HLEN; | ||
102 | } | ||
103 | } | ||
104 | return skb; | 110 | return skb; |
105 | } | 111 | } |
106 | 112 | ||
@@ -161,7 +167,7 @@ struct sk_buff *vlan_untag(struct sk_buff *skb) | |||
161 | skb_pull_rcsum(skb, VLAN_HLEN); | 167 | skb_pull_rcsum(skb, VLAN_HLEN); |
162 | vlan_set_encap_proto(skb, vhdr); | 168 | vlan_set_encap_proto(skb, vhdr); |
163 | 169 | ||
164 | skb = vlan_check_reorder_header(skb); | 170 | skb = vlan_reorder_header(skb); |
165 | if (unlikely(!skb)) | 171 | if (unlikely(!skb)) |
166 | goto err_free; | 172 | goto err_free; |
167 | 173 | ||