Skip to content
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

Add functions to work with devlink device parameters #950

Merged
merged 1 commit into from
Feb 12, 2024

Conversation

ykulazhenkov
Copy link
Contributor

Add functions to work with devlink device parameters

Functions added:

// DevlinkGetDeviceParams returns parameters for devlink device
// Equivalent to: `devlink dev param show <bus>/<device>`
DevlinkGetDeviceParams(bus string, device string)

// DevlinkGetDeviceParamByName returns specific parameter for devlink device
// Equivalent to: `devlink dev param show <bus>/<device> name <param>`
`DevlinkGetDeviceParamByName(bus string, device string, param string)`

// DevlinkSetDeviceParam set specific parameter for devlink device
// Equivalent to: `devlink dev param set <bus>/<device> name <param> cmode <cmode> value <value>`
`DevlinkSetDeviceParam(bus string, device string, param string, cmode uint8, value interface{})`

Theses function can be tested without real HW with netdevsim virtual device. Tests will automatically create devices if netdevsim module is loaded.

cc @adrianchiris

devlink_linux.go Show resolved Hide resolved
devlink_linux.go Outdated Show resolved Hide resolved
devlink_linux.go Outdated Show resolved Hide resolved
devlink_linux.go Outdated Show resolved Hide resolved
devlink_linux.go Show resolved Hide resolved
devlink_test.go Outdated Show resolved Hide resolved
Functions added:

DevlinkGetDeviceParams - get all parameters for device
DevlinkGetDeviceParamByName - get specific parameter for device
DevlinkSetDeviceParam - set parameter for device

Signed-off-by: Yury Kulazhenkov <[email protected]>
Copy link
Collaborator

@adrianchiris adrianchiris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me !

Thx for addressing my comments @ykulazhenkov

devlink_linux.go Show resolved Hide resolved
@ykulazhenkov
Copy link
Contributor Author

@aboch could you please take a look at the PR?

@aboch
Copy link
Collaborator

aboch commented Feb 12, 2024

Thank you @ykulazhenkov for the UT
Thanks @adrianchiris for the review

@aboch aboch merged commit 5daafaf into vishvananda:main Feb 12, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants