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 NetBSD currently uses traffic class 0 only...



details:   https://anonhg.NetBSD.org/src/rev/573a452e4477
branches:  trunk
changeset: 997380:573a452e4477
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Mar 05 09:42:36 2019 +0000

description:
NetBSD currently uses traffic class 0 only. Other traffic classes aren't used
yet. When IXGBE_TC_COUNTER_NUM is set to lower than IXGBE_DCB_MAX_TRAFFIC_CLASS
(e.g. 1), other traffic classes' counters are not used. It means we don't
generate evcnt for them and don't add the values in
ixgbe_update_stats_counters().

diffstat:

 sys/dev/pci/ixgbe/ixgbe.c      |  12 ++++++------
 sys/dev/pci/ixgbe/ixgbe_type.h |  31 +++++++++++++++++++++++--------
 2 files changed, 29 insertions(+), 14 deletions(-)

diffs (120 lines):

diff -r 851d77511504 -r 573a452e4477 sys/dev/pci/ixgbe/ixgbe.c
--- a/sys/dev/pci/ixgbe/ixgbe.c Tue Mar 05 09:08:51 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe.c Tue Mar 05 09:42:36 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.174 2019/02/22 06:49:15 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.175 2019/03/05 09:42:36 msaitoh Exp $ */
 
 /******************************************************************************
 
@@ -1592,8 +1592,8 @@
                }
        }
 
-       /* 8 registers */
-       for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
+       /* 8 registers exist */
+       for (i = 0; i < IXGBE_TC_COUNTER_NUM; i++) {
                uint32_t mp;
 
                /* MPC */
@@ -1773,7 +1773,7 @@
 
        /* Max number of traffic class is 8 */
        KASSERT(IXGBE_DCB_MAX_TRAFFIC_CLASS == 8);
-       for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
+       for (i = 0; i < IXGBE_TC_COUNTER_NUM; i++) {
                snprintf(adapter->tcs[i].evnamebuf,
                    sizeof(adapter->tcs[i].evnamebuf), "%s tc%d",
                    xname, i);
@@ -2072,7 +2072,7 @@
        adapter->msf_sicount.ev_count = 0;
        adapter->phy_sicount.ev_count = 0;
 
-       for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
+       for (i = 0; i < IXGBE_TC_COUNTER_NUM; i++) {
                if (i < __arraycount(stats->mpc)) {
                        stats->mpc[i].ev_count = 0;
                        if (hw->mac.type == ixgbe_mac_82598EB)
@@ -3605,7 +3605,7 @@
        evcnt_detach(&adapter->msf_sicount);
        evcnt_detach(&adapter->phy_sicount);
 
-       for (i = 0; i < IXGBE_DCB_MAX_TRAFFIC_CLASS; i++) {
+       for (i = 0; i < IXGBE_TC_COUNTER_NUM; i++) {
                if (i < __arraycount(stats->mpc)) {
                        evcnt_detach(&stats->mpc[i]);
                        if (hw->mac.type == ixgbe_mac_82598EB)
diff -r 851d77511504 -r 573a452e4477 sys/dev/pci/ixgbe/ixgbe_type.h
--- a/sys/dev/pci/ixgbe/ixgbe_type.h    Tue Mar 05 09:08:51 2019 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_type.h    Tue Mar 05 09:42:36 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.37 2018/12/06 13:25:02 msaitoh Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.38 2019/03/05 09:42:36 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -3852,6 +3852,21 @@
        enum ixgbe_fc_mode requested_mode; /* FC mode requested by caller */
 };
 
+/*
+ * NetBSD currently uses traffic class 0 only. Other traffic classes aren't
+ * used yet. When IXGBE_TC_COUNTER_NUM is set to lower than
+ * IXGBE_DCB_MAX_TRAFFIC_CLASS (e.g. 1), other traffic classes' counters are
+ * not used. It means we don't generate evcnt for them and don't add the values
+ * in ixgbe_update_stats_counters().
+ */
+#if !defined(IXGBE_TC_COUNTER_NUM)
+#define IXGBE_TC_COUNTER_NUM IXGBE_DCB_MAX_TRAFFIC_CLASS
+#endif
+#if ((IXGBE_TC_COUNTER_NUM < 1)                                        \
+    || (IXGBE_TC_COUNTER_NUM > IXGBE_DCB_MAX_TRAFFIC_CLASS))
+#error Wrong IXGBE_TC_COUNTER_NUM value
+#endif
+
 /* Statistics counters collected by the MAC */
 struct ixgbe_hw_stats {
        char namebuf[32];
@@ -3866,7 +3881,7 @@
        struct evcnt mspdc;
        struct evcnt mbsdc;
        struct evcnt mpctotal;
-       struct evcnt mpc[8];
+       struct evcnt mpc[IXGBE_TC_COUNTER_NUM];
        struct evcnt mlfc;
        struct evcnt mrfc;
        struct evcnt rlec;
@@ -3874,10 +3889,10 @@
        struct evcnt lxonrxc;
        struct evcnt lxofftxc;
        struct evcnt lxoffrxc;
-       struct evcnt pxontxc[8];
-       struct evcnt pxonrxc[8];
-       struct evcnt pxofftxc[8];
-       struct evcnt pxoffrxc[8];
+       struct evcnt pxontxc[IXGBE_TC_COUNTER_NUM];
+       struct evcnt pxonrxc[IXGBE_TC_COUNTER_NUM];
+       struct evcnt pxofftxc[IXGBE_TC_COUNTER_NUM];
+       struct evcnt pxoffrxc[IXGBE_TC_COUNTER_NUM];
        struct evcnt prc64;
        struct evcnt prc127;
        struct evcnt prc255;
@@ -3890,7 +3905,7 @@
        struct evcnt gptc;
        struct evcnt gorc;
        struct evcnt gotc;
-       struct evcnt rnbc[8];
+       struct evcnt rnbc[IXGBE_TC_COUNTER_NUM];
        struct evcnt ruc;
        struct evcnt rfc;
        struct evcnt roc;
@@ -3915,7 +3930,7 @@
        struct evcnt qbrc[16];
        struct evcnt qbtc[16];
        struct evcnt qprdc[16];
-       struct evcnt pxon2offc[8];
+       struct evcnt pxon2offc[IXGBE_TC_COUNTER_NUM];
        u64 fdirustat_add;
        u64 fdirustat_remove;
        u64 fdirfstat_fadd;



Home | Main Index | Thread Index | Old Index