[PATCH net v2] r8169: recheck the TX descriptor after a vector-map interrupt

From: Vlad Banea

Date: Sun Nov 29 2026 - 08:43:07 EST


With the vector-map interrupt model, the TX interrupt can arrive before
the descriptor write-back is visible to the CPU. rtl_tx() then stops at
a descriptor that still looks owned by the chip, and completed packets
stay unreaped until BQL stops the queue and the watchdog resets the
chip. The legacy handler is not affected because it reads IntrStatus
before polling.

If the first pending descriptor still looks owned, read the vector-map
interrupt status register, which makes the write-back visible, and check
it once more. RX was checked the same way with a request/response test
and showed no stranded descriptors, so it is left unchanged.

Fixes: 677f8f8c4c5f ("r8169: add support for new interrupt mapping")
Signed-off-by: Vlad Banea <montrealtango@xxxxxxxxx>
---

Notes:
Changes in v2:
- read ISR_VEC_MAP_REG instead of IMR_CLEAR_VEC_MAP_REG (Sashiko)
- say why RX is left unchanged (Sashiko)
- v1: https://lore.kernel.org/netdev/20261125022643.1169045-1-montrealtango@xxxxxxxxx/

Javen Xu confirmed that the RTL8127A, the chip upstream uses this
interrupt model for, is affected:
https://lore.kernel.org/netdev/d672fb6d16b04fb4a1c9b3202d276662@xxxxxxxxxxxxxx/

drivers/net/ethernet/realtek/r8169_main.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index f151ab681393..844c48119028 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -5228,6 +5228,7 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
int budget)
{
unsigned int dirty_tx, bytes_compl = 0, pkts_compl = 0;
+ bool recheck = tp->irq_nvecs > 1;
struct sk_buff *skb;

dirty_tx = tp->dirty_tx;
@@ -5237,8 +5238,18 @@ static void rtl_tx(struct net_device *dev, struct rtl8169_private *tp,
u32 status;

status = le32_to_cpu(READ_ONCE(tp->TxDescArray[entry].opts1));
- if (status & DescOwn)
- break;
+ if (status & DescOwn) {
+ /* The vector-map TX interrupt can arrive before the
+ * descriptor write-back is visible. Reading the
+ * interrupt status register makes it visible, as in
+ * the legacy handler; look once more.
+ */
+ if (!recheck)
+ break;
+ recheck = false;
+ RTL_R32(tp, ISR_VEC_MAP_REG);
+ continue;
+ }

skb = tp->tx_skb[entry].skb;
rtl8169_unmap_tx_skb(tp, entry);

base-commit: 28a371228d4eb4857cc31eeb1a0d7d01e9c3ea2f
--
2.53.0