forked from amorenoz/govdpa
-
Notifications
You must be signed in to change notification settings - Fork 3
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 a MgmtDev interface to VdpaDevice #13
Merged
amorenoz
merged 17 commits into
k8snetworkplumbingwg:master
from
amorenoz:vdpa_mgmt_link
Sep 19, 2022
Merged
Add a MgmtDev interface to VdpaDevice #13
amorenoz
merged 17 commits into
k8snetworkplumbingwg:master
from
amorenoz:vdpa_mgmt_link
Sep 19, 2022
Conversation
This file contains 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
lmilleri
suggested changes
Sep 9, 2022
pkg/kvdpa/device_test.go
Outdated
|
||
func TestVdpaDevGetByMgmt(t *testing.T) { | ||
|
||
list_result := []VdpaDevice{ |
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.
Please change variable name in "listResult"
This layer uses an interface and an empty struct that implements it to be able to mock it for unit tests in the future Uses github.com/vishvananda/netlink for low level netlink handling. For now, it just exposes two operations: - RunVdpaNetlinkCmd: executes a netlink command against the vdpa subsystem - NewAttribute: Creates a new vdpa attribute Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Based on netlink, add support for reading operations (list and get) Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
They are skipped if the right version of the kernel is not found. Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Some helper functions can be used by unit tests to mock a response from the netlink layer Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Also, move supported golang version to 1.17 as it's netlink's requirement. Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Move the information about vhost and virtio devices out of the vdpa device definition to enable extension and clean the API Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Prepare the vdpaDevice for expansion by moving some external functions to vdpaDevice methods. Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
The vdpa API sends the vdpa busName and devName alogside the vdpa device's attributes. Use it to create a MgmtDev and expose it in the API. Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
amorenoz
force-pushed
the
vdpa_mgmt_link
branch
from
September 13, 2022 16:27
3b1f182
to
af800e8
Compare
Right now we can only get a VdpaDevice by PCI address and we do it by inspecting the pci address hierarchy. This is limitted and error prone. Use the management device information to get all the devices whose mgmtDev match. Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
amorenoz
force-pushed
the
vdpa_mgmt_link
branch
from
September 13, 2022 16:33
af800e8
to
67d8544
Compare
lmilleri
approved these changes
Sep 19, 2022
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.
/lgtm
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.
The netlink interface sends mgmtdev information on each device. So we can use it to create a
MgmtDev
on eachVdpaDevice
.Also, the p
GetVdpaDeviceByPci
can now be generalized to use MgmtDev information (busName / devName). pci addresses can still be used but also SF, stand-alone devices (such as vdpasim_net), etc.Based on #12