Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1755712rdf; Sun, 5 Nov 2023 12:57:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPYpm2gxQkB1+yJfHPsTil15TsNHid8QqmqCd0pDsve7QDOsBecHapTZ/bvIGPGThPuPWT X-Received: by 2002:a17:90b:3507:b0:27c:ecec:8854 with SMTP id ls7-20020a17090b350700b0027cecec8854mr11185451pjb.7.1699217859237; Sun, 05 Nov 2023 12:57:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699217859; cv=none; d=google.com; s=arc-20160816; b=p/oAEOe4t5K8aG84532f0lkgyiztTktD9H7WR7/mLomBApAKISU8YJXUj4SecI2wVg 4flrGG8HehWJ1Nm7iZkoBMEHz08mhvhK0+KeZ9nk7JwpfmdDxZx15rxjKJ5DnmVujp9N Gdbioexb1WaarMO3guGdk6Ds+IRNhbJTD0/QkZ1uOEvafvp68jg6ez66lhNLt1WApBzR +hp/aIDx9PG/zf13dLL7rZc5k9IzGRof1fr/63iDNH8K29UBi1tLD0XvWLt1DDdMCm7d vcLX4BW6wb0FU1PI3NGozEjC8wbDeR+mGGrjUy+RiHU3sG3oOTGw7FhAuBbv0nSW9fG4 rtJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=gQE5Q7bSQ5CYGQU246bebUi4YlUrrbixJJSlZ4tZEQg=; fh=G3jVr66/sTBxblB4VkyKBP17P5NL/3UjRtmVOzWFD40=; b=obnYQOXrxL88uw98x9afvHm4K4lHr0f/ngLk1jIgPMQv0tPBz6AMdpnW4SxK6uHvBa eYrw/cWWy5s8nJm14yBhgYyf5gaSZ9tC4MqNRt3Ub9EX6AQ9k3mg4mHNTRgf2L6tNxQ4 izV10K1kBo+whWzCykyUQZPb5gtFsHbc9UcmucgnlXdrehOCCREejpizn2Do9vp+EjAK 8feQbMG6ynoH/eTZPIYYEkU3Gu7NYVrdqgD88djqtYVPobr8TBJjrFHNUCIWEJwvb/VQ 8gVbNlnY6el8mluc/607inRFF1sRa9SNzsuVc8X6NHs3kCespyuWGMqb53s0iacGesqw i9uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eebXLP15; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id oa16-20020a17090b1bd000b002805a422743si7310290pjb.12.2023.11.05.12.57.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 12:57:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eebXLP15; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 2872080C113D; Sun, 5 Nov 2023 12:57:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229667AbjKEU5g (ORCPT + 99 others); Sun, 5 Nov 2023 15:57:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbjKEU5c (ORCPT ); Sun, 5 Nov 2023 15:57:32 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB02BEB for ; Sun, 5 Nov 2023 12:57:29 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-507ad511315so5477153e87.0 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=vger.kernel.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=eebXLP15HFRHF1NnfTmdlPXcVOVbnmtE9p8dzz+IYmqFzesu1EkR+fVaXcEV5iDmYe OgiebByePomyAo9ga9txe6TlOwSPNlgoXQgeqP5GACCp9bYrQXhPdRX720MlHUkbui68 cTzw/oERVjohWz//20L7BPP9MDgBvSTM3gV3Ekz1BWhnv7F1cqq6nApigEZKm9SFbfX5 35qt0oBJ5n74RnqT8hcRD33giUNU6gZL91oYfaxDcHRUNYftLzJwix+fh+/nb0U64qNJ KQl5Cvfpk/oBhmmquYMwuSX35Y1xqmTlh/7be3SCtg88PVBM0T49LTvZy63IfKlPZSz+ Si6w== 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=U+vjpuavYR43iyXgHTV23yW2TgfTmWBCezv/j7jzVrLS/4QNNKS1nifp9/mPIaUZFK f/+UFJ24HKN3K4Jc0vjt7lE/TlkH5OeBQuWj5kfFZfJtVAzFae5Stk+coVXDt+mLEtR5 rWwMbrD4y3qpAqfOTjG82VYVEShmUXR5nM2ugdiGUWHWPYm73aGrFfu34MuSXpALJEt7 OgubK2X+VdvOHRvk60DI3g2UHfbZwSMoYdaQLJ7P2MjMZBuG1REfmYmNOpkl8n3U9Xyd vsJZ42XoFdfjw+QVZUlxJ+Y+VEpw3CCv/7PpU1lkF6rIXXuFGS6SKitDQ9+/0zy43ANA 6vtA== X-Gm-Message-State: AOJu0YxC6H1ZVcIZlp7F7FvzfM5Ml0RAbTlkSmGuiidL2GhIf0uZBt2o EgA6bmEDeo75hOo1twwxBOlWNuxgcQxhVkez+RI= 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 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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?q?Micha=C5=82_Miros=C5=82aw?= , 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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Sun, 05 Nov 2023 12:57:38 -0800 (PST) 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 --- 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 { -- 2.34.1