From patchwork Tue Nov 7 09:54:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13448242 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 7CCD2C0018C for ; Tue, 7 Nov 2023 09:55:07 +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=y1NQmyjmT/qiYpP1mwzoDsx82pNFavINYWpcqlFHkyQ=; b=APY49b4NtsRqgy OnndqwU67fzc/0cglqJbIcsoNevRxGQpcXzD0m00JPFSx5wFWZJK4LhPp3NKKYQHTO9aoftwNoS1+ EaqkTCYEfSLumTt2j2A35fdoZUKfk/gWIOC+Ez6674or4XTR9+Sj+P0tmcNzEkQ9mrSOs+e+ReMVE +55xNGGvmA+ZtVldfVRf/7Odhn61jbl3n3LJULzmBXdvPK5jfyBW0VZ/KAbJwUQf/f1TQyGDlL+nu XF30/HTCnQo1cMnovAA/aqirvt6dY7xtpqTRhd977CC1z4EOT5RyMegvWJ3rA89vaRekG7b9jQv+B umMXJ2WhXzPn0dXcuhUQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0InB-000yAi-1U; Tue, 07 Nov 2023 09:54:41 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0In8-000y8D-0C for linux-arm-kernel@lists.infradead.org; Tue, 07 Nov 2023 09:54:39 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-507be298d2aso7022882e87.1 for ; Tue, 07 Nov 2023 01:54:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699350874; x=1699955674; 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=JloLY/S3J4vbR80IcKlfhvbtLk/oEHP3bZQboIzjIZc=; b=W2ErXBJ2SLxQtkJNpe9jUWjxjMQhZVlOkMxxsWzOPIrUUyaeuwMl14x7m309DyJPTJ FGFgUA5RB1lFASq0R6UZLLOQhyCtMIZXtIEEg7DDQZgKU8HlqKS1AeEobZ6XuXXOVsb5 elqrLhdk/paYIKYBIqLkiSvubW4je+bB2li4QDl10TSkUFkb5zmPAQJwTlcSNq5DZUp8 +P16AxWutN5QG2Aq4/jOq+6En+SZrc7/BKJF5EE5ljxwi1u8Hc6d0zYoayEKXtg+hulr kcQoxRABQgW/vovih7Hm+W0GNNf5xsWOlCaoiviUqAVNjDC2laBJrjeNY+QR8CV3NLfT JP2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699350874; x=1699955674; 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=JloLY/S3J4vbR80IcKlfhvbtLk/oEHP3bZQboIzjIZc=; b=Y1MXr6kcidUW/QSt9u8jh1Vnalbh3CyyBlqoQFyGBMCgEdkNd0EY4GS+7VqlPUciGD QraqCfGsELfn3Z/GEgJfkqY5HDtJXOHjOucnRLyIF1m5EmrTzDRC6YLj0knxn3nuRo0r BH7WO7Z3yvzQDTUncMdxQnZ0pFhDrUsdO5O/QePW06BJ1rEssTffn8dZ0v+b9NWAoilL 1NTYRCeuJzNW6Mqgm/sFBe9kfp+5a8/g+KXhTp3uxz4nNnSAKQwckS07CRFZLgx+1PXh dGrrH9pDw0NmnctvsYcgFuU5J/fbvyEXuf9PGGMPdzpEGqGifcIO2jXAM+dbpvJb5F/K 6RNQ== X-Gm-Message-State: AOJu0Yxv6Ct8FUsl5W9uQPNHsQwuMSK7n7Bs8+QAKl9UDxfu9+oDu2oU YoZn3azzAj1fllMw9tzCVvOa8ZAU9AjbPiOzHRI= X-Google-Smtp-Source: AGHT+IFpYjXoetaqCE4w0x17lDufaf6MMnsyuen6QOAUsAm15BkmP4tyeuBHkl/HJ06CXDK6NOBRxg== X-Received: by 2002:a05:6512:b8d:b0:509:47e1:6ebe with SMTP id b13-20020a0565120b8d00b0050947e16ebemr13946569lfv.14.1699350874094; Tue, 07 Nov 2023 01:54:34 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 01:54:33 -0800 (PST) From: Linus Walleij Date: Tue, 07 Nov 2023 10:54:26 +0100 Subject: [PATCH net v3 1/4] net: ethernet: cortina: Fix MTU max setting MIME-Version: 1.0 Message-Id: <20231107-gemini-largeframe-fix-v3-1-e3803c080b75@linaro.org> References: <20231107-gemini-largeframe-fix-v3-0-e3803c080b75@linaro.org> In-Reply-To: <20231107-gemini-largeframe-fix-v3-0-e3803c080b75@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-20231107_015438_104152_09BDA626 X-CRM114-Status: GOOD ( 14.86 ) 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") Reviewed-by: Andrew Lunn 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 {