From patchwork Tue Nov 7 09:54:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 16327 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp125199vqo; Tue, 7 Nov 2023 01:55:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IH77R1SNw/wzPPsSQXbo/6bQnTPFu5E+Y30y5FZrNiiGjUA0jv/o7Y2I/NJ90Dkc1TluRQO X-Received: by 2002:a05:6a21:3e02:b0:180:e3f1:4f60 with SMTP id bk2-20020a056a213e0200b00180e3f14f60mr18064634pzc.45.1699350945216; Tue, 07 Nov 2023 01:55:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699350945; cv=none; d=google.com; s=arc-20160816; b=mCLjZAuuomOtqaL0BL4Vb7qjI8rTxoZEknP+013hk2JEWCJ3hW8ZpJ3XD2NblujIDf 5iRGzkhMcDUJVC5JN2K7h0ncMyBKgmzTGLA+8+uCgH5SBqsEC6MzFB6zGUhgzE1OVB/M Je52imV1m59M5eCFZVj7GRo6NSrip/91TOATuySmBUUYT5pEvAER/5vbtwqbh0b2dPPZ 8Y7sK9Pi/gPP4JzP03eVTAy4yeOvYj/z5wv8zwyTo7RlwJckWbh35WVM2sHzoJ/+It2N Mu3oqcP8+gTduIRtVmAZS03vG748eoU+Zdlv15YCwbGEwGFeWGevur9G/ZX7BN+D6nGe tR0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:content-transfer-encoding:mime-version :message-id:date:subject:from:dkim-signature; bh=+KVxbyf63W63AUZ1cjifrLlcVV0rg+APXv/mnMjOM+w=; fh=G3jVr66/sTBxblB4VkyKBP17P5NL/3UjRtmVOzWFD40=; b=1HijwG4Mkqig4FZ2IUKXq3xiChf6fDFItGgyGMEouYBZIftfpLNO2e1Wj9fsLscA/R Bn1lileLSlBXldbyuuxwnx/CCyRrIP3Y71PPmAjgCH+z7rxnOZt0QDzzPlVI/nlXjc5y W2d7fLOnrRr5pX2bQqSnFdFAVf1J4uiQIHuklmyRuqzlqwKR4UWWXMcSe99xOMoYiIr8 tWbMcsaP/ju6+rZP7TrDZ4b/a8eMUG6DRAPLel9sdXyg/gapDL9W9i7d6X4uXUQ+II3j y1OxZZmZCYLDzy3sCYxSaTryC0t3Qhrb3nmwgezHgApRUwr8h2P/YNZJKaoEoUVXkjja bBaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pytBYZQV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id jy13-20020a17090342cd00b001c39f2b4d2bsi9378929plb.438.2023.11.07.01.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:55:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pytBYZQV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 5BF6E8028919; Tue, 7 Nov 2023 01:54:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233843AbjKGJyj (ORCPT + 33 others); Tue, 7 Nov 2023 04:54:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233829AbjKGJyi (ORCPT ); Tue, 7 Nov 2023 04:54:38 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CBD811A for ; Tue, 7 Nov 2023 01:54:34 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-507973f3b65so7336964e87.3 for ; Tue, 07 Nov 2023 01:54:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699350873; x=1699955673; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=+KVxbyf63W63AUZ1cjifrLlcVV0rg+APXv/mnMjOM+w=; b=pytBYZQV9ZnZlU4wxdv96tF2HwEufIfvVY8y7Q02ZSam9shdF5GNSTx1grkLNNkFoi mcr1D9QZweNlf/jGlm6aO4/TO3DYlg319BvMxpf81h8sIXz8PgYv4W1VcMp/TGZh2CUR rriWFufywFj6z6Myuw0TbleYODnd8eVqfNtUIdcrxOK0x87pxJxUhRi5Cq3ruY0m45G/ HY39MkplRgMG7fNWkXT7c2spYrsgOWrnzutAhbzpj/dbj/kbj1KtAg6vhmoc/4909mlO Os/IkzoUiVPSeeLJzbxlfmLk7vrz5RD41/iCZTrb53F//YbFyDZgi5bf55GbghD71pPo 3f3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699350873; x=1699955673; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+KVxbyf63W63AUZ1cjifrLlcVV0rg+APXv/mnMjOM+w=; b=vgu1+YFxCvkyo+yMqS4+FH7oBGL18h8hM9RZUQCcAXLJ+zO8n02TQAoLVaslrvIEVp KrvX7xDfYnYrOxZLBEQ4wHoACWgh+yvhngajOP4vzGPFXJdgntxYThVjoz84oRrkBVd8 Z07fjLfBNYn/uodlZk03ZKaS5tG4DOXAUL5+4HtRjYH3/K16uQPfXsaDZ6zrtIOI8Mab 1J/bBrg0zGzcmfPDSJtkFLhEv8zqpIRCX159TSOvjAuxKhAUYK5sW+aM+ZyRdEWY5Enu 67I1BH6clr1EjY80OOpkApiq+voO94FEi46TVJRTrj01oY8Y2/I+nkBM8iKMMte12DPV kqAw== X-Gm-Message-State: AOJu0YzubfEdM1KRAW/dTpyA7QoqM3cDTFWc1lMTH6g/+tLJM/kbdddo YuJMlZdulO9atxgnvDZ6RldbDQ== X-Received: by 2002:a05:6512:201c:b0:508:266a:e85f with SMTP id a28-20020a056512201c00b00508266ae85fmr23464114lfb.1.1699350872555; Tue, 07 Nov 2023 01:54:32 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id m25-20020ac24ad9000000b005091314185asm296356lfp.285.2023.11.07.01.54.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:54:32 -0800 (PST) From: Linus Walleij Subject: [PATCH net v3 0/4] Fix large frames in the Gemini ethernet driver Date: Tue, 07 Nov 2023 10:54:25 +0100 Message-Id: <20231107-gemini-largeframe-fix-v3-0-e3803c080b75@linaro.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAFEJSmUC/4XNQQ7CIBAF0KsY1mIKlGpdeQ/jAulAJ2nBDA3RN L27hJUujMv/J//NyhIQQmLn3coIMiaMoQS13zE7muCB41Ayk41UQjQt9zBjQD4Z8uDIzMAdPrk VrRqkPZ7EXbOyfRCUurpXFmBht1KOmJZIr/ori3r6w2bBG95brYVyUjqlLhMGQ/EQyVcyy09G/ 2JkYeygjDams23ffTHbtr0BA5R4owcBAAA= To: Hans Ulli Kroll , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Vladimir Oltean , Andrew Lunn Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Walleij X-Mailer: b4 0.12.4 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 07 Nov 2023 01:54:58 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781898616619167029 X-GMAIL-MSGID: 1781898616619167029 This is the result of a bug hunt for a problem with the RTL8366RB DSA switch leading me wrong all over the place. I am indebted to Vladimir Oltean who as usual pointed out where the real problem was, many thanks! Tryig to actually use big ("jumbo") frames on this hardware uncovered the real bugs. Then I tested it on the DSA switch and it indeed fixes the issue. To make sure it also works fine with big frames on non-DSA devices I also copied a large video file over scp to a device with maximum frame size, the data was transported in large TCP packets ending up in 0x7ff sized frames using software checksumming at ~2.0 MB/s. If I set down the MTU to the standard 1500 bytes so that hardware checksumming is used, the scp transfer of the same file was slightly lower, ~1.8-1.9 MB/s. Despite this not being the best test it shows that we can now stress the hardware with large frames and that software checksum works fine. Signed-off-by: Linus Walleij --- Changes in v3: - Do not reimplement the existing oversize check (sigh what is wrong with me). Drop that patch. - Drop the gmac_fix_features() since we are better off falling back to software checksums dynamically per-frame. - Add a new patch to bypass the checksumming engine if we are not handling TCP or UDP. - Link to v2: https://lore.kernel.org/r/20231105-gemini-largeframe-fix-v2-0-cd3a5aa6c496@linaro.org Changes in v2: - Don't check for oversized MTU request: the framework makes sure it doesn't happen. - Drop unrelated BIT() macro cleanups (I might send these later for net-next) - Use a special error code if the skbuff is too big and fail gracefully is this happens. - Do proper checksum of the frame using a software fallback when the frame is too long for hardware checksumming. - Link to v1: https://lore.kernel.org/r/20231104-gemini-largeframe-fix-v1-0-9c5513f22f33@linaro.org --- Linus Walleij (4): net: ethernet: cortina: Fix MTU max setting net: ethernet: cortina: Fix max RX frame define net: ethernet: cortina: Handle large frames net: ethernet: cortina: Checksum only TCP and UDP drivers/net/ethernet/cortina/gemini.c | 66 +++++++++++++++++++++++------------ drivers/net/ethernet/cortina/gemini.h | 4 +-- 2 files changed, 45 insertions(+), 25 deletions(-) --- base-commit: e85fd73c7d9630d392f451fcf69a457c8e3f21dd change-id: 20231104-gemini-largeframe-fix-c143d2c781b5 Best regards,