Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

avvarikrish
Copy link

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.

@avvarikrish
Copy link
Author

@vishvananda @aboch wondering if you can take a look at this pr? Thanks!

Copy link
Contributor

@e0ne e0ne left a 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
Copy link
Collaborator

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)
Copy link
Collaborator

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)
Copy link
Collaborator

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
Copy link
Collaborator

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?

@aboch
Copy link
Collaborator

aboch commented Aug 23, 2024

@avvarikrish ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants