safchain / ethtool

A simple ethtool "like" library for GO
Apache License 2.0
120 stars 69 forks source link

panic on eth0 #11

Closed matrohon closed 5 months ago

matrohon commented 7 years ago

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.

matrohon commented 7 years ago

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

srinisakh commented 4 years ago

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