Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4258536imm; Mon, 18 Jun 2018 11:46:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLBlSRiQ5tShxPVr+7H6xpo/g0CZw+BP1PC6AzEYKG0oz7Q48bDiJghQlOlG/l+xh5YrI8p X-Received: by 2002:a65:5bce:: with SMTP id o14-v6mr11988309pgr.449.1529347614610; Mon, 18 Jun 2018 11:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529347614; cv=none; d=google.com; s=arc-20160816; b=kPxpJ4drHOaMWxOQt2rv66aXlu6EjM7IB1qcbKkftFws+PJdUAlaqFxQag7G3/wU4U zk/Yl4sdl93JvCR3UvlFDsvMQZFXs6IzqfIYgdn5v754RpykJCxdM66dLvHSQz7ZOzQd EU+EOuSRrcOygRIbkfx9lscPV1aORAxiXYrJYuCiYX2+vWfQkFhxafT7ps8iCTG2U9N2 tHIVGp1hy8KsL1iecBw6hHFKo0usp+zolqMnZfLjx+DKx0w4+xoqTB13VlBnAELvUIyd d50xd8MiKO3NcDtbeuUkis50zWhTMIySHWnSv9q5ojT9rjw2Sf6CdCGKD0gJl5oTVmbl Zx9g== 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 :in-reply-to:references:mime-version:arc-authentication-results; bh=0P/JJdL5fmKTxfde4ygPlkmLN20iMKsAZh4CE1cZQ9w=; b=VERLYkg32pnnMjn/0rMvwMZTIFiYn6uXKcfg14sw5rLXDRGqRJajaTYqyYFeE3mK8y 2UZ5DmpVV3nAAXUQw+38X5oQq6a0rL4XI/dwK1l3EEm3Zqn6CdJEm3TbJ08iuukJc1hE wYXbm5HfLHMEI/JLMzwqMJVC/s1QfrmA/mu4bH96u7T5+nmsoRgtT5XyC4B8K4GHG1Y1 H+gKfr+w+OIlWUanB6XTOGAFSQNoOnBNX13fTWmTS87ZPiNu+Qi+oiNeMJ3+hmlrd/d/ m1f4xNxNcIZjZUeIHfi3m8NvQHLPtCiL+te6oJhsq2pmRrYzulxo2mCvCYs9v9VKG0dE 74gQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3-v6si9956263pgf.339.2018.06.18.11.46.40; Mon, 18 Jun 2018 11:46:54 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936031AbeFRSqA (ORCPT + 99 others); Mon, 18 Jun 2018 14:46:00 -0400 Received: from mail-ot0-f196.google.com ([74.125.82.196]:35003 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935726AbeFRSp6 (ORCPT ); Mon, 18 Jun 2018 14:45:58 -0400 Received: by mail-ot0-f196.google.com with SMTP id q17-v6so19679336otg.2; Mon, 18 Jun 2018 11:45:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0P/JJdL5fmKTxfde4ygPlkmLN20iMKsAZh4CE1cZQ9w=; b=RjeGsqS0IXwDOirELCK/Bii8VhCtz76rqBNvrVZOZ7S91B0EzIsrPgJJtWS7f3pd/K B3wH0u3cDItlY++oEh6SH4M3ke8Yruun4UuIZWsUqqfkMLKtfhMFgU28iY+GR8DeD+rr dIIlaoJP8cw4rrc1aNC5i6q2xc3p/bFO51SNuPVfTV6SfMQQJflszFOGu3wQQNbrHPtw m7LFdyt7kBSnDfldJa302BVe4d/qhpjtUlzqLdqVL42iaCDUC8m5sOrKVnFUEBnQo9zE g89iuk7Km+nx6dIntctVyEkAALFDI6v7T3HWjuKySsAQSQK9xzhFmcbvHJAOP3oJKrL5 YJHg== X-Gm-Message-State: APt69E0XTWJ2wDqa0XdHQZnVqUdHFMN4JRiUt3FO9wbzGgRyT5MJwHG4 kdA+uTeaqKo1nZABLnN6Ly3DWHUcR7eDoedCuno= X-Received: by 2002:a9d:5b3a:: with SMTP id x55-v6mr8777062oth.127.1529347558123; Mon, 18 Jun 2018 11:45:58 -0700 (PDT) MIME-Version: 1.0 References: <20180615185645.8921-1-malat@debian.org> <9d88677a-f2be-2089-79df-15df4e9a5dd6@gmail.com> <87o9g8geu0.fsf@igel.home> <816ef746-5278-1d51-1d9d-55593e377681@gmail.com> In-Reply-To: <816ef746-5278-1d51-1d9d-55593e377681@gmail.com> From: Mathieu Malaterre Date: Mon, 18 Jun 2018 20:45:46 +0200 Message-ID: Subject: Re: [PATCH] Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends" To: eric.dumazet@gmail.com Cc: schwab@linux-m68k.org, "David S. Miller" , Eric Dumazet , LKML , Christophe LEROY , Meelis Roos , netdev@vger.kernel.org, linuxppc-dev 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 Mon, Jun 18, 2018 at 8:18 PM Eric Dumazet wrote: > > > > On 06/18/2018 10:54 AM, Andreas Schwab wrote: > > On Jun 17 2018, Eric Dumazet wrote: > > > >> Oh this is silly, please try : > >> > >> diff --git a/net/core/skbuff.c b/net/core/skbuff.c > >> index c642304f178ce0a4e1358d59e45032a39f76fb3f..54dd9c18ecad817812898d6f335e1794a07dabbe 100644 > >> --- a/net/core/skbuff.c > >> +++ b/net/core/skbuff.c > >> @@ -1845,10 +1845,9 @@ EXPORT_SYMBOL(___pskb_trim); > >> int pskb_trim_rcsum_slow(struct sk_buff *skb, unsigned int len) > >> { > >> if (skb->ip_summed == CHECKSUM_COMPLETE) { > >> - int delta = skb->len - len; > >> + __wsum csumdiff = skb_checksum(skb, len, skb->len - len, 0); > >> > >> - skb->csum = csum_sub(skb->csum, > >> - skb_checksum(skb, len, delta, 0)); > >> + skb->csum = csum_block_sub(skb->csum, csumdiff, len); > >> } > >> return __pskb_trim(skb, len); > >> } > > > > That doesn't help either. > > > > Andreas. > > > > Then maybe NIC provided csum is not correct. > > It does not compute a checksum on all the frame, but part of it. > > You could use this patch to double check. > > diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c > index 7a16d40a72d13cf1d522e8a3a396c826fe76f9b9..277859ea73e35271a10b02011120fca248ec8e71 100644 > --- a/drivers/net/ethernet/sun/sungem.c > +++ b/drivers/net/ethernet/sun/sungem.c > @@ -857,6 +857,11 @@ static int gem_rx(struct gem *gp, int work_to_do) > > csum = (__force __sum16)htons((status & RXDCTRL_TCPCSUM) ^ 0xffff); > skb->csum = csum_unfold(csum); > + { > + __wsum rsum = csum_partial(skb->data + ETH_HLEN, len - ETH_HLEN, 0); > + if (csum != csum_fold(rsum)) > + pr_err_ratelimited("sungem wrong csum : %x/%x, len %u bytes\n", csum, csum_fold(rsum), len); > + } > skb->ip_summed = CHECKSUM_COMPLETE; > skb->protocol = eth_type_trans(skb, gp->dev); > > Here is what I get on my side [ 53.628847] sungem: sungem wrong csum : 4e04/f97, len 64 bytes [ 53.667063] sungem: sungem wrong csum : eea8/6eec, len 149 bytes [ 58.648952] sungem: sungem wrong csum : 2095/3d06, len 64 bytes [ 58.669414] sungem: sungem wrong csum : 5245/b50, len 149 bytes [ 63.674451] sungem: sungem wrong csum : 2d8/5abd, len 149 bytes [ 68.678233] sungem: sungem wrong csum : b8fc/a498, len 149 bytes [ 73.685771] sungem: sungem wrong csum : 374/5a21, len 149 bytes [ 78.689089] sungem: sungem wrong csum : d81/5014, len 149 bytes [ 83.683261] sungem: sungem wrong csum : 4e04/f97, len 64 bytes [ 83.690193] sungem: sungem wrong csum : c2f7/9a9d, len 149 bytes [ 88.692511] sungem: sungem wrong csum : f4d8/68bc, len 149 bytes [ 93.699915] sungem: sungem wrong csum : 1370/4a25, len 149 bytes [ 98.703136] sungem: sungem wrong csum : e1b5/7bdf, len 149 bytes [ 103.704230] sungem: sungem wrong csum : 5321/a74, len 149 bytes [ 108.688912] sungem: sungem wrong csum : 2095/3d06, len 64 bytes [ 108.706559] sungem: sungem wrong csum : ddbc/7fd8, len 149 bytes [ 113.713189] sungem: sungem wrong csum : 5a65/330, len 149 bytes [ 113.891697] sungem: sungem wrong csum : 4e04/f97, len 64 bytes [ 118.717151] sungem: sungem wrong csum : f7c8/65cc, len 149 bytes [ 123.722680] sungem: sungem wrong csum : 3d7a/201b, len 149 bytes [ 128.726524] sungem: sungem wrong csum : c8fd/9497, len 149 bytes [ 133.732045] sungem: sungem wrong csum : de0d/7f87, len 149 bytes [ 135.529163] sungem: sungem wrong csum : 3089/b6dd, len 96 bytes [ 135.529208] eth0: hw csum failure [ 135.529220] CPU: 0 PID: 0 Comm: swapper Not tainted 4.17.0+ #7 [ 135.529226] Call Trace: [ 135.529243] [dffedbe0] [c069ddac] __skb_checksum_complete+0xf0/0x108 (unreliable) > > >