From patchwork Thu Dec 5 15:40:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 847966 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2061.outbound.protection.outlook.com [40.107.100.61]) (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 4246E222586; Thu, 5 Dec 2024 15:44:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733413489; cv=fail; b=JRkHVbNi9TJJWHgDyHhJrLVoSydK1RMKQG5rkOjeeVhF7lOYa01YG/KUaJrkav/VzWODHwQICYz9v0T1G9mMo5eCtN96mm1ZVlWTTzGv/yOgUMjGVbruaY7WrcKdxvQRwjo4OYakIcRiz3zBe/mpisZnKDOR0lJxwjhO+bR0svQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733413489; c=relaxed/simple; bh=cVfKjVqLaxBjvU8xsYDqwvrVmkq7fEKbZK6IxdezcGo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=J/l1/N6YLzpAAjdA/9Bjp5VnqJu1k1HHuOiFdW4IcdVlrzBY/VgLwfQDiMj1MPJbGFge1CaZQc2OT5KV9H6Wj5+LoQO/1x2c62lQ1TmeLCR1JOfv0WD/QMI7ppMaV9bOpBEUgt2a38OtmKJvDC2X6IJTOFoE3b8iF9trP0U+ylM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=HEMeELrg; arc=fail smtp.client-ip=40.107.100.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="HEMeELrg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Z0TsGgm9/QeaUVOnh02sm/4ebxRE6jVEzMk7yZDpmuBSYU5674G0zbmGrEz+mcWtdZUUOaN1ntNtd7EtowT8RYRL4+zscnVmgBoXxGN5ID/jyGh7ZnZ1J8ci7fyC+2uYQwTCcAoJi+p8vGI6xx9CMIZP7Cec5gdwNLsBF71GiVcTGVWzvmTZljKjr01Q7cIbB37GTHN8JNnZ/szXtebGfxFsFXwHEWPe0UENU75RZd7HHs5EHVJhYHNnkWwXtvxd2VcypfIJOr8shMsUSaOsIo1dgiTV5XfHXogavwSxT3X/gRCo2LhkhId+HwzflzTcN43fp0VLn38XJSSe2qYtEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DVqdvTshHxNki3bZ3TKLjG68UTcnAHsRVq2A6Gcb6kI=; b=owimIt3fbL2Tbr6k8qr7p/OQTLNrfLtZwbOST1YYkNeEs5NchydMmJJrkYOq9z+prxZrseVD102XCYSjlSQbOBTKRbBU7SNRDgxMXeI1W00EZ3LzwwnFATg48CDR1wi4dZ697ZdHYSYuW79w8cMml9BZrROVG5Oca5YxYG4rNMYbXCVucs7cj71OdGnwDTNeMETnT7dJhJzGzS+s5Yl7/PWPCb/K4ftSKej4njf+He+Zj7/49FTaqvmxFnpvtFfSHscHQflfqyTmMOJeIM7fMm+SrDvt/Sqmrojv00kQ34LRDpux483sHbwCSin1rh8ZXB+dMLzI9kYNlY6EcU6/Lw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DVqdvTshHxNki3bZ3TKLjG68UTcnAHsRVq2A6Gcb6kI=; b=HEMeELrgI/TXrgRTP7tlmzAyeINPJeoa77pDpwEUg6+VZPAx6A73qC4JjTKaiUp8DW6jCclyKFIyigVPECp6onDgMIIuIk2AvxjDdkDjPhhGtRgwqaL3eiMGENPitwCB1MihZKQirhicM37ETa75UbKHBCGXkWPx+NbkYAdYsXSfnITLWj7hCSpJ7E0zeH5S2TG8yJGI9VN0Lq8S3VzQcwU3/Th5UT2UEUDvTcZ3ZZSZJgWoWSFn3IOL+Kms7AFkhsCQsIXffOjPN/5C2qRcfjjlvQom1qTgYbwi3+wC+ZK4Ji3HFow4K0WvscwAXjIdQiaSZTM+cTJ3y9pEY9fOKg== Received: from DM6PR21CA0027.namprd21.prod.outlook.com (2603:10b6:5:174::37) by DM4PR12MB6010.namprd12.prod.outlook.com (2603:10b6:8:6a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.19; Thu, 5 Dec 2024 15:44:36 +0000 Received: from DS1PEPF00017093.namprd03.prod.outlook.com (2603:10b6:5:174:cafe::93) by DM6PR21CA0027.outlook.office365.com (2603:10b6:5:174::37) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.8 via Frontend Transport; Thu, 5 Dec 2024 15:44:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DS1PEPF00017093.mail.protection.outlook.com (10.167.17.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Thu, 5 Dec 2024 15:44:36 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 5 Dec 2024 07:44:20 -0800 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 5 Dec 2024 07:44:14 -0800 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , CC: Simon Horman , Ido Schimmel , "Petr Machata" , , Shuah Khan , Benjamin Poirier , Hangbin Liu , Vladimir Oltean , Subject: [PATCH net-next v2 09/11] selftests: net: lib: Rename ip_link_master() to ip_link_set_master() Date: Thu, 5 Dec 2024 16:40:58 +0100 Message-ID: X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017093:EE_|DM4PR12MB6010:EE_ X-MS-Office365-Filtering-Correlation-Id: 2781b555-79ea-4949-2554-08dd1543b8e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: sKoBhp2z+QS72fEPO4d60fb7IvrJm+cZ5je4cvqsypN40xWOrkisqrjwg/aRcJv27YBJFSH20Fss8SFwFkrybY/jU8osGQYttOz6HfXcdavvSg3oO5EyizOKFmcgwwLnk+xFZsDlq5hGzEWfsIbUv1I9PgxuxvJB3jJL4/I6w4vryPpoTYnAvgIqUaE8tXEXJHhDw31FtARA/SQFdes1C66Qul06qpM6NVdVwz/R84Ij4A2utIRQqCQ/Mw2B+uP9eL5YIxXzSn/Owp1cUIsm8ceHPGHkhG6+OF7Z+Fq8DcIxyGhV9IBU+EdVrFy2auHx0P77mxeq5MGEJpiwkv/RVISaEj48u5DgweRd5DG5nbzX9jxx7VeLpyt4BpSDgGIwqwqGthIWvVCWCv6LV+LrZ5XrVriBd9lYLWQViS/V36OTEC8n0CfYx6TMtoO4vCEmPbbH4sR04i5FPVKBC9xBQEFi2z9cJ/jszG8eMr7K0vidEokzLB+8SPlxnxP+4Lv/nG+RBd/0mcfYM8+f6/jKMXFM04abf+oQq2yTyZd3UFDLpmrUBl3hB+ABeKQhDEsBjBHQauvKAlgolaPnCvPltTq7zc2vDT+ZJJL3pftskj2uIsCIHxvCYxediVl+I3Sp6an2JAJ6nglE0piow/YqkvXOEDcydr65eOHDwY2pU0Jk47LEhHAzh3uneCyBEhgcKW0hCG7C0zTByLfDyNNlvpDNuw1ifP8qN3HZNNl88DJWlqG3LbVuo29dekO9HUiwjNefSr0DyIb06NbeKn0qUASDV2bniTYqDgXJQELQ6yTV576LwASOdC8aBu+2Uo0qPhV5pjPY7Jeom5KjwAtUVPdZpjZgs64jYc7mdJisiidL1ZpOMfuYqZZ2Rl9SEhRQfb2Ocp0IDH+B7ZGKG0KxN571VGtJqU6+opPT877QqIsbWBq8suQzesmhATVEoyTmDlArQnicElioej+sw1CdMAx1OjZR2m7pWkgg2w/Le3IPRU1coelYEWz/M6PtDaAPVTtNByTg1LrAP1QnKE/VZMI8izv6DPNkhwwpgHq/McwRJk3SeODIPZ8eeEpgkeRyxVcQeFwrMUw3AekAvPQG4S9H3rfHFdxXkvOJqGINusNZ1mlw0rtIpaDHjTxbPYrpJk2kVBobaFev3NnWi/kI7TB+ZfqF5wFBj/Srq8C9aWSzHryD2sToeDkjY6SKnWY+5a78mUXmY/SbvkWOeD9vXsy9bqnRr6dIhjZVinpQYy5x1SGgFumhncZ3ZdzIUKztiXmtvQXotuDWGJP8vlIzkWWUtJ2c7kZjomZvLCiTTs489TK4hm0r9u0EaAmEJNApJEdYoARwqGURG+46nGp3Ou9ZWFzlemAN3x0CaSB09Pae7Ke0vRTk8twLoEZdVfxigGdp3W4fyKG1+vqrYlX3SrzSl52LyWJTmMdvhV4XCOdXt7dSYHZSoBdQ82O24d6f X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(82310400026)(1800799024)(36860700013)(7416014)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2024 15:44:36.3736 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2781b555-79ea-4949-2554-08dd1543b8e2 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017093.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6010 Let's have a verb in that function name to make it clearer what's going on. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel Reviewed-by: Nikolay Aleksandrov --- Notes: CC: Shuah Khan CC: Benjamin Poirier CC: Hangbin Liu CC: Vladimir Oltean CC: linux-kselftest@vger.kernel.org tools/testing/selftests/net/fdb_notify.sh | 6 +++--- tools/testing/selftests/net/lib.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/fdb_notify.sh b/tools/testing/selftests/net/fdb_notify.sh index c03151e7791c..c159230c9b62 100755 --- a/tools/testing/selftests/net/fdb_notify.sh +++ b/tools/testing/selftests/net/fdb_notify.sh @@ -49,7 +49,7 @@ test_dup_vxlan_self() { ip_link_add br up type bridge vlan_filtering 1 ip_link_add vx up type vxlan id 2000 dstport 4789 - ip_link_master vx br + ip_link_set_master vx br do_test_dup add "vxlan" dev vx self dst 192.0.2.1 do_test_dup del "vxlan" dev vx self dst 192.0.2.1 @@ -59,7 +59,7 @@ test_dup_vxlan_master() { ip_link_add br up type bridge vlan_filtering 1 ip_link_add vx up type vxlan id 2000 dstport 4789 - ip_link_master vx br + ip_link_set_master vx br do_test_dup add "vxlan master" dev vx master do_test_dup del "vxlan master" dev vx master @@ -79,7 +79,7 @@ test_dup_macvlan_master() ip_link_add br up type bridge vlan_filtering 1 ip_link_add dd up type dummy ip_link_add mv up link dd type macvlan mode passthru - ip_link_master mv br + ip_link_set_master mv br do_test_dup add "macvlan master" dev mv self do_test_dup del "macvlan master" dev mv self diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index 8994fec1c38f..5ea6537acd2b 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -451,7 +451,7 @@ ip_link_add() defer ip link del dev "$name" } -ip_link_master() +ip_link_set_master() { local member=$1; shift local master=$1; shift From patchwork Thu Dec 5 15:40:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 847690 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2075.outbound.protection.outlook.com [40.107.223.75]) (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 BE9EB222590; Thu, 5 Dec 2024 15:44:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733413490; cv=fail; b=IDfIviDP17TZSehP4TOHRARYxE69F9gCzCpME3bqcyPSzMcaEvOQCr6h11gEIC5EKa2OfOxGSCmfwW+c8Lj7u3D8Ftj3ei6+4l3yNutBRNma7KkNyJY1VVV/xui04WsQRcdxxNXnm52rxC1U0e9KxfQVq10indBC5a4n2GAafoI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733413490; c=relaxed/simple; bh=RUmjpS00KQPThj9efFSMqJlPjLPKYyp632VyEJwERTY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IhxVByptLGE95e8kj5fxaenU2EqPWSGdCcCFXeD3AMcuu+TCdmaUVu0NoWnhEg5GCn6smNgeCejyGse9X8W4c1YnrtTr2zC3FSRYa8OJWtUTi0YFr88cTw2bcUOvd0HSC8plO54w1N4jq4karycdNaexvcSrgnki+AFF6f7KpAo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=N6uCRaid; arc=fail smtp.client-ip=40.107.223.75 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="N6uCRaid" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yOQgStL4ud6XbnN453TPVzKtfImBNVPPPiVxkREYUPCt/SYLFBzplYgFH0C6eIHQ4B1Aub2PJ8/vQolf33dx0n/YGxGnk/s6SeOXQoW2Y7s++hHtJTNP6oT1/xKLBjcgZO3GfqHMYX+OZ7KiksK2D0/Y8LESNTM5MLMb3C3axGQB660vVwOHw+z/eN6xlbQ9cB+cDsPpR0AxAg0RC4jEKDoRDrS8cGTmA9CmOOLc5bsX/KrHDKTE+Cgx7JQdW0vAbNc5PM1elGpZ0MuGTzVfUUiu5pcV+Pv/Ojx8ilVezaC0k8e9tS4kkEhHjjyU9JbaVtm3BItDQ1SCp5RoBfNl+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iemher0mO6qrlOQ5kx+Fwf3R18yaGpgpyBN2/v8lXvg=; b=nnmVVVr2yj6GhrIdTt1CQGsx8Dbo4ithvBvzPMnInf9rAhW7ji/YVXqmJhBRsseKLlvLOHQ3W5x4qLrsC06h11NuaXjm+RXGAf+r/JetvZfZZs+IJvGYmm82q05vCxWc6fHx5wlEvzDVUVD1mJFZQQflJ+vXA42HOyxv//zNW3iRVk8RzK24QwOKsDCCRjic5v+SiU+Na0WWxIjcoslgOGoE+L2vP7QZ9utYeY/dWwydvujD1OrdVrMwl4CBvGyPGUnBsNR79qsRipKGtUYc6qKPv/VB8XxAfmXLwWrPla/lFa4Z7aRViSqBnSuNNHRTbgN7V/Q7DBIsaWlD09veBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iemher0mO6qrlOQ5kx+Fwf3R18yaGpgpyBN2/v8lXvg=; b=N6uCRaid4EdFjrIt/xU+YSep6FeaqVFgbSU+DbJZJ/iJlMMMCImx81XKhFgPxSPTrOdTJR8JPfJ2vzFqkZLrz1T12Vqsvr/0pAKWZM/u1O4OMVsaQswPDEZwGhPstRT4BO/MDs4eM7GMD5mCHo9YJirea9waYN+IbNprEulJIdKOPxRtLEyP2GIj76xAWfYMzrfpcR9KBgrPKky6uYj5Do1SzVLUftQ9QRz9QWBwHGQaIZcFSV0P7QnZblccFgsLbqfxsTka9TXF1sh0Esmip5wnwrgN/0e73qbInBBxnJ9Y4waoDynbJUPSQ1bK2hqBIykY1TD4OJemvDGckPz67Q== Received: from DM6PR03CA0096.namprd03.prod.outlook.com (2603:10b6:5:333::29) by DS0PR12MB6533.namprd12.prod.outlook.com (2603:10b6:8:c2::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.18; Thu, 5 Dec 2024 15:44:45 +0000 Received: from DS1PEPF00017095.namprd03.prod.outlook.com (2603:10b6:5:333:cafe::3b) by DM6PR03CA0096.outlook.office365.com (2603:10b6:5:333::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.10 via Frontend Transport; Thu, 5 Dec 2024 15:44:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DS1PEPF00017095.mail.protection.outlook.com (10.167.17.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Thu, 5 Dec 2024 15:44:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 5 Dec 2024 07:44:27 -0800 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 5 Dec 2024 07:44:21 -0800 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , CC: Simon Horman , Ido Schimmel , "Petr Machata" , , Shuah Khan , Benjamin Poirier , Hangbin Liu , Vladimir Oltean , Subject: [PATCH net-next v2 10/11] selftests: net: lib: Add several autodefer helpers Date: Thu, 5 Dec 2024 16:40:59 +0100 Message-ID: X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017095:EE_|DS0PR12MB6533:EE_ X-MS-Office365-Filtering-Correlation-Id: e2144707-998e-46d6-92d1-08dd1543bded X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|7416014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: Dq3aUKywAiUFleFHdZ6MKbdTqJ2GS0xCcjLihnkW6aEI5LzPaOrc9L6421kpiIub5Q0zZoiApMG+LGrm/8H8fqWZrQfCevYCI0X1xmoiNGvDG+Tqns9fr9Pty/3PvPIy33xyxWBY3RFVnJCHg5zwOhU/hXkFUyQWHL+9qGMkaJEUDz9PjnPqG/hs5IbagHUndVQPothp+eyQPkDEwAVG5gJ+XGPEtTdjTUMPUPtowK6GW8G2voRlEUeLOO1t0+xGD1qBGEZ0+KiMxRLMgxmLLQ5b5fTskDqjBrgUPaQ/0cTc7UtEm1D8ulqh1sqoHaLDIHHwNjV7iyOV9Dpi+5rNVJ0xzrnSu/fLfh3vRg8XhcM3mcjlms99Lglen86/z012mF2aMbqkpFxQEWYU74h+VdfjaJ52WKeIK6yNziWItFuE5X/o8mrnuuKyfdtLwkZFBbQj9ZzilipXYmzZKvRrdBkjNwekYBxr2W+TDFyyTpIsiHdp6SfvPTLPVDO5CZJYWoNmfWqlyBkbvpoZYELM1evtYCIM07kCUjhBheGUmG+5csHuE+YqoD1zeqs+aUorjbMHoH0DdurqK4LFk5nUZhaijs+ZjzGT6ulMazfAZY8IEEhw5ejX2s4r/rInLUMoDMh6Yuv7jQd8JRfU7lZ7gNntkhbIWLQNWZrdQ1u35Rbu/VCujoKERtlMndpO9aqzzrPfywPGzEL7V2VKh4+EzXAAAk6WjUFfOhbWzscyMb1IFliLU7m58mVWqXuu5TB7cQw24V5F5uan0wk+WNGDixXpMpXGxSRtLblyQBaYS2/sKsTExti5gJxCHWLF1kAItUR5vNX29+tdLmC+yhiBDRSpi3vB4aCAf2lF+NNH0CmOBts2c2REFSoOwOSwsninSPjzKPyY14D/x2UpNvzKCf+83eURy9u6YpdGEn3ODzVasqTCuHjPohWwhKIxv1t5p8D/f1C64OYiIrIAbsTOZ45zH3/TYjhbCVpYGD6EzArgLXnf7WfL5qB+v+7IODv91jhzOxWrLU1P1DbQTjJ0I4RtIeUtK2PZU/lmBxojCQReagT70qY/cOBuc+CI6pracWYsfmw0CEQLxJg0CC0gDVqd49db9uBEhKF0zTpNj27drdMHhvdiFoxCAE3PTQA4PUs6SinSAqE2/YvlNC8z8S9hZR5Elh+Fh2znNaIVoHCtNhF+++21bB5sqn2aVcI98KSM1hkAK2fWayl8KTEuoBybwegATiBwxmC1/6GXQKNFvaG/0UoqvhO7kE1MuvqR6/XESpE5LAKHfbJ00C4foJSQligKTo2bfE/70swj1o8tk0lm6pxtqBbJfpqG3COzVDnLmviw8XB1C0xrzbSJc9T7IfbC6TigrooFndHOkBqAeyoBI7lfTQkSaynSaHar4HRDmOL6VmU5MEoDcSaTZgeNH3TvoPyMsWfwZFKKZO7OBIK0AUd6ofJu9TBOeVyj X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(1800799024)(376014)(7416014)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2024 15:44:44.8371 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e2144707-998e-46d6-92d1-08dd1543bded X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017095.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6533 Add ip_link_set_addr(), ip_link_set_up(), ip_addr_add() and ip_route_add() to the suite of helpers that automatically schedule a corresponding cleanup. When setting a new MAC, one needs to remember the old address first. Move mac_get() from forwarding/ to that end. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel Reviewed-by: Nikolay Aleksandrov --- Notes: CC: Shuah Khan CC: Benjamin Poirier CC: Hangbin Liu CC: Vladimir Oltean CC: linux-kselftest@vger.kernel.org tools/testing/selftests/net/forwarding/lib.sh | 7 ---- tools/testing/selftests/net/lib.sh | 39 +++++++++++++++++++ 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 7337f398f9cc..1fd40bada694 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -932,13 +932,6 @@ packets_rate() echo $(((t1 - t0) / interval)) } -mac_get() -{ - local if_name=$1 - - ip -j link show dev $if_name | jq -r '.[]["address"]' -} - ether_addr_to_u64() { local addr="$1" diff --git a/tools/testing/selftests/net/lib.sh b/tools/testing/selftests/net/lib.sh index 5ea6537acd2b..2cd5c743b2d9 100644 --- a/tools/testing/selftests/net/lib.sh +++ b/tools/testing/selftests/net/lib.sh @@ -435,6 +435,13 @@ xfail_on_veth() fi } +mac_get() +{ + local if_name=$1 + + ip -j link show dev $if_name | jq -r '.[]["address"]' +} + kill_process() { local pid=$1; shift @@ -459,3 +466,35 @@ ip_link_set_master() ip link set dev "$member" master "$master" defer ip link set dev "$member" nomaster } + +ip_link_set_addr() +{ + local name=$1; shift + local addr=$1; shift + + local old_addr=$(mac_get "$name") + ip link set dev "$name" address "$addr" + defer ip link set dev "$name" address "$old_addr" +} + +ip_link_set_up() +{ + local name=$1; shift + + ip link set dev "$name" up + defer ip link set dev "$name" down +} + +ip_addr_add() +{ + local name=$1; shift + + ip addr add dev "$name" "$@" + defer ip addr del dev "$name" "$@" +} + +ip_route_add() +{ + ip route add "$@" + defer ip route del "$@" +} From patchwork Thu Dec 5 15:41:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Machata X-Patchwork-Id: 847965 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2059.outbound.protection.outlook.com [40.107.236.59]) (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 A41E0225762; Thu, 5 Dec 2024 15:45:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733413507; cv=fail; b=B9oGqoAd9vHZuISdIkXVp/oCCQ4WSSB+lJso9jXuhQCobTakVCbtZRQqWrr6O0/TkTcVBIUyt90ULfMpweR0+a+fwnRzcG0NUdg7E3o2cZHZICm7NkCvhhM23KjWtfT+QLedFM5ARo4g1pABHnuJyn1GEiXm41WRU7Pi+ORBNCU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733413507; c=relaxed/simple; bh=i95+KLcasmBaLOXDbeCg3RBd5J9QMw5Ik70fOPsSSmU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Z3ejEvPkRbUHtE/24117rPT6pOmJE7w9A8G7u/0zIDk/nyhZvdRV+jLoXGjn2/oLGQIS7XYz09COSKlp5VFmmzoiz3DljiuxPxSRq8bwMeWtUG8+GruAefTe4nXlvC1zxrCOZkn1dK+Av6m0V/WPS2BjnpUJwyJkuYVDtosxAM4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=Y7+Nwnth; arc=fail smtp.client-ip=40.107.236.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Y7+Nwnth" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DhdT6WqlE7km2UN6ry2xxF9KlR5y89kHNaonpnbRbrkuF0rzYoR1+OY7TZQHDnbM6pf6bj/Ns4JFOnXcPEOKFKsvWD1L+nl/mDjjjpqWEy8BgHxVR7qJgjGjfjjPO+BBK8j4wai+VfIS1rnaa6Ws1+0RvJuihJU6sEBuFaMb7gncAE6ezNfFskcli9sWDJ8J+TD70Zoa6/KDvbhMsSgdEbLpT0Z84jbX2mz3COFB1yF4F+2ari2V6/zjvIf8XsQnii1AQqkEFunIrh4oLjVVyg5JYWRVqX1d8wxe8/UBJcJcJKRv+pBPur7d4Dwvw8Bq7vjuheFtVlEL/K5UHp+n2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZGaF9TAhee8pq5tjJ8dDOAh0SKzCk8l2bVsDZ+NEXT4=; b=pRmP7+/uMLf43b5OdplX8iCUY7uqdVeo72BqkrkXOxburrUI9WjmLyC16Ggw3cO4Uxfd5myzkpZEUN/aJ/6p3bWZF18MkxCSDG2RrkjdiXRUDfN1VFfBkkDQGb0R1P2LeJ+ubuO4QyTnxRkZv/ZxEPfQLnf2/ASTQ3CiDR2IhNPjrXUW3PD8eXuKFqk7Z9b0MUwEB7sQn49ykFWhCS8p0cIvtQ8/1V3OdbBaSsTRL4KvstUl1C4W2EI1K5AKKXfB6JLxjICZg9qb5nVeAHrcba+Ig5HjT1S5469GiRqgdpY2lo7h5y5MKZfFxqxOc3N9JoPiuQ2FDl+Kp4X69SwWWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZGaF9TAhee8pq5tjJ8dDOAh0SKzCk8l2bVsDZ+NEXT4=; b=Y7+Nwnthfd27FSKhwPmk59kGY3j+kM2HWhbVJPv4ZiA1v/9R5OBoFMuD/CNaUK76ITzS3uNrplguW+LGXaTxr8SlzDyYZutBeVGlW5iWyvLiE85ezrKGgjpwbW7+FzHzwo5q53Ell1JyDAP56znMfWHYhFxG+P9Q+GPm3wmG74dHgHLpjSFRXR6UWZZ87jb0r18p2otQcS4fNw0bUELb97J3hPuPZLKSqBEOS4QdgINjwL5D655LbzKHLTCekX/GEL5YhPoLQt/UqgsRNiluwV2zjbncf7LMaoACGzI2zOkhvBx8qqZM2lee/qB1Cr1hCF+SNdzpZVSSOXOi/JxPCw== Received: from DM6PR21CA0018.namprd21.prod.outlook.com (2603:10b6:5:174::28) by IA1PR12MB6090.namprd12.prod.outlook.com (2603:10b6:208:3ee::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.12; Thu, 5 Dec 2024 15:44:55 +0000 Received: from DS1PEPF00017093.namprd03.prod.outlook.com (2603:10b6:5:174:cafe::24) by DM6PR21CA0018.outlook.office365.com (2603:10b6:5:174::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8251.4 via Frontend Transport; Thu, 5 Dec 2024 15:44:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DS1PEPF00017093.mail.protection.outlook.com (10.167.17.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Thu, 5 Dec 2024 15:44:53 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 5 Dec 2024 07:44:35 -0800 Received: from localhost.localdomain (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 5 Dec 2024 07:44:27 -0800 From: Petr Machata To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , CC: Simon Horman , Ido Schimmel , "Petr Machata" , , Shuah Khan , Benjamin Poirier , Hangbin Liu , Vladimir Oltean , Subject: [PATCH net-next v2 11/11] selftests: forwarding: Add a selftest for the new reserved_bits UAPI Date: Thu, 5 Dec 2024 16:41:00 +0100 Message-ID: <388bef3c30ebc887d4e64cd86a362e2df2f2d2e1.1733412063.git.petrm@nvidia.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017093:EE_|IA1PR12MB6090:EE_ X-MS-Office365-Filtering-Correlation-Id: 79336d57-d4be-4fda-3a08-08dd1543c2d9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|7416014|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: b+EMbThoD009GXhSh5k1XWHutEhJDPVWbUfTrtVhRwzpZrXoLWuYL0y7/yoTFrWiOKap7PK2p58O5P2lwN3D6YgaFpDt7k7rcxLH5YFyq8dR5KkLPHjyDGE8DfqnfHweCHdOvLkC2bP3tAn66XG3ex/fArIS6YwEOIam8S78O1PVe8tm8miakvsK2iargvuiMef6+tzGZzx7oCqJ1YwrLa2PZtyBwNmfB2cNPjFB/3EZCkLw3h6KjbMD+KLg9DCilqzwz3Ql0ltUvemNALVnacuZl/boqw8yV5HXjxOlJmOLMKEG0g5XuCj8vh4vcqu5QkjLvF8ggBmWZTZ6+XR6h1YmshoQ/XusZowz+2AfWbcZwgWLYVNugUOAPEgM/Tav0xJv53pAYUjGZ4Bm45cq51+jvV3oQpRxWBcd6YASwc59fC26LhXepI/CPckgkd+6CyrNRuXJg9oZpdoLTGIczkkIFXSsorsyZu2OQ5STXe78GdI9nt/KExFZVYcIGIdHaMJ5Z1duCIhtH5tefndnRfa3ejPCBpDnviPh01zVXYzEZO6DHUnUX7+HBQSgtgOP+LO1aHDpVFud7AxzM94Hmomw0UmY5LolkVDR+J0T1mQsabEkfusLY/e8FOB0ekQPBJlvBbtMCQw7jqyC+r5vaMEOBCmw8XY8rabInGziTLkMi0eRRMEX8Q0I+BIg5Dcuehfs4wnm7rXchQKux1EBLtA8mDo6ueoBJaKVkBB0pUsJVndk3NBfSBkC9yXrkAvJ2BdluySO8a5hOp/3A92674jBlS6VLpxSGjcrdxNsxcKK6f6vNAA0vGQcX5ZKEHm+3hIlSYMJJnlXG15c3xtA+ZoTt14VA0qT4oj70fVvKiI/Q+wjj/w+27HntjfdrPtXwPLf8w1Itztoj2a2pMWNLmueq7bpnQmzCP02LyTNTFtF/HFog3AamTwo6OUa0IQylBigqZD0GJ41LPPCw8mCUdCvOITb1joPXZNCi4toERgxSFVB5WDKFxZipErRK/szvLoPzMhT3WxYWpx5q37FHzK00bVgAbc7+J88mq9GszxUo12GiCmSC4gYNsM2kOec93nAhRMGsak/EyTEbGMF1ehAt/RDJdVjsSzKciXtGbqUQGl0yvXmgkCtnB/9oXTWNbV9ttinRISwKP9hIvLtAMGg773WuR0mCOLO8dKWl1zOS+xTTzT3PihDDkg37fxjKvtvOprRbOHP6T+Euo6HLoiLeVklz7mr4JTlKXBHBtoXruNPzAVQ/8+LiNp1I/T4Ij3SmnjST6EywSq3bexAmh5QhBzMglCnD12BkYwQkXBTH3/VjhvkoMBX5x/RMX4lKkKEz7ZVZ9RkRUzoSx1rMhJ4+kl03JOw8Y2eO8uRMJnS0DpaJpTYnQuCjPyY3xbxoLGBKFigqEmsZeSV6AAoiSa4UZ2Kn/rds3hZWQP48e6KGk5vSS3qcYknbLuWUXlR X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(36860700013)(7416014)(376014)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2024 15:44:53.0924 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 79336d57-d4be-4fda-3a08-08dd1543c2d9 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017093.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6090 Run VXLAN packets through a gateway. Flip individual bits of the packet and/or reserved bits of the gateway, and check that the gateway treats the packets as expected. Signed-off-by: Petr Machata Reviewed-by: Ido Schimmel Reviewed-by: Nikolay Aleksandrov --- Notes: v2: - Add the new test to Makefile CC: Shuah Khan CC: Benjamin Poirier CC: Hangbin Liu CC: Vladimir Oltean CC: linux-kselftest@vger.kernel.org .../testing/selftests/net/forwarding/Makefile | 1 + .../net/forwarding/vxlan_reserved.sh | 352 ++++++++++++++++++ 2 files changed, 353 insertions(+) create mode 100755 tools/testing/selftests/net/forwarding/vxlan_reserved.sh diff --git a/tools/testing/selftests/net/forwarding/Makefile b/tools/testing/selftests/net/forwarding/Makefile index 7d885cff8d79..00bde7b6f39e 100644 --- a/tools/testing/selftests/net/forwarding/Makefile +++ b/tools/testing/selftests/net/forwarding/Makefile @@ -105,6 +105,7 @@ TEST_PROGS = bridge_fdb_learning_limit.sh \ vxlan_bridge_1q_port_8472_ipv6.sh \ vxlan_bridge_1q_port_8472.sh \ vxlan_bridge_1q.sh \ + vxlan_reserved.sh \ vxlan_symmetric_ipv6.sh \ vxlan_symmetric.sh diff --git a/tools/testing/selftests/net/forwarding/vxlan_reserved.sh b/tools/testing/selftests/net/forwarding/vxlan_reserved.sh new file mode 100755 index 000000000000..46c31794b91b --- /dev/null +++ b/tools/testing/selftests/net/forwarding/vxlan_reserved.sh @@ -0,0 +1,352 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 + +# +--------------------+ +# | H1 (vrf) | +# | + $h1 | +# | | 192.0.2.1/28 | +# +----|---------------+ +# | +# +----|--------------------------------+ +# | SW | | +# | +--|------------------------------+ | +# | | + $swp1 BR1 (802.1d) | | +# | | | | +# | | + vx1 (vxlan) | | +# | | local 192.0.2.17 | | +# | | id 1000 dstport $VXPORT | | +# | +---------------------------------+ | +# | | +# | 192.0.2.32/28 via 192.0.2.18 | +# | | +# | + $rp1 | +# | | 192.0.2.17/28 | +# +--|----------------------------------+ +# | +# +--|----------------------------------+ +# | | | +# | + $rp2 | +# | 192.0.2.18/28 | +# | | +# | VRP2 (vrf) | +# +-------------------------------------+ + +: ${VXPORT:=4789} +: ${ALL_TESTS:=" + default_test + plain_test + reserved_0_test + reserved_10_test + reserved_31_test + reserved_56_test + reserved_63_test + "} + +NUM_NETIFS=4 +source lib.sh + +h1_create() +{ + simple_if_init $h1 192.0.2.1/28 + defer simple_if_fini $h1 192.0.2.1/28 + + tc qdisc add dev $h1 clsact + defer tc qdisc del dev $h1 clsact + + tc filter add dev $h1 ingress pref 77 \ + prot ip flower skip_hw ip_proto icmp action drop + defer tc filter del dev $h1 ingress pref 77 +} + +switch_create() +{ + ip_link_add br1 type bridge vlan_filtering 0 mcast_snooping 0 + # Make sure the bridge uses the MAC address of the local port and not + # that of the VxLAN's device. + ip_link_set_addr br1 $(mac_get $swp1) + ip_link_set_up br1 + + ip_link_set_up $rp1 + ip_addr_add $rp1 192.0.2.17/28 + ip_route_add 192.0.2.32/28 nexthop via 192.0.2.18 + + ip_link_set_master $swp1 br1 + ip_link_set_up $swp1 +} + +vrp2_create() +{ + simple_if_init $rp2 192.0.2.18/28 + defer simple_if_fini $rp2 192.0.2.18/28 +} + +setup_prepare() +{ + h1=${NETIFS[p1]} + swp1=${NETIFS[p2]} + + rp1=${NETIFS[p3]} + rp2=${NETIFS[p4]} + + vrf_prepare + defer vrf_cleanup + + forwarding_enable + defer forwarding_restore + + h1_create + switch_create + + vrp2_create +} + +vxlan_header_bytes() +{ + local vni=$1; shift + local -a extra_bits=("$@") + local -a bits + local i + + for ((i=0; i < 64; i++)); do + bits[i]=0 + done + + # Bit 4 is the I flag and is always on. + bits[4]=1 + + for i in ${extra_bits[@]}; do + bits[i]=1 + done + + # Bits 32..55 carry the VNI + local mask=0x800000 + for ((i=0; i < 24; i++)); do + bits[$((i + 32))]=$(((vni & mask) != 0)) + ((mask >>= 1)) + done + + local bytes + for ((i=0; i < 8; i++)); do + local byte=0 + local j + for ((j=0; j < 8; j++)); do + local bit=${bits[8 * i + j]} + ((byte += bit << (7 - j))) + done + bytes+=$(printf %02x $byte): + done + + echo ${bytes%:} +} + +neg_bytes() +{ + local bytes=$1; shift + + local -A neg=([0]=f [1]=e [2]=d [3]=c [4]=b [5]=a [6]=9 [7]=8 + [8]=7 [9]=6 [a]=5 [b]=4 [c]=3 [d]=2 [e]=1 [f]=0 [:]=:) + local out + local i + + for ((i=0; i < ${#bytes}; i++)); do + local c=${bytes:$i:1} + out+=${neg[$c]} + done + echo $out +} + +vxlan_ping_do() +{ + local count=$1; shift + local dev=$1; shift + local next_hop_mac=$1; shift + local dest_ip=$1; shift + local dest_mac=$1; shift + local vni=$1; shift + local reserved_bits=$1; shift + + local vxlan_header=$(vxlan_header_bytes $vni $reserved_bits) + + $MZ $dev -c $count -d 100msec -q \ + -b $next_hop_mac -B $dest_ip \ + -t udp sp=23456,dp=$VXPORT,p=$(: + )"$vxlan_header:"$( : VXLAN + )"$dest_mac:"$( : ETH daddr + )"00:11:22:33:44:55:"$( : ETH saddr + )"08:00:"$( : ETH type + )"45:"$( : IP version + IHL + )"00:"$( : IP TOS + )"00:54:"$( : IP total length + )"99:83:"$( : IP identification + )"40:00:"$( : IP flags + frag off + )"40:"$( : IP TTL + )"01:"$( : IP proto + )"00:00:"$( : IP header csum + )"$(ipv4_to_bytes 192.0.2.3):"$( : IP saddr + )"$(ipv4_to_bytes 192.0.2.1):"$( : IP daddr + )"08:"$( : ICMP type + )"00:"$( : ICMP code + )"8b:f2:"$( : ICMP csum + )"1f:6a:"$( : ICMP request identifier + )"00:01:"$( : ICMP request seq. number + )"4f:ff:c5:5b:00:00:00:00:"$( : ICMP payload + )"6d:74:0b:00:00:00:00:00:"$( : + )"10:11:12:13:14:15:16:17:"$( : + )"18:19:1a:1b:1c:1d:1e:1f:"$( : + )"20:21:22:23:24:25:26:27:"$( : + )"28:29:2a:2b:2c:2d:2e:2f:"$( : + )"30:31:32:33:34:35:36:37" +} + +vxlan_device_add() +{ + ip_link_add vx1 up type vxlan id 1000 \ + local 192.0.2.17 dstport "$VXPORT" \ + nolearning noudpcsum tos inherit ttl 100 "$@" + ip_link_set_master vx1 br1 +} + +vxlan_all_reserved_bits() +{ + local i + + for ((i=0; i < 64; i++)); do + if ((i == 4 || i >= 32 && i < 56)); then + continue + fi + echo $i + done +} + +vxlan_ping_vanilla() +{ + vxlan_ping_do 10 $rp2 $(mac_get $rp1) 192.0.2.17 $(mac_get $h1) 1000 +} + +vxlan_ping_reserved() +{ + for bit in $(vxlan_all_reserved_bits); do + vxlan_ping_do 1 $rp2 $(mac_get $rp1) \ + 192.0.2.17 $(mac_get $h1) 1000 "$bit" + ((n++)) + done +} + +vxlan_ping_test() +{ + local what=$1; shift + local get_stat=$1; shift + local expect=$1; shift + + RET=0 + + local t0=$($get_stat) + + "$@" + check_err $? "Failure when running $@" + + local t1=$($get_stat) + local delta=$((t1 - t0)) + + ((expect == delta)) + check_err $? "Expected to capture $expect packets, got $delta." + + log_test "$what" +} + +__default_test_do() +{ + local n_allowed_bits=$1; shift + local what=$1; shift + + vxlan_ping_test "$what: clean packets" \ + "tc_rule_stats_get $h1 77 ingress" \ + 10 vxlan_ping_vanilla + + local t0=$(link_stats_get vx1 rx errors) + vxlan_ping_test "$what: mangled packets" \ + "tc_rule_stats_get $h1 77 ingress" \ + $n_allowed_bits vxlan_ping_reserved + local t1=$(link_stats_get vx1 rx errors) + + RET=0 + local expect=$((39 - n_allowed_bits)) + local delta=$((t1 - t0)) + ((expect == delta)) + check_err $? "Expected $expect error packets, got $delta." + log_test "$what: drops reported" +} + +default_test_do() +{ + vxlan_device_add + __default_test_do 0 "Default" +} + +default_test() +{ + in_defer_scope \ + default_test_do +} + +plain_test_do() +{ + vxlan_device_add reserved_bits 0xf7ffffff000000ff + __default_test_do 0 "reserved_bits 0xf7ffffff000000ff" +} + +plain_test() +{ + in_defer_scope \ + plain_test_do +} + +reserved_test() +{ + local bit=$1; shift + + local allowed_bytes=$(vxlan_header_bytes 0xffffff $bit) + local reserved_bytes=$(neg_bytes $allowed_bytes) + local reserved_bits=${reserved_bytes//:/} + + vxlan_device_add reserved_bits 0x$reserved_bits + __default_test_do 1 "reserved_bits 0x$reserved_bits" +} + +reserved_0_test() +{ + in_defer_scope \ + reserved_test 0 +} + +reserved_10_test() +{ + in_defer_scope \ + reserved_test 10 +} + +reserved_31_test() +{ + in_defer_scope \ + reserved_test 31 +} + +reserved_56_test() +{ + in_defer_scope \ + reserved_test 56 +} + +reserved_63_test() +{ + in_defer_scope \ + reserved_test 63 +} + +trap cleanup EXIT + +setup_prepare +setup_wait +tests_run + +exit $EXIT_STATUS