From patchwork Sun Nov 5 20:57:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13446146 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 05830C4167B for ; Sun, 5 Nov 2023 20:58:00 +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:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=weud1qIw/00DSva1Jrdu7DhqJfz+uG8I55GHm/Jtb5Q=; b=JXwDNCFgEbewRV DXvevTxU4rpCRzx6Cmue8/r97K9SgwWdrJjAKHIJznRyWOUmo1fWg+hWObKGjughHUwTu8TOcAU+A ZjhaPZ800vEBGcnOuo1OGBA5J1w77Ndzt6jlM3/OrJG8McTWAA3Ognjy9guuW0goTWWfAyOkAytxE dIIJWyVHIjBHIUnnc2duG3YvJTuih+2RbG4oucc3RF9qYUhQypVbjD32L17CjnrwCOf8xKlRa5qJw kTlGHHnCIGAM3daTEwN/ChGuqkVhq9aZTSPGYmiJXD9JTbyWOf8tgEBkXcRz1tea496D6J23OxsVx pBgRed7t00kEi7rTpbdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qzkBb-00FVxT-0l; Sun, 05 Nov 2023 20:57:35 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qzkBY-00FVup-1p for linux-arm-kernel@lists.infradead.org; Sun, 05 Nov 2023 20:57:33 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-507bd644a96so5435192e87.3 for ; Sun, 05 Nov 2023 12:57:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699217848; x=1699822648; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gQE5Q7bSQ5CYGQU246bebUi4YlUrrbixJJSlZ4tZEQg=; b=AmqtKjibYZ1Qc0V0FoPwPz8dIQaM3HAYN/b9s4HgPjwTPr0QiuBQqeQTb07JNYy/LG 9JJA4PiZiK1og3ibPhoX3MQRzrQzsUI4PiXDe4/47QZDow61QcQU1oxfnpAgtUqpgOQe UwHiIzOqRQXaPziPtccD8KAbc8+WXXdS2UlFcC7NejmTmSfXzU7JvLVCNV+a49K61JEa xHGZMxo/S59KjLic1lKF0AsrhbWEbVgu8nisKWMtZkKs/9HFVBgQv2Kiu6pp8brbcong jfBwhRsVOIW8CkWBuN1R0nBLR7n4FbLNtJo3cQTE02u2Jn0i5IuaS+SpW8VGcO5TtzI9 t3lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699217848; x=1699822648; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gQE5Q7bSQ5CYGQU246bebUi4YlUrrbixJJSlZ4tZEQg=; b=fpJDFblHff68I7W/3VVxo1rRDoZRRQgNNw4Bej9DpYeNT1PXvvL+n7uiN+iHXkDQkW xHmBsjzF8+qVD84+dM2THb/exh4++OG43FrodwTpBFrUm9vgavdOEeUehIDiBeaSIBVC z2W/o0RPEapinUBSawebyr/GfFvdg34ziOsvlOoKfNMbEoW+ZHM9tZiQqt8bc6uIMr3c SLJc3R7mVpb8dmE/2k/dg5WHBXzO9SQ9N3SkqQAM7RgFqjTV32yldGwQ5HfWgfqepXR7 q/RsbQq8/3bOTPS1ejukJkYSfWv2SBzIxPdJwX9TgOJ2sOsM4dTB/8b8lwdRIqgwQlPG bv3A== X-Gm-Message-State: AOJu0YyequDqUw8pvq5xXzhCym0E86UCopet6eUXIw5Mi7mQseaD20od pUIuPvIkNsDae1/h4qY602FdvA== X-Google-Smtp-Source: AGHT+IHOmoeKz7m5iyemJOxxs0vWx/4QhLzQOa5mtwwvMfSXkeaGjljiQd5YYPz0Pgyz9fiVyiPrlQ== X-Received: by 2002:ac2:4d07:0:b0:502:ff3b:766f with SMTP id r7-20020ac24d07000000b00502ff3b766fmr18019859lfi.6.1699217847698; Sun, 05 Nov 2023 12:57:27 -0800 (PST) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id d12-20020ac24c8c000000b00507c72697d0sm931873lfl.303.2023.11.05.12.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 12:57:27 -0800 (PST) From: Linus Walleij Date: Sun, 05 Nov 2023 21:57:23 +0100 Subject: [PATCH net v2 1/4] net: ethernet: cortina: Fix MTU max setting MIME-Version: 1.0 Message-Id: <20231105-gemini-largeframe-fix-v2-1-cd3a5aa6c496@linaro.org> References: <20231105-gemini-largeframe-fix-v2-0-cd3a5aa6c496@linaro.org> In-Reply-To: <20231105-gemini-largeframe-fix-v2-0-cd3a5aa6c496@linaro.org> 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-20231105_125732_613765_3786C267 X-CRM114-Status: GOOD ( 14.51 ) 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 The RX max frame size is over 10000 for the Gemini ethernet, but the TX max frame size is actually just 2047 (0x7ff after checking the datasheet). Reflect this in what we offer to Linux, cap the MTU at the TX max frame minus ethernet headers. Use the BIT() macro for related bit flags so these TX settings are consistent. Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet") Signed-off-by: Linus Walleij Reviewed-by: Andrew Lunn --- drivers/net/ethernet/cortina/gemini.c | 7 ++++--- drivers/net/ethernet/cortina/gemini.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 5423fe26b4ef..ed9701f8ad9a 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -2464,11 +2464,12 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) netdev->hw_features = GMAC_OFFLOAD_FEATURES; netdev->features |= GMAC_OFFLOAD_FEATURES | NETIF_F_GRO; - /* We can handle jumbo frames up to 10236 bytes so, let's accept - * payloads of 10236 bytes minus VLAN and ethernet header + /* We can receive jumbo frames up to 10236 bytes but only + * transmit 2047 bytes so, let's accept payloads of 2047 + * bytes minus VLAN and ethernet header */ netdev->min_mtu = ETH_MIN_MTU; - netdev->max_mtu = 10236 - VLAN_ETH_HLEN; + netdev->max_mtu = MTU_SIZE_BIT_MASK - VLAN_ETH_HLEN; port->freeq_refill = 0; netif_napi_add(netdev, &port->napi, gmac_napi_poll); diff --git a/drivers/net/ethernet/cortina/gemini.h b/drivers/net/ethernet/cortina/gemini.h index 9fdf77d5eb37..201b4efe2937 100644 --- a/drivers/net/ethernet/cortina/gemini.h +++ b/drivers/net/ethernet/cortina/gemini.h @@ -502,7 +502,7 @@ union gmac_txdesc_3 { #define SOF_BIT 0x80000000 #define EOF_BIT 0x40000000 #define EOFIE_BIT BIT(29) -#define MTU_SIZE_BIT_MASK 0x1fff +#define MTU_SIZE_BIT_MASK 0x7ff /* Max MTU 2047 bytes */ /* GMAC Tx Descriptor */ struct gmac_txdesc {