Skip to content

Commit

Permalink
offloading: Support multiple vlan tags in GSO.
Browse files Browse the repository at this point in the history
We assume that hardware TSO can't support multiple levels of vlan tags
but we allow it to be done.  Therefore, enable GSO to parse these tags
so we can fallback to software.

Signed-off-by: Jesse Gross <[email protected]>
CC: Ben Hutchings <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
jessegross authored and davem330 committed Nov 15, 2010
1 parent e1e78db commit c8d5bcd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1794,16 +1794,18 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT);
struct packet_type *ptype;
__be16 type = skb->protocol;
int vlan_depth = ETH_HLEN;
int err;

if (type == htons(ETH_P_8021Q)) {
struct vlan_ethhdr *veh;
while (type == htons(ETH_P_8021Q)) {
struct vlan_hdr *vh;

if (unlikely(!pskb_may_pull(skb, VLAN_ETH_HLEN)))
if (unlikely(!pskb_may_pull(skb, vlan_depth + VLAN_HLEN)))
return ERR_PTR(-EINVAL);

veh = (struct vlan_ethhdr *)skb->data;
type = veh->h_vlan_encapsulated_proto;
vh = (struct vlan_hdr *)(skb->data + vlan_depth);
type = vh->h_vlan_encapsulated_proto;
vlan_depth += VLAN_HLEN;
}

skb_reset_mac_header(skb);
Expand Down

0 comments on commit c8d5bcd

Please sign in to comment.