From patchwork Thu Feb 27 15:34:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Barker X-Patchwork-Id: 13994782 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 9DE6AC1B0FF for ; Thu, 27 Feb 2025 15:34:30 +0000 (UTC) Received: from relmlie5.idc.renesas.com (relmlie5.idc.renesas.com [210.160.252.171]) by mx.groups.io with SMTP id smtpd.web11.13398.1740670464074608951 for ; Thu, 27 Feb 2025 07:34:27 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: bp.renesas.com, ip: 210.160.252.171, mailfrom: paul.barker.ct@bp.renesas.com) X-CSE-ConnectionGUID: jkxyEdSlRjeu0YmAMEZ9Tg== X-CSE-MsgGUID: i9V/9/JsQbCz6aEzkwFR7A== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 28 Feb 2025 00:34:27 +0900 Received: from rz-ub2404.betafive.net (unknown [10.226.93.138]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 8383A402CEAC; Fri, 28 Feb 2025 00:34:25 +0900 (JST) From: Paul Barker To: Pavel Machek , Nobuhiro Iwamatsu Cc: cip-dev@lists.cip-project.org Subject: [PATCH 6.1.y-cip 02/12] net: ravb: Fix R-Car RX frame size limit Date: Thu, 27 Feb 2025 15:34:03 +0000 Message-ID: <20250227153413.686812-3-paul.barker.ct@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250227153413.686812-1-paul.barker.ct@bp.renesas.com> References: <20250227153413.686812-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 15:34:30 -0000 X-Groupsio-URL: https://lists.cip-project.org/g/cip-dev/message/17966 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 852545f38dfc..5cd72098d1be 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -568,8 +568,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 |