aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2013-04-18 22:04:30 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-19 14:46:06 -0400
commit86a9bad3ab6b6f858fd4443b48738cabbb6d094c (patch)
tree21d41b1c81e0f3e53ac4004627a8c9588099fea1 /net/8021q
parent1fd9b1fc310314911f66d2f14a8e4f0ef37bf47b (diff)
net: vlan: add protocol argument to packet tagging functions
Add a protocol argument to the VLAN packet tagging functions. In case of HW tagging, we need that protocol available in the ndo_start_xmit functions, so it is stored in a new field in the skb. The new field fits into a hole (on 64 bit) and doesn't increase the sks's size. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q')
-rw-r--r--net/8021q/vlan_core.c8
-rw-r--r--net/8021q/vlan_dev.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index 4e4c360353ea..bdb0b9d2e9cf 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -8,11 +8,12 @@
8bool vlan_do_receive(struct sk_buff **skbp) 8bool vlan_do_receive(struct sk_buff **skbp)
9{ 9{
10 struct sk_buff *skb = *skbp; 10 struct sk_buff *skb = *skbp;
11 __be16 vlan_proto = skb->vlan_proto;
11 u16 vlan_id = skb->vlan_tci & VLAN_VID_MASK; 12 u16 vlan_id = skb->vlan_tci & VLAN_VID_MASK;
12 struct net_device *vlan_dev; 13 struct net_device *vlan_dev;
13 struct vlan_pcpu_stats *rx_stats; 14 struct vlan_pcpu_stats *rx_stats;
14 15
15 vlan_dev = vlan_find_dev(skb->dev, htons(ETH_P_8021Q), vlan_id); 16 vlan_dev = vlan_find_dev(skb->dev, vlan_proto, vlan_id);
16 if (!vlan_dev) 17 if (!vlan_dev)
17 return false; 18 return false;
18 19
@@ -38,7 +39,8 @@ bool vlan_do_receive(struct sk_buff **skbp)
38 * original position later 39 * original position later
39 */ 40 */
40 skb_push(skb, offset); 41 skb_push(skb, offset);
41 skb = *skbp = vlan_insert_tag(skb, skb->vlan_tci); 42 skb = *skbp = vlan_insert_tag(skb, skb->vlan_proto,
43 skb->vlan_tci);
42 if (!skb) 44 if (!skb)
43 return false; 45 return false;
44 skb_pull(skb, offset + VLAN_HLEN); 46 skb_pull(skb, offset + VLAN_HLEN);
@@ -127,7 +129,7 @@ struct sk_buff *vlan_untag(struct sk_buff *skb)
127 129
128 vhdr = (struct vlan_hdr *) skb->data; 130 vhdr = (struct vlan_hdr *) skb->data;
129 vlan_tci = ntohs(vhdr->h_vlan_TCI); 131 vlan_tci = ntohs(vhdr->h_vlan_TCI);
130 __vlan_hwaccel_put_tag(skb, vlan_tci); 132 __vlan_hwaccel_put_tag(skb, skb->protocol, vlan_tci);
131 133
132 skb_pull_rcsum(skb, VLAN_HLEN); 134 skb_pull_rcsum(skb, VLAN_HLEN);
133 vlan_set_encap_proto(skb, vhdr); 135 vlan_set_encap_proto(skb, vhdr);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index d7457b7e1b95..8af508536d36 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -167,7 +167,7 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
167 u16 vlan_tci; 167 u16 vlan_tci;
168 vlan_tci = vlan->vlan_id; 168 vlan_tci = vlan->vlan_id;
169 vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb); 169 vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
170 skb = __vlan_hwaccel_put_tag(skb, vlan_tci); 170 skb = __vlan_hwaccel_put_tag(skb, vlan->vlan_proto, vlan_tci);
171 } 171 }
172 172
173 skb->dev = vlan->real_dev; 173 skb->dev = vlan->real_dev;