2021-08-21 08:54:34 +00:00
|
|
|
From eccfde35476213d30a67dedb63f007e7ae8da78c Mon Sep 17 00:00:00 2001
|
|
|
|
From: Phil Elwell <phil@raspberrypi.com>
|
|
|
|
Date: Fri, 25 Sep 2020 15:07:23 +0100
|
|
|
|
Subject: [PATCH] net: bcmgenet: Reset RBUF on first open
|
|
|
|
|
|
|
|
If the RBUF logic is not reset when the kernel starts then there
|
|
|
|
may be some data left over from any network boot loader. If the
|
|
|
|
64-byte packet headers are enabled then this can be fatal.
|
|
|
|
|
|
|
|
Extend bcmgenet_dma_disable to do perform the reset, but not when
|
|
|
|
called from bcmgenet_resume in order to preserve a wake packet.
|
|
|
|
|
|
|
|
N.B. This different handling of resume is just based on a hunch -
|
|
|
|
why else wouldn't one reset the RBUF as well as the TBUF? If this
|
|
|
|
isn't the case then it's easy to change the patch to make the RBUF
|
|
|
|
reset unconditional.
|
|
|
|
|
|
|
|
See: https://github.com/raspberrypi/linux/issues/3850
|
|
|
|
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
|
|
|
---
|
|
|
|
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 16 ++++++++++++----
|
|
|
|
1 file changed, 12 insertions(+), 4 deletions(-)
|
|
|
|
|
|
|
|
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
|
|
|
|
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
|
kernel: bump 5.10 to 5.10.108
Patches automatically rebased.
Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200
Tested-by: John Audia <graysky@archlinux.us>
Build-tested: ath79/generic, ramips/mt76{20,21,x8}, ipq40xx, mvebu, realtek/rtl{838,930}x, x86/64
Run-tested: ramips/mt7621, mvebu
Tested-by: Stijn Segers <foss@volatilesystems.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
(cherry picked from commit 2c26eb4e484fe6d7a8159a22f97b6db7ca6e9221)
2022-03-23 09:47:19 +00:00
|
|
|
@@ -3246,7 +3246,7 @@ static void bcmgenet_get_hw_addr(struct
|
2021-08-21 08:54:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Returns a reusable dma control register value */
|
|
|
|
-static u32 bcmgenet_dma_disable(struct bcmgenet_priv *priv)
|
|
|
|
+static u32 bcmgenet_dma_disable(struct bcmgenet_priv *priv, bool flush_rx)
|
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
u32 reg;
|
kernel: bump 5.10 to 5.10.108
Patches automatically rebased.
Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200
Tested-by: John Audia <graysky@archlinux.us>
Build-tested: ath79/generic, ramips/mt76{20,21,x8}, ipq40xx, mvebu, realtek/rtl{838,930}x, x86/64
Run-tested: ramips/mt7621, mvebu
Tested-by: Stijn Segers <foss@volatilesystems.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
(cherry picked from commit 2c26eb4e484fe6d7a8159a22f97b6db7ca6e9221)
2022-03-23 09:47:19 +00:00
|
|
|
@@ -3271,6 +3271,14 @@ static u32 bcmgenet_dma_disable(struct b
|
2021-08-21 08:54:34 +00:00
|
|
|
udelay(10);
|
|
|
|
bcmgenet_umac_writel(priv, 0, UMAC_TX_FLUSH);
|
|
|
|
|
|
|
|
+ if (flush_rx) {
|
|
|
|
+ reg = bcmgenet_rbuf_ctrl_get(priv);
|
|
|
|
+ bcmgenet_rbuf_ctrl_set(priv, reg | BIT(0));
|
|
|
|
+ udelay(10);
|
|
|
|
+ bcmgenet_rbuf_ctrl_set(priv, reg);
|
|
|
|
+ udelay(10);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
return dma_ctrl;
|
|
|
|
}
|
|
|
|
|
kernel: bump 5.10 to 5.10.108
Patches automatically rebased.
Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200
Tested-by: John Audia <graysky@archlinux.us>
Build-tested: ath79/generic, ramips/mt76{20,21,x8}, ipq40xx, mvebu, realtek/rtl{838,930}x, x86/64
Run-tested: ramips/mt7621, mvebu
Tested-by: Stijn Segers <foss@volatilesystems.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
(cherry picked from commit 2c26eb4e484fe6d7a8159a22f97b6db7ca6e9221)
2022-03-23 09:47:19 +00:00
|
|
|
@@ -3334,8 +3342,8 @@ static int bcmgenet_open(struct net_devi
|
2021-08-21 08:54:34 +00:00
|
|
|
|
|
|
|
bcmgenet_set_hw_addr(priv, dev->dev_addr);
|
|
|
|
|
|
|
|
- /* Disable RX/TX DMA and flush TX queues */
|
|
|
|
- dma_ctrl = bcmgenet_dma_disable(priv);
|
|
|
|
+ /* Disable RX/TX DMA and flush TX and RX queues */
|
|
|
|
+ dma_ctrl = bcmgenet_dma_disable(priv, true);
|
|
|
|
|
|
|
|
/* Reinitialize TDMA and RDMA and SW housekeeping */
|
|
|
|
ret = bcmgenet_init_dma(priv);
|
kernel: bump 5.10 to 5.10.108
Patches automatically rebased.
Build system: x86_64
Build-tested: bcm2711/RPi4B, mt7622/RT3200
Run-tested: bcm2711/RPi4B, mt7622/RT3200
Tested-by: John Audia <graysky@archlinux.us>
Build-tested: ath79/generic, ramips/mt76{20,21,x8}, ipq40xx, mvebu, realtek/rtl{838,930}x, x86/64
Run-tested: ramips/mt7621, mvebu
Tested-by: Stijn Segers <foss@volatilesystems.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
(cherry picked from commit 2c26eb4e484fe6d7a8159a22f97b6db7ca6e9221)
2022-03-23 09:47:19 +00:00
|
|
|
@@ -4191,7 +4199,7 @@ static int bcmgenet_resume(struct device
|
2021-08-21 08:54:34 +00:00
|
|
|
bcmgenet_hfb_create_rxnfc_filter(priv, rule);
|
|
|
|
|
|
|
|
/* Disable RX/TX DMA and flush TX queues */
|
|
|
|
- dma_ctrl = bcmgenet_dma_disable(priv);
|
|
|
|
+ dma_ctrl = bcmgenet_dma_disable(priv, false);
|
|
|
|
|
|
|
|
/* Reinitialize TDMA and RDMA and SW housekeeping */
|
|
|
|
ret = bcmgenet_init_dma(priv);
|