'How to map ethtool's bus-info to /sys/devices/?
How are the bus-info addresses from ethtool -i <netdev> to be interpreted in order to address the corresponding HW device in /sys/devices/? That is, using the Linux sysfs API with the information returned by the ethtool ioctl SIOCETHTOOL (or similar) API?
Please note that I'm in a situation where I cannot use
/sys/class/net/due to the way thatsysfsfilters thenet/branch(es) based on the mounting process' network namespace.sysfsdoes not filternet/based on the sysfs-reading process' current network namespace; compare this withprocfswhich always correctly adapts to the procfs-reading process' current PID namespace.
For instance, on a Raspberry Pi 4B with Ubuntu 21.10 ethtool -i eth0 for the integrated eth0 HW NIC just draws a literal blank:
bus-info:
The eth0 device seems to be located here: /sys/devices/platform/emmc2bus/subsystem/devices/fd580000.ethernet/.
Plugging in an USB-based Ethernet dongle and then querying it I get:
bus-info: usb-0000:01:00.0-1.1
Unfortunately, that's not a directly valid item in, say, /sys/devices/...
How are the bus-info addresses reported by the ethtool API (socket/RTNETLINK) to be resolved depending on the different "bus" systems?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
