Module Name:    src
Committed By:   riastradh
Date:           Tue Jul 19 08:21:02 UTC 2022

Modified Files:
        src/sys/dev/pci: if_wm.c

Log Message:
wm(4): Use bus_dmamap_sync, not bus_space_barrier, for tx desc.

The newly written tx descriptor needs to be visible to the device
before the TDT register is set.  There's no bus space mappings that
need any barriers, though -- nothing mapped prefetchable or cacheable
here.  So bus_dmamap_sync (via wm_cdtxsync) is necessary, not
bus_space_barrier.  By accident, bus_space_barrier implies the same
barrier instructions as bus_dmamap_sync on some architectures, but it
wouldn't work at all if we were bouncing.

ok msaitoh@, knakahara@


To generate a diff of this commit:
cvs rdiff -u -r1.743 -r1.744 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.743 src/sys/dev/pci/if_wm.c:1.744
--- src/sys/dev/pci/if_wm.c:1.743	Tue Jul 19 06:50:34 2022
+++ src/sys/dev/pci/if_wm.c	Tue Jul 19 08:21:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.743 2022/07/19 06:50:34 skrll Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.744 2022/07/19 08:21:02 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.743 2022/07/19 06:50:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.744 2022/07/19 08:21:02 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4918,8 +4918,8 @@ wm_flush_desc_rings(struct wm_softc *sc)
 	txd->wtx_fields.wtxu_options = 0;
 	txd->wtx_fields.wtxu_vlan = 0;
 
-	bus_space_barrier(sc->sc_st, sc->sc_sh, 0, 0,
-	    BUS_SPACE_BARRIER_WRITE);
+	wm_cdtxsync(txq, 0, WM_NTXDESC(txq),
+	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 	txq->txq_next = WM_NEXTTX(txq, txq->txq_next);
 	CSR_WRITE(sc, WMREG_TDT(0), txq->txq_next);

Reply via email to