-
Notifications
You must be signed in to change notification settings - Fork 179
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
Remove PF from pools with Pfnames and rootDevices #410
Remove PF from pools with Pfnames and rootDevices #410
Conversation
84d058a
to
ff9e7ce
Compare
@@ -486,26 +478,6 @@ var _ = Describe("In the utils package", func() { | |||
}, | |||
"0000:01:10.0", "fakeSwitchdevPF", false, | |||
), | |||
Entry("device is a PF in switchdev mode", |
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.
I remove all the PF verification
reading the documentation we have carefully when using PfName and rootDevice we should only include the Vfs
|
I am not sure why the CI is not able to pull the go packages.. I test it locally and it pass
|
I also clean my cache and run it again
|
Signed-off-by: Sebastian Sch <sebassch@gmail.com>
901fd44
to
18142d5
Compare
/lgtm |
please do not merge until i have a chance to review. |
} | ||
return "", fmt.Errorf("error getting PF for PCI device %s %v", pciAddr, err) | ||
} | ||
return filepath.Base(pciinfo), nil | ||
} | ||
|
||
// GetPfName returns SRIOV PF name for the given VF | ||
// If device is not VF then it will return its own ifname if exist else empty string | ||
// If device is not VF then it will return empty string | ||
func GetPfName(pciAddr string) (string, error) { | ||
pfEswitchMode, err := GetPfEswitchMode(pciAddr) |
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.
I think we should check if pciAddr
is not a VF and exit early WDYT ?
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.
done can you have another look?
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.
better to use !IsSriovVF()
as you might get a PF which is capable of SR-IOV with no VFs.
in this case, if the PF is in switchdev you might hit L#81 below and return the PF netdev instead of ""
same might happen in getPfAddr()
but its being prevented by lines 52-53 above (before your changes)
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.
one comment, otherwise LGTM
18142d5
to
8035fd9
Compare
} | ||
return "", fmt.Errorf("error getting PF for PCI device %s %v", pciAddr, err) | ||
} | ||
return filepath.Base(pciinfo), nil | ||
} | ||
|
||
// GetPfName returns SRIOV PF name for the given VF | ||
// If device is not VF then it will return its own ifname if exist else empty string | ||
// If device is not VF then it will return empty string | ||
func GetPfName(pciAddr string) (string, error) { | ||
pfEswitchMode, err := GetPfEswitchMode(pciAddr) |
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.
better to use !IsSriovVF()
as you might get a PF which is capable of SR-IOV with no VFs.
in this case, if the PF is in switchdev you might hit L#81 below and return the PF netdev instead of ""
same might happen in getPfAddr()
but its being prevented by lines 52-53 above (before your changes)
pkg/utils/utils.go
Outdated
func GetPfAddr(pciAddr string) (string, error) { | ||
if IsSriovPF(pciAddr) { |
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.
i dont think its needed, lines 56-60 below ensure its a VF.
also you might still get PF (sriov capable) with no sriov configured.
so to exit early you can !IsSriovVF()
imo you can either
- remove this check
- replace the check with
!IsSriovVF()
and remove the check in L#59
This commit remove the PF from pools if a Pfnames or rootDevices selector are implemented Signed-off-by: Sebastian Sch <sebassch@gmail.com>
8035fd9
to
6d8ad3e
Compare
thanks for the comments @adrianchiris can you please give it another look? |
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, thanks @SchSeba !
/cc @bn222 |
/lgtm |
This commit remove the PF from pools if a Pfnames or rootDevices
selector are implemented
Signed-off-by: Sebastian Sch sebassch@gmail.com