Count up if_{opackets,oerrors,ierrors,collisions}.
And also "MAC Transmit Error" is tx error, not rx.
This commit is contained in:
parent
e48ad7e887
commit
65e1200c74
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: if_mvxpe.c,v 1.9 2016/02/13 06:12:46 hikaru Exp $ */
|
/* $NetBSD: if_mvxpe.c,v 1.10 2016/02/13 06:33:21 hikaru Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Internet Initiative Japan Inc.
|
* Copyright (c) 2015 Internet Initiative Japan Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.9 2016/02/13 06:12:46 hikaru Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.10 2016/02/13 06:33:21 hikaru Exp $");
|
||||||
|
|
||||||
#include "opt_multiprocessor.h"
|
#include "opt_multiprocessor.h"
|
||||||
|
|
||||||
|
@ -189,67 +189,71 @@ STATIC struct mvxpe_mib_def {
|
||||||
int reg64;
|
int reg64;
|
||||||
const char *sysctl_name;
|
const char *sysctl_name;
|
||||||
const char *desc;
|
const char *desc;
|
||||||
|
int ext;
|
||||||
|
#define MVXPE_MIBEXT_IF_OERRORS 1
|
||||||
|
#define MVXPE_MIBEXT_IF_IERRORS 2
|
||||||
|
#define MVXPE_MIBEXT_IF_COLLISIONS 3
|
||||||
} mvxpe_mib_list[] = {
|
} mvxpe_mib_list[] = {
|
||||||
{MVXPE_MIB_RX_GOOD_OCT, 1, "rx_good_oct",
|
{MVXPE_MIB_RX_GOOD_OCT, 1, "rx_good_oct",
|
||||||
"Good Octets Rx"},
|
"Good Octets Rx", 0},
|
||||||
{MVXPE_MIB_RX_BAD_OCT, 0, "rx_bad_oct",
|
{MVXPE_MIB_RX_BAD_OCT, 0, "rx_bad_oct",
|
||||||
"Bad Octets Rx"},
|
"Bad Octets Rx", 0},
|
||||||
{MVXPE_MIB_RX_MAC_TRNS_ERR, 0, "rx_mac_err",
|
{MVXPE_MIB_TX_MAC_TRNS_ERR, 0, "tx_mac_err",
|
||||||
"MAC Transmit Error"},
|
"MAC Transmit Error", MVXPE_MIBEXT_IF_OERRORS},
|
||||||
{MVXPE_MIB_RX_GOOD_FRAME, 0, "rx_good_frame",
|
{MVXPE_MIB_RX_GOOD_FRAME, 0, "rx_good_frame",
|
||||||
"Good Frames Rx"},
|
"Good Frames Rx", 0},
|
||||||
{MVXPE_MIB_RX_BAD_FRAME, 0, "rx_bad_frame",
|
{MVXPE_MIB_RX_BAD_FRAME, 0, "rx_bad_frame",
|
||||||
"Bad Frames Rx"},
|
"Bad Frames Rx", 0},
|
||||||
{MVXPE_MIB_RX_BCAST_FRAME, 0, "rx_bcast_frame",
|
{MVXPE_MIB_RX_BCAST_FRAME, 0, "rx_bcast_frame",
|
||||||
"Broadcast Frames Rx"},
|
"Broadcast Frames Rx", 0},
|
||||||
{MVXPE_MIB_RX_MCAST_FRAME, 0, "rx_mcast_frame",
|
{MVXPE_MIB_RX_MCAST_FRAME, 0, "rx_mcast_frame",
|
||||||
"Multicast Frames Rx"},
|
"Multicast Frames Rx", 0},
|
||||||
{MVXPE_MIB_RX_FRAME64_OCT, 0, "rx_frame_1_64",
|
{MVXPE_MIB_RX_FRAME64_OCT, 0, "rx_frame_1_64",
|
||||||
"Frame Size 1 - 64"},
|
"Frame Size 1 - 64", 0},
|
||||||
{MVXPE_MIB_RX_FRAME127_OCT, 0, "rx_frame_65_127",
|
{MVXPE_MIB_RX_FRAME127_OCT, 0, "rx_frame_65_127",
|
||||||
"Frame Size 65 - 127"},
|
"Frame Size 65 - 127", 0},
|
||||||
{MVXPE_MIB_RX_FRAME255_OCT, 0, "rx_frame_128_255",
|
{MVXPE_MIB_RX_FRAME255_OCT, 0, "rx_frame_128_255",
|
||||||
"Frame Size 128 - 255"},
|
"Frame Size 128 - 255", 0},
|
||||||
{MVXPE_MIB_RX_FRAME511_OCT, 0, "rx_frame_256_511",
|
{MVXPE_MIB_RX_FRAME511_OCT, 0, "rx_frame_256_511",
|
||||||
"Frame Size 256 - 511"},
|
"Frame Size 256 - 511"},
|
||||||
{MVXPE_MIB_RX_FRAME1023_OCT, 0, "rx_frame_512_1023",
|
{MVXPE_MIB_RX_FRAME1023_OCT, 0, "rx_frame_512_1023",
|
||||||
"Frame Size 512 - 1023"},
|
"Frame Size 512 - 1023", 0},
|
||||||
{MVXPE_MIB_RX_FRAMEMAX_OCT, 0, "rx_fame_1024_max",
|
{MVXPE_MIB_RX_FRAMEMAX_OCT, 0, "rx_fame_1024_max",
|
||||||
"Frame Size 1024 - Max"},
|
"Frame Size 1024 - Max", 0},
|
||||||
{MVXPE_MIB_TX_GOOD_OCT, 1, "tx_good_oct",
|
{MVXPE_MIB_TX_GOOD_OCT, 1, "tx_good_oct",
|
||||||
"Good Octets Tx"},
|
"Good Octets Tx", 0},
|
||||||
{MVXPE_MIB_TX_GOOD_FRAME, 0, "tx_good_frame",
|
{MVXPE_MIB_TX_GOOD_FRAME, 0, "tx_good_frame",
|
||||||
"Good Frames Tx"},
|
"Good Frames Tx", 0},
|
||||||
{MVXPE_MIB_TX_EXCES_COL, 0, "tx_exces_collision",
|
{MVXPE_MIB_TX_EXCES_COL, 0, "tx_exces_collision",
|
||||||
"Excessive Collision"},
|
"Excessive Collision", MVXPE_MIBEXT_IF_OERRORS},
|
||||||
{MVXPE_MIB_TX_MCAST_FRAME, 0, "tx_mcast_frame",
|
{MVXPE_MIB_TX_MCAST_FRAME, 0, "tx_mcast_frame",
|
||||||
"Multicast Frames Tx"},
|
"Multicast Frames Tx"},
|
||||||
{MVXPE_MIB_TX_BCAST_FRAME, 0, "tx_bcast_frame",
|
{MVXPE_MIB_TX_BCAST_FRAME, 0, "tx_bcast_frame",
|
||||||
"Broadcast Frames Tx"},
|
"Broadcast Frames Tx"},
|
||||||
{MVXPE_MIB_TX_MAC_CTL_ERR, 0, "tx_mac_err",
|
{MVXPE_MIB_TX_MAC_CTL_ERR, 0, "tx_mac_err",
|
||||||
"Unknown MAC Control"},
|
"Unknown MAC Control", 0},
|
||||||
{MVXPE_MIB_FC_SENT, 0, "fc_tx",
|
{MVXPE_MIB_FC_SENT, 0, "fc_tx",
|
||||||
"Flow Control Tx"},
|
"Flow Control Tx", 0},
|
||||||
{MVXPE_MIB_FC_GOOD, 0, "fc_rx_good",
|
{MVXPE_MIB_FC_GOOD, 0, "fc_rx_good",
|
||||||
"Good Flow Control Rx"},
|
"Good Flow Control Rx", 0},
|
||||||
{MVXPE_MIB_FC_BAD, 0, "fc_rx_bad",
|
{MVXPE_MIB_FC_BAD, 0, "fc_rx_bad",
|
||||||
"Bad Flow Control Rx"},
|
"Bad Flow Control Rx", 0},
|
||||||
{MVXPE_MIB_PKT_UNDERSIZE, 0, "pkt_undersize",
|
{MVXPE_MIB_PKT_UNDERSIZE, 0, "pkt_undersize",
|
||||||
"Undersized Packets Rx"},
|
"Undersized Packets Rx", MVXPE_MIBEXT_IF_IERRORS},
|
||||||
{MVXPE_MIB_PKT_FRAGMENT, 0, "pkt_fragment",
|
{MVXPE_MIB_PKT_FRAGMENT, 0, "pkt_fragment",
|
||||||
"Fragmented Packets Rx"},
|
"Fragmented Packets Rx", MVXPE_MIBEXT_IF_IERRORS},
|
||||||
{MVXPE_MIB_PKT_OVERSIZE, 0, "pkt_oversize",
|
{MVXPE_MIB_PKT_OVERSIZE, 0, "pkt_oversize",
|
||||||
"Oversized Packets Rx"},
|
"Oversized Packets Rx", MVXPE_MIBEXT_IF_IERRORS},
|
||||||
{MVXPE_MIB_PKT_JABBER, 0, "pkt_jabber",
|
{MVXPE_MIB_PKT_JABBER, 0, "pkt_jabber",
|
||||||
"Jabber Packets Rx"},
|
"Jabber Packets Rx", MVXPE_MIBEXT_IF_IERRORS},
|
||||||
{MVXPE_MIB_MAC_RX_ERR, 0, "mac_rx_err",
|
{MVXPE_MIB_MAC_RX_ERR, 0, "mac_rx_err",
|
||||||
"MAC Rx Errors"},
|
"MAC Rx Errors", MVXPE_MIBEXT_IF_IERRORS},
|
||||||
{MVXPE_MIB_MAC_CRC_ERR, 0, "mac_crc_err",
|
{MVXPE_MIB_MAC_CRC_ERR, 0, "mac_crc_err",
|
||||||
"MAC CRC Errors"},
|
"MAC CRC Errors", MVXPE_MIBEXT_IF_IERRORS},
|
||||||
{MVXPE_MIB_MAC_COL, 0, "mac_collision",
|
{MVXPE_MIB_MAC_COL, 0, "mac_collision",
|
||||||
"MAC Collision"},
|
"MAC Collision", MVXPE_MIBEXT_IF_COLLISIONS},
|
||||||
{MVXPE_MIB_MAC_LATE_COL, 0, "mac_late_collision",
|
{MVXPE_MIB_MAC_LATE_COL, 0, "mac_late_collision",
|
||||||
"MAC Late Collision"},
|
"MAC Late Collision", MVXPE_MIBEXT_IF_OERRORS},
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1690,6 +1694,7 @@ mvxpe_start(struct ifnet *ifp)
|
||||||
sc->sc_tx_ring[q].tx_queue_len);
|
sc->sc_tx_ring[q].tx_queue_len);
|
||||||
DPRINTIFNET(ifp, 1, "a packet is added to tx ring\n");
|
DPRINTIFNET(ifp, 1, "a packet is added to tx ring\n");
|
||||||
sc->sc_tx_pending++;
|
sc->sc_tx_pending++;
|
||||||
|
ifp->if_opackets++;
|
||||||
ifp->if_timer = 1;
|
ifp->if_timer = 1;
|
||||||
sc->sc_wdogsoft = 1;
|
sc->sc_wdogsoft = 1;
|
||||||
bpf_mtap(ifp, m);
|
bpf_mtap(ifp, m);
|
||||||
|
@ -3207,6 +3212,7 @@ mvxpe_clear_mib(struct mvxpe_softc *sc)
|
||||||
STATIC void
|
STATIC void
|
||||||
mvxpe_update_mib(struct mvxpe_softc *sc)
|
mvxpe_update_mib(struct mvxpe_softc *sc)
|
||||||
{
|
{
|
||||||
|
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
KASSERT_SC_MTX(sc);
|
KASSERT_SC_MTX(sc);
|
||||||
|
@ -3214,6 +3220,7 @@ mvxpe_update_mib(struct mvxpe_softc *sc)
|
||||||
for (i = 0; i < __arraycount(mvxpe_mib_list); i++) {
|
for (i = 0; i < __arraycount(mvxpe_mib_list); i++) {
|
||||||
uint32_t val_hi;
|
uint32_t val_hi;
|
||||||
uint32_t val_lo;
|
uint32_t val_lo;
|
||||||
|
uint64_t val;
|
||||||
|
|
||||||
if (mvxpe_mib_list[i].reg64) {
|
if (mvxpe_mib_list[i].reg64) {
|
||||||
/* XXX: implement bus_space_read_8() */
|
/* XXX: implement bus_space_read_8() */
|
||||||
|
@ -3229,8 +3236,23 @@ mvxpe_update_mib(struct mvxpe_softc *sc)
|
||||||
if ((val_lo | val_hi) == 0)
|
if ((val_lo | val_hi) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sc->sc_sysctl_mib[i].counter +=
|
val = ((uint64_t)val_hi << 32) | (uint64_t)val_lo;
|
||||||
((uint64_t)val_hi << 32) | (uint64_t)val_lo;
|
sc->sc_sysctl_mib[i].counter += val;
|
||||||
|
|
||||||
|
switch (mvxpe_mib_list[i].ext) {
|
||||||
|
case MVXPE_MIBEXT_IF_OERRORS:
|
||||||
|
ifp->if_oerrors += val;
|
||||||
|
break;
|
||||||
|
case MVXPE_MIBEXT_IF_IERRORS:
|
||||||
|
ifp->if_ierrors += val;
|
||||||
|
break;
|
||||||
|
case MVXPE_MIBEXT_IF_COLLISIONS:
|
||||||
|
ifp->if_collisions += val;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: if_mvxpereg.h,v 1.3 2016/02/12 09:24:15 hikaru Exp $ */
|
/* $NetBSD: if_mvxpereg.h,v 1.4 2016/02/13 06:33:21 hikaru Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015 Internet Initiative Japan Inc.
|
* Copyright (c) 2015 Internet Initiative Japan Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
@ -244,7 +244,7 @@
|
||||||
/* Rx */
|
/* Rx */
|
||||||
#define MVXPE_MIB_RX_GOOD_OCT 0x00 /* 64bit */
|
#define MVXPE_MIB_RX_GOOD_OCT 0x00 /* 64bit */
|
||||||
#define MVXPE_MIB_RX_BAD_OCT 0x08
|
#define MVXPE_MIB_RX_BAD_OCT 0x08
|
||||||
#define MVXPE_MIB_RX_MAC_TRNS_ERR 0x0c
|
#define MVXPE_MIB_TX_MAC_TRNS_ERR 0x0c
|
||||||
#define MVXPE_MIB_RX_GOOD_FRAME 0x10
|
#define MVXPE_MIB_RX_GOOD_FRAME 0x10
|
||||||
#define MVXPE_MIB_RX_BAD_FRAME 0x14
|
#define MVXPE_MIB_RX_BAD_FRAME 0x14
|
||||||
#define MVXPE_MIB_RX_BCAST_FRAME 0x18
|
#define MVXPE_MIB_RX_BCAST_FRAME 0x18
|
||||||
|
|
Loading…
Reference in New Issue