-
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
[switchdev 6/x] Update netlink lib and add helper functions #633
[switchdev 6/x] Update netlink lib and add helper functions #633
Conversation
Thanks for your PR,
To skip the vendors CIs use one of:
|
Pull Request Test Coverage Report for Build 8016849082Details
💛 - Coveralls |
2cb562f
to
8682736
Compare
Thanks for your PR,
To skip the vendors CIs use one of:
|
8682736
to
dfd1376
Compare
Thanks for your PR,
To skip the vendors CIs use one of:
|
dfd1376
to
1f15f18
Compare
Thanks for your PR,
To skip the vendors CIs use one of:
|
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 looks good , left a few comments.
pkg/host/internal/kernel/kernel.go
Outdated
log.Log.V(2).Info("GetDriverByBusAndDevice(): get driver for device", "bus", bus, "device", device) | ||
driver, err := getDriverByBusAndDevice(bus, device) | ||
if err != nil { | ||
log.Log.V(2).Info("GetDriverByBusAndDevice(): can't read device driver for device", "bus", bus, "device", 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.
given its a no on the comment above,
we are going to have roughly the same information logged in this verbosity level by getDriverByBusAndDevice
do we really want this additional logs (here and below)?
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 agree, there is no need for additional logs here.
pkg/host/internal/kernel/kernel.go
Outdated
// device - the name of the device on the bus, e.g. 0000:85:1e.5 for PCI or vpda1 for VDPA | ||
func (k *kernel) GetDriverByBusAndDevice(bus, device string) (string, error) { | ||
log.Log.V(2).Info("GetDriverByBusAndDevice(): get driver for device", "bus", bus, "device", device) | ||
driver, err := getDriverByBusAndDevice(bus, 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.
WDYT about just renaming this function and making it part of kernel struct ?
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 removed extra logging from GetDriverByBusAndDevice
. I would prefer to keep getDriverByBusAndDevice
as a separate function
pkg/host/internal/network/network.go
Outdated
@@ -196,3 +200,93 @@ func (n *network) GetNetDevLinkSpeed(ifaceName string) string { | |||
|
|||
return fmt.Sprintf("%s Mb/s", strings.TrimSpace(string(data))) | |||
} | |||
|
|||
// GetDeviceParam returns devlink parameter for the device as a string, if the parameter has multiple values |
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: GetDevlinkDeviceParam
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.
fixed
pkg/host/types/interfaces.go
Outdated
@@ -97,6 +97,13 @@ type NetworkInterface interface { | |||
GetNetDevMac(name string) string | |||
// GetNetDevLinkSpeed returns the network interface link speed | |||
GetNetDevLinkSpeed(name string) string | |||
// GetDeviceParam returns devlink parameter for the device as a string, if the parameter has multiple values |
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: GetDevlinkDeviceParam
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.
fixed
pkg/host/internal/network/network.go
Outdated
return "", err | ||
} | ||
if len(param.Values) == 0 { | ||
funcLog.Error(fmt.Errorf("param %s has no value", paramName), |
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.
do we want to return here ? else code will panic if it tries to access param.Values[0]
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.
yes, I lost return statement here. Good catch!
pkg/host/internal/network/network.go
Outdated
funcLog.V(2).Info("SetDevlinkDeviceParam(): set device parameter") | ||
param, err := n.netlinkLib.DevlinkGetDeviceParamByName(consts.BusPci, pciAddr, paramName) | ||
if err != nil { | ||
funcLog.Error(err, "SetDevlinkDeviceParam(): can get existing param data") |
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 -> can't
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.
fixed
pkg/host/internal/network/network.go
Outdated
return fmt.Errorf("parameter has unknown value type: %d", param.Type) | ||
} | ||
if err != nil { | ||
err = fmt.Errorf("failed to convert value %s to the required type: %d", value, param.Type) |
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.
maybe use %T and print the type of typedValue ?
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.
good idea, done
1f15f18
to
8d90dce
Compare
Thanks for your PR,
To skip the vendors CIs use one of:
|
8d90dce
to
6bbc469
Compare
Thanks for your PR,
To skip the vendors CIs use one of:
|
Signed-off-by: Yury Kulazhenkov <[email protected]>
This required to support additional configuration options and to remove need to mount /dev/ folder to the container (govdpa requires it) Signed-off-by: Yury Kulazhenkov <[email protected]>
Signed-off-by: Yury Kulazhenkov <[email protected]>
6bbc469
to
f5d2e2c
Compare
Thanks for your PR,
To skip the vendors CIs use one of:
|
@e0ne @adrianchiris I addressed your comments and rebased the PR. Please, take another look. Thx |
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!
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
This PR contains following changes:
cc @adrianchiris @SchSeba @zeeke