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 Improve ixv(4)'s some event counters.
details: https://anonhg.NetBSD.org/src/rev/de79886e9ccd
branches: trunk
changeset: 359732:de79886e9ccd
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Wed Jan 19 10:30:04 2022 +0000
description:
Improve ixv(4)'s some event counters.
- The virtual function's packet counter registers are not cleared on read.
To solve this problem, <REGNAME>, base_<REGNAME>, last_<REGNAME> and
saved_reset_<REGNAME> are in the struct ixgbevf_hw_stats and some
functions use them. However, saved_reset_<REGNAME> is set but never
referenced. base_<REGNAME> is set and it's only used for
saved_reset_<REGNAME>, so it's also unused in reality. THERE ARE A LOT
OF GARBAGE. Remove them.
- Call ixv_init_stats() in ixv_clear_evcnt() to make ifconfig -z ixvN
work correctly.
diffstat:
sys/dev/pci/ixgbe/ixgbe_vf.h | 14 +----------
sys/dev/pci/ixgbe/ixv.c | 57 +++++++++----------------------------------
2 files changed, 13 insertions(+), 58 deletions(-)
diffs (157 lines):
diff -r 4403639c27b3 -r de79886e9ccd sys/dev/pci/ixgbe/ixgbe_vf.h
--- a/sys/dev/pci/ixgbe/ixgbe_vf.h Wed Jan 19 10:23:00 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_vf.h Wed Jan 19 10:30:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.h,v 1.15 2021/12/24 05:02:11 msaitoh Exp $ */
+/* $NetBSD: ixgbe_vf.h,v 1.16 2022/01/19 10:30:04 msaitoh Exp $ */
/******************************************************************************
SPDX-License-Identifier: BSD-3-Clause
@@ -101,12 +101,6 @@
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;
u64 last_vfgorc;
@@ -118,12 +112,6 @@
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 4403639c27b3 -r de79886e9ccd sys/dev/pci/ixgbe/ixv.c
--- a/sys/dev/pci/ixgbe/ixv.c Wed Jan 19 10:23:00 2022 +0000
+++ b/sys/dev/pci/ixgbe/ixv.c Wed Jan 19 10:30:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.175 2022/01/18 10:06:59 msaitoh Exp $ */
+/* $NetBSD: ixv.c,v 1.176 2022/01/19 10:30:04 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.175 2022/01/18 10:06:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.176 2022/01/19 10:30:04 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -131,7 +131,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 *);
@@ -561,7 +560,6 @@
IXGBE_MAX_VF_MC, M_DEVBUF, M_WAITOK);
/* Do the stats setup */
- ixv_save_stats(adapter);
ixv_init_stats(adapter);
ixv_add_stats_sysctls(adapter);
@@ -2400,34 +2398,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)
@@ -2445,22 +2420,13 @@
(((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) \
@@ -2468,11 +2434,8 @@
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; \
+ count.ev_count += current - last; \
(last) = current; \
- count.ev_count &= 0xFFFFFFF000000000LL; \
- count.ev_count |= current; \
}
/************************************************************************
@@ -2859,7 +2822,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