r8169: change wmb to smb_wmb in rtl8169_start_xmit
Heiner Kallweit
maintainerPATCH 1/1 r8169: change wmb to smb_wmb in rtl8169_start_xmit
A barrier is needed here to ensure that rtl_tx sees the descriptor changes (DescOwn set) before the updated tp->cur_tx value. Else it may wrongly assume that the transfer has been finished already. For this purpose smp_wmb() is sufficient.
No separate barrier is needed for ordering the descriptor changes with the MMIO doorbell write. The needed barrier is included in the non-relaxed writel() used by rtl8169_doorbell().
--- drivers/net/ethernet/realtek/r8169_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/realtek/r8169_main.c +2 -2
@@ -4251,8 +4251,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, txd_first->opts1 |=cpu_to_le32 (DescOwn | FirstFrag); -/* Force all memory writes to complete before notifying device */ -wmb (); +/* rtl_tx needs to see descriptor changes before updated tp->cur_tx */ +smp_wmb (); tp->cur_tx += frags +1 ;
Signature · 1 line
2.26.1
From: Heiner Kallweit <[email protected]>
Date: Mon, 20 Apr 2020 22:52:59 +0200
Quoted 10 lines
A barrier is needed here to ensure that
rtl_txsees the descriptor changes (DescOwn set) before the updatedtp->cur_txvalue. Else it may wrongly assume that the transfer has been finished already. For this purposesmp_wmb()is sufficient.No separate barrier is needed for ordering the descriptor changes with the MMIO doorbell write. The needed barrier is included in the non-relaxed
writel()used byrtl8169_doorbell().Signed-off-by Heiner Kallweit <[email protected]>
Applied, thanks.