safchain/ethtool

panic on eth0

matrohon opened this issue · 2 comments

I'm using the example you're providing in your README, with eth0

It ends up with a panic

panic:

operation not supported

goroutine 1 [running]:
panic(0x4c4260, 0xc82000a2c0)
/opt/go/src/runtime/panic.go:464 +0x3e6
main.main()
/opt/stack/go/src/mat/ethtool-test/main.go:18 +0x149
exit status 2

and ethtool is telling me that no stats are available for eth0.

it seems ethtool and associated syscalls are really driver dependent, and not all drivers implement the stats feature. smsc75xx for instance does not.

However this driver seems to update the corresponding /net/dev/ file :
https://github.com/torvalds/linux/blob/5924bbecd0267d87c24110cbe2041b5075173a25/drivers/net/usb/smsc75xx.c#L2147

Shouldn't it gracefully return error when the stats are not available for e.g. ethtool just returns stats not available

$ sudo /sbin/ethtool -S ens3
no stats available