Skip to contentSkip to conversation

net: bgmac: rate limit RX error messages

PATCH Applied Rosen Penev 4 participants 4 messages Oct 18 – Oct 22

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: bgmac: rate limit RX error messages

When the RX ring is full the RX FIFO overflows. With RX overflow continue enabled, the DMA engine then writes one frame with a bogus length (always 0x45c2 on a BCM4716), which the driver drops with "Found oversized packet at slot %d, DMA issue!".

Under sustained overload this happens on every NAPI poll. On an Asus RT-N16 a 950 Mbit/s UDP stream to the router printed about 1450 such lines in 20 seconds. The messages are printed from NAPI context, so with a serial console the router spends most of its time printing.

The frames are already accounted in rx_length_errors and rx_errors. Rate limit both RX error messages. With this change the same flood printed 60 lines while rx_length_errors counted 14297 dropped frames.

Fixes 6a6c708469c9 ("bgmac: add check for oversized packets")
---
 drivers/net/ethernet/broadcom/bgmac.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bgmac.c +6 -4
index 1835266fdd09..b3a92ae95de3 100644
@@ -447,16 +447,18 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
 
 			/* Check for poison and drop or pass the packet */
 			if (len == 0xdead && flags == 0xbeef) {
-				netdev_err(bgmac->net_dev, "Found poisoned packet at slot %d, DMA issue!\n",
-					   ring->start);
+				if (net_ratelimit())
+					netdev_err(bgmac->net_dev, "Found poisoned packet at slot %d, DMA issue!\n",
+						   ring->start);
 				put_page(virt_to_head_page(buf));
 				bgmac->net_dev->stats.rx_errors++;
 				break;
 			}
 
 			if (len > BGMAC_RX_ALLOC_SIZE) {
-				netdev_err(bgmac->net_dev, "Found oversized packet at slot %d, DMA issue!\n",
-					   ring->start);
+				if (net_ratelimit())
+					netdev_err(bgmac->net_dev, "Found oversized packet at slot %d, DMA issue!\n",
+						   ring->start);
 				put_page(virt_to_head_page(buf));
 				bgmac->net_dev->stats.rx_length_errors++;
 				bgmac->net_dev->stats.rx_errors++;
Signature · 1 line
2.56.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines

When the RX ring is full the RX FIFO overflows. With RX overflow continue enabled, the DMA engine then writes one frame with a bogus length (always 0x45c2 on a BCM4716), which the driver drops with "Found oversized packet at slot %d, DMA issue!".

Under sustained overload this happens on every NAPI poll. On an Asus RT-N16 a 950 Mbit/s UDP stream to the router printed about 1450 such lines in 20 seconds. The messages are printed from NAPI context, so with a serial console the router spends most of its time printing.

Quoted 6 lines

The frames are already accounted in rx_length_errors and rx_errors. Rate limit both RX error messages. With this change the same flood printed 60 lines while rx_length_errors counted 14297 dropped frames.

Fixes 6a6c708469c9 ("bgmac: add check for oversized packets")

Not sure there is a preferred choice between net_ratelimit() and e.g. dev_err_ratelimited(), the difference seems to be that the latter keeps a limit per call site rather than a global one. Since it already calls netdev_err(), i suppose this makes sense.

#2 lore raw
In reply to Rosen Penev
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Sun, 18 Oct 2026 16:16:29 -0700 you wrote:

When the RX ring is full the RX FIFO overflows. With RX overflow continue enabled, the DMA engine then writes one frame with a bogus length (always 0x45c2 on a BCM4716), which the driver drops with "Found oversized packet at slot %d, DMA issue!".

Under sustained overload this happens on every NAPI poll. On an Asus RT-N16 a 950 Mbit/s UDP stream to the router printed about 1450 such lines in 20 seconds. The messages are printed from NAPI context, so with a serial console the router spends most of its time printing.

[...]

Here is the summary with links:
- [net] net: bgmac: rate limit RX error messages

    https://git.kernel.org/netdev/net-next/c/77dac783f113

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#3 lore raw
In reply to Rosen Penev
Quoted 34 lines · Rosen Penev

When the RX ring is full the RX FIFO overflows. With RX overflow continue enabled, the DMA engine then writes one frame with a bogus length (always 0x45c2 on a BCM4716), which the driver drops with "Found oversized packet at slot %d, DMA issue!".

Under sustained overload this happens on every NAPI poll. On an Asus RT-N16 a 950 Mbit/s UDP stream to the router printed about 1450 such lines in 20 seconds. The messages are printed from NAPI context, so with a serial console the router spends most of its time printing.

The frames are already accounted in rx_length_errors and rx_errors. Rate limit both RX error messages. With this change the same flood printed 60 lines while rx_length_errors counted 14297 dropped frames.

Fixes 6a6c708469c9 ("bgmac: add check for oversized packets")
---
  drivers/net/ethernet/broadcom/bgmac.c | 10 ++++++----
  1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/ethernet/broadcom/bgmac.c +3 -2
index 1835266fdd09..b3a92ae95de3 100644
@@ -447,16 +447,18 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
 
  			/* Check for poison and drop or pass the packet */
  			if (len == 0xdead && flags == 0xbeef) {
-				netdev_err(bgmac->net_dev, "Found poisoned packet at slot %d, DMA issue!\n",
-					   ring->start);
+				if (net_ratelimit())
+					netdev_err(bgmac->net_dev, "Found poisoned packet at slot %d, DMA issue!\n",
+						   ring->start);
  				put_page(virt_to_head_page(buf));

drivers/net/ethernet/broadcom/bgmac.c static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, · line 461

Quoted 10 lines
drivers/net/ethernet/broadcom/bgmac.c +3 -2
  				bgmac->net_dev->stats.rx_errors++;
  				break;
  			}
 
  			if (len > BGMAC_RX_ALLOC_SIZE) {
-				netdev_err(bgmac->net_dev, "Found oversized packet at slot %d, DMA issue!\n",
-					   ring->start);
+				if (net_ratelimit())
+					netdev_err(bgmac->net_dev, "Found oversized packet at slot %d, DMA issue!\n",
+						   ring->start);

No objection, but the issue is that we are going over BGMAC_RX_ALLOC_SIZE, and I believe the check should actually be BGMAC_RX_MAX_FRAME_SIZE because we have the skb_shared_info at the end of the packet, if we start overflowing that, we will call skb_over_panic() very soon.

Signature · 1 line
Florian