Module Name:    src
Committed By:   knakahara
Date:           Wed Feb 17 08:10:34 UTC 2021

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

Log Message:
wm(4) use atomic_{load,store}_relaxed for evcnt 64 bit counter.

ok'ed by msaitoh@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.697 -r1.698 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.697 src/sys/dev/pci/if_wm.c:1.698
--- src/sys/dev/pci/if_wm.c:1.697	Thu Nov 19 02:36:30 2020
+++ src/sys/dev/pci/if_wm.c	Wed Feb 17 08:10:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.697 2020/11/19 02:36:30 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.698 2021/02/17 08:10:33 knakahara 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.697 2020/11/19 02:36:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.698 2021/02/17 08:10:33 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -661,8 +661,12 @@ do {									\
 } while (/*CONSTCOND*/0)
 
 #ifdef WM_EVENT_COUNTERS
-#define	WM_EVCNT_INCR(ev)	(ev)->ev_count++
-#define	WM_EVCNT_ADD(ev, val)	(ev)->ev_count += (val)
+#define	WM_EVCNT_INCR(ev)						\
+	atomic_store_relaxed(&((ev)->ev_count),				\
+	    atomic_load_relaxed(&(ev)->ev_count) + 1)
+#define	WM_EVCNT_ADD(ev, val)						\
+	atomic_store_relaxed(&((ev)->ev_count),				\
+	    atomic_load_relaxed(&(ev)->ev_count) + (val))
 
 #define WM_Q_EVCNT_INCR(qname, evname)			\
 	WM_EVCNT_INCR(&(qname)->qname##_ev_##evname)

Reply via email to