From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-181.mta1.migadu.com (out-181.mta1.migadu.com [95.215.58.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B10603783D1 for ; Fri, 6 Mar 2026 08:27:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772785663; cv=none; b=j3k+DBnNO8CUK78CtMAtK5bYg96uC4Q5Pd5XCfey1m5kWeThOkI4e0BIxv4N1J7MAJb+XjW0+PRwx+gi9/274FPdKH+83YtzKCBw/1J3iODKJ3AgwIrmTlYhST83AQqCmUyTfRFjnq0LBcRIA3bPP8sjwwZsmwGpzxIwLnHPCm8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772785663; c=relaxed/simple; bh=8KwMX7rOPHqN0JRnKPoZcoCMDpawsu9xOYe+Wu5lPe4=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=esjDyq+6nct/fKaII3Y4sUmr1BZEyD/+QVpdbAvxZD73xJVoKy1Vb3yMOVUNPiMizy/9ac0lztCUvgMgDCrKqI49PTukY9rVmFTavS+tc6QcxI33A/UoTbrxc+gy5BsjAjk2dVqIqzQsy9yW5Wy8llonwCjOSio1W8PDRM4uLTw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=xczkBhnA; arc=none smtp.client-ip=95.215.58.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="xczkBhnA" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772785659; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yf3BpmiwIYmoJ95AnZcLyjGB7Tqw7Xk2U18Mzc2vMvQ=; b=xczkBhnArmPr4WFyJS8zOnROBG1hzlTTFZaJwZC2ELnKGMk3ncIsmOytLN1oyWz/nmjH0O 474Slof9okvBsFSq9qNPdJTY4gcpc2/rcOiCTCT+1DcI/4q3Qnm4CnUY8ocnKbxs9k8SM9 jO063uNNdUTpjOF9kuj05vTghLVwjjE= Date: Fri, 6 Mar 2026 00:27:32 -0800 Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 0/4] RDMA/rxe: Add the support that rxe can work in net namespace To: jgg@ziepe.ca, leon@kernel.org, zyjzyj2000@gmail.com, dsahern@kernel.org, linux-rdma@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20260306082452.1822-1-yanjun.zhu@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zhu Yanjun In-Reply-To: <20260306082452.1822-1-yanjun.zhu@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 在 2026/3/6 0:24, Zhu Yanjun 写道: > Currently rxe does not work correctly in network namespaces. > > When the rdma_rxe module is loaded, a UDP socket listening on port > 4791 is created in init_net. When users run: > > ip link add ... type rxe > > inside another network namespace, the RXE RDMA link is created but it > cannot function properly because the underlying UDP socket belongs to > init_net. Other network namespaces cannot use that socket. > > To address this issue, this series introduces net namespace support > for rxe and moves socket management to be per network namespace. > > The series first introduces per-net namespace management for the IPv4 > and IPv6 sockets used by rxe. The sockets are created when the network > namespace becomes active and are released when the namespace is > destroyed. > > Based on this infrastructure, rxe RDMA links are then created and > destroyed within each network namespace. This ensures that both the > UDP sockets and RDMA links are correctly scoped to the namespace in > which they are used. > > With these changes, rxe RDMA links can be created and used both in > init_net and in other network namespaces, and resources are properly > cleaned up during namespace teardown. > > The series also includes a selftest to verify RXE functionality in > network namespaces. The selftest results are as below: " # make -C tools/testing/selftests TARGETS=rdma run_tests make: Entering directory '/root/Development/linux/tools/testing/selftests' make[1]: Nothing to be done for 'all'. TAP version 13 1..3 # timeout set to 45 # selftests: rdma: rping_between_netns.sh # server DISCONNECT EVENT... # wait for RDMA_READ_ADV state 10 ok 1 selftests: rdma: rping_between_netns.sh # timeout set to 45 # selftests: rdma: rxe_ipv6.sh ok 2 selftests: rdma: rxe_ipv6.sh # timeout set to 45 # selftests: rdma: socket_with_rxe.sh ok 3 selftests: rdma: socket_with_rxe.sh make: Leaving directory '/root/Development/linux/tools/testing/selftests' " Best Regards, Zhu Yanjun > > Zhu Yanjun (4): > RDMA/rxe: Add testcase for net namespace rxe > RDMA/nldev: Add dellink function pointer > RDMA/rxe: Add net namespace support for IPv4/IPv6 sockets > RDMA/rxe: Support RDMA link creation and destruction per net namespace > > MAINTAINERS | 1 + > drivers/infiniband/core/nldev.c | 6 + > drivers/infiniband/sw/rxe/Makefile | 3 +- > drivers/infiniband/sw/rxe/rxe.c | 41 ++++- > drivers/infiniband/sw/rxe/rxe_net.c | 122 ++++++++++---- > drivers/infiniband/sw/rxe/rxe_net.h | 9 +- > drivers/infiniband/sw/rxe/rxe_ns.c | 156 ++++++++++++++++++ > drivers/infiniband/sw/rxe/rxe_ns.h | 17 ++ > include/rdma/rdma_netlink.h | 2 + > tools/testing/selftests/Makefile | 1 + > tools/testing/selftests/rdma/Makefile | 5 + > tools/testing/selftests/rdma/config | 3 + > .../selftests/rdma/rping_between_netns.sh | 57 +++++++ > tools/testing/selftests/rdma/rxe_ipv6.sh | 47 ++++++ > .../testing/selftests/rdma/socket_with_rxe.sh | 64 +++++++ > 15 files changed, 493 insertions(+), 41 deletions(-) > create mode 100644 drivers/infiniband/sw/rxe/rxe_ns.c > create mode 100644 drivers/infiniband/sw/rxe/rxe_ns.h > create mode 100644 tools/testing/selftests/rdma/Makefile > create mode 100644 tools/testing/selftests/rdma/config > create mode 100755 tools/testing/selftests/rdma/rping_between_netns.sh > create mode 100755 tools/testing/selftests/rdma/rxe_ipv6.sh > create mode 100755 tools/testing/selftests/rdma/socket_with_rxe.sh > -- Best Regards, Yanjun.Zhu