-
Notifications
You must be signed in to change notification settings - Fork 744
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
rdma: add netdev field for rdma link info #822
base: main
Are you sure you want to change the base?
Conversation
@vishvananda @aboch wondering if you can take a look at this pr? Thanks! |
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.
The change itself looks good to me. @avvarikrish please add unit-tests for the new feature
@@ -54,6 +56,11 @@ func executeOneGetRdmaLink(data []byte) (*RdmaLink, error) { | |||
r := bytes.NewReader(value) | |||
binary.Read(r, nl.NativeEndian(), &Index) | |||
link.Attrs.Index = Index | |||
case nl.RDMA_NLDEV_ATTR_PORT_INDEX: | |||
var Index uint32 |
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.
Why is Index
with a capital I
?
return nil | ||
} | ||
|
||
return fmt.Errorf("link %v not found or unexpected number of msgs", link.Attrs.Name) |
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 also print the number of msgs
[...] of msgs (%d)", link.Attrs.Name, len(msgs))
} | ||
if (len % 4) != 0 { | ||
// Skip pad bytes | ||
reader.Seek(int64(4-(len%4)), seekCurrent) |
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.
make sure to gofmt your new code
if len(msgs) == 1 { | ||
netdev, err := executeOneGetRdmaNetdev(msgs[0]) | ||
if err != nil { | ||
return err |
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.
Should this error message provide a little ore context? for example the name of the requested device?
@avvarikrish ping |
This would allow users to get the underlying network interface associated with each rdma link. It is essentially the
netdev
attribute for an rdma link.