From patchwork Thu Feb 9 07:18:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13134097 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D213C61DA4 for ; Thu, 9 Feb 2023 07:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229615AbjBIHVR (ORCPT ); Thu, 9 Feb 2023 02:21:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbjBIHVQ (ORCPT ); Thu, 9 Feb 2023 02:21:16 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2053.outbound.protection.outlook.com [40.107.93.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4761C4615E for ; Wed, 8 Feb 2023 23:20:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fR4jjdT0mz3uSl4d3oqh8TB8liMIdGtS3RemhzBt1aEHOTwA2bpWBn63kwjH7kBLr3xdhwY0/ZfozYUrMh63cm6Dbh5eaWa6yaBpjKHpRKOYxAcivVNPnmBSGu+/0x4/oAbshf2qGV5qiM4i1Ny2PMxG/uny2RIAemoKvIEKxHqLhr4QKZGHajVgpbYG9wJxlmO/JusqHVwuDN+Ad2O5df6UKvFLyAPjgPKKsCG7OSzHmZGcXjf1jc7PqdYRZZja3ZJYdTAtJ2br9MAAM+OByGBNX8cO+2x1WXa4qFDJSOT1cunH1sGsPQPA5FPgj5rIzGwA+fd+eOnHWmSh47Jv+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=JqHB7dWSGsKpXgwAQVQWWEimvj8FozTynhhfekfxDV0=; b=WJjiPuvJFy/Huo4kABTiP+t7316Ehl3r3D3t3UoaWERyA1Dzm7lAagVOURFSagvzmbmOTIfpzxQk0ZOvBVM0fdzdJ1zaDPzzUJRaU3GBOpn3s54XM9Kwq5LyYQLXBOIC3n6nzVZLZHwsXpv+qbPULUSLeH258LtAlkCZjBIQfdVd9SfwHU1l4s89fH6oLxXykQhdmFm+2IifHErjB9+f96vMLxoCyYIH1rjCV4hhB962AJrgAeGqEES6yLc9Dy/lKw3cSHnYPTB4jRECsnldLmn1a+HDxfR/UFI+mhyrwBBjbwhlyFyPnp40lmzs7/rYWU+HPDlASpAJMGz/Y3q9Xg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none 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=JqHB7dWSGsKpXgwAQVQWWEimvj8FozTynhhfekfxDV0=; b=KG3tMqeZmADTy4PKT8bM+194p9Ko+bhpCrWsbguW/KL8pxBA6IfUYNilkmfYwLG+a9vKyYjK3VMF2/dPRsbn0KSn/3PoLqW8rAEYpLYfDzH2OqIV27xTdAX8TUHiHtiMk82zmNru/Vb7tgxLUDsUoUpZWiSEVhQNvOXCHRpJDSD0iUjrMfidw8jhorPz/CU5AEOi94od0YGv3F5QcPdcNU4ny1WaXeA3825x4SmAslQMIEBC1LNgW+Ry9dqtO5Z1PlFpWMn6TJM+YsfruN5EBSNSH0nPrKPoTYCWEbM456NNIAjDVUGzCDLMrH+YF1g/5J89Ifye3uLnkhV8UugxMA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by CY8PR12MB7755.namprd12.prod.outlook.com (2603:10b6:930:87::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Thu, 9 Feb 2023 07:19:32 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::7d2c:828f:5cae:7eab]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::7d2c:828f:5cae:7eab%9]) with mapi id 15.20.6064.035; Thu, 9 Feb 2023 07:19:32 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 1/4] bridge: mcast: Use correct define in MDB dump Date: Thu, 9 Feb 2023 09:18:49 +0200 Message-Id: <20230209071852.613102-2-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230209071852.613102-1-idosch@nvidia.com> References: <20230209071852.613102-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR09CA0170.eurprd09.prod.outlook.com (2603:10a6:800:120::24) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|CY8PR12MB7755:EE_ X-MS-Office365-Filtering-Correlation-Id: fa04dc4a-bbf1-4cbb-e2d5-08db0a6dfd63 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JFIxnX4BdkUuZKhv0dPB5vRYXRmI4Mxn1M01ByQvPbfq6O54EQZA3KlkKX2N8aoldpcbf2Vl9/GbAUK7MSMaKzR7DdszUxKth6OMX7re/FAh5zlRgLpSA/BFr1aghNmG7QR3TRpz2O5vWBH6qJbQcGj879yVxL+kt3JJ9W2JjffzyakxmwZFG8bKTTFq9r6NF5SJVUKYXySsUQ2LQcedxzpmDz4LUQjUryCnlXBLwNVsln22PGXQSTAaXqiBE3fy0XrUmYT6z4FVRIZqgC7VLp11OHi/YFW6LIzqbyotgUNoCgX/owUWV6YAbpavpViRj75IySO5D75Y2Vg1RFqGqWzuDyKDXZpSxQHOGS70nSDoMdSn2Zh8eQIuCuNA4WI9kgAkyk105keEp5HCl9gldCpIumebreiFlQmV/VZyqImeLhdwjqDlvvr2zeFXnxLFFA/+Pi5ruVT/RGQ31+r7+Kf17MqrypZ53tLVmKJT/Smvfkp4xIiS/jMOaQTzv5I0bFEYIsq29OMKN5RN2kZ8PpfLwnRPEO5tiy7EsONrt38AJYpuOol+PugXeUiO+UfK/5V+gne2cITsyhyJyJ4kY7D024J0PzEtckHb0LoJgpXMvXBRJOQRd5wZrLlPt5XY0wF57fqd64qybw8UKfM91w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6512007)(2906002)(186003)(6506007)(1076003)(26005)(36756003)(107886003)(6666004)(5660300002)(478600001)(6486002)(8936002)(41300700001)(2616005)(4744005)(8676002)(66946007)(4326008)(66476007)(83380400001)(66556008)(86362001)(38100700002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wFuMqOe1WmAT3DNLAxpWW6UcDucIs/Z7B1560gnI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ay7koC1UG2cXsujoG/IEy+kZkmRL6I8w5e28shxEL97PBDJZGsx1I8h4osVumT8JU/dRqDSIobjADaifTomq2HXlli5/dYUUWz3Jz1qdqqOteqNXvIy3F3bDg3qWjSVMZZsu1bwMwWLArmQhOa+N8dghuovuZRNQToPRaCAoLLKlLWf69YNvCMbay3zzDYwm2+SsY728oF47ajqlkqdog16gXnSgmka22ON7ymax8AGLIOnClaf2fpnNcN/7UTXlwf1HhPNYaO73jFN2RXuchpIZTVnCiordf1bciRhW6gI8DaSwn+y7hxlBf+0az98qd0tukVt9LYrJJ+kk/lNcmOOIOZuOpwkc+R6s0NQKpYSeVnVVI7AypElyUjNPg9amYRJKAWOTdknaK7hC0TDjKBYyJs+NNPfCLACwNVie4zqdYGRVZ2MHVH4K4Ky8/AbIr0KavPzPhDYyyOHjzakodnEYz1aAN X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa04dc4a-bbf1-4cbb-e2d5-08db0a6dfd63 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 07:19:32.3514 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: f8D319EcuGQCSjsQ35NHf+u8hSV35PqQdipRi+sxtSyBAKIX5MPjKGNE6PJw1K36Iw4nsstmxA2qKXo3tiHb5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7755 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 'MDB_PG_FLAGS_PERMANENT' and 'MDB_PERMANENT' happen to have the same value, but the latter is uAPI and cannot change, so use it when dumping an MDB entry. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 9f22ebfdc518..13076206e497 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -259,7 +259,7 @@ static int __mdb_fill_info(struct sk_buff *skb, #endif } else { ether_addr_copy(e.addr.u.mac_addr, mp->addr.dst.mac_addr); - e.state = MDB_PG_FLAGS_PERMANENT; + e.state = MDB_PERMANENT; } e.addr.proto = mp->addr.proto; nest_ent = nla_nest_start_noflag(skb, From patchwork Thu Feb 9 07:18:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13134096 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A83CCC61DA4 for ; Thu, 9 Feb 2023 07:21:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229478AbjBIHVG (ORCPT ); Thu, 9 Feb 2023 02:21:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbjBIHVF (ORCPT ); Thu, 9 Feb 2023 02:21:05 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2080.outbound.protection.outlook.com [40.107.92.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEFCB442C0 for ; Wed, 8 Feb 2023 23:20:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cqvzOI7vendGyHE/fPapmHb6IcMUBDcz6MAMcQMTuWqulOUBF82PVUn0ChI5E+YEafKDgHNUuPmTXDwM4N4REVlu6GWWkunaLSCTChROms6VvZLYp4wVsWsZ2F4W5rzFh7lzB2c3UigslbVz0N6moMeK4qjpDjQ2ejz9eiMLulzauvVcnv8qSru26XcbostmHJU1adF0c6lghfgxeAhAAQvg/0K/OPJPYM8xITOKjsh3fClbwAbkwaK/4hp6H6s9Ec4WgogPQ4qmwZkiP1J/zsuMNWymgNmNrS+DOcoW0UIFdzAR0xChrpoucHvv6sRI/LCd3JuyY4jjt3B8mv96JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=H/6+UXKKZ2rpYAaCAv+LG7aAv+9rhlrWlu74D+hcCj8=; b=fq1J/i/gK3P4zKlzRcx7TIV/qu31QrLgHjTXj6Ce36304DUEF0r6GM/fWKeP7iGaajV0/yuE8EZNWAPIA52Bg1X0PdeJp9HvD0p/4UN8kWldIo131XjvIue407BhPnApv+5j1EkrSe0BWmJR7Ju6GDBMNsGk92MV8vimbCavZW23sZBeh8Ly86Zrzu8wG9N5X5NhJGXF5a5vJdxyz061qAX4qW5MKyeQSSjrGhXowzP8Z2YJkw+L70Sy6WtBJav5tssv/53BIDAAAgYgIfJ8fPiFi23luafWVV5M+UgM41IAGvyaz0sfSZWVKvlr7yo7VVGNf+jrFlttOC27m4LxAA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none 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=H/6+UXKKZ2rpYAaCAv+LG7aAv+9rhlrWlu74D+hcCj8=; b=HfvunNxH99N67atjuhvx551EyOJpUK1uV+f3DzMdbo/tmfPcsTWt1WisEHkXyLLzTShepmJ8Ueo1EsBQ3EClXmNjJ0F9eAtpEmOvLSi2qKA/malGa8LcoKMcxyxMvhXjvnER46dSdtkkenyRdAjyHYZARseHdBXCjy7iy0XLaobxTBxMHHvrEQB2nGToFEYaB7oQP/fZmxTlJq7bBmeadrG5s7tDvx/g21U+HuVZ7dG+0y4a2deFEeMV2fw8wsFN0iNU1k36fObxAHcRvaL4ffx/PRFnt6OisMybNBNI+UCsJUE/hBiCQdMMHJwKG0C6oGXEPtKNfSgRAb9Biffgxg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by CY8PR12MB7755.namprd12.prod.outlook.com (2603:10b6:930:87::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Thu, 9 Feb 2023 07:19:46 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::7d2c:828f:5cae:7eab]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::7d2c:828f:5cae:7eab%9]) with mapi id 15.20.6064.035; Thu, 9 Feb 2023 07:19:46 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 2/4] bridge: mcast: Remove pointless sequence generation counter assignment Date: Thu, 9 Feb 2023 09:18:50 +0200 Message-Id: <20230209071852.613102-3-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230209071852.613102-1-idosch@nvidia.com> References: <20230209071852.613102-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR03CA0043.eurprd03.prod.outlook.com (2603:10a6:803:50::14) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|CY8PR12MB7755:EE_ X-MS-Office365-Filtering-Correlation-Id: ebbec40b-6280-4da8-cbc8-08db0a6e05e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j0ZmxB0lpZMVk6nyTCIxl4WbXv8p0nPYteWQmjBqVGYfTz9WXfhUMWxKnw8a+1Nh4Q/gOB5Oog3f+91c6jwhX6L1/5dw39m6hhB8pKTeZEE73T/wy2C/4HaXgq2zGub5l1Cg1rTCYVqX9ORPLn7s/UY1tzIuBgZr47g5silluTB7IY7y91tXvTEJeWPLiUtlK19wFiygFs2mPSZx77Bgi1LU+/nC9etz8sdcJmKPVOK5mE1UrZsHkKo3gMfatvfM6c5MiPcNjSF7OhxdJXksvl6BzJaQ+OjW2O3WBpi7pLnvUnXhQnlOt99R7cSGHuQx8PzPZlpV68+T71o27Yp7dezyE0Y8d4+IDhaRy+iE9vT1o2xuPqDnw96rjzsej8d7s7yPyokkUWzJ5uVGbdFok8UTu46lrymHPveav5VJy8KAoXN652QJnVS3m4tArYQnNFvOTpJjxhBUz0M2Ir9CIzAYEIoBumU3coyXtVhIqmlT0UJyZ48aSrpzYzeVi9wcGQR3ZGMeM4cVAj/C4vp3xwy6+JccqOgk9keGIPDgvAeIobQHmH/MOxOYvOgo0TzW91GweCQZCOpSRtZ3JjvyyrEbV4R7djKMufnmJIs1+qjswub8U56qaEwhzo72i4KaqqssnhSv9hxLATqnF7zcWQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6512007)(2906002)(186003)(6506007)(1076003)(26005)(36756003)(107886003)(6666004)(5660300002)(478600001)(6486002)(8936002)(41300700001)(2616005)(8676002)(66946007)(4326008)(66476007)(83380400001)(66556008)(86362001)(38100700002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VDV+aE2sEKrDGw+sKq7K7dzdTAjvgUBfkrR5DDr1l6klrL7kbAwn24Rq/KAAwygfPXNACrNJoaJmXd6JOEKc5rZbw13fNjF7ysPtKawtlWfYXmytjON/7Pa/RhUSO6cuy64yfLh5BlRmMP+FQeFfcFJ6twi97zbQrsaEU48llGttIk9zrNhDfnGQ5fTbUZiulYfd5ecPnJ4Sw3/ksidLixvQNPE/gtMYKD2gGpq2xkUygbVAb9Z3YYhrF1VA01Cq5PqX9Pe7NgtH/iOq+ndv+4VzCD/dt3RkO9gxzpCW+TsKEUdT1wH6N+QJC1j3Vo6F03rD7Lz3kbjXGGr4+Tse1qwW/NrDBDxCDMuw6eglmIfjc9lM/7LdfetxGIx1mUxNLmZ3NdxiGmJyGymx9Z56/iOfUTsyhAQX8H9+IE3bGsqrRhM4++40sB/eZQ6MWdbcoy3c5qCgBRt7aK/P0yjdt6Vvata/fTmnD5LGZyzO3/Ud8WhY4L+SUreFtXZEsKrjAzsOMGLcaMJU3nUx+oqVUAXJ/ryFg1mJjU0XpwM9ehoj/dN3QM7RhC26FfA40wI27QTMd9Kv9tcO//2fiAFByMYQHxYxIwe/hCLYLzLsnU2I+sn6aRcg8OT8Ft85iNSeqjyzgpqnyq6ux1eZo7XaU9m/EHfJy5FQCoy5t8zqHNUdKNCAZnhpD9f+CmtzNlI+ky2tBOkL8e3w2sMvg9IvY/3H90gT0kRCjDFnKSUmPEX9XX+2kOR0BV0sy6omqT1I0dtmrROwDY67EoXfV+4Ms6qbjHfuGEg7QV7u9K0bW+qBQmcRQ1MztQTjetON8h7gN9JMY9YaVPGSxb8kO0ccdp40xVF2ZLWJKGPT/+xoRIwMD9zE6sNXUKmFpRQrQ2ap3m61KCZcSpVcVANS5dbFOObRK6Z3R613xAua+XS8fw5K6tREE2H83JVqs1wY5avL7jREiE3lBGbidUr//1LgOjUlFaAmSvNE44ABglxPG7RBLz2DAxWcQDmyyIAQ0O0xRkfXQ2QbFm3nQ7xQ9fzTlAyPu1gEBP38XDEzSMRzcmCDt3GkX/dovNED1Ejxa/z1S/iASPQgKEWtG+xVgA2f5WjOpqbOwIlg9stqKYwICVvzrU+0SUMJoQGGZdEH9Av7za+yT7wUmh3uyFj+LePnJ4b5RYFZ58uB8Ek9JW4WTkM8cAeLuEJv/b7rPStNDxJxXogfbh7TC+UyUJR2tNfUa/S8B1zLspwuwTEBkm62qSSlXuRUn9hJ+6nG1KIR0AjeUQ6BZxZiNcZyn8CMwiNrL04ZhsSgSZBh/XZOFtob9URSj8P/iCxy8WO+MTSIaOMVp6SOETRTLiXzXZsjQNMMLGlmP8apq+1itCgFnkEPYZ8eUaJ/coBIKHV+UC8JdgFnZi+yxpw9tgpsLjjDLSvWz34JcRnhw8JYbWoKib203bARiK7Wz2bcVMwjrlDrTTxrNxBskwx6IEffM5NFKRfjDoMYkzN9D7kn77zx9Q0O8htHn+SS8vkDinjwso5Sc0PX+uxCs13S5dy08jJ/3lM4BEObgxaNjrM9HxjPeDUIQnki0c0xI4i88ddpu/23XBC4 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ebbec40b-6280-4da8-cbc8-08db0a6e05e9 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 07:19:46.6195 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +XoOmWf6BIkyI01Q57FRx55vdCh6Kmwh1zw1C2AIOuyrQWxCYeQBcIbh9gJiAuyV/Fd0sTR7TatLcPeHY+E0Cg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7755 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The purpose of the sequence generation counter in the netlink callback is to identify if a multipart dump is consistent or not by calling nl_dump_check_consistent() whenever a message is generated. The function is not invoked by the MDB code, rendering the sequence generation counter assignment pointless. Remove it. Note that even if the function was invoked, we still could not accurately determine if the dump is consistent or not, as there is no sequence generation counter for MDB entries, unlike nexthop objects, for example. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 13076206e497..96f36febfb30 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -421,8 +421,6 @@ static int br_mdb_dump(struct sk_buff *skb, struct netlink_callback *cb) rcu_read_lock(); - cb->seq = net->dev_base_seq; - for_each_netdev_rcu(net, dev) { if (netif_is_bridge_master(dev)) { struct net_bridge *br = netdev_priv(dev); From patchwork Thu Feb 9 07:18:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13134098 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE07BC61DA4 for ; Thu, 9 Feb 2023 07:21:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229813AbjBIHVh (ORCPT ); Thu, 9 Feb 2023 02:21:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjBIHVa (ORCPT ); Thu, 9 Feb 2023 02:21:30 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2080.outbound.protection.outlook.com [40.107.92.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 835E73C06 for ; Wed, 8 Feb 2023 23:21:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LGfdp4Ryl2rxLCWOxeaVNfJJd0J9szSpy/WAsjoHEBNjgffViJn6KSrDSi7bXPGMun+BMHtYP1AL1BaOVBkkVUXdb+2VwPhEFSJ0y1vfphWppK1VgGE5Qs67DDjlG2uRpBpbxTD+p0hogXuUqZAYbEEuSzM2h0uOgxcb+bzNwktEfUxlrJTO6rO/bYmZFxUA0Bd2CZstLfJUyNwQrzpFQMRgnQjbjF6Zl3pjWOK/uo9BC8J1ClluRk4LA110Pph7/gzAHn2zQrAKB652k4AooQZuANlLqgUVoWpiG3P/sk6zQQA/tE40wGBXs7hqGTL6T5S7KnRnPMeIitiivL4OUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=/MSdRyowfkz64UV5rptMDYknkdbhAubmzsGyfZQhTjc=; b=OyZx12Hz6sDvzXYG5xBF94zqwEXiG/Cm4HFb47ORuuJfIGDceF/dTxZxsof00NljmNvWbpmu8n+TqVpKaQ8MulS7QhwCNe3Wnxk+cY4jAB1+ZY4gD0rZ/uTsg+rCaur/C7ls01KCnpM7M0HBstT8pkqI+BijwRaTRr2kMA29aEbWwgabjlMrsWBI4oej4c3BewON9VvE/GV8V9ZFGHeOrsvNU1zcWnn+SyU/4RJDDYAvrhuC0a8pvSxhkLxrh5fcFxdBaee3s3kKZ3aZ9pdAkIsvi0ItYhUxlWSrKULsFbP7sjgrt1xnUIB5I8mK53saASACoRuitMKOo8ijO3BTag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none 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=/MSdRyowfkz64UV5rptMDYknkdbhAubmzsGyfZQhTjc=; b=X5gW7BrGW/1gZMJLhH+AenkL4DG7Gh4A7TVvM2QFeG1kLx6xYvYfsw9yzR4lEaw0WOCBzoN9t/viPt2b6bcCCJUrewIxGad0crBYuUp7fCXbAtwUc2WbcSIZ85q2lIdShptwKb6htD0hXND2Odz6P4kMpfTd7OG1TtwyroopWKiFHd3Lz21Dtr6Cws2cglO1D0SyVrcd0nb79IqEGtSYguzXDVJC8abAeJ8oM/1z02R0gE3nne67puwYU7M1WDym4d7jcXsbLbI1hueHnzoThc5AQ4ZCY6gsd6eRkvyykXPW59z2Io61SY9KSRHpIJNVWeD/C/dtxALrM7ZoMcgqmQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by CY8PR12MB7755.namprd12.prod.outlook.com (2603:10b6:930:87::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Thu, 9 Feb 2023 07:19:53 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::7d2c:828f:5cae:7eab]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::7d2c:828f:5cae:7eab%9]) with mapi id 15.20.6064.035; Thu, 9 Feb 2023 07:19:53 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 3/4] bridge: mcast: Move validation to a policy Date: Thu, 9 Feb 2023 09:18:51 +0200 Message-Id: <20230209071852.613102-4-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230209071852.613102-1-idosch@nvidia.com> References: <20230209071852.613102-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR07CA0248.eurprd07.prod.outlook.com (2603:10a6:803:b4::15) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|CY8PR12MB7755:EE_ X-MS-Office365-Filtering-Correlation-Id: d1caac1b-d298-4c81-64bd-08db0a6e09b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YtQzuHj+2UqHE+SDsBNS88TTvYZGR8Auu6+Fk+M6VKykb01UkIgutR/7bP3mcPd4iBAlZL3FNYx6VO9YqVfkBW9vQfa9Q2cuLjKxdlIUbbuYEICQzQTjXP0gkN2L8+Li54VM933/VDcVRvTAA5t9DNkQLIm94WpQIEbAJEH1yLTEX2P3i8e1R1I6NU36g8qN9niLyNLWMdQzG1hVqBX04Kp4kjtDWkP412i6d0f0AQhPSiFLE3WAWY73R//nd1UBE0ffRPXps6v5pHXjFHuiXoYxNi9hUXrlaBSbQTmRr1J8dvQ6/J4E9irKzkyurfmqotIkbo6v+sh+0lvS8gt62jCzrVVyEVrTXMpNyNh2b0eFlzQgLCDAy+H+hMsB06UTmcmS5d9ilLnd9IT3wIusMHu6PhzPdNzKezpbJHakL27OYpfrhQH9tg92TqPheetrmkF067UJ+3gSahoH6KvAYmK5E9X9eokr/TBCe2OciQKfyAo2OK5VRdDpA/f6ft1ob/OMHHXYWmD/0yESJxvB+ZTwH4fqiRZQQMYhL7rXJGj0kn1ooS09shRIGcqEfAs2SajD7KTL6eKHPXUImZ3JxKkcsYK+iQ572svQyBg2+ZeFKnlSTIjdttBqpd/LlkT+N1dcx+oUHFyr62a1tttxcA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6512007)(2906002)(186003)(6506007)(1076003)(26005)(36756003)(107886003)(5660300002)(478600001)(6486002)(8936002)(41300700001)(2616005)(8676002)(66946007)(4326008)(66476007)(83380400001)(66556008)(86362001)(38100700002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rnGhdm5IoxKH9SyYnZRZwtaLErs3trOgzvWyn/hIEAeNpkEhxbKDhLGJNU2F6pN8BiK8jU4p5hLBaernzA1Ukz9VkLZOOM2eDMgvALS0+i3rrd9LtCZR2535wE7fv+lNPG6HyQv+rNVFNEoq3KFmm7QwO6M6s2x8RUgphkzkvbocPTHI0spNEQJ4NiyxGMQbSsyaVx99vlQBnSyGZ7Z2MrC/78PWXGJ4Jmbq804tAYYhlMYTWWRiSc1j6wvH5mA6tnBHWwfOzr7uRBDzXuwuiWVStB0A+WqpR4o0sDKHlgz9B2rV8bqxIcnEv5Xj5Pyef9BKz1Xbk8PYJUh366+WyGb8Qbf6ENgOoDjwbPKe7OSK3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YUrtFUhNKOUVXnWRd725E6yZvEgcyADEA2hkJYNk+iRHem2BaRdhPxDbI2ugCgx6+SxjTdpusoO3c0oXDjc4xGSsvZpuLuhK7YpWb00Nl8HboRsT0zKAV/nybUNOeFk3Ur3N7CBCogHlnQBfvaeqRER7n4ZtddngAe X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1caac1b-d298-4c81-64bd-08db0a6e09b4 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 07:19:52.9648 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5BlfZeNCSamZTEll8Wrtaqx5OxI/qd+ZCNqfGDOoWzl5docpslyoOCXW4SUerUS9vOjf6zltF+RJhQLZjJqM8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7755 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Future patches are going to move parts of the bridge MDB code to the common rtnetlink code in preparation for VXLAN MDB support. To facilitate code sharing between both drivers, move the validation of the top level attributes in RTM_{NEW,DEL}MDB messages to a policy that will eventually be moved to the rtnetlink code. Use 'NLA_NESTED' for 'MDBA_SET_ENTRY_ATTRS' instead of NLA_POLICY_NESTED() as this attribute is going to be validated using different policies in the underlying drivers. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 96f36febfb30..25c48d81a597 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -683,51 +683,58 @@ static const struct nla_policy br_mdbe_attrs_pol[MDBE_ATTR_MAX + 1] = { [MDBE_ATTR_RTPROT] = NLA_POLICY_MIN(NLA_U8, RTPROT_STATIC), }; -static bool is_valid_mdb_entry(struct br_mdb_entry *entry, - struct netlink_ext_ack *extack) +static int validate_mdb_entry(const struct nlattr *attr, + struct netlink_ext_ack *extack) { + struct br_mdb_entry *entry = nla_data(attr); + + if (nla_len(attr) != sizeof(struct br_mdb_entry)) { + NL_SET_ERR_MSG_MOD(extack, "Invalid MDBA_SET_ENTRY attribute length"); + return -EINVAL; + } + if (entry->ifindex == 0) { NL_SET_ERR_MSG_MOD(extack, "Zero entry ifindex is not allowed"); - return false; + return -EINVAL; } if (entry->addr.proto == htons(ETH_P_IP)) { if (!ipv4_is_multicast(entry->addr.u.ip4)) { NL_SET_ERR_MSG_MOD(extack, "IPv4 entry group address is not multicast"); - return false; + return -EINVAL; } if (ipv4_is_local_multicast(entry->addr.u.ip4)) { NL_SET_ERR_MSG_MOD(extack, "IPv4 entry group address is local multicast"); - return false; + return -EINVAL; } #if IS_ENABLED(CONFIG_IPV6) } else if (entry->addr.proto == htons(ETH_P_IPV6)) { if (ipv6_addr_is_ll_all_nodes(&entry->addr.u.ip6)) { NL_SET_ERR_MSG_MOD(extack, "IPv6 entry group address is link-local all nodes"); - return false; + return -EINVAL; } #endif } else if (entry->addr.proto == 0) { /* L2 mdb */ if (!is_multicast_ether_addr(entry->addr.u.mac_addr)) { NL_SET_ERR_MSG_MOD(extack, "L2 entry group is not multicast"); - return false; + return -EINVAL; } } else { NL_SET_ERR_MSG_MOD(extack, "Unknown entry protocol"); - return false; + return -EINVAL; } if (entry->state != MDB_PERMANENT && entry->state != MDB_TEMPORARY) { NL_SET_ERR_MSG_MOD(extack, "Unknown entry state"); - return false; + return -EINVAL; } if (entry->vid >= VLAN_VID_MASK) { NL_SET_ERR_MSG_MOD(extack, "Invalid entry VLAN id"); - return false; + return -EINVAL; } - return true; + return 0; } static bool is_valid_mdb_source(struct nlattr *attr, __be16 proto, @@ -1292,6 +1299,14 @@ static int br_mdb_config_attrs_init(struct nlattr *set_attrs, return 0; } +static const struct nla_policy mdba_policy[MDBA_SET_ENTRY_MAX + 1] = { + [MDBA_SET_ENTRY_UNSPEC] = { .strict_start_type = MDBA_SET_ENTRY_ATTRS + 1 }, + [MDBA_SET_ENTRY] = NLA_POLICY_VALIDATE_FN(NLA_BINARY, + validate_mdb_entry, + sizeof(struct br_mdb_entry)), + [MDBA_SET_ENTRY_ATTRS] = { .type = NLA_NESTED }, +}; + static int br_mdb_config_init(struct net *net, const struct nlmsghdr *nlh, struct br_mdb_config *cfg, struct netlink_ext_ack *extack) @@ -1302,7 +1317,7 @@ static int br_mdb_config_init(struct net *net, const struct nlmsghdr *nlh, int err; err = nlmsg_parse_deprecated(nlh, sizeof(*bpm), tb, - MDBA_SET_ENTRY_MAX, NULL, extack); + MDBA_SET_ENTRY_MAX, mdba_policy, extack); if (err) return err; @@ -1344,14 +1359,8 @@ static int br_mdb_config_init(struct net *net, const struct nlmsghdr *nlh, NL_SET_ERR_MSG_MOD(extack, "Missing MDBA_SET_ENTRY attribute"); return -EINVAL; } - if (nla_len(tb[MDBA_SET_ENTRY]) != sizeof(struct br_mdb_entry)) { - NL_SET_ERR_MSG_MOD(extack, "Invalid MDBA_SET_ENTRY attribute length"); - return -EINVAL; - } cfg->entry = nla_data(tb[MDBA_SET_ENTRY]); - if (!is_valid_mdb_entry(cfg->entry, extack)) - return -EINVAL; if (cfg->entry->ifindex != cfg->br->dev->ifindex) { struct net_device *pdev; From patchwork Thu Feb 9 07:18:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13134099 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C5F6C05027 for ; Thu, 9 Feb 2023 07:21:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229700AbjBIHVp (ORCPT ); Thu, 9 Feb 2023 02:21:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229784AbjBIHVg (ORCPT ); Thu, 9 Feb 2023 02:21:36 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2053.outbound.protection.outlook.com [40.107.93.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C01151B33C for ; Wed, 8 Feb 2023 23:21:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZElNje04JlVFxNNKbLtUHy629x0ntFhf4qARLCKS2fiu1H+yXjKPH5PFjwShG5hLTNEdcJYryPxOhHlZ1nTBSLyrOFtMOpbOq96jZb52DyxO+s2kPDEaSwrQoPP4sByg9mVoOPG8QXMnzSagjUwUCTcGs47P6KohjERXhUVTK3cjHlj1kXKAk7U/o9ahbXwIICZtgCuNuPeWLPhd8x9xiolSTI/f+dJpiaBfVqJoal+E1OUO3hY6mY1m0bM6y6eadFuG3gq7h+w/rm2XQm5oK2AqN/tpYN+ed/GCpFDPYsRKmoxtGZTkG6jDSgymaBbnxrRdkdeh2zCaYL2jwpGKBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Ma0lMYhmkgsFbsPUuCcNQ33R7PVCiMwdt8Gw3JCvLBw=; b=ikP8ce07O+1bacLbjkg3rKTPDKxix1i9eForscfs38rXw3C9LaRunJLZEAyul7UJkcVJETDVZ2bKMNRw406vUzw+gozVsPnYumlR0N6qGFLwTXiF8m2olXUQeuIvvqTsXMCrp+5gPnI3f5FBxjLyNvZnUK0UuLrRQJ1xaW94fmnbbE3UpfFn2Ukpi5mcti0onIMzMalIftj0Rj0p7lLH6rlFxDgxIhEcEfUdsRKHIC99oM2/lkj96nKRFVOiy+YkGkDhyrDyaNHyHeD0o+a9ujYNiugMXvFRFLTxw/KA0DKmrHXjENKhZkGW7MhuqDSIvBEx1Aq0dU87K+T8ZxBa3Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none 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=Ma0lMYhmkgsFbsPUuCcNQ33R7PVCiMwdt8Gw3JCvLBw=; b=MFLFd+7TpokBjGiqzXgb5kl0echq8+d5Bu55ymy29FUxCS2dkPN/QfdM16U8ptkEJImMXlOGOgRmE8cDrr/Wjy75XfVeQrfLvYnOmIEDp8H17deuuI9OsBxlhLO00cxvZNEn2pSWrccEqSeURKLF8P+sy+Os837mvFRjzlP5Za/jj34SzFb9j3GjPPNWs4Kv5MajLUoYcJeY7p9d7tChGxGFascRpoLJNK9Oi2XFsUNZg55KzMwwHgmeIU67Hkoci/hQXaqno/6tkniSPe/urDrE4ktAPXQ/uBswGJAMcJYpu5yoahdCW11rIIGoy/tTqxuX9Vl1MIW9qcQFhsNP0w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by CY8PR12MB7755.namprd12.prod.outlook.com (2603:10b6:930:87::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.17; Thu, 9 Feb 2023 07:19:59 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::7d2c:828f:5cae:7eab]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::7d2c:828f:5cae:7eab%9]) with mapi id 15.20.6064.035; Thu, 9 Feb 2023 07:19:59 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, razor@blackwall.org, roopa@nvidia.com, petrm@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 4/4] selftests: forwarding: Add MDB dump test cases Date: Thu, 9 Feb 2023 09:18:52 +0200 Message-Id: <20230209071852.613102-5-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20230209071852.613102-1-idosch@nvidia.com> References: <20230209071852.613102-1-idosch@nvidia.com> X-ClientProxiedBy: VI1P195CA0071.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::24) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|CY8PR12MB7755:EE_ X-MS-Office365-Filtering-Correlation-Id: fdcc49e4-da08-4206-3443-08db0a6e0dc6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vAZaRuaDh7IOHdwin6UDQ8KvTiZ79nZXNKhv1fuxeUoAXjaX88rJ5ZbugoNmCqeIYqbA08Ib6Is6L1O/6HeDH8NVNj+BoX6Xna4DTciComyI8A2lWRrVlbc3PdR+8wvKyXYtyWIk9haHhVrcvDdQmW6mhRHSA9K8k5EoA/VT+5HMh2NCGNk4N9u6JIeUqCrzBjTICEJCi7Rfss2NZl1nhJrJ0OYyOmUZZ9ViZEaKNtb0tmJpWlKhz/kgb2g8zZABCpvkxN5nsmQ3lrTEKIm5i4SPdC4BhSRkGOjJ4c7GhDAD7swDfb5wTfvE8cRNvVDyC/XmvfkP3lxRjldPEp8XmR95yCmZh/Vqnbewv+VmF4Li5IintGHEcv41B/Rs4eWip8GT04HCD60l7q2erMAM7qYuv75KB2vBYFpLW4MNwKL0ONOmEP+We4tX/87cQF0JinYplB63I4Cxy/yllgknCU8a/VL/hb5nJP8pQ4uTa5Ue2kubg+7ABdXlCRWrEtjJcPXQcl/z2jckq5UVVWVYad1YKA5d3pE57IuCtkAvknWRl/IBvfvW7UGWE5rL46gSv8p2lF/mrb0aZKNXFfnmusSrSt4j72TuPFJCr0/n1olYhS3AyMYRxw4SYJ0rMCs+LgCmEGwC/fOeTevnJQdHxA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199018)(6512007)(2906002)(186003)(6506007)(1076003)(26005)(36756003)(107886003)(6666004)(5660300002)(478600001)(6486002)(8936002)(41300700001)(2616005)(8676002)(66946007)(4326008)(66476007)(83380400001)(66556008)(86362001)(38100700002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mX1QtRU2JgQJmkDz0VLX829l4/KDJ4jkDA1xjqzv6nPZPHXzKgOJOe7sLL1HIylFAmIppGlgbrWIr0ApMm0KHa+kEWfVBaQnuMq/6ACLlG91CTpgZy7eJCw582E0j6Fe0wV/huo/69NzSY1RcvhevMlwIgtfEfsQLtn9DOJX78ZoiaW385w+ReA+io3ey08dfCHq8qAWswjoz5EakJfrzPWHSIUDphdtyYXEei5GgrvErQAKseAeB1sXOCTFP/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TnmZvFfc5FJdfGhXRtPXXM+biC+PpZWhUZMsB5ZTuv4mDorSYmqAhyoSGMuRWYinyIwTYx5catMjX+w70mC7W62HJZuv9TwkKdzR56DNy7AF8OhWixumbO3Q4XQ7zajX94qDYEtcMo9IbXN4WwQ9APnk3Dc+SRnYI7ilHRzOWoWlQWTRgW8BWGd+bpXPRzGfQu46OD82bxoPIVDhmmP39ooq8gn2S3JCQplQTHdCgkesn8ezFKGZfIbsIao41bDq6C53R8tIAsBwXd X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: fdcc49e4-da08-4206-3443-08db0a6e0dc6 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2023 07:19:59.7924 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Cye9b4MjBKnBvwOV7DSEXWqm/xRcPYwdoaogzZ+Dit0q8pWVY32EtNNFkIjQkLaL4R27oJjiy5MP477sjB3tfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7755 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The kernel maintains three markers for the MDB dump: 1. The last bridge device from which the MDB was dumped. 2. The last MDB entry from which the MDB was dumped. 3. The last port-group entry that was dumped. Add test cases for large scale MDB dump to make sure that all the configured entries are dumped and that the markers are used correctly. Specifically, create 2 bridges with 32 ports and add 256 MDB entries in which all the ports are member of. Test that each bridge reports 8192 (256 * 32) permanent entries. Do that with IPv4, IPv6 and L2 MDB entries. On my system, MDB dump of the above is contained in about 50 netlink messages. Example output: # ./bridge_mdb.sh [...] INFO: # Large scale dump tests TEST: IPv4 large scale dump tests [ OK ] TEST: IPv6 large scale dump tests [ OK ] TEST: L2 large scale dump tests [ OK ] [...] Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Acked-by: Nikolay Aleksandrov --- .../selftests/net/forwarding/bridge_mdb.sh | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/tools/testing/selftests/net/forwarding/bridge_mdb.sh b/tools/testing/selftests/net/forwarding/bridge_mdb.sh index b48867d8cadf..ae3f9462a2b6 100755 --- a/tools/testing/selftests/net/forwarding/bridge_mdb.sh +++ b/tools/testing/selftests/net/forwarding/bridge_mdb.sh @@ -742,10 +742,109 @@ cfg_test_port() cfg_test_port_l2 } +ipv4_grps_get() +{ + local max_grps=$1; shift + local i + + for i in $(seq 0 $((max_grps - 1))); do + echo "239.1.1.$i" + done +} + +ipv6_grps_get() +{ + local max_grps=$1; shift + local i + + for i in $(seq 0 $((max_grps - 1))); do + echo "ff0e::$(printf %x $i)" + done +} + +l2_grps_get() +{ + local max_grps=$1; shift + local i + + for i in $(seq 0 $((max_grps - 1))); do + echo "01:00:00:00:00:$(printf %02x $i)" + done +} + +cfg_test_dump_common() +{ + local name=$1; shift + local fn=$1; shift + local max_bridges=2 + local max_grps=256 + local max_ports=32 + local num_entries + local batch_file + local grp + local i j + + RET=0 + + # Create net devices. + for i in $(seq 1 $max_bridges); do + ip link add name br-test${i} up type bridge vlan_filtering 1 \ + mcast_snooping 1 + for j in $(seq 1 $max_ports); do + ip link add name br-test${i}-du${j} up \ + master br-test${i} type dummy + done + done + + # Create batch file with MDB entries. + batch_file=$(mktemp) + for i in $(seq 1 $max_bridges); do + for j in $(seq 1 $max_ports); do + for grp in $($fn $max_grps); do + echo "mdb add dev br-test${i} \ + port br-test${i}-du${j} grp $grp \ + permanent vid 1" >> $batch_file + done + done + done + + # Program the batch file and check for expected number of entries. + bridge -b $batch_file + for i in $(seq 1 $max_bridges); do + num_entries=$(bridge mdb show dev br-test${i} | \ + grep "permanent" | wc -l) + [[ $num_entries -eq $((max_grps * max_ports)) ]] + check_err $? "Wrong number of entries in br-test${i}" + done + + # Cleanup. + rm $batch_file + for i in $(seq 1 $max_bridges); do + ip link del dev br-test${i} + for j in $(seq $max_ports); do + ip link del dev br-test${i}-du${j} + done + done + + log_test "$name large scale dump tests" +} + +# Check large scale dump. +cfg_test_dump() +{ + echo + log_info "# Large scale dump tests" + + cfg_test_dump_common "IPv4" ipv4_grps_get + cfg_test_dump_common "IPv6" ipv6_grps_get + cfg_test_dump_common "L2" l2_grps_get +} + cfg_test() { cfg_test_host cfg_test_port + cfg_test_dump } __fwd_test_host_ip()