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: 16406 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp306769vqs; Thu, 9 Nov 2023 01:03:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFM+ZokVzrZv2yD7k2l5UwFktFm8kHVWeIP3ec3LVgTg1nf0NskUWbPtVQgOhb1+/Rl+igD X-Received: by 2002:a05:6a00:244b:b0:6c3:450f:2b64 with SMTP id d11-20020a056a00244b00b006c3450f2b64mr6949114pfj.6.1699520629860; Thu, 09 Nov 2023 01:03:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699520629; cv=none; d=google.com; s=arc-20160816; b=osnVL9SKBzoVses9CMYGl4+AX2VkVCwoMaFvwUN83lwM/hzT70pt1pK2YhgN0IjS3L IzLJQiibPO7AyrIELMS+gNYUKZPkCY5sziOsLRzMTMFHEYp/yQUUc2V0FAHgjscwOgCe DaQXkGcI9yHMZotU8Yx1GAuuZ3bLnp9zWAzjtxh5WD0zGAV0fnIuq5QFJd2vZGPEDko8 4Esm2YDg2jeG+Z0I08k/t28bpyoKKO+cgDw6gR6IE7wrNRKkkQmpuJCJ5F71K5Z+mvnO /OISQTYSOKT/rDJZMcT+J5ZaXdxXZXYjkTMa2uJE6qRIcTunuj17+bElilvYeIn7E2nH zYsg== 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=X23W+DtxdHmqBzJUyijkKW7gcM1l2veMuv/ye91bjTA=; fh=G3jVr66/sTBxblB4VkyKBP17P5NL/3UjRtmVOzWFD40=; b=UW3o7CUhk3qZI6xeNYfuuLI1IGpsCiWM+rBOj0EcgOwaM4cyz4Gv7Hnu7VoZqF5is5 zs9n8x9NXG0EiVLVnASuJQimb8dU0qTTxLh9jctCFf89CwNIjUm+En9QOFSh2yrmK6dT Lzu/1s8qF4Ft1H2+iWy2lQlBT3t/w+hwGbQE4kIn0qzOjnphPi61wQUp2wxYrfhKtCbh hLE8uJI9tsdhjjQ/TjkscZILWVQFE3BmsSiYMU2JPTTJb89nB4IJota9C/nTMsJ2Bgzo fPSWhEFC8Sfa/bz5MUj6Pbger5/uMVD8LuhDYYvL5MhORg+AICwUh39BmoRB1Vj0tFFZ opgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LX/2ft4F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id e10-20020a63690a000000b005bd335981e2si6267612pgc.678.2023.11.09.01.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 01:03:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="LX/2ft4F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 8F136822229D; Thu, 9 Nov 2023 01:03:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234069AbjKIJDX (ORCPT + 32 others); Thu, 9 Nov 2023 04:03:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234094AbjKIJDS (ORCPT ); Thu, 9 Nov 2023 04:03:18 -0500 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00BC5171D for ; Thu, 9 Nov 2023 01:03:15 -0800 (PST) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2c503da4fd6so6898561fa.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=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=X23W+DtxdHmqBzJUyijkKW7gcM1l2veMuv/ye91bjTA=; b=LX/2ft4FvsXvpYzdvUh45S8NiVjyZP831Pz8sy8qA6UYxcloRt3EiTHgyxwDBarlRv 1JX8RvBEEK+3Sue2zz2fYZo2zufQBVUlPR+1+udBIZIwLK6L27gWR3i/wtsa+Kwgqpm5 JHZMor6zzOd3YCfUcQ2NKhw1YEv1fT67iLpKBW4yVA73xz1cvjt2w2g+BYObqNPWqQkn eAQvSW/G75S/cbV1fIuR3em7g9Bi8xJD2I8DNmU+QO4KoSgxsCn5Zb/FaQlTEPwIWroE yXntW145ItIpEXAKj66sT2VOsk5wPRrXsfux6t6BoKlnT8hZ17Mrx/fS24zDXORvnsqn T2lg== 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=jzXp1KBDeaKBEvNCZa6lua7P8VAuWWtR8Xj7OsW5Fy88jqr8tbiin1EFSPWLZH1baj 2q98HeYyBLIUEHWiLlYH/vqN+HKsoxu3h21J+T6f8lp7YZw4ZNw0DTjcNw6VM32eH96/ TFJJXlyIWfCJLsETKW4tsKJNoyk61jcU0D3tZeJhDX5o/P3d0pMrhfh4DAcdYT27tlTq M6dKvMySUt+nTYfoEuX5AosvLSpvnspIxcjqm5eo83IQQwPG0b42M83EZrMEfXrahdeT hiEjvnfuHxbipWGm/+ligzgi9akXzbp533QBlRKTSUCsggh4HrlZdnJWAvqDoCG6fiRU Zl4w== X-Gm-Message-State: AOJu0YxCB31gIfOW/SnMC0wpjoe/EvJJU5xsj7vo2BLDkW8ciy5EuNjg YSZpTApOfp2+6bScfLVZ9PUkyA== 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 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 (agentk.vger.email [0.0.0.0]); Thu, 09 Nov 2023 01:03:46 -0800 (PST) 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 agentk.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782076544200866719 X-GMAIL-MSGID: 1782076544200866719 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,