From: Simon Horman Date: Tue, 24 Sep 2013 07:44:05 +0000 (+0900) Subject: datapath: simplify VLAN segmentation X-Git-Tag: sliver-openvswitch-2.0.90-1~13^2~1 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=6b30e53e6290b43e60c7c6f64f568a1d17961920;p=sliver-openvswitch.git datapath: simplify VLAN segmentation Push vlan tag onto packet before segmentation to simplify the code. As suggested by Pravin Shelar and Jesse Gross. Signed-off-by: Simon Horman Signed-off-by: Jesse Gross --- diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c index 215a47e49..31680fd7d 100644 --- a/datapath/vport-netdev.c +++ b/datapath/vport-netdev.c @@ -296,6 +296,11 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb) features &= ~(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO | NETIF_F_FSO); + skb = __vlan_put_tag(skb, skb->vlan_proto, vlan_tx_tag_get(skb)); + if (unlikely(!skb)) + return 0; + vlan_set_tci(skb, 0); + if (netif_needs_gso(skb, features)) { struct sk_buff *nskb; @@ -306,7 +311,7 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb) goto drop; skb_shinfo(skb)->gso_type &= ~SKB_GSO_DODGY; - goto tag; + goto xmit; } if (IS_ERR(nskb)) @@ -318,27 +323,16 @@ static int netdev_send(struct vport *vport, struct sk_buff *skb) do { nskb = skb->next; skb->next = NULL; - - skb = __vlan_put_tag(skb, skb->vlan_proto, vlan_tx_tag_get(skb)); - if (likely(skb)) { - len += skb->len; - vlan_set_tci(skb, 0); - dev_queue_xmit(skb); - } - + len += skb->len; + dev_queue_xmit(skb); skb = nskb; } while (skb); return len; } - -tag: - skb = __vlan_put_tag(skb, skb->vlan_proto, vlan_tx_tag_get(skb)); - if (unlikely(!skb)) - return 0; - vlan_set_tci(skb, 0); } +xmit: len = skb->len; dev_queue_xmit(skb);