Download presentation
Presentation is loading. Please wait.
1
Statistical Counters A brief look at our Intel gigabit ethernet network controller’s ‘event-counting’ registers
2
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)
3
Initializing the nic’s counters The statistical counters all have address- offsets 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 { intr; // clear all of the Pro/1000 controller’s statistical counters for (r = 0x4000; r < 0x41FF; r += 4) ioread32( io + r ); }
4
A few ‘counter’ examples 0x4000 CRCERRSCRC Errors Count 0x400C RXERRCReceive Error Count 0x4014SCCSingle Collision Count 0x4018ECOLExcessive Collision Count 0x4048XONRXCXON Received Count 0x404CXONTXCXON Transmitted Count 0x4050XOFFRXCXOFF Received Count 0x4054XOFFTXCXOFF Transmitted Count 0x4074GPRCGood Packets Received 0x4078BPRCBroadcast Packets Received 0x407CMPRCMulticast Packets Received 0x40D0TPRTotal Packets Received 0x40D4TPTTotal Packets Transmitted 0x40F0MPTCMulticast Packets Transmitted 0x40F4BPTCBroadcast Packets Transmitted
5
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_TORLTotal Octets Received Low E1000_TORHTotal Octets Received High E1000_TOTLTotal Octets Transmitted Low E1000_TOTHTotal Octets Transmitted High
6
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?
7
‘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
8
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 9 th Ave) San Francisco, CA 94118 Cost is $7-per-person
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.