Netdev List
 help / color / mirror / Atom feed
* [PATCH net] r8169: recheck the TX descriptor after a vector-map interrupt
@ 2026-11-25  2:26 Vlad Banea
  2026-11-25  2:32 ` netdev-bot+sinfo
  0 siblings, 1 reply; 3+ messages in thread
From: Vlad Banea @ 2026-11-25  2:26 UTC (permalink / raw)
  To: netdev
  Cc: hkallweit1, javen_xu, nic_swsd, andrew+netdev, davem, edumazet,
	kuba, pabeni, linux-kernel

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 a register,
which makes the write-back visible, and check it once more.

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

Notes:
    Javen Xu confirmed that the RTL8127A, the chip upstream uses this
    interrupt model for, is affected:
    https://lore.kernel.org/netdev/d672fb6d16b04fb4a1c9b3202d276662@realsil.com.cn/
    
    This was patch 1 of the RTL8125B RSS RFC; the rest follows for net-next.
    Since the RFC, the second read is a continue instead of a repeated read.
    RFC: https://lore.kernel.org/netdev/20261111220114.3863505-1-montrealtango@gmail.com/

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

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index f151ab681393..76b96f31017d 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,17 @@ 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. A register read
+			 * makes it visible; look once more.
+			 */
+			if (!recheck)
+				break;
+			recheck = false;
+			RTL_R8(tp, IMR_CLEAR_VEC_MAP_REG);
+			continue;
+		}
 
 		skb = tp->tx_skb[entry].skb;
 		rtl8169_unmap_tx_skb(tp, entry);

base-commit: 846a6d0982be30aaba5268aac14a0c557d70cc23
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-25  2:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  2:26 [PATCH net] r8169: recheck the TX descriptor after a vector-map interrupt Vlad Banea
2026-11-25  2:32 ` netdev-bot+sinfo
2026-11-25  2:45   ` Vlad Banea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox