Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci ixl(4) supports in-chip statistic counters per VSI



details:   https://anonhg.NetBSD.org/src/rev/0a47a2aa96b3
branches:  trunk
changeset: 467003:0a47a2aa96b3
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Thu Jan 09 02:55:41 2020 +0000

description:
ixl(4) supports in-chip statistic counters per VSI

diffstat:

 sys/dev/pci/if_ixl.c |  118 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 117 insertions(+), 1 deletions(-)

diffs (181 lines):

diff -r cde910bb0be0 -r 0a47a2aa96b3 sys/dev/pci/if_ixl.c
--- a/sys/dev/pci/if_ixl.c      Thu Jan 09 02:43:45 2020 +0000
+++ b/sys/dev/pci/if_ixl.c      Thu Jan 09 02:55:41 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ixl.c,v 1.17 2020/01/09 02:43:45 yamaguchi Exp $    */
+/*     $NetBSD: if_ixl.c,v 1.18 2020/01/09 02:55:41 yamaguchi Exp $    */
 
 /*
  * Copyright (c) 2013-2015, Intel Corporation
@@ -559,6 +559,26 @@
        uint64_t         isc_link_xoff_rx_offset;
        struct evcnt     isc_link_xoff_tx;
        uint64_t         isc_link_xoff_tx_offset;
+       struct evcnt     isc_vsi_rx_discards;
+       uint64_t         isc_vsi_rx_discards_offset;
+       struct evcnt     isc_vsi_rx_bytes;
+       uint64_t         isc_vsi_rx_bytes_offset;
+       struct evcnt     isc_vsi_rx_unicast;
+       uint64_t         isc_vsi_rx_unicast_offset;
+       struct evcnt     isc_vsi_rx_multicast;
+       uint64_t         isc_vsi_rx_multicast_offset;
+       struct evcnt     isc_vsi_rx_broadcast;
+       uint64_t         isc_vsi_rx_broadcast_offset;
+       struct evcnt     isc_vsi_tx_errors;
+       uint64_t         isc_vsi_tx_errors_offset;
+       struct evcnt     isc_vsi_tx_bytes;
+       uint64_t         isc_vsi_tx_bytes_offset;
+       struct evcnt     isc_vsi_tx_unicast;
+       uint64_t         isc_vsi_tx_unicast_offset;
+       struct evcnt     isc_vsi_tx_multicast;
+       uint64_t         isc_vsi_tx_multicast_offset;
+       struct evcnt     isc_vsi_tx_broadcast;
+       uint64_t         isc_vsi_tx_broadcast_offset;
 };
 
 /*
@@ -623,6 +643,7 @@
        uint16_t                 sc_uplink_seid;        /* le */
        uint16_t                 sc_downlink_seid;      /* le */
        uint16_t                 sc_vsi_number;         /* le */
+       uint16_t                 sc_vsi_stat_counter_idx;
        uint16_t                 sc_seid;
        unsigned int             sc_base_queue;
 
@@ -4168,6 +4189,7 @@
        struct ixl_aq_desc iaq;
        struct ixl_aq_vsi_param *param;
        struct ixl_aq_vsi_reply *reply;
+       struct ixl_aq_vsi_data *data;
        int rv;
 
        /* grumble, vsi info isn't "known" at compile time */
@@ -4207,6 +4229,8 @@
 
        reply = (struct ixl_aq_vsi_reply *)iaq.iaq_param;
        sc->sc_vsi_number = reply->vsi_number;
+       data = IXL_DMA_KVA(vsi);
+       sc->sc_vsi_stat_counter_idx = le16toh(data->stat_counter_idx);
 
        return 0;
 }
@@ -5639,6 +5663,17 @@
        evcnt_attach_dynamic(&isc->isc_rx_broadcast, EVCNT_TYPE_MISC,
            NULL, device_xname(sc->sc_dev), "Rx broadcast / port");
 
+       evcnt_attach_dynamic(&isc->isc_vsi_rx_bytes, EVCNT_TYPE_MISC,
+           NULL, device_xname(sc->sc_dev), "Rx bytes / vsi");
+       evcnt_attach_dynamic(&isc->isc_vsi_rx_discards, EVCNT_TYPE_MISC,
+           NULL, device_xname(sc->sc_dev), "Rx discard / vsi");
+       evcnt_attach_dynamic(&isc->isc_vsi_rx_unicast, EVCNT_TYPE_MISC,
+           NULL, device_xname(sc->sc_dev), "Rx unicast / vsi");
+       evcnt_attach_dynamic(&isc->isc_vsi_rx_multicast, EVCNT_TYPE_MISC,
+           NULL, device_xname(sc->sc_dev), "Rx multicast / vsi");
+       evcnt_attach_dynamic(&isc->isc_vsi_rx_broadcast, EVCNT_TYPE_MISC,
+           NULL, device_xname(sc->sc_dev), "Rx broadcast / vsi");
+
        evcnt_attach_dynamic(&isc->isc_tx_size_64, EVCNT_TYPE_MISC,
            NULL, device_xname(sc->sc_dev), "Tx size 64");
        evcnt_attach_dynamic(&isc->isc_tx_size_127, EVCNT_TYPE_MISC,
@@ -5666,6 +5701,17 @@
        evcnt_attach_dynamic(&isc->isc_tx_broadcast, EVCNT_TYPE_MISC,
            NULL, device_xname(sc->sc_dev), "Tx broadcast / port");
 
+       evcnt_attach_dynamic(&isc->isc_vsi_tx_bytes, EVCNT_TYPE_MISC,
+           NULL, device_xname(sc->sc_dev), "Tx bytes / vsi");
+       evcnt_attach_dynamic(&isc->isc_vsi_tx_errors, EVCNT_TYPE_MISC,
+           NULL, device_xname(sc->sc_dev), "Tx errors / vsi");
+       evcnt_attach_dynamic(&isc->isc_vsi_tx_unicast, EVCNT_TYPE_MISC,
+           NULL, device_xname(sc->sc_dev), "Tx unicast / vsi");
+       evcnt_attach_dynamic(&isc->isc_vsi_tx_multicast, EVCNT_TYPE_MISC,
+           NULL, device_xname(sc->sc_dev), "Tx multicast / vsi");
+       evcnt_attach_dynamic(&isc->isc_vsi_tx_broadcast, EVCNT_TYPE_MISC,
+           NULL, device_xname(sc->sc_dev), "Tx broadcast / vsi");
+
        sc->sc_stats_intval = IXL_STATS_INTERVAL_MSEC;
        callout_init(&sc->sc_stats_callout, CALLOUT_MPSAFE);
        callout_setfunc(&sc->sc_stats_callout, ixl_stats_callout, sc);
@@ -5737,6 +5783,16 @@
        evcnt_detach(&isc->isc_tx_size_1023);
        evcnt_detach(&isc->isc_tx_size_1522);
        evcnt_detach(&isc->isc_tx_size_big);
+       evcnt_detach(&isc->isc_vsi_rx_discards);
+       evcnt_detach(&isc->isc_vsi_rx_bytes);
+       evcnt_detach(&isc->isc_vsi_rx_unicast);
+       evcnt_detach(&isc->isc_vsi_rx_multicast);
+       evcnt_detach(&isc->isc_vsi_rx_broadcast);
+       evcnt_detach(&isc->isc_vsi_tx_errors);
+       evcnt_detach(&isc->isc_vsi_tx_bytes);
+       evcnt_detach(&isc->isc_vsi_tx_unicast);
+       evcnt_detach(&isc->isc_vsi_tx_multicast);
+       evcnt_detach(&isc->isc_vsi_tx_broadcast);
 
        evcnt_detach(&sc->sc_event_atq);
        evcnt_detach(&sc->sc_event_link);
@@ -5980,6 +6036,66 @@
            0, I40E_GLPRT_RJC(sc->sc_port),
            &isc->isc_rx_jabber_offset, isc->isc_has_offset);
        atomic_add_64(&isc->isc_rx_jabber.ev_count, delta);
+
+       /* VSI rx counters */
+       delta = ixl_stat_delta(sc,
+           0, I40E_GLV_RDPC(sc->sc_vsi_stat_counter_idx),
+           &isc->isc_vsi_rx_discards_offset, isc->isc_has_offset);
+       atomic_add_64(&isc->isc_vsi_rx_discards.ev_count, delta);
+
+       delta = ixl_stat_delta(sc,
+           I40E_GLV_GORCH(sc->sc_vsi_stat_counter_idx),
+           I40E_GLV_GORCL(sc->sc_vsi_stat_counter_idx),
+           &isc->isc_vsi_rx_bytes_offset, isc->isc_has_offset);
+       atomic_add_64(&isc->isc_vsi_rx_bytes.ev_count, delta);
+
+       delta = ixl_stat_delta(sc,
+           I40E_GLV_UPRCH(sc->sc_vsi_stat_counter_idx),
+           I40E_GLV_UPRCL(sc->sc_vsi_stat_counter_idx),
+           &isc->isc_vsi_rx_unicast_offset, isc->isc_has_offset);
+       atomic_add_64(&isc->isc_vsi_rx_unicast.ev_count, delta);
+
+       delta = ixl_stat_delta(sc,
+           I40E_GLV_MPRCH(sc->sc_vsi_stat_counter_idx),
+           I40E_GLV_MPRCL(sc->sc_vsi_stat_counter_idx),
+           &isc->isc_vsi_rx_multicast_offset, isc->isc_has_offset);
+       atomic_add_64(&isc->isc_vsi_rx_multicast.ev_count, delta);
+
+       delta = ixl_stat_delta(sc,
+           I40E_GLV_BPRCH(sc->sc_vsi_stat_counter_idx),
+           I40E_GLV_BPRCL(sc->sc_vsi_stat_counter_idx),
+           &isc->isc_vsi_rx_broadcast_offset, isc->isc_has_offset);
+       atomic_add_64(&isc->isc_vsi_rx_broadcast.ev_count, delta);
+
+       /* VSI tx counters */
+       delta = ixl_stat_delta(sc,
+           0, I40E_GLV_TEPC(sc->sc_vsi_stat_counter_idx),
+           &isc->isc_vsi_tx_errors_offset, isc->isc_has_offset);
+       atomic_add_64(&isc->isc_vsi_tx_errors.ev_count, delta);
+
+       delta = ixl_stat_delta(sc,
+           I40E_GLV_GOTCH(sc->sc_vsi_stat_counter_idx),
+           I40E_GLV_GOTCL(sc->sc_vsi_stat_counter_idx),
+           &isc->isc_vsi_tx_bytes_offset, isc->isc_has_offset);
+       atomic_add_64(&isc->isc_vsi_tx_bytes.ev_count, delta);
+
+       delta = ixl_stat_delta(sc,
+           I40E_GLV_UPTCH(sc->sc_vsi_stat_counter_idx),
+           I40E_GLV_UPTCL(sc->sc_vsi_stat_counter_idx),
+           &isc->isc_vsi_tx_unicast_offset, isc->isc_has_offset);
+       atomic_add_64(&isc->isc_vsi_tx_unicast.ev_count, delta);
+
+       delta = ixl_stat_delta(sc,
+           I40E_GLV_MPTCH(sc->sc_vsi_stat_counter_idx),
+           I40E_GLV_MPTCL(sc->sc_vsi_stat_counter_idx),
+           &isc->isc_vsi_tx_multicast_offset, isc->isc_has_offset);
+       atomic_add_64(&isc->isc_vsi_tx_multicast.ev_count, delta);
+
+       delta = ixl_stat_delta(sc,
+           I40E_GLV_BPTCH(sc->sc_vsi_stat_counter_idx),
+           I40E_GLV_BPTCL(sc->sc_vsi_stat_counter_idx),
+           &isc->isc_vsi_tx_broadcast_offset, isc->isc_has_offset);
+       atomic_add_64(&isc->isc_vsi_tx_broadcast.ev_count, delta);
 }
 
 static int



Home | Main Index | Thread Index | Old Index