From patchwork Tue Nov 5 02:05:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuniyuki Iwashima X-Patchwork-Id: 13862249 Received: from smtp-fw-2101.amazon.com (smtp-fw-2101.amazon.com [72.21.196.25]) (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 3297C1E521 for ; Tue, 5 Nov 2024 02:05:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=72.21.196.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730772327; cv=none; b=j7Pw9Hq8ar6ZUSs4NPmJ0WsDF6uAyBeiWMcDuyVYkSsCqI1nv3h5G3HGde8jCbjG3WZ9ZChGHHSp4h3f8uUOV5kVKM3ig5b56WAew02b7fEInCDNIKNDQsfYS9ADBJJUR/+dyuHi/klucHoQbizo0AyIXITkAzvH5lYn0sR44NU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730772327; c=relaxed/simple; bh=txlNxgiLXkVfwks3OuvbNST+i6qEtZbeMdgsx99W/Ys=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=gg4DG8UaMrqy+5c5hTTsB/x6hv9AhBuMA6HKesjA4LNlOki/QQrQvbqHUAlv686B051O9IyhMM0NS5bkzzJd7bBwtn5d53mo5sihNKJqkfsyOZqkNR0anofb+/iA/P30W0LgEdEKk+SyFHlBR/xhclCI0XwOpr61/Owt9ekpiTs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com; spf=pass smtp.mailfrom=amazon.co.jp; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b=nWs7oqJA; arc=none smtp.client-ip=72.21.196.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=amazon.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="nWs7oqJA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1730772327; x=1762308327; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=I39qd4Jyy4sdCpL/+ilN0noROVpoN7I/DaIuuWyxja0=; b=nWs7oqJABYorAQd0i5z83l2flfw+R/d0oyZ50uwH//mbu7i3H/U6hc3z CU1doh2vuFanKR6ZsQvjE0WG54c3BANrDe6Tn0H6ws9Yd3TTXxn5bU7JV /z7QZsnlVSJp6rH4gpUFH5veDELP1kDu9DV14fS1tBNXoq2vkFSVLHYps o=; X-IronPort-AV: E=Sophos;i="6.11,258,1725321600"; d="scan'208";a="440286927" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO smtpout.prod.us-west-2.prod.farcaster.email.amazon.dev) ([10.43.8.6]) by smtp-border-fw-2101.iad2.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2024 02:05:23 +0000 Received: from EX19MTAUWA002.ant.amazon.com [10.0.7.35:12495] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.13.170:2525] with esmtp (Farcaster) id 427af49d-4ec4-49e4-8657-046433ff449a; Tue, 5 Nov 2024 02:05:22 +0000 (UTC) X-Farcaster-Flow-ID: 427af49d-4ec4-49e4-8657-046433ff449a Received: from EX19D004ANA001.ant.amazon.com (10.37.240.138) by EX19MTAUWA002.ant.amazon.com (10.250.64.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.34; Tue, 5 Nov 2024 02:05:21 +0000 Received: from 6c7e67c6786f.amazon.com (10.187.171.42) by EX19D004ANA001.ant.amazon.com (10.37.240.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.1258.35; Tue, 5 Nov 2024 02:05:18 +0000 From: Kuniyuki Iwashima To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman CC: Andrew Lunn , Marc Kleine-Budde , Vincent Mailhol , "Daniel Borkmann" , Nikolay Aleksandrov , Kuniyuki Iwashima , Kuniyuki Iwashima , Subject: [PATCH v1 net-next 0/8] rtnetlink: Convert rtnl_newlink() to per-netns RTNL. Date: Mon, 4 Nov 2024 18:05:06 -0800 Message-ID: <20241105020514.41963-1-kuniyu@amazon.com> X-Mailer: git-send-email 2.39.5 (Apple Git-154) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EX19D043UWC004.ant.amazon.com (10.13.139.206) To EX19D004ANA001.ant.amazon.com (10.37.240.138) X-Patchwork-Delegate: kuba@kernel.org Patch 1 introduces struct rtnl_nets and helper functions to acquire multiple per-netns RTNL in rtnl_newlink(). Patch 2 - 6 are to prefetch the peer device's netns in rtnl_newlink(). Patch 7 converts rtnl_newlink() to per-netns RTNL. Patch 8 pushes RTNL down to rtnl_dellink() and rtnl_setlink(), but the conversion will not be completed unless we support cases with peer/upper/lower devices. Kuniyuki Iwashima (8): rtnetlink: Introduce struct rtnl_nets and helpers. rtnetlink: Factorise rtnl_link_get_net_tb(). rtnetlink: Add peer_type in struct rtnl_link_ops. veth: Set VETH_INFO_PEER to veth_link_ops.peer_type. vxcan: Set VXCAN_INFO_PEER to vxcan_link_ops.peer_type. netkit: Set IFLA_NETKIT_PEER_INFO to netkit_link_ops.peer_type. rtnetlink: Convert RTM_NEWLINK to per-netns RTNL. rtnetlink: Register rtnl_dellink() and rtnl_setlink() with RTNL_FLAG_DOIT_PERNET_WIP. drivers/net/can/vxcan.c | 12 +-- drivers/net/netkit.c | 11 +-- drivers/net/veth.c | 18 +---- include/net/rtnetlink.h | 14 ++++ net/core/rtnetlink.c | 163 +++++++++++++++++++++++++++++++++++++--- 5 files changed, 175 insertions(+), 43 deletions(-)