From patchwork Fri Oct 18 17:13:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Pirko X-Patchwork-Id: 284677 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 469842C0099 for ; Sat, 19 Oct 2013 04:14:05 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756759Ab3JRROA (ORCPT ); Fri, 18 Oct 2013 13:14:00 -0400 Received: from mail-ea0-f175.google.com ([209.85.215.175]:41816 "EHLO mail-ea0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756533Ab3JRRN4 (ORCPT ); Fri, 18 Oct 2013 13:13:56 -0400 Received: by mail-ea0-f175.google.com with SMTP id m14so2192221eaj.34 for ; Fri, 18 Oct 2013 10:13:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GhtTbuxJUAf0H39zoD/uq2/JaVonjQbzWJN3W0e73HQ=; b=OwoxaPydq3hYBE3SW6JTiLI1/nVWzwCy3/XMfJDbk3wGMVr5sTCFyNv3fCzz4fE8wG BjRQ12NsqcJaff7NfFH8fc9HikYJdoehrC6EV1bop8qa5dpTjzmTkEFKwdgX8o8jUET3 AZ2lXkLjP4lOb+r/8LSBZpBm/izV4LDDAJ4KCm8Dshk3uA7vNTEwSdGktQXCmahyHUhE o2qPfXv3TNuQC9cFznVt3cXeVuaGF092jTtGDEdl6m2ghAkVmJqGynAg+N/WASJa+oju oDxV/W7+4YFJDwklYFuQGYp3YVYyuB/rVCUweGP10N+UFdqNzIOsk+bYGRICQHR4AwVK wCjw== X-Gm-Message-State: ALoCoQkMRa9F6vQCcxKLm9u2YAj2vxTOOh4Xx+0NwrZfIBcT8Q6/gdTAhCFhDGexbwlejlXA0V2s X-Received: by 10.14.109.134 with SMTP id s6mr4355491eeg.84.1382116435655; Fri, 18 Oct 2013 10:13:55 -0700 (PDT) Received: from localhost (sun-0.pirko.cz. [84.16.102.25]) by mx.google.com with ESMTPSA id f49sm6914081eec.7.2013.10.18.10.13.54 for (version=TLSv1.2 cipher=AES128-GCM-SHA256 bits=128/128); Fri, 18 Oct 2013 10:13:55 -0700 (PDT) From: Jiri Pirko To: netdev@vger.kernel.org Cc: davem@davemloft.net, eric.dumazet@gmail.com, hannes@stressinduktion.or, jdmason@kudzu.us, yoshfuji@linux-ipv6.org, kuznet@ms2.inr.ac.ru, jmorris@namei.org, kaber@trash.net, herbert@gondor.apana.org.au Subject: [patch net REPOST 2/3] ip6_output: do skb ufo init for peeked non ufo skb as well Date: Fri, 18 Oct 2013 19:13:50 +0200 Message-Id: <1382116431-28758-3-git-send-email-jiri@resnulli.us> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1382116431-28758-1-git-send-email-jiri@resnulli.us> References: <1382116431-28758-1-git-send-email-jiri@resnulli.us> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now, if user application does: sendto lenmtu flag 0 The skb is not treated as fragmented one because it is not initialized that way. So move the initialization to fix this. introduced by: commit e89e9cf539a28df7d0eb1d0a545368e9920b34ac "[IPv4/IPv6]: UFO Scatter-gather approach" Signed-off-by: Jiri Pirko --- net/ipv6/ip6_output.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index a54c45c..c6cfa2f 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1008,6 +1008,7 @@ static inline int ip6_ufo_append_data(struct sock *sk, { struct sk_buff *skb; + struct frag_hdr fhdr; int err; /* There is support for UDP large send offload by network @@ -1015,8 +1016,6 @@ static inline int ip6_ufo_append_data(struct sock *sk, * udp datagram */ if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL) { - struct frag_hdr fhdr; - skb = sock_alloc_send_skb(sk, hh_len + fragheaderlen + transhdrlen + 20, (flags & MSG_DONTWAIT), &err); @@ -1036,20 +1035,23 @@ static inline int ip6_ufo_append_data(struct sock *sk, skb->transport_header = skb->network_header + fragheaderlen; skb->protocol = htons(ETH_P_IPV6); - skb->ip_summed = CHECKSUM_PARTIAL; skb->csum = 0; - /* Specify the length of each IPv6 datagram fragment. - * It has to be a multiple of 8. - */ - skb_shinfo(skb)->gso_size = (mtu - fragheaderlen - - sizeof(struct frag_hdr)) & ~7; - skb_shinfo(skb)->gso_type = SKB_GSO_UDP; - ipv6_select_ident(&fhdr, rt); - skb_shinfo(skb)->ip6_frag_id = fhdr.identification; __skb_queue_tail(&sk->sk_write_queue, skb); - } + } else if (skb_is_gso(skb)) + goto append; + + skb->ip_summed = CHECKSUM_PARTIAL; + /* Specify the length of each IPv6 datagram fragment. + * It has to be a multiple of 8. + */ + skb_shinfo(skb)->gso_size = (mtu - fragheaderlen - + sizeof(struct frag_hdr)) & ~7; + skb_shinfo(skb)->gso_type = SKB_GSO_UDP; + ipv6_select_ident(&fhdr, rt); + skb_shinfo(skb)->ip6_frag_id = fhdr.identification; +append: return skb_append_datato_frags(sk, skb, getfrag, from, (length - transhdrlen)); }