RDMA/core: Extend RDMA device registration to be net namespace aware
authorMark Bloch <mbloch@nvidia.com>
Tue, 17 Jun 2025 08:44:01 +0000 (11:44 +0300)
committerLeon Romanovsky <leon@kernel.org>
Thu, 26 Jun 2025 12:10:07 +0000 (08:10 -0400)
commit8cffca866ba86cbf0d097e56521b17d830956d4a
tree3d569667d9a368501fc8e7fa62a7b4932cca0218
parent19564a8576ac847ec981207292b500efbbbfaf7b
RDMA/core: Extend RDMA device registration to be net namespace aware

Presently, RDMA devices are always registered within the init network
namespace, even if the associated devlink device's namespace was
changed via a devlink reload. This mismatch leads to discrepancies
between the network namespace of the devlink device and that of the
RDMA device.

Therefore, extend the RDMA device allocation API to optionally take
the net namespace. This isn't limited to devices that support devlink
but allows all users to provide the network namespace if they need to
do so.

If a network namespace is provided during device allocation, it's up
to the caller to make sure the namespace stays valid until
ib_register_device() is called.

Signed-off-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
drivers/infiniband/core/device.c
drivers/infiniband/sw/rdmavt/vt.c
include/rdma/ib_verbs.h