]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
inet: restore gso for vxlan
authorEric Dumazet <edumazet@google.com>
Mon, 28 Oct 2013 01:18:16 +0000 (18:18 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Oct 2013 04:23:06 +0000 (00:23 -0400)
Alexei reported a performance regression on vxlan, caused
by commit 3347c9602955 "ipv4: gso: make inet_gso_segment() stackable"

GSO vxlan packets were not properly segmented, adding IP fragments
while they were not expected.

Rename 'bool tunnel' to 'bool encap', and add a new boolean
to express the fact that UDP should be fragmented.
This fragmentation is triggered by skb->encapsulation being set.

Remove a "skb->encapsulation = 1" added in above commit,
as its not needed, as frags inherit skb->frag from original
GSO skb.

Reported-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Tested-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/af_inet.c

index f4a159e705c0c57af71d6efb99a3608f2a304f5a..09d78d4a3cff0ede57130b6c0e6cae11aaa61c5c 100644 (file)
@@ -1251,8 +1251,8 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
        struct sk_buff *segs = ERR_PTR(-EINVAL);
        const struct net_offload *ops;
        unsigned int offset = 0;
+       bool udpfrag, encap;
        struct iphdr *iph;
-       bool tunnel;
        int proto;
        int nhoff;
        int ihl;
@@ -1290,8 +1290,8 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
                goto out;
        __skb_pull(skb, ihl);
 
-       tunnel = SKB_GSO_CB(skb)->encap_level > 0;
-       if (tunnel)
+       encap = SKB_GSO_CB(skb)->encap_level > 0;
+       if (encap)
                features = skb->dev->hw_enc_features & netif_skb_features(skb);
        SKB_GSO_CB(skb)->encap_level += ihl;
 
@@ -1306,24 +1306,23 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
        if (IS_ERR_OR_NULL(segs))
                goto out;
 
+       udpfrag = !!skb->encapsulation && proto == IPPROTO_UDP;
        skb = segs;
        do {
                iph = (struct iphdr *)(skb_mac_header(skb) + nhoff);
-               if (!tunnel && proto == IPPROTO_UDP) {
+               if (udpfrag) {
                        iph->id = htons(id);
                        iph->frag_off = htons(offset >> 3);
                        if (skb->next != NULL)
                                iph->frag_off |= htons(IP_MF);
                        offset += skb->len - nhoff - ihl;
-               } else  {
+               } else {
                        iph->id = htons(id++);
                }
                iph->tot_len = htons(skb->len - nhoff);
                ip_send_check(iph);
-               if (tunnel) {
+               if (encap)
                        skb_reset_inner_headers(skb);
-                       skb->encapsulation = 1;
-               }
                skb->network_header = (u8 *)iph - skb->head;
        } while ((skb = skb->next));