]> git.ipfire.org Git - thirdparty/openwrt.git/commit
realtek: eth: adapt interrupt handling for fragments 24538/head
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Fri, 31 Jul 2026 09:27:23 +0000 (11:27 +0200)
committerMarkus Stockhausen <markus.stockhausen@gmx.de>
Tue, 4 Aug 2026 17:55:42 +0000 (19:55 +0200)
commit5ad22ced647f7812aee505eed898c69b0d6d66e0
tree6cefcb1c4991b0c8404ccde7a9470460ebf2557d
parentb9411790fc7b48a25dd6c3feb8bb9903622a723d
realtek: eth: adapt interrupt handling for fragments

The existing interrupt handling of the ethernet driver worked
well until the driver implemented receive fragment handling.
This change uncovered a constellation that did not exist before.

A received packet is written into the page pool with multiple
fragments. On RTL93xx the head-of-line (HOL) feature limits
the number of receivable fragments perfectly. There will never
be a "buffer full" situation where the hardware only encounters
ring buffers that are held by the Linux kernel. On RTL83xx
this is slightly different:

- The driver programs free floating rings
- Only the ownership flag of the ring buffer decides if the
  hardware can hand over a packet to the CPU.
- So the hardware can receive a packet even if it does not
  completely fit into the available fragments.

With this there is a small chance that

- The buffer has less space than a just received packet
- The hardware generates an overflow (RUN OUT) interrupt
- With no completely received packet the hardware DOES NOT
  generate a receive (DONE) interrupt.

So it is not sufficient to just look on the DONE interrupts.
The RUN OUT interrupts must be inspected as well. As the
current logic is quite cryptic enhance this as follows:

- Provide new RTL83xx/RTL93xx specific helpers
- Add new callbacks to the driver configuration structure
- Link the configuration with the new helpers
- Use the callbacks where needed.

While we are here:

- Enable only interrupts for active receive rings. Until
  now the driver activated all receive interrupts (8/32)
  although it supports only 2 rings.
- Use DIV_ROUND_UP instead of classic division for register
  calculation.

Link: https://github.com/openwrt/openwrt/pull/24538
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
target/linux/realtek/files-6.18/drivers/net/ethernet/rtl838x_eth.c
target/linux/realtek/files-6.18/drivers/net/ethernet/rtl838x_eth.h