* [PATCH net-next] r8169: change wmb to smb_wmb in rtl8169_start_xmit
@ 2020-04-20 20:52 Heiner Kallweit
2020-04-20 23:04 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2020-04-20 20:52 UTC (permalink / raw)
To: Realtek linux nic maintainers, David Miller; +Cc: netdev
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().
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/ethernet/realtek/r8169_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index ece899be9..bb8dcdb17 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -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;
--
2.26.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] r8169: change wmb to smb_wmb in rtl8169_start_xmit
2020-04-20 20:52 [PATCH net-next] r8169: change wmb to smb_wmb in rtl8169_start_xmit Heiner Kallweit
@ 2020-04-20 23:04 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-04-20 23:04 UTC (permalink / raw)
To: hkallweit1; +Cc: nic_swsd, netdev
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Mon, 20 Apr 2020 22:52:59 +0200
> 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().
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-20 23:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 20:52 [PATCH net-next] r8169: change wmb to smb_wmb in rtl8169_start_xmit Heiner Kallweit
2020-04-20 23:04 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).