Skip to content

Commit

Permalink
feat: Read PCIE AER counters class/net
Browse files Browse the repository at this point in the history
Linux provides AER counters in the path /sys/class/net/<iface>/device/

This is split amoung 3 different files:
aer_dev_correctable
aer_dev_fatal
aer_dev_nonfatal

Signed-off-by: Diego Asturias <[email protected]>
  • Loading branch information
dasturiasArista committed Dec 10, 2024
1 parent 3e3f0e9 commit 1f561c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions sysfs/net_class_aer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ type CorrectableAerCounters struct {
HeaderOF uint64
}

// NonCorrectableAerCounters contains values from /sys/class/net/<iface>/device/aer_dev_[non]fatal
// UncorrectableAerCounters contains values from /sys/class/net/<iface>/device/aer_dev_[non]fatal
// for single interface (iface).
type NonCorrectableAerCounters struct {
type UncorrectableAerCounters struct {
Undefined uint64
DLP uint64
SDES uint64
Expand All @@ -66,8 +66,8 @@ type NonCorrectableAerCounters struct {
type AerCounters struct {
Name string // Interface name
Correctable CorrectableAerCounters
Fatal NonCorrectableAerCounters
NonFatal NonCorrectableAerCounters
Fatal UncorrectableAerCounters
NonFatal UncorrectableAerCounters
}

// AllAerCounters is collection of AER counters for every interface (iface) in /sys/class/net.
Expand Down Expand Up @@ -185,7 +185,7 @@ func parseCorrectableAerCounters(devicePath string, counters *CorrectableAerCoun
// parseUncorrectableAerCounters parses uncorrectable error counters in
// /sys/class/net/<iface>/device/aer_dev_[non]fatal.
func parseUncorrectableAerCounters(devicePath string, counterType string,
counters *NonCorrectableAerCounters) error {
counters *UncorrectableAerCounters) error {
path := filepath.Join(devicePath, "device", "aer_dev_"+counterType)
value, err := util.ReadFileNoStat(path)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions sysfs/net_class_aer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func TestAerCounters(t *testing.T) {
CorrIntErr: 7,
HeaderOF: 8,
},
Fatal: NonCorrectableAerCounters{
Fatal: UncorrectableAerCounters{
Undefined: 10,
DLP: 11,
SDES: 12,
Expand All @@ -82,7 +82,7 @@ func TestAerCounters(t *testing.T) {
TLPBlockedErr: 26,
PoisonTLPBlocked: 27,
},
NonFatal: NonCorrectableAerCounters{
NonFatal: UncorrectableAerCounters{
Undefined: 30,
DLP: 31,
SDES: 32,
Expand Down

0 comments on commit 1f561c3

Please sign in to comment.