Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/5dc7cc24df94
branches:  netbsd-9
changeset: 359886:5dc7cc24df94
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Jan 29 16:43:23 2022 +0000

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

        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 49b03beb4377 -r 5dc7cc24df94 sys/dev/pci/ixgbe/ixgbe_vf.h
--- a/sys/dev/pci/ixgbe/ixgbe_vf.h      Sat Jan 29 16:33:10 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_vf.h      Sat Jan 29 16:43:23 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.h,v 1.13.8.1 2019/09/26 19:07:22 martin Exp $ */
+/* $NetBSD: ixgbe_vf.h,v 1.13.8.2 2022/01/29 16:43:23 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 49b03beb4377 -r 5dc7cc24df94 sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c   Sat Jan 29 16:33:10 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c   Sat Jan 29 16:43:23 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.125.2.13 2021/11/20 15:16:53 martin Exp $ */
+/* $NetBSD: ixv.c,v 1.125.2.14 2022/01/29 16:43:23 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.125.2.13 2021/11/20 15:16:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.125.2.14 2022/01/29 16:43:23 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -130,7 +130,6 @@
 static int     ixv_unregister_vlan(struct adapter *, u16);
 
 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 *);
@@ -538,7 +537,6 @@
        }
 
        /* Do the stats setup */
-       ixv_save_stats(adapter);
        ixv_init_stats(adapter);
        ixv_add_stats_sysctls(adapter);
 
@@ -2338,34 +2336,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)
@@ -2383,34 +2358,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;                                       \
 }
 
 /************************************************************************
@@ -2794,7 +2760,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