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

Support for acquiring DDP profile using devlink #387

Merged
merged 21 commits into from
Jun 2, 2024

Conversation

ipatrykx
Copy link
Contributor

@ipatrykx ipatrykx commented Oct 14, 2021

This PR introduces support for devlink commands to be used to acquire DDP profile name on supported hardware. First, the devlink will be used, and if it is not supported then it will fallback to DDPTool as it was before.

Some of the devlink related code will be possibly moved to vishvananda/netlink library if the PR there will be accepted.

Later this can be used to add support for DDP profiles in k8snetworkplumbingwg/sriov-network-operator.

@ipatrykx ipatrykx changed the title Added support for acquiring DDP profile using devlink Support for acquiring DDP profile using devlink Oct 14, 2021
@Eoghan1232
Copy link
Collaborator

Eoghan1232 commented Oct 14, 2021

LGTM

@zshi-redhat
Copy link
Collaborator

/cc @SchSeba

pkg/utils/ddp.go Show resolved Hide resolved
pkg/utils/devlink.go Outdated Show resolved Hide resolved
pkg/utils/devlink.go Outdated Show resolved Hide resolved
pkg/netdevice/pciNetDevice.go Outdated Show resolved Hide resolved
pkg/netdevice/pciNetDevice.go Outdated Show resolved Hide resolved
pkg/utils/devlink.go Outdated Show resolved Hide resolved
@zshi-redhat
Copy link
Collaborator

@ipatrykx Would you mind updating this PR? I assume some of the util functions have been merged in netlink go library. Thank you!

@ipatrykx
Copy link
Contributor Author

Hi @zshi-redhat , sure, sorry for the delay on that. I am right now on a tight schedule, but will try to do this until Tuesday.

@ipatrykx ipatrykx changed the base branch from master to alpine_image_broken November 30, 2021 15:47
@ipatrykx ipatrykx changed the base branch from alpine_image_broken to master November 30, 2021 15:47
pkg/utils/devlink.go Outdated Show resolved Hide resolved
@ipatrykx ipatrykx force-pushed the devlink-support branch 2 times, most recently from cbfaa77 to 1ea4df3 Compare October 26, 2022 13:54
@coveralls
Copy link
Collaborator

coveralls commented Oct 26, 2022

Pull Request Test Coverage Report for Build 3329699271

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 16 of 35 (45.71%) changed or added relevant lines in 4 files are covered.
  • 18 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-2.0%) to 75.202%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/utils/testing.go 0 1 0.0%
pkg/utils/netlink_provider.go 0 4 0.0%
pkg/netdevice/pciNetDevice.go 11 17 64.71%
pkg/utils/ddp.go 5 13 38.46%
Files with Coverage Reduction New Missed Lines %
pkg/utils/netlink_provider.go 3 33.33%
pkg/netdevice/pciNetDevice.go 15 72.82%
Totals Coverage Status
Change from base Build 2733786348: -2.0%
Covered Lines: 1580
Relevant Lines: 2101

💛 - Coveralls

@ipatrykx ipatrykx force-pushed the devlink-support branch 2 times, most recently from 48535fc to 9161854 Compare October 27, 2022 13:55
@ipatrykx
Copy link
Contributor Author

ipatrykx commented Oct 27, 2022

Hi @zshi-redhat , sure, sorry for the delay on that. I am right now on a tight schedule, but will try to do this until Tuesday.

@zshi-redhat I know, I've said I'll deliver it until Tuesday, but Thursday isn't bad as well, isn't it? 🥳

Anyway, I've rebased this PR on top of the current master, fixed some issues and added unit tests. Hope we can get it merged soon.

@adrianchiris
Copy link
Contributor

@Eoghan1232 @ipatrykx is there a plan to re-kindle this work ?

@Eoghan1232
Copy link
Collaborator

@Eoghan1232 @ipatrykx is there a plan to re-kindle this work ?

Hi @adrianchiris , yes of course.
Looks like just to resolve a merge conflict, will get to it this week :)
Then let's get it merged!

@Eoghan1232 Eoghan1232 mentioned this pull request May 23, 2023
Co-Authored-By: Eoghan1232 <Eoghan1232@users.noreply.github.com>
Co-Authored-By: ipatrykx <ipatrykx@users.noreply.github.com>
@Eoghan1232
Copy link
Collaborator

Eoghan1232 commented May 24, 2023

@SchSeba @adrianchiris PTAL

@Eoghan1232
Copy link
Collaborator

As discussed in community, a test is needed to verify if the DDP Tool can be removed from the Dockerfile, as this PR should remove the dependency.

Moving the changes into the GetDDPProfiles function

Signed-off-by: Eoghan Russell <eoghan.russell@intel.com>
@Eoghan1232
Copy link
Collaborator

@SchSeba @adrianchiris I've updated this PR. PTAL

removed gocyclo as method is no longer changed

Signed-off-by: Eoghan Russell <eoghan.russell@intel.com>
pkg/netdevice/pciNetDevice.go Show resolved Hide resolved
pkg/utils/devlink.go Outdated Show resolved Hide resolved
pkg/utils/devlink.go Outdated Show resolved Hide resolved
pkg/utils/ddp.go Show resolved Hide resolved
pkg/utils/ddp.go Outdated Show resolved Hide resolved
@adrianchiris
Copy link
Contributor

at some point we would need to switch to interfaces here like we did with sriov-network-operator.
not related to this PR.

Signed-off-by: Eoghan Russell <eoghan.russell@intel.com>
@Eoghan1232
Copy link
Collaborator

@adrianchiris thanks for the feedback! I've updated the PR, PTAL

Signed-off-by: Eoghan Russell <eoghan.russell@intel.com>
pkg/utils/ddp.go Show resolved Hide resolved
pkg/utils/ddp.go Show resolved Hide resolved
)

// IsDevlinkDDPSupportedByPCIDevice checks if DDP of PCI device can be acquired with devlink info command
func IsDevlinkDDPSupportedByPCIDevice(device string) bool {
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is the different between the two functions?

Copy link
Collaborator

Choose a reason for hiding this comment

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

IsDevlinkDDPSupportedByPCIDevice:
This function is intended to check if DDP is supported specifically for PCI devices.

IsDevlinkDDPSupportedByDevice:
This function is more generic and checks if DDP is supported for any type of device.

I guess since IsDevlinkDDPSupportedByPCIDevice is just a wrapper that calls IsDevlinkDDPSupportedByDevice, we could remove IsDevlinkDDPSupportedByPCIDevice in replace of IsDevlinkDDPSupportedByDevice

WDYT?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I have removed IsDevlinkDDPSupportedByPCIDevice and used IsDevlinkDDPSupportedByDevice throughout instead

pkg/utils/devlink.go Outdated Show resolved Hide resolved
@Eoghan1232
Copy link
Collaborator

will update this PR in next day - also update docs to call out support for E800 series but issue with current ddptool means E700 series may not work.

@Eoghan1232
Copy link
Collaborator

just testing my changes - will push commit after

Signed-off-by: Eoghan Russell <eoghan.russell@intel.com>
@Eoghan1232
Copy link
Collaborator

@SchSeba @adrianchiris PTAL

Signed-off-by: Eoghan Russell <eoghan.russell@intel.com>
)

var (
netlinkDevlinkGetDeviceInfoByNameAsMap = netlink.DevlinkGetDeviceInfoByNameAsMap
Copy link
Contributor

@adrianchiris adrianchiris May 22, 2024

Choose a reason for hiding this comment

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

we already have a netlink provider [1] shouldnt we extend it with the new method ? it already has netlink calls to devlink.

then, the rest of the functions in this file would be moved to ddp.go as they are pretty specific for ddp.

in tests (ddp_test.go) we would use a mocked version of NetlinkProvider instead of defining a fake function.

[1]

GetDevLinkDeviceEswitchAttrs(ifName string) (*nl.DevlinkDevEswitchAttr, error)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @adrianchiris yes 100% agree.

I migrated the code, but have hit an issue with the mockery.

2024/05/23 14:26:14 internal error: package "bytes" without types was imported from "github.com/k8snetworkplumbingwg/sriov-network-device-plugin/pkg/utils"

I am trying to figure out the reason, but this is blocking me from making the changes, as I cannot regenerate the mocked version of the NetlinkProvider Interface.

I also did a test of moving the code to a test project and trying to compile but still hit the same issues with mockery.

Has anyone come across an issue like this with mockery before?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I found this one argoproj/argo-workflows#8251
can you try to build the mockery version please?

@adrianchiris
Copy link
Contributor

@Eoghan1232 i gave another round, left a comment to make things a bit more consistent with other places in device plugin code.

hoping to get this sorted soon so i can tag a release.

Eoghan Russell added 2 commits May 31, 2024 15:21
extended netlink provider
updated unit tests
regenerated mocked interfaces
addressed comments

Signed-off-by: Eoghan Russell <eoghan.russell@intel.com>
@Eoghan1232
Copy link
Collaborator

trying to fix lint issue.....

@Eoghan1232
Copy link
Collaborator

@adrianchiris @SchSeba PTAL

Copy link
Contributor

@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.

LGTM

Copy link
Collaborator

@SchSeba SchSeba left a comment

Choose a reason for hiding this comment

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

LGTM

BUT please squash all the commits to reasonable ones :)

@adrianchiris adrianchiris merged commit bd0a56d into k8snetworkplumbingwg:master Jun 2, 2024
10 of 11 checks passed
@adrianchiris
Copy link
Contributor

Squashed to single commit, edited commit msg to contain brief description.

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.

7 participants