]> git.hungrycats.org Git - linux/commitdiff
net: ravb: Fix R-Car RX frame size limit
authorPaul Barker <paul.barker.ct@bp.renesas.com>
Wed, 18 Sep 2024 08:18:39 +0000 (09:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:33:21 +0000 (16:33 +0200)
[ Upstream commit ec8234717db8589078d08b17efa528a235c61f4f ]

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 <s.shtylyov@omp.ru>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/renesas/ravb_main.c

index 4d100283c30fb4958feeb23f5686bdd70be4cf25..067357b2495cdce7f938646f98cf3afded8c53ae 100644 (file)
@@ -530,8 +530,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 |