Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev/pci/ixgbe Pull up the following revisions (all vi...



details:   https://anonhg.NetBSD.org/src/rev/9f141f80d5e5
branches:  netbsd-8
changeset: 359893:9f141f80d5e5
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Jan 29 16:45:49 2022 +0000

description:
Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1725:

        sys/dev/pci/ixgbe/ixgbe_vf.h                    1.16-1.17
        sys/dev/pci/ixgbe/ixv.c                         1.176-1.177

Make ifconfig -z ixvN clear event counter.

diffstat:

 sys/dev/pci/ixgbe/ixgbe_vf.h |  20 ++---------
 sys/dev/pci/ixgbe/ixv.c      |  72 ++++++++++++-------------------------------
 2 files changed, 25 insertions(+), 67 deletions(-)

diffs (173 lines):

diff -r 9227adcad4ad -r 9f141f80d5e5 sys/dev/pci/ixgbe/ixgbe_vf.h
--- a/sys/dev/pci/ixgbe/ixgbe_vf.h      Sat Jan 29 16:36:07 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_vf.h      Sat Jan 29 16:45:49 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.h,v 1.8.6.4 2019/09/26 18:19:26 martin Exp $ */
+/* $NetBSD: ixgbe_vf.h,v 1.8.6.5 2022/01/29 16:45:49 martin Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -101,29 +101,17 @@
        struct evcnt l4cs;
        struct evcnt l4cs_bad;
 
-       u64 base_vfgprc;
-       u64 base_vfgptc;
-       u64 base_vfgorc;
-       u64 base_vfgotc;
-       u64 base_vfmprc;
-
-       u64 last_vfgprc;
-       u64 last_vfgptc;
+       u32 last_vfgprc;
+       u32 last_vfgptc;
        u64 last_vfgorc;
        u64 last_vfgotc;
-       u64 last_vfmprc;
+       u32 last_vfmprc;
 
        struct evcnt vfgprc;
        struct evcnt vfgptc;
        struct evcnt vfgorc;
        struct evcnt vfgotc;
        struct evcnt vfmprc;
-
-       u64 saved_reset_vfgprc;
-       u64 saved_reset_vfgptc;
-       u64 saved_reset_vfgorc;
-       u64 saved_reset_vfgotc;
-       u64 saved_reset_vfmprc;
 };
 
 s32 ixgbe_init_ops_vf(struct ixgbe_hw *hw);
diff -r 9227adcad4ad -r 9f141f80d5e5 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Sat Jan 29 16:36:07 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Sat Jan 29 16:45:49 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.56.2.33 2021/11/20 15:21:31 martin Exp $ */
+/* $NetBSD: ixv.c,v 1.56.2.34 2022/01/29 16:45:49 martin 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.56.2.33 2021/11/20 15:21:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.56.2.34 2022/01/29 16:45:49 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -130,7 +130,6 @@
 #endif
 
 static void    ixv_add_device_sysctls(struct adapter *);
-static void    ixv_save_stats(struct adapter *);
 static void    ixv_init_stats(struct adapter *);
 static void    ixv_update_stats(struct adapter *);
 static void    ixv_add_stats_sysctls(struct adapter *);
@@ -550,7 +549,6 @@
        }
 
        /* Do the stats setup */
-       ixv_save_stats(adapter);
        ixv_init_stats(adapter);
        ixv_add_stats_sysctls(adapter);
 
@@ -2269,34 +2267,11 @@
 
 
 /************************************************************************
- * ixv_save_stats
+ * ixv_init_stats
  *
  *   The VF stats registers never have a truly virgin
- *   starting point, so this routine tries to make an
- *   artificial one, marking ground zero on attach as
- *   it were.
- ************************************************************************/
-static void
-ixv_save_stats(struct adapter *adapter)
-{
-       struct ixgbevf_hw_stats *stats = &adapter->stats.vf;
-
-       if (stats->vfgprc.ev_count || stats->vfgptc.ev_count) {
-               stats->saved_reset_vfgprc +=
-                   stats->vfgprc.ev_count - stats->base_vfgprc;
-               stats->saved_reset_vfgptc +=
-                   stats->vfgptc.ev_count - stats->base_vfgptc;
-               stats->saved_reset_vfgorc +=
-                   stats->vfgorc.ev_count - stats->base_vfgorc;
-               stats->saved_reset_vfgotc +=
-                   stats->vfgotc.ev_count - stats->base_vfgotc;
-               stats->saved_reset_vfmprc +=
-                   stats->vfmprc.ev_count - stats->base_vfmprc;
-       }
-} /* ixv_save_stats */
-
-/************************************************************************
- * ixv_init_stats
+ *   starting point, so this routine save initial vaules to
+ *   last_<REGNAME>.
  ************************************************************************/
 static void
 ixv_init_stats(struct adapter *adapter)
@@ -2314,34 +2289,25 @@
            (((u64)(IXGBE_READ_REG(hw, IXGBE_VFGOTC_MSB))) << 32);
 
        adapter->stats.vf.last_vfmprc = IXGBE_READ_REG(hw, IXGBE_VFMPRC);
-
-       adapter->stats.vf.base_vfgprc = adapter->stats.vf.last_vfgprc;
-       adapter->stats.vf.base_vfgorc = adapter->stats.vf.last_vfgorc;
-       adapter->stats.vf.base_vfgptc = adapter->stats.vf.last_vfgptc;
-       adapter->stats.vf.base_vfgotc = adapter->stats.vf.last_vfgotc;
-       adapter->stats.vf.base_vfmprc = adapter->stats.vf.last_vfmprc;
 } /* ixv_init_stats */
 
 #define UPDATE_STAT_32(reg, last, count)               \
 {                                                      \
        u32 current = IXGBE_READ_REG(hw, (reg));        \
-       if (current < (last))                           \
-               count.ev_count += 0x100000000LL;        \
+       count.ev_count += current - last;               \
        (last) = current;                               \
-       count.ev_count &= 0xFFFFFFFF00000000LL;         \
-       count.ev_count |= 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 += 0x1000000000LL;       \
-       (last) = current;                               \
-       count.ev_count &= 0xFFFFFFF000000000LL;         \
-       count.ev_count |= 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;                                       \
 }
 
 /************************************************************************
@@ -2725,7 +2691,11 @@
        stats->ipcs_bad.ev_count = 0;
        stats->l4cs_bad.ev_count = 0;
 
-       /* Packet Reception Stats */
+       /*
+        * Packet Reception Stats.
+        * Call ixv_init_stats() to save last VF counters' values.
+        */
+       ixv_init_stats(adapter);
        stats->vfgprc.ev_count = 0;
        stats->vfgorc.ev_count = 0;
        stats->vfmprc.ev_count = 0;



Home | Main Index | Thread Index | Old Index