Skip to content

net: macb: Fix RX ring refill issue after link up#7222

Merged
pelwell merged 1 commit intoraspberrypi:rpi-6.12.yfrom
pelwell:macbstall
Feb 6, 2026
Merged

net: macb: Fix RX ring refill issue after link up#7222
pelwell merged 1 commit intoraspberrypi:rpi-6.12.yfrom
pelwell:macbstall

Conversation

@pelwell
Copy link
Contributor

@pelwell pelwell commented Feb 4, 2026

[ Patch created by @xiaoleiwang123456 ]

When the link goes down, the receive pipeline is cleared but the RX queue pointer register remains unchanged. This causes a critical issue where some RX ring entries may contain invalid addresses after link up.

The problem manifests when:

  1. An entry with an invalid address prevents rx_tail from advancing (gem_rx() checks rxused as 0)
  2. No gap exists between rx_prepared_head and rx_tail from previous refill operations
  3. gem_rx_refill() cannot refill entries because CIRC_SPACE() always returns 0
  4. RSR register reports exception with value 0x7
  5. The hardware detected that the buffer was unavailable. The DMA will reread the pointer each time it receives an end-of-frame signal until a valid pointer is found, but the software cannot fill it.

This regression was introduced by commit 99537d5 which moved mog_init_rings() from macb_mac_link_up() to macb_open(), leaving the RX ring in an inconsistent state after link transitions.

Fix this by:

  • Reinitializing RX rings on link up via mog_init_rings()
  • Adding full_refill atomic counter to force complete ring refill
  • Ensuring all entries are traversed and refilled after link up
  • Resetting rx_tail and rx_prepared_head to 0

Fixes: 99537d5 ("net: macb: Relocate mog_init_rings() callback from macb_mac_link_up() to macb_open()")
Closes: #7200 (comment)

When the link goes down, the receive pipeline is cleared but the RX
queue pointer register remains unchanged. This causes a critical issue
where some RX ring entries may contain invalid addresses after link up.

The problem manifests when:
1. An entry with an invalid address prevents rx_tail from advancing
   (gem_rx() checks rxused as 0)
2. No gap exists between rx_prepared_head and rx_tail from previous
   refill operations
3. gem_rx_refill() cannot refill entries because CIRC_SPACE() always
   returns 0
4. RSR register reports exception with value 0x7
5. The hardware detected that the buffer was unavailable. The DMA will
   reread the pointer each time it receives an end-of-frame signal until
   a valid pointer is found, but the software cannot fill it.

This regression was introduced by commit 99537d5 which moved
mog_init_rings() from macb_mac_link_up() to macb_open(), leaving
the RX ring in an inconsistent state after link transitions.

Fix this by:
- Reinitializing RX rings on link up via mog_init_rings()
- Adding full_refill atomic counter to force complete ring refill
- Ensuring all entries are traversed and refilled after link up
- Resetting rx_tail and rx_prepared_head to 0

Fixes: 99537d5 ("net: macb: Relocate mog_init_rings() callback from macb_mac_link_up() to macb_open()")
Closes: raspberrypi#7200 (comment)
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
@pelwell pelwell merged commit 6fc937d into raspberrypi:rpi-6.12.y Feb 6, 2026
11 of 12 checks passed
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Feb 6, 2026
See: raspberrypi/linux#7205

kernel: Adds a driver for the new series of Studio DAC8x soundcards
See: raspberrypi/linux#7197

kernel: configs: enable CONFIG_CRYPTO_LZ4HC=m and support bcachefs-tools dkms build
See: raspberrypi/linux#7208

kernel: misc: rp1-pio: Defer for out-of-order probing
See: raspberrypi/linux#7215

kernel: pcie-brcmstb: move the unilateral disable of CLKREQ# before link-up
See: raspberrypi/linux#7225

kernel: configs: enable Si5351 i2c common clock driver
See: raspberrypi/linux#7223

kernel: net: macb: Fix RX ring refill issue after link up
See: raspberrypi/linux#7222

kernel: overlays: Add a pins_none parameter to audremap
See: raspberrypi/linux#7229

kernel: Add support for pps-rp1 dtoverlay
See: raspberrypi/linux#7209
popcornmix added a commit to raspberrypi/rpi-firmware that referenced this pull request Feb 6, 2026
See: raspberrypi/linux#7205

kernel: Adds a driver for the new series of Studio DAC8x soundcards
See: raspberrypi/linux#7197

kernel: configs: enable CONFIG_CRYPTO_LZ4HC=m and support bcachefs-tools dkms build
See: raspberrypi/linux#7208

kernel: misc: rp1-pio: Defer for out-of-order probing
See: raspberrypi/linux#7215

kernel: pcie-brcmstb: move the unilateral disable of CLKREQ# before link-up
See: raspberrypi/linux#7225

kernel: configs: enable Si5351 i2c common clock driver
See: raspberrypi/linux#7223

kernel: net: macb: Fix RX ring refill issue after link up
See: raspberrypi/linux#7222

kernel: overlays: Add a pins_none parameter to audremap
See: raspberrypi/linux#7229

kernel: Add support for pps-rp1 dtoverlay
See: raspberrypi/linux#7209
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Regression] commit f5c055c28415688bde0d8cc100803e8d4d3f3a04 in the rpi-6.12.y branch introduced a regression in the bmac driver

2 participants