r8169: recheck the TX descriptor after a vector-map interrupt
PATCH 1/1 r8169: recheck the TX descriptor after a vector-map interrupt
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.
---
Notes:
Javen Xu confirmed that the RTL8127A, the chip upstream uses this interrupt model for, is affected:
https://lore.kernel.org/netdev/[email protected]/
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/[email protected]/
drivers/net/ethernet/realtek/r8169_main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +12 -2
@@ -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
Signature · 1 line
2.53.0
[email protected]
AI reviewThis is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware.
Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages.
Signature · 2 lines
The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Tested on two RTL8125B (XID 641, firmware rtl8125b-2_0.0.2 07/13/20) connected back to back, in an x86_64 KVM guest with VFIO passthrough. Upstream uses the vector-map interrupt model only on the RTL8127A, which I don't have, so the test kernel also had the RTL8125B RSS series from the RFC to enable it on these chips. Without the fix, bursty TCP traffic hit TX timeouts (17 and 6 in two runs of 30 bursts); with it, none, and sustained traffic ran at 2.36 Gbit/s with no retransmits. The same fix was also tested on a RISC-V board (SpacemiT K1) with two RTL8125B.
Javen Xu confirmed that the RTL8127A is affected as well.
Vlad