Statistical Counters A brief look at our Intel gigabit ethernet network controller’s

Download Report

Transcript Statistical Counters A brief look at our Intel gigabit ethernet network controller’s

Statistical Counters
A brief look at our Intel gigabit
ethernet network controller’s
‘event-counting’ registers
Statistics registers
• The 82573L has several dozen statistical
counters which automatically operate to
keep track of significant events affecting
the ethernet controller’s performance
• Most are 32-bit ‘read-only’ registers, and
they are automatically cleared when read
• Your module’s initialization routine could
read them all (to start counting from zero)
Initializing the nic’s counters
• The statistical counters all have addressoffsets in the range 0x04000 – 0x041FF
• You can use a very simple program-loop to
‘clear’ each of these read-only registers
// Here ‘io’ is the virtual base-address of the nic’s i/o-memory region
{
int
r;
// clear all of the Pro/1000 controller’s statistical counters
for (r = 0x4000; r < 0x41FF; r += 4) ioread32( io + r );
}
A few ‘counter’ examples
0x4000
0x400C
0x4014
0x4018
0x4048
0x404C
0x4050
0x4054
0x4074
0x4078
0x407C
0x40D0
0x40D4
0x40F0
0x40F4
CRCERRS
RXERRC
SCC
ECOL
XONRXC
XONTXC
XOFFRXC
XOFFTXC
GPRC
BPRC
MPRC
TPR
TPT
MPTC
BPTC
CRC Errors Count
Receive Error Count
Single Collision Count
Excessive Collision Count
XON Received Count
XON Transmitted Count
XOFF Received Count
XOFF Transmitted Count
Good Packets Received
Broadcast Packets Received
Multicast Packets Received
Total Packets Received
Total Packets Transmitted
Multicast Packets Transmitted
Broadcast Packets Transmitted
A few 64-bit counters
• Some of the events being counted by the
NIC occur too frequently for a 32-bit count
to provide reliable accuacy (i.e., ‘overflow’)
• In such cases a pair of adjacent registers
provides the upper-and-lower halves of a
64-bit (i.e., quadword) statistical counter:
E1000_TORL
E1000_TORH
E1000_TOTL
E1000_TOTH
Total Octets Received Low
Total Octets Received High
Total Octets Transmitted Low
Total Octets Transmitted High
Our ‘nicstats.c’ module
• We wrote this kernel module for easily
viewing the statistical counter values:
$ cat /proc/nicstats
• It led us to the discovery of one ‘mystery
counter’ not mentioned in Intel’s manual
• Can you solve that mystery?
‘nicstats2.c’
• This enhanced version of our ‘nicstats.c’
module shows names of all the counters
• It uses some programming ideas that you
may find useful in case you wish to create
your own Linux software tools for studying
some other hardware devices in the future
ACM Event
• Tonight’s class will conclude early so that
students can attend tonight’s event which
our ACM Student Chapter has organized:
823 Clement Street (near 9th Ave)
San Francisco, CA 94118
Cost is $7-per-person