From patchwork Thu Feb 27 14:57:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 13994751 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 aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30703C19F32 for ; Thu, 27 Feb 2025 14:57:40 +0000 (UTC) Received: from relmlie6.idc.renesas.com (relmlie6.idc.renesas.com [210.160.252.172]) by mx.groups.io with SMTP id smtpd.web10.12484.1740668247211775388 for ; Thu, 27 Feb 2025 06:57:30 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: bp.renesas.com, ip: 210.160.252.172, mailfrom: paul.barker.ct@bp.renesas.com) X-CSE-ConnectionGUID: 5Ia6IpF3SIGqD0Vs3C7eiA== X-CSE-MsgGUID: Gt2qmJv7SoyJ3MnPZYd5Cg== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 27 Feb 2025 23:57:29 +0900 Received: from rz-ub2404.betafive.net (unknown [10.226.93.138]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 4E891434774C; Thu, 27 Feb 2025 23:57:27 +0900 (JST) From: Paul Barker To: Pavel Machek , Nobuhiro Iwamatsu Cc: cip-dev@lists.cip-project.org Subject: [PATCH 5.10.y-cip 02/11] net: ravb: Fix R-Car RX frame size limit Date: Thu, 27 Feb 2025 14:57:11 +0000 Message-ID: <20250227145720.229324-3-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250227145720.229324-1-paul.barker.ct@bp.renesas.com> References: <20250227145720.229324-1-paul.barker.ct@bp.renesas.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 27 Feb 2025 14:57:40 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17953 commit ec8234717db8589078d08b17efa528a235c61f4f upstream. The RX frame size limit should not be based on the current MTU setting. Instead it should be based on the hardware capabilities. While we're here, improve the description of the receive frame length setting as suggested by Niklas. Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") Reviewed-by: Sergey Shtylyov Reviewed-by: Niklas Söderlund Signed-off-by: Paul Barker Reviewed-by: Simon Horman Signed-off-by: Paolo Abeni Signed-off-by: Paul Barker --- drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index f0351db7c1b2..f8b58995e9b6 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -528,8 +528,16 @@ static void ravb_emac_init_gbeth(struct net_device *ndev) static void ravb_emac_init_rcar(struct net_device *ndev) { - /* Receive frame limit set register */ - ravb_write(ndev, ndev->mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN, RFLR); + struct ravb_private *priv = netdev_priv(ndev); + + /* Set receive frame length + * + * The length set here describes the frame from the destination address + * up to and including the CRC data. However only the frame data, + * excluding the CRC, are transferred to memory. To allow for the + * largest frames add the CRC length to the maximum Rx descriptor size. + */ + ravb_write(ndev, priv->info->rx_max_frame_size + ETH_FCS_LEN, RFLR); /* EMAC Mode: PAUSE prohibition; Duplex; RX Checksum; TX; RX */ ravb_write(ndev, ECMR_ZPF | ECMR_DM |