Commit Graph

10 Commits

Author SHA1 Message Date
Vishvananda Abrams
1e35ba25dc test: Improve test reliability with proper cleanup and isolation
Refactors test setup and teardown logic to use `t.Cleanup` instead
of `defer`. This ensures that cleanup functions are correctly scoped
to each subtest's lifecycle, improving test isolation and reliability.

The `setUpNetlinkTest` helper function is also improved to correctly
save and restore the original network namespace, ensuring that tests
do not leak state.

To support this, a `Close()` method that returns an error is added to
the `Handle` struct, allowing for proper cleanup of underlying netlink
sockets. The test helpers are updated to use this new method,
preventing resource leaks between tests.

Additionally, a bug in the `netns` tests is fixed where a large
namespace ID could overflow a 32-bit integer, causing spurious
failures on some systems.
2025-08-27 09:24:17 -07:00
bingshen.wbs
c4bb4f91d6 rdma: support rdma metrics: resource and statistic
Signed-off-by: bingshen.wbs <bingshen.wbs@alibaba-inc.com>
2025-05-09 11:48:52 -07:00
张祖建
b8aac10bba fix staticcheck issues 2021-09-21 09:10:48 -05:00
Wei Fu
c33185cb84 rdma: support rdma link add/del functionality
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-09-18 10:31:51 -07:00
Adrian Chiris
f4f591aee8 Add support for getting all RDMA devices in the system
- Add RdmaLinkList() method that retrieves RDMA devices
  in the system.

- Modify RdmaLinkByName() to use RdmaLinkList() to avoid code
  duplication.

- Add unit test that demonstrates how to use RdmaLinkList()

Signed-off-by: Adrian Chiris <adrianc@mellanox.com>
2020-06-03 11:56:48 -07:00
Parav Pandit
123a384710 Add an API to change net namespace of RDMA device
Add an API to change net namespace of RDMA device similar to

$ rdma dev set [DEV] netns NSNAME

Signed-off-by: Parav Pandit <parav@mellanox.com>
2019-06-13 22:19:36 -07:00
Parav Pandit
0f040b9e2c Add an API to set RDMA subsystem network namespace mode
Add an API to change the RDMA subsystem network namespace mode as either
shared or exclusive similar to

$ rdma system set netns { shared | exclusive }

Signed-off-by: Parav Pandit <parav@mellanox.com>
2019-06-07 21:21:07 -07:00
Parav Pandit
4666477197 Add an API to query RDMA subsystem net namespace mode
RDMA subsystem can be running in shared or exclusive mode with regards
to sharing RDMA device sharing among multiple network namespaces.

Add and API to query such mode of kernel similar to iproute2 command
$ rdma system show netns

Signed-off-by: Parav Pandit <parav@mellanox.com>
2019-06-07 21:21:07 -07:00
Parav Pandit
b48eed5d7d Add an API to rename rdma device name
Add an API RdmaLinkSetName() and test case to rename a
rdma device name.

Signed-off-by: Parav Pandit <parav@mellanox.com>
2018-10-29 12:38:29 -07:00
Parav Pandit
1970aef3ab Add RDMA netlink socket for RDMA device information
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
2018-04-28 17:02:23 -07:00