New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: x/sys/unix: Add support for ethtool_cmd and ethtool_value #62702
Comments
Should we pass an ioctl code to |
In my copy of I don't understand what the There seem to be a lot of backward compatibility concerns here; does this need to be in x/sys/unix, or would it be better in a third_party package? |
Thank you for taking a look at this proposal, @ianlancetaylor.
I made the following edits based on your comments:
type EthtoolLinkSettings struct {
// struct ethtool_link_settings from linux/ethtool.h ...
}
// IoctlGetEthtoolLinkSettings fetches link settings for the network device specified by ifname
func IoctlGetEthtoolLinkSettings(fd int, ifname string) (*EthtoolLinkSettings, error) // Uses .Cmd=ETHTOOL_GLINKSETTINGS
type EthtoolValue struct {
// struct ethtool_value from linux/ethtool.h ...
}
// IoctlGetEthtoolLinkStatus fetches link status for the network device specified by ifname
func IoctlGetLinkStatus(fd int, ifname string) (*EthtoolValue, error) // Uses .Cmd=ETHTOOL_GLINK
// Get functions for other commands that return *EthtoolValue can be implemented with a similar signature
Do the above edits clear the concerns around backwards compatibility? |
CC @mdlayher |
Seems reasonable to me, although I should note there has been an ongoing effort to expose the ethtool interface via genetlink. I have a library at https://github.com/mdlayher/ethtool that is far from complete but may be more easily extended than dealing with the ioctls. https://www.kernel.org/doc/html/latest/networking/ethtool-netlink.html But since they're part of the Linux UAPI I also have no objections adding more ioctl calls to x/sys/unix. |
Great, thank you for the feedback. I'll proceed to implementation unless there are further concerns. |
For invoking ioctl with the SIOCETHTOOL request, only
EthtoolDrvinfo
is supported by x/sys/unix at the moment. This is a proposal to implement support for ethtool_cmd and ethtool_value structs as follows:The text was updated successfully, but these errors were encountered: