Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/ixgbe Fix ixv.c rev. 1.176. Calculate 36bit coun...



details:   https://anonhg.NetBSD.org/src/rev/5cf12917fc5e
branches:  trunk
changeset: 359811:5cf12917fc5e
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Jan 24 01:57:52 2022 +0000

description:
Fix ixv.c rev. 1.176. Calculate 36bit counter correctly.

diffstat:

 sys/dev/pci/ixgbe/ixv.c |  21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diffs (42 lines):

diff -r b25c6899d8e1 -r 5cf12917fc5e sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Mon Jan 24 01:50:19 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Mon Jan 24 01:57:52 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.176 2022/01/19 10:30:04 msaitoh Exp $ */
+/* $NetBSD: ixv.c,v 1.177 2022/01/24 01:57:52 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.176 2022/01/19 10:30:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.177 2022/01/24 01:57:52 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2429,13 +2429,16 @@
        (last) = current;                               \
 }
 
-#define UPDATE_STAT_36(lsb, msb, last, count)          \
-{                                                      \
-       u64 cur_lsb = IXGBE_READ_REG(hw, (lsb));        \
-       u64 cur_msb = IXGBE_READ_REG(hw, (msb));        \
-       u64 current = ((cur_msb << 32) | cur_lsb);      \
-       count.ev_count += current - last;               \
-       (last) = current;                               \
+#define UPDATE_STAT_36(lsb, msb, last, count)                  \
+{                                                              \
+       u64 cur_lsb = IXGBE_READ_REG(hw, (lsb));                \
+       u64 cur_msb = IXGBE_READ_REG(hw, (msb));                \
+       u64 current = ((cur_msb << 32) | cur_lsb);              \
+       if (current < (last))                                   \
+               count.ev_count += current + __BIT(36) - (last); \
+       else                                                    \
+               count.ev_count += current - (last);             \
+       (last) = current;                                       \
 }
 
 /************************************************************************



Home | Main Index | Thread Index | Old Index