Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp50489imm; Tue, 19 Jun 2018 15:43:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIsEbMS/X0954EO07mGVR0VNKGN50oaAQS8hq4W+Kb8aMwggR9rI83QapzDdkgbyvQr5iWj X-Received: by 2002:a62:2414:: with SMTP id r20-v6mr20024953pfj.108.1529448187992; Tue, 19 Jun 2018 15:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529448187; cv=none; d=google.com; s=arc-20160816; b=u6YrQmGZJjA3/RLNGSjmrS5qaBAHIan1HMHiFCgTMFLwTkJR07UxXMKs2ZQaKGwPE8 bOg8HiMp219FSr4SCmYkaoVrx0Yk34QzXgEo3/diUY5g80A5NwcTXe3bRpKJ9cDiF/vC TMrI1ZDLTLDnOwEUvaUrDhkpkPQsx44yYrm+/Y904pSyMTQi1BCujUanQjSgAt1HH9/l jJ9SZayhV6mjMoiPlQosQzXlbInCsEMPjvbjMYdKmPsjV9ztdvN2jfOHNkjPUSDO/el8 I2ZVcRf/ybsDThFtqWei+G78SYeb4TDu0Gc3eTtw+ytWcIfFFHYgWS/FdG0zikOCF30b fpSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=+N14IqHj1JWJbTCF4/bBR+wUorZz0gsx/CWimG9i/Jc=; b=EPV0PK9xHaCDRvsIe4eVEja+ikh2ABfksJrsmLctDVxykQ1a8OPhoe+W3B1fY0bgyi nyHql3WzHEpS1j64WKMxMj0VeZva7M42tXms1PMEX2NrwwwvfkCZW2an8UZc38ljM/cf yYPu8t760mc2Ax81+ccMHwOgC92Xxq/2/MPGm1H7uRDc2o6tM4JKDvpyF/fUKRm5pJS2 hE2v3oGE+3mzYAsbGJIDeYB0wqNh0lHWeSX/e59BIJ49IyqXEgpQ1teheFQyEJqaTidW nH7eTzLSDgjPuASE0T4ZlsuFRc7ngB59cDv41E1v/igOO9qNTYER3pKQ7T8QPS39DGuf kGFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vTQ2AZpV; 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 v137-v6si575384pgb.682.2018.06.19.15.42.53; Tue, 19 Jun 2018 15:43:07 -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=vTQ2AZpV; 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 S1753758AbeFSWlD (ORCPT + 99 others); Tue, 19 Jun 2018 18:41:03 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37420 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751579AbeFSWlB (ORCPT ); Tue, 19 Jun 2018 18:41:01 -0400 Received: by mail-pf0-f194.google.com with SMTP id y5-v6so565122pfn.4; Tue, 19 Jun 2018 15:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=+N14IqHj1JWJbTCF4/bBR+wUorZz0gsx/CWimG9i/Jc=; b=vTQ2AZpVLAQowc5U9qSGXMp/DMkzaGSZdo1lNOO+DngXbN+yvfPGaqe/OvnWNiD8r2 QlWZDMqNIl/o1sA+eN0l41H9t5bmjLaICdnUH9JM64jImHkw3P2l3rzzKf6i7h5w5CnN 4qaQ7lldFK6H3O8D2kOz/rbuoi+leloREXkzZaEOtRyNo759dbFCRKSpiFYX6BxGY4Bw y1zcgGPs1tkKxuqLiUNUL/GgQ4LbFCvxLgv2OyeaLMu7aXZ2ydEfRMbu5iURbeJo8Pmw 9dA8WH3ILdz8LHocyv7t5lSJmngN4V3TOn256URUrND3OLG+4KbPtxDqPdcC+0hwTSyl IJ7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+N14IqHj1JWJbTCF4/bBR+wUorZz0gsx/CWimG9i/Jc=; b=GI8fv4IqZNnWqbHrmjOPPPRbPCohi3b536ia12Lf2Na1Lv8EaDM8/LVDyWREvQGZ0L FqNKWVbKkSZ9a0yW6vqUpiidTDrkrvj/17gSbC5E8HAf8xRQIPljmpIEqyMySbCispP5 SZFO97dLeOLh3OHO9IEfF1gMGLxohE/JhOMM48U2wNrTRUIeGBG6kaCdKCx6SORcV2bD /8k9u6kq+H/4yU4gNvNUF7gclHFYPCm+2w3NMiea57diRTa3zCD6mte1Qs9ow2iRAXkR QyqzjKNeukqhS2EkgNqoH9J8Ede8xBRHO+y+mvn6FEbdE7Hvc8cwevK9RWOGfDG3iSnf 7+Ww== X-Gm-Message-State: APt69E18qmPZsbnGbrHD5kokRCDJl5riedmlkZQoQvzlvlg+PYQYjdVn uJWJ0nJavgTGGKgX4r4zUAk= X-Received: by 2002:a63:6b84:: with SMTP id g126-v6mr16489664pgc.139.1529448060440; Tue, 19 Jun 2018 15:41:00 -0700 (PDT) Received: from ?IPv6:2620:15c:2c1:200:55c7:81e6:c7d8:94b? ([2620:15c:2c1:200:55c7:81e6:c7d8:94b]) by smtp.gmail.com with ESMTPSA id k10-v6sm1081931pfj.29.2018.06.19.15.40.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jun 2018 15:40:59 -0700 (PDT) Subject: Re: [PATCH] Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends" To: Andreas Schwab , Eric Dumazet Cc: Mathieu Malaterre , "David S. Miller" , Eric Dumazet , LKML , Christophe LEROY , Meelis Roos , netdev@vger.kernel.org, linuxppc-dev 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> <21523399-92ee-f8da-1a3e-0561f62850b7@gmail.com> <87po0mvbgl.fsf@igel.home> <05645b90-d3bc-466d-116f-548f3ee39de9@gmail.com> <87lgbav24y.fsf@igel.home> From: Eric Dumazet Message-ID: <03721d75-8705-b1f1-af30-388d36512be6@gmail.com> Date: Tue, 19 Jun 2018 15:40:59 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <87lgbav24y.fsf@igel.home> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/19/2018 03:32 PM, Andreas Schwab wrote: > On Jun 19 2018, Eric Dumazet wrote: > >> diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c >> index 7a16d40a72d13cf1d522e8a3a396c826fe76f9b9..672d6748ab44f0890e92d5ca55d6ff6834c20dc9 100644 >> --- a/drivers/net/ethernet/sun/sungem.c >> +++ b/drivers/net/ethernet/sun/sungem.c >> @@ -60,8 +60,7 @@ >> #include >> #include "sungem.h" >> >> -/* Stripping FCS is causing problems, disabled for now */ >> -#undef STRIP_FCS >> +#define STRIP_FCS >> >> #define DEFAULT_MSG (NETIF_MSG_DRV | \ >> NETIF_MSG_PROBE | \ >> @@ -435,7 +434,7 @@ static int gem_rxmac_reset(struct gem *gp) >> writel(desc_dma & 0xffffffff, gp->regs + RXDMA_DBLOW); >> writel(RX_RING_SIZE - 4, gp->regs + RXDMA_KICK); >> val = (RXDMA_CFG_BASE | (RX_OFFSET << 10) | >> - ((14 / 2) << 13) | RXDMA_CFG_FTHRESH_128); >> + (ETH_HLEN << 13) | RXDMA_CFG_FTHRESH_128); >> writel(val, gp->regs + RXDMA_CFG); >> if (readl(gp->regs + GREG_BIFCFG) & GREG_BIFCFG_M66EN) >> writel(((5 & RXDMA_BLANK_IPKTS) | >> @@ -857,6 +856,14 @@ 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) && net_ratelimit()) >> + pr_err("sungem wrong csum : %x/%x, len %u bytes\n", >> + csum, csum_fold(rsum), len); >> + print_hex_dump(KERN_ERR, "raw data: ", DUMP_PREFIX_OFFSET, >> + 16, 1, skb->data, len, true); >> + } >> skb->ip_summed = CHECKSUM_COMPLETE; >> skb->protocol = eth_type_trans(skb, gp->dev); >> >> @@ -1761,7 +1768,7 @@ static void gem_init_dma(struct gem *gp) >> writel(0, gp->regs + TXDMA_KICK); >> >> val = (RXDMA_CFG_BASE | (RX_OFFSET << 10) | >> - ((14 / 2) << 13) | RXDMA_CFG_FTHRESH_128); >> + (ETH_HLEN << 13) | RXDMA_CFG_FTHRESH_128); >> writel(val, gp->regs + RXDMA_CFG); >> >> writel(desc_dma >> 32, gp->regs + RXDMA_DBHI); > > With that patch I still get the wrong csum messages, but no longer the > hw csum failure messages (tested on a PowerMac G5). > > [ 662.659767] sungem: sungem wrong csum : 8359/7ca6, len 86 bytes, c0000001fee9cc02 > [ 662.659775] raw data: 00000000: 00 0d 93 43 81 62 d4 3d 7e 4c 48 b7 86 dd 61 01 ...C.b.=~LH...a. > [ 662.659778] raw data: 00000010: 1c 1e 00 20 06 40 20 01 0a 62 17 11 88 01 00 00 ... .@ ..b...... > [ 662.659780] raw data: 00000020: 00 00 00 00 0a 38 20 01 0a 62 17 11 88 01 00 00 .....8 ..b...... > [ 662.659783] raw data: 00000030: 00 00 00 00 00 07 9a 18 00 16 c1 9a 7e ea ea 44 ............~..D > [ 662.659785] raw data: 00000040: fb 4a 80 10 05 93 44 08 00 00 01 01 08 0a 59 68 .J....D.......Yh > [ 662.659788] raw data: 00000050: ba e2 0e bb ac ae ...... > > Andreas. > Note that 8359 and 7ca6 are the same really (a missing ~ to invert csum_partial()) So the bug was that : 1) Driver programmed a wrong start offset for the csum (7 bytes instead of 14 bytes to skip Ethernet Header) 2) FCS was not stripped. Basically CHECKSUM_COMPLETE support never worked, but this was hidden by the fact that linux stack had to throw away this CHECKSUM_COMPLETE because the FCS had to be removed. Thanks !