-
Notifications
You must be signed in to change notification settings - Fork 183
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
net: replace the ethtool external program calls with the safchain/ethtool
package
#321
base: main
Are you sure you want to change the base?
Conversation
test failures are intentional (!!!) to make sure we don't merge without explicit action! |
proposed PR: safchain/ethtool#49 |
I'm happy there's interest in this approach! The main and only blocker here seems that the upstream project is a bit slowmoving. I'll look for other alternatives. I'm also considering a fork tailored for ghw purposes, but I'm still considering the maintainership costs. |
@jaypipes just wondering: would a minimal |
If there isn't a viable option out there in the open source world that is well-maintained and documented, I'd be perfectly fine doing an |
perfect, my thoughts exactly. Let me try harder not to have this internal package if we can help it. |
4c91a0a
to
5517fa0
Compare
merged! happy to resume the work on this PR! |
7133a50
to
f1141d3
Compare
WIP just because I want to add more tests. Other than that the PR is fully reviewable |
safchain/ethtool
package
f1141d3
to
809e54e
Compare
safchain/ethtool
packagesafchain/ethtool
package
ready for review |
// Features for enp58s0f1: | ||
// rx-checksumming: on | ||
// tx-checksumming: off | ||
// tx-checksum-ipv4: off | ||
// tx-checksum-ip-generic: off [fixed] | ||
// tx-checksum-ipv6: off | ||
// tx-checksum-fcoe-crc: off [fixed] | ||
// tx-checksum-sctp: off [fixed] | ||
// scatter-gather: off | ||
// tx-scatter-gather: off | ||
// tx-scatter-gather-fraglist: off [fixed] | ||
// tcp-segmentation-offload: off | ||
// tx-tcp-segmentation: off | ||
// tx-tcp-ecn-segmentation: off [fixed] | ||
// tx-tcp-mangleid-segmentation: off | ||
// tx-tcp6-segmentation: off |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the capability strings exactly the same with the ethtool library as they were with the raw parsing of the ethtool
binary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, pretty bad oversight on my side. Let me add a test which ensure this. On the code side, if this is not already the case, we can add a thin translation layer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ffromani I was only making sure :) it may be that the ethtool library does use the exact same strings. but if not, we'll need to add a translation table to ensure backwards compat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so the ethtool program gets the identifiers from the kernel using the ioctl interface: https://kernel.googlesource.com/pub/scm/network/ethtool/ethtool/+/refs/heads/ethtool-3.4.y/ethtool.c#1310 https://docs.kernel.org/networking/ethtool-netlink.html#strset-get
And so it does the ethtool package: https://github.com/safchain/ethtool/blob/master/ethtool.go#L733
Hence the names should be exactly the same, unless it is the ethtool
program which does some translation, which I haven't checked yet. On it.
ok, so the tool uses more than a single ioctl to dump all the information (this is
|
Replace calls to the "ethtool" external binary to the go package https://github.com/safchain/ethtool No feature reduction is expected, internal change only. Signed-off-by: Francesco Romani <[email protected]>
809e54e
to
90e212c
Compare
Signed-off-by: Francesco Romani <[email protected]>
I'm struggling to understand why the output is different once I force (recompile) ethtool to use ioctl, there are still some differences. |
@ffromani I'm open to any ideas you have :) If you want to try keeping the ethtool binary support and adding an environment variable switch for this new behaviour, good with me! |
replace the ethtool invocation and related output parsing with the
ethtool
package which can now provide the same information natively (e.g. the package will NOT call the binary bug it will query the kernel)Fixes: #317