Added Link Settings (GLINKSETTINGS/SLINKSETTINGS) Support#102
Merged
safchain merged 2 commits intosafchain:masterfrom May 7, 2025
Merged
Added Link Settings (GLINKSETTINGS/SLINKSETTINGS) Support#102safchain merged 2 commits intosafchain:masterfrom
safchain merged 2 commits intosafchain:masterfrom
Conversation
safchain
reviewed
May 5, 2025
9493add to
0281baa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix #82 #33
Added Link Settings (GLINKSETTINGS/SLINKSETTINGS) Support
This change introduces support for the
ETHTOOL_GLINKSETTINGSandETHTOOL_SLINKSETTINGSioctls, providing a more modern and comprehensive way to configure network interface Link Settings compared to the olderETHTOOL_GSET/SSET.Main Functions
GetLinkSettings(intfName string) (*LinkSettings, error):intfName).ETHTOOL_GLINKSETTINGSioctl to get extended Link Settings.GLINKSETTINGS(returns anEOPNOTSUPPerror), it automatically falls back to calling the olderCmdGet()(usingETHTOOL_GSET) and converts the result to the newLinkSettingsstruct before returning.LinkSettingsstruct containing the detailed Link Settings.SetLinkSettings(intfName string, settings LinkSettings) error:intfName) using the providedsettingsstruct.GLINKSETTINGSinterface.ETHTOOL_SLINKSETTINGSioctl to apply the settings.EOPNOTSUPPerror), it attempts to fall back to calling the olderCmdSet()(usingETHTOOL_SSET).SSET, it checks if the requested Link Modes insettingsexceed the capabilities of the old interface (e.g., setting modes beyond bit 31). If they do, an error is returned because the old interface cannot fulfill the request.