Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci wm(4) use atomic_{load,store}_relaxed for evcnt ...
details: https://anonhg.NetBSD.org/src/rev/a622bd409385
branches: trunk
changeset: 980757:a622bd409385
user: knakahara <knakahara%NetBSD.org@localhost>
date: Wed Feb 17 08:10:33 2021 +0000
description:
wm(4) use atomic_{load,store}_relaxed for evcnt 64 bit counter.
ok'ed by msaitoh@n.o.
diffstat:
sys/dev/pci/if_wm.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (33 lines):
diff -r 72dc69a71868 -r a622bd409385 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c Wed Feb 17 08:09:22 2021 +0000
+++ b/sys/dev/pci/if_wm.c Wed Feb 17 08:10:33 2021 +0000
@@ -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 @@
} 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)
Home |
Main Index |
Thread Index |
Old Index