From patchwork Thu Nov 9 09:03:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13450822 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 CF719C4332F for ; Thu, 9 Nov 2023 09:03:45 +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=CU0Sz3oITs9DjgLX5mRQFNUeXRYvQQ2yLznQy3Z0IGs=; b=IzkUZQvGb96cdL WanCBBVltrt+7vDVfx1d1jAtuatVYkFBS7eW9P8846szMvrgMKtyFVI3L37AWy4ndQPcVWCl3hF18 2Arrnns9g1ABz1a6yYaD/ipNTGIrvFwY5X4dj4t38ALyfZVkug/cJDucYdXO7Njaox5wW1EtBPulP L4+yGFL3SOJyZJOKGA0EAa56VBku1yd/DsV0szkGlN1Mn1qxqq4gQYehDjzpn7VJoU/TxonjllrWu exzdpeMpr/Ofxm9mha3e65NEpiz1gqxzC/5Ok9HfjNU2MraKZvwZvUZzmPh6c1aY11pgy46IbgVSp pgcq8bdp9GWjzFuB9Ylg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r10wY-005iKl-1L; Thu, 09 Nov 2023 09:03:18 +0000 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r10wV-005iJC-2B for linux-arm-kernel@lists.infradead.org; Thu, 09 Nov 2023 09:03:17 +0000 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c503da4fd6so6898551fa.1 for ; Thu, 09 Nov 2023 01:03:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699520594; x=1700125394; 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=X23W+DtxdHmqBzJUyijkKW7gcM1l2veMuv/ye91bjTA=; b=Jo6J8p7jPcW9bSR18V/+b9vUadQhbO2CUBmsn2gSoZytvI/BrDkWuQzWoBl2zsEZ6l OiUZFVZb1CM5Ag2roXZdOU5vdmcqlVPR4qEWmJmdvTZg8Dggi0TTTHrAvt1/e/P8qbt+ qkc1mqII+MhXQtdY8VwawNEzA5RDbuff+yPy91SG/vQO4WNCU5z6HFUC9XeLcc2UxMt0 1/yMAI1QE31Gv5cy7wAViRtYqayBAb60vrESK6UWAk+vl/R0NpHYC+vhcdo8W9YD2B5h XgGwC7gsqIBxWwrZh7j5DgpxpdfHUpHBbu1WcyI6ZPZzTviSFQmhm2YoWaj8jH28GA4r qNTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699520594; x=1700125394; 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=X23W+DtxdHmqBzJUyijkKW7gcM1l2veMuv/ye91bjTA=; b=pyXWjn0PJCvltifG8HAl6QnHstNfU2B76lI3pSy2zQ/ZqPT4qgmVOg/S1mgM9KE5yV F0n6lol5sAvj6gA1No89iw2S4xB2iF9FCpl/9rIkIHuz+NsmuPUeQNyErTgYgO44mw5b qsg/cguPgDOtg9UNSGNcEO9jV8hvFYR0Avy2/8BUJLs9wF2sj4zrr1BA2rz2+NhRkTTx rPHN+RIaxt97CWG/WSKQdlofte9LgXwtFFDVxPBKKUo02o5nGWB0MKAGtQRetIoeO4gK d4ekWraA//TuDfDmKF1ABHZ2IVIg1AXlVOmHZYF8Amcu4O5vvbfvWhav7I+7bYmk6qD1 D1Nw== X-Gm-Message-State: AOJu0YzAkW0s7MofcUNKWcvo02B4WzTtXL4Nz0Xtvp07Gn2dq1vROkD5 w+08u73uF0wZeR3Z+7s4Esu9QQ== X-Google-Smtp-Source: AGHT+IFwKlWTvRrQ1ZFMN7SHZYCNDqEQVjVoIvuY549D7L8oHnqQqDA8MivwJ7zAVezbFWntv0hILw== X-Received: by 2002:a05:651c:2047:b0:2c6:edfd:658a with SMTP id t7-20020a05651c204700b002c6edfd658amr3500404ljo.31.1699520593928; Thu, 09 Nov 2023 01:03:13 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id h19-20020a05651c159300b002bbacc6c523sm2212383ljq.49.2023.11.09.01.03.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 01:03:13 -0800 (PST) From: Linus Walleij Subject: [PATCH net v4 0/3] Fix large frames in the Gemini ethernet driver Date: Thu, 09 Nov 2023 10:03:11 +0100 Message-Id: <20231109-gemini-largeframe-fix-v4-0-6e611528db08@linaro.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAE+gTGUC/4XNQQqDMBAF0KtI1k1JMonarnqP0kWMEx3QWKJIi 3j3BleWIl3+P/w3CxsxEo7smi0s4kwjDSEFfcqYa21okFOdMlNCgZRC8wZ7CsQ7Gxv00fbIPb2 4kxpq5YpSVoal7TNiqjf3zgJO7JHKlsZpiO/t1yy30x92llzwizNGglfKA9w6CjYO5yE2GzmrP WOOGJUYV4M11uZOX/IfBvZMccRAYhBKAU6UoirMF7Ou6wf1EM5ATgEAAA== 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-20231109_010315_741182_E47502F1 X-CRM114-Status: GOOD ( 19.19 ) 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 v4: - Strip stray v1-related comment from the commit message on patch 1 - Move the hunks deleting gmac_fix_features() from patch "net: ethernet: cortina: Handle large frames" to "net: ethernet: cortina: Fix MTU max setting" as it is perfectly motivated by the MTU change, then move this patch later in the series. - Drop the last patch only activating the checksum engine for TCP and UDP explicitly. It's not fixing a regression, so let's reconsider it for net-next rather than net. - Link to v3: https://lore.kernel.org/r/20231107-gemini-largeframe-fix-v3-0-e3803c080b75@linaro.org 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 (3): net: ethernet: cortina: Fix max RX frame define net: ethernet: cortina: Handle large frames net: ethernet: cortina: Fix MTU max setting drivers/net/ethernet/cortina/gemini.c | 45 ++++++++++++++++++++++------------- drivers/net/ethernet/cortina/gemini.h | 4 ++-- 2 files changed, 31 insertions(+), 18 deletions(-) --- base-commit: ffc253263a1375a65fa6c9f62a893e9767fbebfa change-id: 20231104-gemini-largeframe-fix-c143d2c781b5 Best regards,