Commit 5978f8a9 authored by Michał Mirosław's avatar Michał Mirosław Committed by David S. Miller

bridge: use __vlan_hwaccel helpers

This removes assumption than vlan_tci != 0 when tag is present.
Signed-off-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 418a976d
...@@ -671,10 +671,8 @@ static int br_nf_push_frag_xmit(struct net *net, struct sock *sk, struct sk_buff ...@@ -671,10 +671,8 @@ static int br_nf_push_frag_xmit(struct net *net, struct sock *sk, struct sk_buff
return 0; return 0;
} }
if (data->vlan_tci) { if (data->vlan_proto)
skb->vlan_tci = data->vlan_tci; __vlan_hwaccel_put_tag(skb, data->vlan_proto, data->vlan_tci);
skb->vlan_proto = data->vlan_proto;
}
skb_copy_to_linear_data_offset(skb, -data->size, data->mac, data->size); skb_copy_to_linear_data_offset(skb, -data->size, data->mac, data->size);
__skb_push(skb, data->encap_size); __skb_push(skb, data->encap_size);
...@@ -740,8 +738,13 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff ...@@ -740,8 +738,13 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff
data = this_cpu_ptr(&brnf_frag_data_storage); data = this_cpu_ptr(&brnf_frag_data_storage);
data->vlan_tci = skb->vlan_tci; if (skb_vlan_tag_present(skb)) {
data->vlan_proto = skb->vlan_proto; data->vlan_tci = skb->vlan_tci;
data->vlan_proto = skb->vlan_proto;
} else {
data->vlan_proto = 0;
}
data->encap_size = nf_bridge_encap_header_len(skb); data->encap_size = nf_bridge_encap_header_len(skb);
data->size = ETH_HLEN + data->encap_size; data->size = ETH_HLEN + data->encap_size;
......
...@@ -905,7 +905,7 @@ static inline int br_vlan_get_tag(const struct sk_buff *skb, u16 *vid) ...@@ -905,7 +905,7 @@ static inline int br_vlan_get_tag(const struct sk_buff *skb, u16 *vid)
int err = 0; int err = 0;
if (skb_vlan_tag_present(skb)) { if (skb_vlan_tag_present(skb)) {
*vid = skb_vlan_tag_get(skb) & VLAN_VID_MASK; *vid = skb_vlan_tag_get_id(skb);
} else { } else {
*vid = 0; *vid = 0;
err = -EINVAL; err = -EINVAL;
......
...@@ -420,7 +420,7 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br, ...@@ -420,7 +420,7 @@ struct sk_buff *br_handle_vlan(struct net_bridge *br,
} }
if (v->flags & BRIDGE_VLAN_INFO_UNTAGGED) if (v->flags & BRIDGE_VLAN_INFO_UNTAGGED)
skb->vlan_tci = 0; __vlan_hwaccel_clear_tag(skb);
if (p && (p->flags & BR_VLAN_TUNNEL) && if (p && (p->flags & BR_VLAN_TUNNEL) &&
br_handle_egress_vlan_tunnel(skb, v)) { br_handle_egress_vlan_tunnel(skb, v)) {
...@@ -493,8 +493,8 @@ static bool __allowed_ingress(const struct net_bridge *br, ...@@ -493,8 +493,8 @@ static bool __allowed_ingress(const struct net_bridge *br,
__vlan_hwaccel_put_tag(skb, br->vlan_proto, pvid); __vlan_hwaccel_put_tag(skb, br->vlan_proto, pvid);
else else
/* Priority-tagged Frame. /* Priority-tagged Frame.
* At this point, We know that skb->vlan_tci had * At this point, we know that skb->vlan_tci VID
* VLAN_TAG_PRESENT bit and its VID field was 0x000. * field was 0.
* We update only VID field and preserve PCP field. * We update only VID field and preserve PCP field.
*/ */
skb->vlan_tci |= pvid; skb->vlan_tci |= pvid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment