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: 13448240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2812AC4332F for ; Tue, 7 Nov 2023 09:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:Message-Id:Date: Subject:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=5rzrrc3bxEFm3EChwavqrnJ8FOskKYlZGP54qddDS0g=; b=RGDhYfq4zQXHit 1BelGmq3E/FODeUPwmEce819ZMgtq4wrGw0uLIV+QVoOHOTGUW0z4RqJICvr6Nw65UK5i1v+Qd8zt CXW+AzAiezsd4yuCovSjrxMPdvYXR2FSXmGy1S2YTdTMcsEsOOioFrrqSpH8BXBmGS0k24G5L3TlH yC1mpsX/1Xl+Oq1vyfTVrpdf9i7EuNhz5DLwMqBuBLgv5czDLsUSGskotMNJvHRocRqLDLYy53uHV +/zQQY2gPDPm/Lv/1d3wkxe1RlNllTICApkPkv5X9hqiVf4fTcbBMHKB11uJecMznQXWHYF4wSiAg 3QOHMu/sGvrANuBXto3A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0InA-000yAA-2T; Tue, 07 Nov 2023 09:54:40 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0In7-000y8A-2L for linux-arm-kernel@lists.infradead.org; Tue, 07 Nov 2023 09:54:39 +0000 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-507973f3b65so7336969e87.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=lists.infradead.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=EMjU755Y+1gxyEieJpAYnkzkLn1VQ94ZhGnaMClNnvVSzToCLJ553/t3jfGuC+VM11 KF1MmCaI0TkEWtpSLAK/7qFH0y3fyEV3J9A8iLRbAoUZwd9Td1humdqqXVWSTBRHXMsx aLtodJh23XoZnp9QXxROq05gEayvoWnWu4ecbNMcr15srhmLwEY6F4D1DufcCVUtT/K7 BtDHVN2mD8MUYlBSyUSSTlm9HuQUtEsjiHCG6bl2o4QwHkb8VFCA68/Unpbys7MtuYfK eqAnZ6BDGH5bHuedHgzc4WgOP2GYgxY70jm6Fim/Fxx3PnlcQzaNW2uZT1H8uCjeKdsR +g7A== 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=T+0Ap3A3d4vMxjqapSnFiLXVeOx5LzDK8aHvRLDI7/CylDQtxKeFKIyc+/+2uI7k70 V+cpgHnyKX9wZK5OKXRVfqj8avm7obQ8MF5jCpSpmUbhhbCoTC/BlAvG3YVHFsMhK71R BWhStMPzXMUVc5oY6Z2RAOSoGZf+utDYc2oqVdsp6LvphnMBGq55hsuwLnaQpZHXYn2x Jvh3IBDFKvu3Nsyp/ykBQQVyCEi1VqY72iO/hnxoJdAcO+xUu7HJEGVopsUmqB7F1d+a GylNku+5gbdTKvQZ5/foRXz/rCpAnZtXLm7Ec6GpfkyMuur0tkuT6b2CMroJIdjLTnMu SjYA== X-Gm-Message-State: AOJu0YwHUl0BSgZtlgdruN4oUFcIASJ3sv31G7bU3nA/enUa/2wsPGoD no4qDD8Jz/KZoU/s+y0lIMHmCVqOHpgNFc+4/to= X-Google-Smtp-Source: AGHT+IHaEDMyUObMlXrFqoLoDzJvzNU0tys1WG7+cZQWqx4WDBC+KFxmSp6l8CrC/bJVSZX+Ze64xg== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_015437_790464_2693DEF8 X-CRM114-Status: GOOD ( 16.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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,