mirror of
https://github.com/vishvananda/netlink
synced 2025-02-15 19:46:50 +00:00
This patch adds very basic support for getting information about RDMA networking device; starting with device index, name, firmware version, node GUID and system image GUID. This is done through RDMA netlink socket. RDMA devices are some what similar to Ethernet devices. However there are few major differences between them. RDMA devices usually have one or two ports, unlike Ethernet devices. Each port has its own attributes, state and network addresses which are different than Ethernet devices (Link and LinkAttrs). They almost don't overlap with Link and LinkAttrs. Therefore it doesn't derive Link and LinkAttrs structure; instead they are represented using RdmaLink and RdmaLinkAttrs. RdmaLink represents a RDMA device containing its attributes. All Rdma device communication occurs through rdma subsystem's netlink socket. Signed-off-by: Parav Pandit parav@mellanox.com
35 lines
612 B
Go
35 lines
612 B
Go
// +build linux
|
|
|
|
package netlink
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func setupRdmaKModule(t *testing.T, name string) {
|
|
skipUnlessRoot(t)
|
|
file, err := ioutil.ReadFile("/proc/modules")
|
|
if err != nil {
|
|
t.Fatal("Failed to open /proc/modules", err)
|
|
}
|
|
for _, line := range strings.Split(string(file), "\n") {
|
|
n := strings.Split(line, " ")[0]
|
|
if n == name {
|
|
return
|
|
}
|
|
|
|
}
|
|
t.Skipf("Test requires kmodule %q.", name)
|
|
}
|
|
|
|
func TestRdmaGetRdmaLink(t *testing.T) {
|
|
minKernelRequired(t, 4, 16)
|
|
setupRdmaKModule(t, "ib_core")
|
|
_, err := RdmaLinkByName("foo")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|