Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1529687imm; Fri, 27 Jul 2018 20:24:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfuD6RFT2tAJUXfFe+d9xkR1scqq4ydjlWERceDjGxJ1yAmMfAa+83VLLVO4eLPU+z839nh X-Received: by 2002:a63:1a20:: with SMTP id a32-v6mr8329782pga.446.1532748267797; Fri, 27 Jul 2018 20:24:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532748267; cv=none; d=google.com; s=arc-20160816; b=iwGbIZhSGMQwFUkezidc+Wx9ATyzSRy37OYXmjulzL1TISAafPf20h5SSCmSB8mL31 6Z13InGk7AA3rk9DNjXRUrKEXrCMcWK6AtjhHgy1ijLXTEd8+JqIkPOj7jc7eCK9EWd2 ZSf0vVbA6X5Py5zyD7blSQjkg9pr7jCGPjEU43AUsHK0uVUk2PFjS1plibTUh8ivRqsQ zyo0TeuOPU7KQZIleSrAQgLA1ie7dGUL7Tj1zkKvmrd3xAP2V2ZXvqzuExZEspWUVcGC cgnJh0uQEF/Y5azMaISZXtBFgYoB7Cxw/Yng9D7LId/+5IqT1ZMI7IniVS+ZKyB8IiOC KlxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=ngTwG3AyKoLbVmOXZlv8PTFVymmOH84nJz8xqQxkx6o=; b=MblnNtSWComlT5Wp/3k7CKDI9nBSdD0zBo3Je9pFJ1yng4vHYT3ZNWyLYJCiGycJyq dZy6x/zdnlN6RA0bl/GTknkwPJJvgkYSIG32jZnvd2RFBItHupEltJpT5738DJF10ckn Knk/epDQu6aH6Jc9h9AzqDgcOqENakyJUKSJNoeL3JgdgxgqY4hnq/JNRRhkBMgVTL/2 srBMHYYJnPy6tDZ5T/VbGA+OEqXn8F0YvpUNQPFNxDOR3JtEkA5Sd4oTX8ZLtHzdZCiV NYDXEGMgKf7dgJ8LdIv8EQ409/VmOtHu1mTZocNHL3aVpENa3T3AhTlt+wyH+W3mQVY2 wQYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qFEg5uDE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2-v6si5230067pfb.365.2018.07.27.20.24.13; Fri, 27 Jul 2018 20:24:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qFEg5uDE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726212AbeG1EsP (ORCPT + 99 others); Sat, 28 Jul 2018 00:48:15 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:38926 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725946AbeG1EsP (ORCPT ); Sat, 28 Jul 2018 00:48:15 -0400 Received: by mail-it0-f68.google.com with SMTP id g141-v6so10023530ita.4; Fri, 27 Jul 2018 20:23:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ngTwG3AyKoLbVmOXZlv8PTFVymmOH84nJz8xqQxkx6o=; b=qFEg5uDEd/7tM54+zfrD+/tc9UEXg131sv0mdv3qWL6VEZWhff8JUnu5OzeYTjkhXC ePlE15MlpR9LAlxKDHpYCxUPkVc9Q772lmnNdbu/jmEkxFOFKIfRwa8bZ7fLoRsqTOKv bU1mGJDz8xpqjzkjkedy4IZcJip8nM6yt8/uDFQc0mWrPqP+/jukoEa334RTHFKJEl5D TwxJRAh3VBpKd/WRdN3ZvuIjRCiGNMqitmDABB/5VDfmE4GR0wvUp5UOMLpHqgzqYcGN Ws3XZAswm2uW6a5FgQJj/BYrptgaA4om2pITaPsHvuCGK7l51N4To3UsPLGXTPuE+jtF HiKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ngTwG3AyKoLbVmOXZlv8PTFVymmOH84nJz8xqQxkx6o=; b=S2Er4MGsI9nEBK0syq4aUvK5g+0/hvxNDKn5E+A7JDQStuSOpjJ1NTiK3jZIFZARY1 XdfABYMed/ZZHjQM0EoPt2ftC9PNagz7+HkaI1aWF2APiaHeHKd22bGo6Daywlz2qZfE q076qSBdVZ1J8dvW+8k5wJuRxiu2hRqnccjCbGGFPGlwYRvlMoYwaTOnMMTCUBaGl9/h bT2W97fNNM9/DL10QzklQQmp2GLf2QImn4OHSXAvPRsZRBuxXBb67yuQiSpQzSCvSYW6 SsOvFIpRzaExXNU4Uz/ykWIZ403iQb8I0O6J4nRtIag9FKXgzikMsB9/VUhwijiq+7Zz g2qg== X-Gm-Message-State: AOUpUlE44Q0CTidESVP7jjihkCN5vB5Xoz2UlIwzH0lQwRjg8nh1+h2+ lloWRHa3c9Qxp5TNbP5iIlnlhJNds8y2+mdicAU= X-Received: by 2002:a24:5004:: with SMTP id m4-v6mr7602050itb.38.1532748206140; Fri, 27 Jul 2018 20:23:26 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:7a47:0:0:0:0:0 with HTTP; Fri, 27 Jul 2018 20:22:45 -0700 (PDT) In-Reply-To: References: <1532746900-11710-1-git-send-email-laoar.shao@gmail.com> <1532746900-11710-2-git-send-email-laoar.shao@gmail.com> From: Yafang Shao Date: Sat, 28 Jul 2018 11:22:45 +0800 Message-ID: Subject: Re: [PATCH net-next 2/2] tcp: propagate GSO to the new skb built in tcp collapse To: Eric Dumazet Cc: David Miller , netdev , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 28, 2018 at 11:13 AM, Eric Dumazet wrote: > On Fri, Jul 27, 2018 at 8:02 PM Yafang Shao wrote: >> >> Currently the collapsed SKB doesn't propagate the GSO information to the >> new SKB. >> The GSO should be propagated for better tracking, i.e. when this SKB is >> dropped we could know how many network segments are dropped. > > What is "the GSO" ? > I mean gso_segs, gso_type and gso_size, which are all set in GRO. >> >> Signed-off-by: Yafang Shao >> --- >> net/ipv4/tcp_input.c | 12 ++++++++++-- >> 1 file changed, 10 insertions(+), 2 deletions(-) >> >> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c >> index 90f83eb..af52e4e 100644 >> --- a/net/ipv4/tcp_input.c >> +++ b/net/ipv4/tcp_input.c >> @@ -4893,6 +4893,8 @@ void tcp_rbtree_insert(struct rb_root *root, struct sk_buff *skb) >> if (!nskb) >> break; >> >> + skb_shinfo(nskb)->gso_size = skb_shinfo(skb)->gso_size; >> + skb_shinfo(nskb)->gso_type = skb_shinfo(skb)->gso_type; > > Why gso_size and gso_type are important ? > > Where later in the stack these values are used ? > I'm not sure it is important or not. I just worry it may be used latter. >> memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); >> #ifdef CONFIG_TLS_DEVICE >> nskb->decrypted = skb->decrypted; >> @@ -4906,18 +4908,24 @@ void tcp_rbtree_insert(struct rb_root *root, struct sk_buff *skb) >> >> /* Copy data, releasing collapsed skbs. */ >> while (copy > 0) { >> - int offset = start - TCP_SKB_CB(skb)->seq; >> int size = TCP_SKB_CB(skb)->end_seq - start; >> + int offset = start - TCP_SKB_CB(skb)->seq; > >> >> BUG_ON(offset < 0); >> if (size > 0) { >> - size = min(copy, size); >> + if (copy >= size) >> + skb_shinfo(nskb)->gso_segs += >> + max_t(u16, 1, skb_shinfo(skb)->gso_segs); >> + else >> + size = copy; >> + > > So... what happens if copy was partial ? > In the current patch, if copy was parial, the gso_segs are in the orignal SKB as it will not be freed now. If that is not ok, what about the bellow change ? else { size = copy; skb_shinfo(nskb)->gso_segs += DIV_ROUND_UP(size, skb_shinfo(nskb)->gso_size); } > Your patch does not really fix the uncertainty, it merely shifts it a bit.