-
Notifications
You must be signed in to change notification settings - Fork 114
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
Intel switchdev #757
Intel switchdev #757
Conversation
Thanks for your PR,
To skip the vendors CIs, Maintainers can use one of:
|
44b682b
to
9486f37
Compare
Pull Request Test Coverage Report for Build 10612389872Details
💛 - Coveralls |
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
I will do a test of this |
worked like a charm @zeeke ;) let me give the PR a review now then we should be good to merge |
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.
Changes LGTM!
once this is merged, we should also update the support HW list.
I will do this
pkg/host/internal/sriov/sriov.go
Outdated
log.Log.Error(err, "setEswitchMode(): failed to set mode", "device", pciAddr, "mode", eswitchMode) | ||
return err | ||
|
||
type setEswitchModeAndNumVFsFn func(string, string, int) error |
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.
nit: can we move this one outside the function?
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.
ok, moving. though that type is not supposed to be used out of this function
pkg/host/internal/sriov/sriov.go
Outdated
|
||
type setEswitchModeAndNumVFsFn func(string, string, int) error | ||
|
||
var setEswitchModeAndNumVFsByDriverName map[string]setEswitchModeAndNumVFsFn = map[string]setEswitchModeAndNumVFsFn{ |
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.
nit: can we do something like
setEswitchModeAndNumVFsByDriverName map[string]setEswitchModeAndNumVFsFn := map[string]setEswitchModeAndNumVFsFn{...}
} | ||
|
||
func (s *sriov) setEswitchModeAndNumVFs(pciAddr string, desiredEswitchMode string, numVFs int) error { | ||
log.Log.V(2).Info("setEswitchModeAndNumVFs(): configure VFs for device", | ||
func (s *sriov) setEswitchModeAndNumVFsMlx(pciAddr string, desiredEswitchMode string, numVFs int) error { |
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 add a function comment to explain the process of how we configure switchDev virtual functions for this case
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.
nit: between b. and c. we also unbind all VFs on PF.
can you add this to the comment ?
note: rebind happens after part of configSriovVFDevices
also what about configureHWOptionsForSwitchdev
? is it the same for intel ice ?
if we need to split that as well, maybe its worth moving switchdev related things to switchdev to switchdev pkg under host folder to avoid bloating sriov pkg.
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.
Adding the comment about "driver unbinding".
Regarding configureHWOptionsForSwitchdev
, current implementation is about setting flow_steering_mode=smfs
, which is Mellanox only (IIUC).
Ice driver doesn't need this step [1] . @Eoghan1232 Can you confirm that?
switchdev and sriov general configurations are tightly coupled. I don't know if moving the switchdev part in a specific package simplifies the code
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 don't think we need to unbind driver, since we need to reset back to 0 vf's anyways
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.
Got it. Then better move the unbindAllVFsOnPF(...)
call outside of setEswitchMode(...)
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.
Regarding configureHWOptionsForSwitchdev, current implementation is about setting flow_steering_mode=smfs, which is Mellanox only (IIUC).
this also enables hw-tc-offload via ethtool.
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.
Regarding configureHWOptionsForSwitchdev, current implementation is about setting flow_steering_mode=smfs, which is Mellanox only (IIUC).
this also enables hw-tc-offload via ethtool.
right! I miss that. I checked and it should not be a problem for the ice driver:
from a local test:
2024-08-29T08:21:49.27421628Z LEVEL(-2) sriov/sriov.go:365 EnableHwTcOffload(): enable offloading {"device": "eno12409"}
2024-08-29T08:21:49.274526639Z LEVEL(-2) sriov/sriov.go:365 EnableHwTcOffload(): already enabled {"device": "eno12409"}
and flow_steering_mode
setting is guarded: if it's not supported, it doesn't hurt.
|
||
BeforeAll(func() { | ||
if cluster.VirtualCluster() { | ||
Skip("IGB driver does not support VF statistics") |
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.
nit: please update the skip message here :)
|
||
By(fmt.Sprintf("Testing on node %s, %d devices found", testNode, len(interfaces))) | ||
|
||
mainDevice := findMainSriovDevice(getConfigDaemonPod(testNode), interfaces) |
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.
you can use findUnusedSriovDevices
to have the list of non main device :)
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.
cool! thnks
bbad045
to
ea50542
Compare
Please hold off with merging this one id like to go over this pr by end of week |
pkg/host/internal/sriov/sriov.go
Outdated
@@ -1029,6 +1047,40 @@ func (s *sriov) setEswitchModeAndNumVFs(pciAddr string, desiredEswitchMode strin | |||
return nil | |||
} | |||
|
|||
// setEswitchModeAndNumVFsIce configures PF eSwitch and sriov_numvfs in the following order: | |||
// a. set eSwitchMode to `switchdev` if requested |
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.
we need to reset vf's to 0 before setting switchdev mode, is this handled?
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.
No, I'll fix it.
sriov_numvfs needs to be set to 0 every time we change between eSwitchMode, right?
Both legacy -> switchdev
and switchdev -> legacy
.
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 believe so, otherwise driver will throw an error I believe.
I can double check this tomorrow to confirm
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 can see in some docs that we must have 0 VF's before switching to switchdev mode.
some changes were pushed to the PR, need to take another look on it
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.
overall lgtm, left one small comment
Add a basic test to loop over all available devices and test if setting `eSwitchMode: switchdev` works. Signed-off-by: Andrea Panattoni <apanatto@redhat.com>
a6508fe
to
06d6c52
Compare
Ice driver supports creating VFs after the eSwitcMode is set to switchdev. This is different than the preferred way for `mlx5` driver. Add specific functions to configure eSwitchMode and SriovNumVFs for each driver. Signed-off-by: Andrea Panattoni <apanatto@redhat.com>
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
nice work!
Got approval from multiple sides, merging. |
Ice driver supports creating VFs after the eSwitcMode is
set to switchdev. This is different than the preferred way
for
mlx5
driver.Add specific functions to configure eSwitchMode and SriovNumVFs
for each driver.
Add a basic test to loop over all available
devices and test if setting
eSwitchMode: switchdev
works.