[PATCH 0/3] net: macb: fix close races (and RX refill error handling)
From: Théo Lebrun
Date: Fri Sep 18 2026 - 16:32:52 EST
The context-swapping series [0] has been ongoing for a while. The most
interesting part is a proper hardware shutdown sequence, which is truly
lacking in other parts of the MACB driver: at close, at suspend and in
the HRESP error task.
Instead of introducing that sequence for a new feature, apply it now to
fix the main offender, the close path. That fixes the races listed in
patch 3 and will allow the sequence to be reused later.
The first two patches are also fixes, but not related to the shutdown
sequence: they address allocation-failure codepaths. They are sent
alongside patch 3 because they touch the same code and would cause
merge conflicts if applied separately.
Now, let me list issues I'm aware of that we do *not* fix here, to make
the scope explicit:
- HRESP task should sync with all other contexts. It frees buffers
under the feet of the whole driver. The hardware shutdown sequence
will help.
- Suspend callback is also racy with BH primitives. We'll be able to
reuse the hardware shutdown sequence.
- Even if we assume tasks are frozen, the phylink ops aren't and might
trigger between suspend and resume callbacks. Here we need to
(1) early return in phylink ops and (2) at resume put the HW in its
proper state according to phylink ops that occured.
- Alloc failure codepaths aren't perfect outside open. Hardware and
ring buffers are left in a sad state. We can probably do better.
[0]: https://lore.kernel.org/all/20260812-macb-context-v9-0-7ddbf5f715e0@xxxxxxxxxxx/
Signed-off-by: Théo Lebrun <theo.lebrun@xxxxxxxxxxx>
---
Théo Lebrun (3):
net: macb: never give hardware a NULL RX buffer
net: macb: propagate RX ring refill errors
net: macb: quiesce IRQs and drain BH on interface close
drivers/net/ethernet/cadence/macb.h | 7 +-
drivers/net/ethernet/cadence/macb_main.c | 119 ++++++++++++++++++++++++-------
2 files changed, 98 insertions(+), 28 deletions(-)
---
base-commit: 994db8ab9d90c64dd641b7ead6efe2eaea7a50dc
change-id: 20260918-macb-close-dbbd23b4b8f2
Best regards,
--
Théo Lebrun <theo.lebrun@xxxxxxxxxxx>