From patchwork Mon Oct 16 13:12:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13423208 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 DDA6727739 for ; Mon, 16 Oct 2023 13:14:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Giqp2HTM" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2058.outbound.protection.outlook.com [40.107.94.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B969AB4 for ; Mon, 16 Oct 2023 06:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fgauorbv0A3gR6xK7aGKFPbOuAvv4syzoFmq3T/T7EUFezVeQEzySTg+P6AhzP8vqJis50TytNcKemEdhETieFxFyl5tYL35oNUE30JsFnETExYB4iHbA00WZzoUmYkqCloogpSu9kdnXNA8XeUnPaoY0Lg+BPRpz8uLGeoJZVB1GtC643O4m/wXxNrZrdfwNY2idOPM7zwNSnXbdo9HdVlzzNtBR7dznTxRsGp+GUBsn50Dd9nCk6HyofS27KRj8+TA6hCUOWT2k2gq3wGdfVb5zqgXlC3EG2T59XpOSVOk/7DEfdnR78VgeLYcN1N9BJGVSF9SDJZlFoWmL/dbXA== 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=bscAPYujcdnifDVSY+NWRcPRixs9E7L/psZwgzJNN98=; b=VVfPcASvzmm9SkUbulIUrxcOI4CAOJKHTmU0zHNbFLUFPnIH6hWJjN72lGaLLBJ1yVrQ9duTTDtkWmYiSIyVoHZD8DOYxyjq2VTnX3fY9IT9/aabxCpkt7YMVuD4rE1rT60gM58ruhzh12ywmZmsOWAXH1Xzza0a8EDkRnJwgT4wztPERLz13qnmTqTuiHGkgRSlkKcyFhJpD8PfQrVh8Lp3FU8Tu6ke4EURxgQFPPZSoa/WGocB9lrzzMJmRH4F378AXLWvPRKLaKFRCAL7KCM+GdmKrveAWB2FWkQeLvAtob/4Igf5PTp5iDFYNoOWxgX741nxc9HAfReO55SFvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org 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 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=bscAPYujcdnifDVSY+NWRcPRixs9E7L/psZwgzJNN98=; b=Giqp2HTM/9Zb/JVGP6X0vbVxd707N9vCeShzfes6PD5mCz4IwcUufnp7Kl1SKEeRemwAb6rzDHJmqVNT/lQ7LMZTt6/EWM+70RLtlOmDlpmgolnBJ+krvQTdmdHfiv/uELoPfE+pzztLEtssZU+Yo9qVymtJvoYpOkA95p9jedGiscxnpAk0C1mVD8oH91cpZt74R/1+EiLwjLx+LhFeQTpVJgqhhTm5ZM12Afo1KISWJx/PmsmybLz8zGAC/WfJzx6yeD7tPqjOUxBpSrARxjjNUy40tKSBDn3GEOrPsbAGhL9VmJb+8VCvYM3UFL8ndCdwBCicdBo2V087M7iK0Q== Received: from MW4PR04CA0148.namprd04.prod.outlook.com (2603:10b6:303:84::33) by PH7PR12MB6442.namprd12.prod.outlook.com (2603:10b6:510:1fa::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 13:13:55 +0000 Received: from CO1PEPF000044EE.namprd05.prod.outlook.com (2603:10b6:303:84:cafe::f0) by MW4PR04CA0148.outlook.office365.com (2603:10b6:303:84::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 13:13:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000044EE.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:13:55 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 06:13:37 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:13:34 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 01/13] bridge: mcast: Dump MDB entries even when snooping is disabled Date: Mon, 16 Oct 2023 16:12:47 +0300 Message-ID: <20231016131259.3302298-2-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044EE:EE_|PH7PR12MB6442:EE_ X-MS-Office365-Filtering-Correlation-Id: 83c37cea-0935-499d-e0e7-08dbce49c039 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nUQXpYFYroRLzf6FVfC2fkTw3DbU/l616clcImT92qvfacr7RIDB7uhN7KFXJISBgLZg9xZtnKM/faIeRdhsX0+96UbVBiDOS9HZN0KyaXHD9eFJDQV5VRAYwSwfP52sITYmec/9vniL/ezzPxVaOt2NZD9T5RUFNecJQw5KxGBciSAKXQNKgo0/hmHq9EGb/7PxekR8hPrVkL+YKfuYykT2piDDsFzWQjgh+YCz5HRtihQJ0/8/L9Nrybs79qeus8VwuOjUnRNPojcUxECey7vsQebpzqcS8fyyXOKya9dSnezZLntymhxXA8pevEgOBTZCBjQOOW/nj33xYaPqb+p4xKLuSn3XXfrZLi485jg68vGcrNsnzrOdbcWOTvyuG99gxrPkTR53d7TK8G+eE/X9KFcBE2XtHvoDGc+tO87iWc5Al+oxCO57gvjwZFLGMJgsz/fcKPlvLg+vtXJlqP8Y4r22sUD/Eb1rQJCF8NqS/QXw0pGtd2Z2MDC3SvxAIILD+2xiRggpdJdwW+kcYoD/0M9v9gWrTpqjhpD19Aqz/H5uCkCARmftedF5lE8FeHt5knIjriNXj4p8ab322jE1ukbS4cJWOdIUmdwM+UXzlsdptiJbGXTO+iWPj6HMrX+KSGPWNuYCPsC7d/PqEThX+YURQXsPWq1dAAzYanGU6zvqCeoTgSLouGXPE9291PePgVlKnwJHSrYqjrH3O5INT79PGCgQbbpUE37fBaJoaTI6BaEGhHDyHrVxWnTu X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(39860400002)(396003)(136003)(346002)(230922051799003)(1800799009)(64100799003)(186009)(451199024)(82310400011)(36840700001)(46966006)(40470700004)(478600001)(316002)(110136005)(41300700001)(8936002)(4326008)(8676002)(70206006)(70586007)(54906003)(5660300002)(40480700001)(36860700001)(7636003)(86362001)(356005)(47076005)(2616005)(107886003)(26005)(36756003)(336012)(426003)(16526019)(83380400001)(82740400003)(40460700003)(6666004)(1076003)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:13:55.4603 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 83c37cea-0935-499d-e0e7-08dbce49c039 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.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6442 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Currently, the bridge driver does not dump MDB entries when multicast snooping is disabled although the entries are present in the kernel: # bridge mdb add dev br0 port swp1 grp 239.1.1.1 permanent # bridge mdb show dev br0 dev br0 port swp1 grp 239.1.1.1 permanent dev br0 port br0 grp ff02::6a temp dev br0 port br0 grp ff02::1:ff9d:e61b temp # ip link set dev br0 type bridge mcast_snooping 0 # bridge mdb show dev br0 # ip link set dev br0 type bridge mcast_snooping 1 # bridge mdb show dev br0 dev br0 port swp1 grp 239.1.1.1 permanent dev br0 port br0 grp ff02::6a temp dev br0 port br0 grp ff02::1:ff9d:e61b temp This behavior differs from other netlink dump interfaces that dump entries regardless if they are used or not. For example, VLANs are dumped even when VLAN filtering is disabled: # ip link set dev br0 type bridge vlan_filtering 0 # bridge vlan show dev swp1 port vlan-id swp1 1 PVID Egress Untagged Remove the check and always dump MDB entries: # bridge mdb add dev br0 port swp1 grp 239.1.1.1 permanent # bridge mdb show dev br0 dev br0 port swp1 grp 239.1.1.1 permanent dev br0 port br0 grp ff02::6a temp dev br0 port br0 grp ff02::1:ffeb:1a4d temp # ip link set dev br0 type bridge mcast_snooping 0 # bridge mdb show dev br0 dev br0 port swp1 grp 239.1.1.1 permanent dev br0 port br0 grp ff02::6a temp dev br0 port br0 grp ff02::1:ffeb:1a4d temp # ip link set dev br0 type bridge mcast_snooping 1 # bridge mdb show dev br0 dev br0 port swp1 grp 239.1.1.1 permanent dev br0 port br0 grp ff02::6a temp dev br0 port br0 grp ff02::1:ffeb:1a4d temp Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 7305f5f8215c..fb58bb1b60e8 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -323,9 +323,6 @@ static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb, struct net_bridge_mdb_entry *mp; struct nlattr *nest, *nest2; - if (!br_opt_get(br, BROPT_MULTICAST_ENABLED)) - return 0; - nest = nla_nest_start_noflag(skb, MDBA_MDB); if (nest == NULL) return -EMSGSIZE; From patchwork Mon Oct 16 13:12:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13423207 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 E8DC11641A for ; Mon, 16 Oct 2023 13:13:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="B1NOxvt8" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2054.outbound.protection.outlook.com [40.107.237.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FF5EA2 for ; Mon, 16 Oct 2023 06:13:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GPxKERaRUEPUHTjS3iz5XfIL2DqBgw8LtSPx4jdl0X23xyoIScCdaHWz7yL7nlzhtCdiPxIlDt6qgvvLMtZSIyU1meA3H06awVN8kjz9MAK86KHn+DHijDwGL+eYyAcysqUctRwP2LnDT2d1s5nBK0mrK0V9s+BJPJ3jddcOEXSHzw9AyhpviGbPGV7Hlh9cvOTOkrMJZhpy2iXTwB24mUs2Hx4hjqOaKfymtjCDOI9dtLDJKSmp3Sc/PJoODYx0P2SWcdw5krIZFlSJByDXvXkrspXeAhUGWpZgVZHglnYFKj04FNs4NjhkcjGizw2hECLParREKLp2/lnZGfH/pA== 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=C2lx4a/YsnaaU6/p/tzyWjrkHfRHP9a5+qb6DI6gwiY=; b=a/QFUfo8fxhzk22Amdr2f9jlwnjAp/cx6P/4Kk6y6ICpXDAj1h0WkaHGmgeiUOMrAD3InKpAKOiG7bZyMGvRZf2Wyu5QMrxEIcKEXcBMFFfo1bsp33LkhMwkYwaMkC9+JXcUrtF6q9wuCMFS+2Imm0Olh5YL4mxUuLo30yo05jQXrxsJl8aRsJ1RX1cGtm3nmJWOkMLS5ogPX9P9cdKTavF03wUA9X9MJww3y6Hr3PsXxdronye5AlG6u9zXWWijM5biDo//kj2itUsB6AoVAtRI2qcATJMBYCzeway9ZNCczRqF7hLB9/3cPJmmlJ9cIvFueJhvMKZBRozQ/m398A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=vger.kernel.org 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 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=C2lx4a/YsnaaU6/p/tzyWjrkHfRHP9a5+qb6DI6gwiY=; b=B1NOxvt8BUgAcewDDgz752ksdrfk1t5hNLmAo1D/UCMqL9/2hHDy5yxwrgxGCpIwP+n6cta0APT9j/QT3Sqr6Bop2vUJxE8hg7mR7jlzndMyaLO8RRQVMLMM8lfFi2zUCbXQYuDxh8gUhBDrbaqxwN1lN8WmY7wuXxyaM0/qt1UNVNZTVswtbBHZtuLzicjlsb0u48TYPhW8K7AjEfAvi9+fssDcNJrKhyNMV7+jJdUD/ykQmQABFIKJ+Ohi3HyTifj4zIeFDror+yL30DYV5Gizn1LpUBl1dVs42auNpbDJAzSE3NSSbfjVH1BUHK8PVAU1fMLL0NmLvuumechAWA== Received: from MN2PR20CA0048.namprd20.prod.outlook.com (2603:10b6:208:235::17) by MN6PR12MB8590.namprd12.prod.outlook.com (2603:10b6:208:47c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 13:13:55 +0000 Received: from BL6PEPF0001AB71.namprd02.prod.outlook.com (2603:10b6:208:235:cafe::a1) by MN2PR20CA0048.outlook.office365.com (2603:10b6:208:235::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 13:13:55 +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 BL6PEPF0001AB71.mail.protection.outlook.com (10.167.242.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:13:55 +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.986.41; Mon, 16 Oct 2023 06:13:40 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:13:37 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 02/13] bridge: mcast: Account for missing attributes Date: Mon, 16 Oct 2023 16:12:48 +0300 Message-ID: <20231016131259.3302298-3-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB71:EE_|MN6PR12MB8590:EE_ X-MS-Office365-Filtering-Correlation-Id: ede0b1db-9de5-4633-7383-08dbce49c02b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Pa4gUoYy0+W3Ab81GY11eY3bRDNu8i/PM8WW2hsvYcVT43S9HsBSCdAoIGZqfGXfJOJ1wu8Ha0sO5ciePbGzRsPOPoGAIocgyYVmIBfK3evXEdqk6815vLoPECYTgLZIM7Za7+a32HGt/tIwGCVm3PBsl8B8E+neq3muMHD7Izl7s6pmLpL+hhsFTUo+IfwKd251nZGnaj/yxs0p5dLNjoAUBCiedG0yAxjIo06KdizNq5COrvkqgQyZa2dRaRSod2IlTGvyxFoZmuySH4NFYepYqULGHIMal8mv6bgHxY1/b9dZSKQVrT7rnNYGM1VMXd/vCB+FlNu02NpTJBU8nvoVr7ni96uQp//2ktp1svb/31IoiE7l3U+nvEYb8HvENC6RgApy3gyZNnH0+4X0CUPGzY5AJFUERtbfwKtaZI0D9IvWi7I/YiNA6r6kWbJhh7EhvA/uvMFhaPPa2lvF6uLPSvg+iEtKob+FMg81LQPoJB894//BwSccZD2aQbu+pLE54ao91ktw3ce9mq2TOQ2Xp4SbdsVo+khTdOfzv0Bi3wBduPodGPx+0xCJJigC09AX/VqlGvQe/zT5NI5s+QFlwRu3BELSj3rEucHaomnjNzjw8bsdZdMIHiHRWwuleCK3jLehDLDfx+93wJKHPzv9iYSgCQkTMVATj4XN4UzX2js383wAaW8atg6xB1Ba1Lv0UWpdpNBzqDZYgJQ+8xMLSfXOynI7hjJX5iw2KuKRdZVYyE+M/vB3TPzIdmCa 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:(13230031)(4636009)(376002)(39860400002)(396003)(136003)(346002)(230922051799003)(1800799009)(64100799003)(186009)(451199024)(82310400011)(36840700001)(46966006)(40470700004)(478600001)(316002)(110136005)(41300700001)(8936002)(4326008)(8676002)(70206006)(70586007)(54906003)(5660300002)(40480700001)(36860700001)(7636003)(86362001)(356005)(47076005)(2616005)(107886003)(26005)(36756003)(336012)(426003)(16526019)(83380400001)(82740400003)(40460700003)(6666004)(1076003)(2906002)(15650500001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:13:55.1783 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ede0b1db-9de5-4633-7383-08dbce49c02b 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: BL6PEPF0001AB71.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR12MB8590 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The 'MDBA_MDB' and 'MDBA_MDB_ENTRY' nest attributes are not accounted for when calculating the size of MDB notifications. Add them along with comments for existing attributes. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index fb58bb1b60e8..08de94bffc12 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -452,11 +452,18 @@ static int nlmsg_populate_mdb_fill(struct sk_buff *skb, static size_t rtnl_mdb_nlmsg_size(struct net_bridge_port_group *pg) { - size_t nlmsg_size = NLMSG_ALIGN(sizeof(struct br_port_msg)) + - nla_total_size(sizeof(struct br_mdb_entry)) + - nla_total_size(sizeof(u32)); struct net_bridge_group_src *ent; - size_t addr_size = 0; + size_t nlmsg_size, addr_size = 0; + + nlmsg_size = NLMSG_ALIGN(sizeof(struct br_port_msg)) + + /* MDBA_MDB */ + nla_total_size(0) + + /* MDBA_MDB_ENTRY */ + nla_total_size(0) + + /* MDBA_MDB_ENTRY_INFO */ + nla_total_size(sizeof(struct br_mdb_entry)) + + /* MDBA_MDB_EATTR_TIMER */ + nla_total_size(sizeof(u32)); if (!pg) goto out; From patchwork Mon Oct 16 13:12: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: 13423209 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 648022772A for ; Mon, 16 Oct 2023 13:14:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Gbn4h+Wb" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2080.outbound.protection.outlook.com [40.107.93.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FBE29B for ; Mon, 16 Oct 2023 06:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aFg3wp4clCGRMR4T+2X9Kfs9pRtSLmkNTjG+M3l3POQ3TNfQ/vdWPXtVz4k53UUxHDeflbLXbIufKZ7J9iq2zxoK0Q3j4VgYUyFVRUDG35t1mku3rPmrpqF+3Y197d1+Jop665cw9cZGy5ZECog20JgD56VDJMNhuQuqZ/TRk10rmu0O4MdLpizsuSsi8MhG1nejBZVSjNiRcc5b04/g/Hr8oEXxPS6o1kEECJgY9i+KCTcm8vOaFewfKKxKQxeJxLxhbR1rpy+XJQz9Oc8UYJUar0P3i6zRPp3eMqspcyr+kQ9wBHbSBW0J3xBjKCnZJHxWdHVwgt1mZOIs9SfM4A== 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=gfHz9A1EjkSmiPWIWHhNnY5h/JaToGDWRgl4zJ1e234=; b=VzsEXlB1sKbNBz7PkJbSY5kgW7m6AZqGjdDLvQIg0jMI5FOFg7/PhzQRJLs03XveUDGC8NmF7Iwa/6iNf4HGTequ8VPvD9n+3gEfnc6yJWsWXojmfQFwXT8k6jWq6l+zG3Vkr9EtEUP75CFFCvVaKeb9dUtK1gE2BL7UiR00P74fWUTN/9YqCFK+q3ADqTqvRLY+Ly8j09AABtfy6QYs88/oLdXerQniWvT/qrAIjpHsSvxqouGjJL+brY/xQHO+C/N0SHmMTOGm9zkHLwENLyJLma28bKrSMq+jBS5YfgoUPZZyhc01Cpov3kR7mGd5OVYOSc6nGo+EB3ScFl3yqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=vger.kernel.org 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 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=gfHz9A1EjkSmiPWIWHhNnY5h/JaToGDWRgl4zJ1e234=; b=Gbn4h+Wblh+75U0UG44iSoE8mXzNcJB0CjlCTVJrD3/uRwS9dH9od5756oYuveyoHOVm/5KE0BeqbKkMtTLFY2Pl3V/kK5tkKdxoXCinhYQ/eyrxPVVl+YHUllgzdWxpW4TzrxoaCWgpFozZzxVF7HihVDcm/hqhV0TaFu05P0SAxXs4jmTrvXGGXhZn8lVzkax5zsSJHHwH3FoyiwzOUsrBfPu/3Pm7fZFOJqGW0pAzhWDocKld5WvFDho/g/PNlhVZl6oXpFmaeFQe8Sj+FlevjJLLme6s3uAmHwJW/hpXKLDJxrVpN5kxoPvSEsKFCmwjP3uA5d8AIGNU6IfcgQ== Received: from MN2PR20CA0041.namprd20.prod.outlook.com (2603:10b6:208:235::10) by MW3PR12MB4508.namprd12.prod.outlook.com (2603:10b6:303:5b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36; Mon, 16 Oct 2023 13:14:02 +0000 Received: from BL6PEPF0001AB71.namprd02.prod.outlook.com (2603:10b6:208:235:cafe::1) by MN2PR20CA0041.outlook.office365.com (2603:10b6:208:235::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 13:14:01 +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 BL6PEPF0001AB71.mail.protection.outlook.com (10.167.242.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:14:01 +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.986.41; Mon, 16 Oct 2023 06:13:43 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:13:40 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 03/13] bridge: mcast: Factor out a helper for PG entry size calculation Date: Mon, 16 Oct 2023 16:12:49 +0300 Message-ID: <20231016131259.3302298-4-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB71:EE_|MW3PR12MB4508:EE_ X-MS-Office365-Filtering-Correlation-Id: f1f9fe99-e2be-4257-bcd0-08dbce49c401 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 17E96HD2OJNKCjcTeJ9fI+WXTuftCIMCWjdQHy066e3GwVxrnn2OeKnf3S5UogXOfJ44YNUTonawiX8jTfuClxW51Y4gmgzJcIc8N/jXBUM1GO2XrOMYKTSMRLlmRVpONtS/H0POcVTjEDlIw8/vSJWu2+qxKTeSED4QEqB4x/4gQmGpNTzcXNhwILarQ3HcQiEIq2/2vWpIpKT2M6OcayPHYSDz3mqUWWXjN3Lfb9MmoKuCW9od/5iBFcNi8PNiwaj5lCaphh/ALNndtzAQutl5k3Ny3nurLdo5RwL7N/ri7S7BkF+i0Ig53SrM/qp4WPYNWrkPzJHSCMXhcy7preSCRAU5ASSuAnFLrgeHHJVI3Y9LetEHpGorwdrnJhMD9RQCRnxPvGHj2Yq63WQgZF1B4545jYS7f+K0Mp2yraaBHwvq+qxAdACNs2jNT3z7zleNHkAAj9rtsgg7KzkqrcEm0sMriEVM3XKy+trIMXdr7rMD9UCVtwyx4kq9Nm9Ca4wDJ7jPVBvb11K7L23yyv62El8KodyzEIKpEBg/TSOJL3/kHOMmsUKRPbDf8TTmgDxWdvPH7fD8RaT2HLcZ2Tc2kmxhfQjHM1zAhmommUOOvdPyNmDPF+Euu2pv7F2XyOZhXnPI7Dh/2Aapd4pnWxc52qqlxhqr6c6CIOfbagRe18gJqyKpmHDIqWAFOdtUh1llBGoJMYjAXFgqNxtx100ibbIe7yU4AM/Yxa+Jt7LS1maa3kXSz3DSROJmSN3Q 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:(13230031)(4636009)(376002)(346002)(136003)(396003)(39860400002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(82310400011)(40470700004)(46966006)(36840700001)(40480700001)(40460700003)(478600001)(110136005)(70586007)(70206006)(54906003)(356005)(47076005)(83380400001)(36860700001)(82740400003)(316002)(336012)(86362001)(16526019)(26005)(107886003)(1076003)(426003)(2616005)(36756003)(41300700001)(5660300002)(7636003)(8676002)(8936002)(4326008)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:14:01.7408 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f1f9fe99-e2be-4257-bcd0-08dbce49c401 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: BL6PEPF0001AB71.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4508 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Currently, netlink notifications are sent for individual port group entries and not for the entire MDB entry itself. Subsequent patches are going to add MDB get support which will require the bridge driver to reply with an entire MDB entry. Therefore, as a preparation, factor out an helper to calculate the size of an individual port group entry. When determining the size of the reply this helper will be invoked for each port group entry in the MDB entry. No functional changes intended. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 08de94bffc12..42983f6a0abd 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -450,18 +450,13 @@ static int nlmsg_populate_mdb_fill(struct sk_buff *skb, return -EMSGSIZE; } -static size_t rtnl_mdb_nlmsg_size(struct net_bridge_port_group *pg) +static size_t rtnl_mdb_nlmsg_pg_size(const struct net_bridge_port_group *pg) { struct net_bridge_group_src *ent; size_t nlmsg_size, addr_size = 0; - nlmsg_size = NLMSG_ALIGN(sizeof(struct br_port_msg)) + - /* MDBA_MDB */ - nla_total_size(0) + - /* MDBA_MDB_ENTRY */ - nla_total_size(0) + /* MDBA_MDB_ENTRY_INFO */ - nla_total_size(sizeof(struct br_mdb_entry)) + + nlmsg_size = nla_total_size(sizeof(struct br_mdb_entry)) + /* MDBA_MDB_EATTR_TIMER */ nla_total_size(sizeof(u32)); @@ -511,6 +506,17 @@ static size_t rtnl_mdb_nlmsg_size(struct net_bridge_port_group *pg) return nlmsg_size; } +static size_t rtnl_mdb_nlmsg_size(const struct net_bridge_port_group *pg) +{ + return NLMSG_ALIGN(sizeof(struct br_port_msg)) + + /* MDBA_MDB */ + nla_total_size(0) + + /* MDBA_MDB_ENTRY */ + nla_total_size(0) + + /* Port group entry */ + rtnl_mdb_nlmsg_pg_size(pg); +} + void br_mdb_notify(struct net_device *dev, struct net_bridge_mdb_entry *mp, struct net_bridge_port_group *pg, From patchwork Mon Oct 16 13:12: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: 13423229 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 7AE2C27739 for ; Mon, 16 Oct 2023 13:14:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Lnx3Fkk3" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2048.outbound.protection.outlook.com [40.107.243.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66215B4 for ; Mon, 16 Oct 2023 06:14:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M3W7FGsgvPjKPdBV+Ezmvq7pZK3jiNMCwXJCeKs81txDiImZRwpG/rGzjEuf9QenvYA3vyTdXo/R1daZz43G64N0TAL1Dtc+9EV4JXC6uU7Q/wFhDbPZDOr5+Q4Br/1QXmqxggZWbSgwPWwlap4MXuIA0hzOigdH9rfKgLDIWRDNPmAl/mej5AB0kZGeVJ/WWDXIG0OuYYnjdZMy3jDWa4P7L+a8O4w0TUtePe+Yji2GYtNLsT2SjAZDIHXz1DU8TJLcheWSIVALBqekcZ4LaDuLLbpNl4OZGkBQyzXYCgoirZF93gZlzZ9U16wT+NDLb2+x+pPI0cACPvOjhG6NLg== 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=Kvn98rfcbAc2Va2VU7W+Q2Eo0H1y6sr9aaANUCjT7Lk=; b=Y2/iOSbklAV4t251Lzq3ZgHSQUACWXfYrkj9E4GWGq05mSraSjdTY94xFU404FPwIxOpPg0fkEeaCTNdxejL7DD6jiryJWSbnkO4M4InvHHhl5uY4CiLuQrYQYofkZGOWZyJZ2lexg+ZR8f4aiE67eAeMYgYs35uSxPxmgoomEQQwC/iLTpJHt56hRYP5Hlfma05WO+HzZIRGpSQt/7bquOYDZ27Lhl5zfkP0XyLbkls0PJhG3GzbJK009PzKViZ8l+j5tKUChNHpVoYUlOYUitdasWdgq0+Q66ELbl9ijFo5ZKEtpDxfMhAEU8+p/2NHRDT/EbM9H1cCkl0JIw6ew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=vger.kernel.org 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 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=Kvn98rfcbAc2Va2VU7W+Q2Eo0H1y6sr9aaANUCjT7Lk=; b=Lnx3Fkk3g4vZ0D4x+lNHaSYDZULDPoeLcq56uXC2ztCM740zpB9chtlB7oukcKqhozAUThNml3ZSe9zRRwc3GRASyfxyp6RhlEfzfGvreqGs3pdGmjSQHwWYp3PIqtpwKmd+F61rscClXuPbvrEiN0XQ5XqIb2Pp0pw0RQK+/YCK7ICrT5XY0JnBAI0fNhkYoMTWhY8yHIxNNAKbKgcv7KYgbEx1+iDuo6J1ciOYMvSAzBasqTIkYZ4tCVjTGPOymGVfCyHoBYZjW6SvBx3BCKSN7gxn73jyukBk4S47+kAiB/sgxDQLfKUnbtq0LZPSgz+0wfUi65DSuzY9am3NuQ== Received: from MN2PR20CA0049.namprd20.prod.outlook.com (2603:10b6:208:235::18) by PH8PR12MB7447.namprd12.prod.outlook.com (2603:10b6:510:215::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Mon, 16 Oct 2023 13:14:04 +0000 Received: from BL6PEPF0001AB71.namprd02.prod.outlook.com (2603:10b6:208:235:cafe::4f) by MN2PR20CA0049.outlook.office365.com (2603:10b6:208:235::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 13:14:03 +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 BL6PEPF0001AB71.mail.protection.outlook.com (10.167.242.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:14:03 +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.986.41; Mon, 16 Oct 2023 06:13:46 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:13:43 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 04/13] bridge: mcast: Rename MDB entry get function Date: Mon, 16 Oct 2023 16:12:50 +0300 Message-ID: <20231016131259.3302298-5-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB71:EE_|PH8PR12MB7447:EE_ X-MS-Office365-Filtering-Correlation-Id: ba55cd98-c75d-4b3d-8a34-08dbce49c4f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OCB2KxfWBLHoItBJZ+ZuoI69+7fTDR4sfcuUZkNXGe7OZDD/RI0MyKg7Njk/TVeqcZrpePcB385JQsqzMPOJZRDlKaNHVCLTCv31uwLlWu8Ap1CEB38Hm8XIqAFAy7HHBAecFCEcIBuBYCdTDbmYJlHCUIQ/K6e0ayRqTnOMYmSwvQp8XCvymNEu1CICpvM8UWOsbWlOukIDto8evpiPviyl6FDXHf/fnmBv72mlIEd6BEbTV7aIGfuP/8kkZXOGyFsxNsnhpICJ41KkosmBG479UojsUp4lZwXTlbRVR3+JWqGBB1Kzk16c4x7SzX7AkFKxONzwBkXQpb0KH+wgVQfdPBr++w0TwL5LGMGatSxDxuLeMHvqjif2A3o/PbZr5qf6owzeUJJmmVkCmeBG/g6uZK3h6MKwnygEGRizxets33ga9i6PwBwh2ZWaZCN2feJy3plagwXqhqkUUFg4i8OC034lAZ6EC1Q3bljxr3cgaUNnsHlAYnr9Dz12h+QMy1toxINN7wXhHmrNt3rNY5UqwaLZrTDzjXFIhWSgZlmD9IFryin4yBOqB5x/t9L24PKV3mUGQzpA8AuXr+OSYEMIuqQABnsF31OmxKpLCVTUKT34x7F9dbfv8DnN1WQHELT9JMN6asU58pdhv3nKEdDSwmgtp4vytI2LlUNUtBhvqNu/JYrslKgv/ldj1FzT9pkPxELQM8aQtXGDjte7qctab5OWMzfv1Or2cHRG/KXEClY8x9L2ZFkac7f93P06 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:(13230031)(4636009)(376002)(396003)(346002)(136003)(39860400002)(230922051799003)(451199024)(64100799003)(82310400011)(186009)(1800799009)(36840700001)(40470700004)(46966006)(40460700003)(1076003)(26005)(6666004)(107886003)(2616005)(16526019)(336012)(426003)(54906003)(36860700001)(83380400001)(47076005)(41300700001)(478600001)(5660300002)(4326008)(2906002)(8676002)(8936002)(70586007)(316002)(110136005)(82740400003)(7636003)(356005)(70206006)(86362001)(40480700001)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:14:03.3346 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba55cd98-c75d-4b3d-8a34-08dbce49c4f2 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: BL6PEPF0001AB71.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7447 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The current name is going to conflict with the upcoming net device operation for the MDB get operation. Rename the function to br_mdb_entry_skb_get(). No functional changes intended. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_device.c | 2 +- net/bridge/br_input.c | 2 +- net/bridge/br_multicast.c | 5 +++-- net/bridge/br_private.h | 10 ++++++---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index 9a5ea06236bd..d624710b384a 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -92,7 +92,7 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev) goto out; } - mdst = br_mdb_get(brmctx, skb, vid); + mdst = br_mdb_entry_skb_get(brmctx, skb, vid); if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst)) br_multicast_flood(mdst, skb, brmctx, false, true); diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c index c729528b5e85..f21097e73482 100644 --- a/net/bridge/br_input.c +++ b/net/bridge/br_input.c @@ -175,7 +175,7 @@ int br_handle_frame_finish(struct net *net, struct sock *sk, struct sk_buff *skb switch (pkt_type) { case BR_PKT_MULTICAST: - mdst = br_mdb_get(brmctx, skb, vid); + mdst = br_mdb_entry_skb_get(brmctx, skb, vid); if ((mdst || BR_INPUT_SKB_CB_MROUTERS_ONLY(skb)) && br_multicast_querier_exists(brmctx, eth_hdr(skb), mdst)) { if ((mdst && mdst->host_joined) || diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 96d1fc78dd39..d7d021af1029 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -145,8 +145,9 @@ static struct net_bridge_mdb_entry *br_mdb_ip6_get(struct net_bridge *br, } #endif -struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge_mcast *brmctx, - struct sk_buff *skb, u16 vid) +struct net_bridge_mdb_entry * +br_mdb_entry_skb_get(struct net_bridge_mcast *brmctx, struct sk_buff *skb, + u16 vid) { struct net_bridge *br = brmctx->br; struct br_ip ip; diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index cbbe35278459..3220898424ce 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -951,8 +951,9 @@ int br_multicast_rcv(struct net_bridge_mcast **brmctx, struct net_bridge_mcast_port **pmctx, struct net_bridge_vlan *vlan, struct sk_buff *skb, u16 vid); -struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge_mcast *brmctx, - struct sk_buff *skb, u16 vid); +struct net_bridge_mdb_entry * +br_mdb_entry_skb_get(struct net_bridge_mcast *brmctx, struct sk_buff *skb, + u16 vid); int br_multicast_add_port(struct net_bridge_port *port); void br_multicast_del_port(struct net_bridge_port *port); void br_multicast_enable_port(struct net_bridge_port *port); @@ -1341,8 +1342,9 @@ static inline int br_multicast_rcv(struct net_bridge_mcast **brmctx, return 0; } -static inline struct net_bridge_mdb_entry *br_mdb_get(struct net_bridge_mcast *brmctx, - struct sk_buff *skb, u16 vid) +static inline struct net_bridge_mdb_entry * +br_mdb_entry_skb_get(struct net_bridge_mcast *brmctx, struct sk_buff *skb, + u16 vid) { return NULL; } From patchwork Mon Oct 16 13:12: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: 13423230 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 2426A27ECE for ; Mon, 16 Oct 2023 13:14:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="bazPTwSS" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2078.outbound.protection.outlook.com [40.107.92.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5521EFE for ; Mon, 16 Oct 2023 06:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zw7pkhh1U/4paHBqAcQdyNN3PAzKKilHt18EPlsu8/DTKKOYk7btow1b74ghPo/XX86MJM3jsPwmoUXCi/i2+ZbIgsIG7S2+OYJPuT1+cV1it1Lf5yG22pSIRgxlqTcVSwEkq0gf+B+TiZNmGbYhYtsFAd6snshCezQnTGzHHKzP93E287g7+wG3dq3oBNnthAzxkFwYA57On3lc3GwEo4q6dk22VfhBPUNLhTLrLU/tizjrT/MezqF5IfMXYkozIxoREit05Ve9MbPsjcp87HYoJSFZqckFGp+SZQvrAhBbX4LyDoEzPy9PhRp+Lt9wSdlW44RV8aEUBeJDTKgJSQ== 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=0yjMJB5rcJ+8MrWeQsljB0+d7+3hGEcxUAz/vBZ1bvo=; b=EODZZDwqvUNvg9892QkUEo3uVB9M8cr7HafyfofhQz5yHnSURowuwwdZRhS1PYawgKRRLJvHutoBJIVRwb5BwiqQOWmF0LOSnsd1XMGGpQyUWG/undc8kRFXZ5t0cVIrkOAgnWNRRmZGKCEr53faw++qAuJ9qm1Eqnu2KpmMCNUUmKKMwyZxrF66l4Uk9nbekNQD3OxYGGGZsWLKXWPTzPFZSgT7ejmz+w7aliI8McmwfpntB/XMjJfbUVCQA3fntmZEwUkWJ+V2wOc+Q/tRbTJVRPiLiPL2tlGhUAhe6XtNqVm4aPZMZ5MNcmb7VSowES0YCAAQ6NGUsGV1tqRsSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=vger.kernel.org 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 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=0yjMJB5rcJ+8MrWeQsljB0+d7+3hGEcxUAz/vBZ1bvo=; b=bazPTwSSHt+gkLbygiQjlEbhxeaxCwKg1Uan1roIIRyR0Ifgll6HCOZchtm2vf1Y2CtWCvkRBdk370Zvj99NFykUvUY4d4xbbG5Mt/bSTcyzOd45+1RRlC7girqrWcbkz9QS26CFMkEJFuJx7AVCmWGimiw2+8TznxsnZsUIe9QSVquL4J+rioK81lnL7F9rvTIw0Vd+QrmqOmOk80mj+1T41uErS2r6BKUmqeBu6sps1v5UT3HT5BshBTSKbP/l7jZH5mEYHQBAP6X6n2Gpgj9/BWH0E5okdhLZoJpKoQ8oz8gTClVOsm4/Vdqj/BGbUoTu94/PhWbV11RJXw0qbQ== Received: from MN2PR20CA0060.namprd20.prod.outlook.com (2603:10b6:208:235::29) by DM4PR12MB5771.namprd12.prod.outlook.com (2603:10b6:8:62::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 13:14:07 +0000 Received: from BL6PEPF0001AB71.namprd02.prod.outlook.com (2603:10b6:208:235:cafe::61) by MN2PR20CA0060.outlook.office365.com (2603:10b6:208:235::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 13:14:07 +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 BL6PEPF0001AB71.mail.protection.outlook.com (10.167.242.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:14:07 +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.986.41; Mon, 16 Oct 2023 06:13:50 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:13:46 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 05/13] vxlan: mdb: Adjust function arguments Date: Mon, 16 Oct 2023 16:12:51 +0300 Message-ID: <20231016131259.3302298-6-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB71:EE_|DM4PR12MB5771:EE_ X-MS-Office365-Filtering-Correlation-Id: 83568a1e-1c91-41a8-4843-08dbce49c738 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SVemNRXMNUuX1pfhnZGd5F1lPxBFTrASaCleUrMD1QZyk9qLi6pc4bcaon4sepbm0LmWn5xo/F1MlvCEfYupJVu578o2D37ruEg+IUj+4FYJx7jQ4ifZLq0A7iqdX2EwPmTXVhZSJbx+d46OWDLG8vSS99Qb/KVfqRsikKelBp6jdvFmNnDcyvxaYTAVX0d4b+TLtFhYFdQevFiXtHR05IxsLypv0zJiC2LB3fQ8jsXZc4OG+pJdT27N5aFxt5u6xr+P5MCFZ7HvZBWbIBFjP91lDWydYKLpz3Bk2/Nrcqog1JJp6YR/9H54ohRbXFE1vDa6wpFVM9MNEIkRkSw8k6gpXiTQLXiQGcRC4h/BRCcRVjmxd7+k9KTu0dp3vSmH/yusz9HLhG6OhvVHjO+phRcdYb21J1KlHoI1pfOx/EMY7TiBgME5q7CJbZ6W5SzrFiAFLNavtffFbY43IXMdC2nbDWLRR1YvgTIOqVZSg9fjG6IKlqQYBwNX1IeOGCoigMsoodje5uZgd57r6qKgjSNHUurna5sP+EB6PlGFYF0JsVfe5U0SPfa3qb+6KhhSgyUlFXjZZrAIK+BhKLVOZoiPPuLJW3uCLU2GYiONmqXuBEvDzcqjsQymtEr4l5tFBgRuaM76MiV4uvPRYT389ju5YIdMwnJqPJUxKa8Xg7RckVrgSSnkKwNUCLuo9/IKwnv5fR5bleOH4XUrXpaWTx4yh511Jue2mkyZfWXET399lycQF19STlYDUtg4qPOv 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:(13230031)(4636009)(39860400002)(346002)(376002)(396003)(136003)(230922051799003)(186009)(82310400011)(1800799009)(451199024)(64100799003)(40470700004)(36840700001)(46966006)(41300700001)(110136005)(70206006)(478600001)(70586007)(54906003)(6666004)(107886003)(1076003)(26005)(16526019)(336012)(426003)(316002)(2616005)(8936002)(4326008)(8676002)(2906002)(5660300002)(36756003)(86362001)(7636003)(47076005)(36860700001)(83380400001)(82740400003)(356005)(40460700003)(40480700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:14:07.1158 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 83568a1e-1c91-41a8-4843-08dbce49c738 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: BL6PEPF0001AB71.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5771 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Adjust the function's arguments and rename it to allow it to be reused by future call sites that only have access to 'struct vxlan_mdb_entry_key', but not to 'struct vxlan_mdb_config'. No functional changes intended. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- drivers/net/vxlan/vxlan_mdb.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/vxlan/vxlan_mdb.c b/drivers/net/vxlan/vxlan_mdb.c index 5e041622261a..0b6043e1473b 100644 --- a/drivers/net/vxlan/vxlan_mdb.c +++ b/drivers/net/vxlan/vxlan_mdb.c @@ -370,12 +370,10 @@ static bool vxlan_mdb_is_valid_source(const struct nlattr *attr, __be16 proto, return true; } -static void vxlan_mdb_config_group_set(struct vxlan_mdb_config *cfg, - const struct br_mdb_entry *entry, - const struct nlattr *source_attr) +static void vxlan_mdb_group_set(struct vxlan_mdb_entry_key *group, + const struct br_mdb_entry *entry, + const struct nlattr *source_attr) { - struct vxlan_mdb_entry_key *group = &cfg->group; - switch (entry->addr.proto) { case htons(ETH_P_IP): group->dst.sa.sa_family = AF_INET; @@ -503,7 +501,7 @@ static int vxlan_mdb_config_attrs_init(struct vxlan_mdb_config *cfg, entry->addr.proto, extack)) return -EINVAL; - vxlan_mdb_config_group_set(cfg, entry, mdbe_attrs[MDBE_ATTR_SOURCE]); + vxlan_mdb_group_set(&cfg->group, entry, mdbe_attrs[MDBE_ATTR_SOURCE]); /* rtnetlink code only validates that IPv4 group address is * multicast. From patchwork Mon Oct 16 13:12: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: 13423231 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 6F0F927731 for ; Mon, 16 Oct 2023 13:14:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="AZnOcmbz" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64E57114 for ; Mon, 16 Oct 2023 06:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TQEDp3bXuk9AzleWPmTbj50u9gw8djQ4mkWdCTY1dwAhBlbpRlPhiKQ9CNr2fdjU2qVKjNVoeYtbsgHESG1Q3U6pisScEnnGbOgJn8We75AiEcdlG7At038dncMRBM9KQMbQ27JxrAuwi4O3kHZGlK3f5tw8HJ+XNvCdbZLFN70XgkxkM1bLb3uikDY8tihDqiLlA1dAXEwLvSuIaOCu/aKtntEQIdfeIiQaBaNvUG9D/21EJST1RfvfL7DdSIPGp+cIXjJ8SsboetSS4r3V0G1Qku9+5oL58yI65T04zk0T5NBetuw0wA7gnceGCV+5gfM8INsL26ZAobNx4qaLsQ== 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=z01Ln3/2kwAqhN9oOHTp4mbfckYoMDivcI4Z3lRkU34=; b=GVJnyCCUNSb11x5FQzgUCaQMr2f50OWTxo6t15qFuUjykybiNIp0sA05n41pT7lFIw1ejgg94S06C+AzrP+zcZmUw1Wvyr0IF6s/uu5kH6V6ycSiyoa/xzQL1H8iG2hChawXH1stzVn3KhLGx1pZrphX1qhvay7CTOFLonQSPFkluZou5CGmzqhrwYPqUmeoclx5ZnqLSf1Q79IjZN//UaAkBhXrCRByrf0XxnAhfPX6pRIh5S4OX2hpLuFCQ9egq0pZQA7AGLRSOOsde++Uj98PaKTGxXD1w39ysF1QWmmpqYZ0sZyWV64ajfkFBUlWAOzVFZb9fW+dwsMjgl7Vuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=vger.kernel.org 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 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=z01Ln3/2kwAqhN9oOHTp4mbfckYoMDivcI4Z3lRkU34=; b=AZnOcmbzbVWED4VGyKoXs6k3bOF4SNUXbjUdsxA4FauQoRul0doqY19UMcME+N9hI+cznaHvqT3MeHRJJLUFTvqUtKZC9XxH3EpPsUtkhDisC3WhP3GPJaaJwslBQlB1FoOHNUq/gZ+En9ebnjM9KDpRNxFigFXsl+qPT6WMeDEdBR2ZuslvAAhainmA7uVGVqQSduWNhBolzAEiHEKHUf7qPs107jetA5Fx5YpoN6Vq/zTQ4qTTkmGKl0pceFKWC4lgOml+ncT6Tfh/plbwmljSPkawCEga76Ybv1VdyWpPaadql2e6+wk3lC4z8idMmlcGgCTRFEll530Tq/ffUw== Received: from MN2PR20CA0062.namprd20.prod.outlook.com (2603:10b6:208:235::31) by PH8PR12MB6985.namprd12.prod.outlook.com (2603:10b6:510:1bc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Mon, 16 Oct 2023 13:14:10 +0000 Received: from BL6PEPF0001AB71.namprd02.prod.outlook.com (2603:10b6:208:235:cafe::34) by MN2PR20CA0062.outlook.office365.com (2603:10b6:208:235::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.36 via Frontend Transport; Mon, 16 Oct 2023 13:14:10 +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 BL6PEPF0001AB71.mail.protection.outlook.com (10.167.242.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:14:10 +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.986.41; Mon, 16 Oct 2023 06:13:52 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:13:49 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 06/13] vxlan: mdb: Factor out a helper for remote entry size calculation Date: Mon, 16 Oct 2023 16:12:52 +0300 Message-ID: <20231016131259.3302298-7-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB71:EE_|PH8PR12MB6985:EE_ X-MS-Office365-Filtering-Correlation-Id: c21756a8-6e49-4b11-59ef-08dbce49c910 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fGrB8gLwhIAWxU+XgOi/McB6IU/bLpx77COCHyXhZ1pFRGYmVKkpiuQLSIlgzmmYZAatrgW52gviaZSO7tYhnrSDTX/Af0RcZIaSJscJlxkR59KN5UHYWKu9PZ/26A/i7YDcd0TAhGs1lP5LEbmt3HJTsEvhxOLbGpUDBoceEh9MMGcoQUKT4Nmej/Eveg6iTSiOYVsYBfmDLUIrHVIbSneLqr/L4KfpnUB+E2ZiI+13BdFquwnpeJ3ntWmio9bA0tsMojMVUxC/BGpYmeezs5BulfobwX9ouF92fNxS5ZZKIkpcwh07kwMx+VeaKyu4WPcgifb9vO/+Tnt1OWXYUkNMZcKXjsPaKaVXPWfjB20yp2pLwpetHynu6mrCCZ1q10hsY+cR5S6kIvTvyMeLUsx1Sc5KUFfJzB3raE9RxnwuN1MBNIiJCd+MdSqFYglYPfPu38mTam4KlyuaMKqUJVO9Cg6Mjpzgp0HZZnBbdurQkFpEUfQX5CN/E3VXOEpaMDZtV7Z0YgFrjEaGaQvXs5GHJ6fNG7BX+njcj1OWf12VGgwU8caVgCS4lEPnGUrcdpcIwVoQMUeREH54JJdd0Fye5W62vzx+65DJoBne9qcAxzrzGCr2ihxTEAap9Hq+JWJXCD09At6OwTJw0594SjSvsrQN32szCIweKpEkQdheaoIX2+JvrDiI13HcHKVC/CZ1Zwnbam/RiVwXjFvMyQXYjbyUcZPQSJthkEquZxEqI+8jpeekHMHhaMTTSsGw 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:(13230031)(4636009)(376002)(346002)(39860400002)(136003)(396003)(230922051799003)(1800799009)(186009)(82310400011)(64100799003)(451199024)(40470700004)(46966006)(36840700001)(478600001)(6666004)(16526019)(83380400001)(1076003)(2616005)(336012)(426003)(107886003)(26005)(2906002)(54906003)(110136005)(5660300002)(41300700001)(70206006)(8936002)(4326008)(316002)(8676002)(70586007)(86362001)(36860700001)(47076005)(36756003)(82740400003)(356005)(7636003)(40480700001)(40460700003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:14:10.2252 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c21756a8-6e49-4b11-59ef-08dbce49c910 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: BL6PEPF0001AB71.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6985 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Currently, netlink notifications are sent for individual remote entries and not for the entire MDB entry itself. Subsequent patches are going to add MDB get support which will require the VXLAN driver to reply with an entire MDB entry. Therefore, as a preparation, factor out a helper to calculate the size of an individual remote entry. When determining the size of the reply this helper will be invoked for each remote entry in the MDB entry. No functional changes intended. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- drivers/net/vxlan/vxlan_mdb.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/drivers/net/vxlan/vxlan_mdb.c b/drivers/net/vxlan/vxlan_mdb.c index 0b6043e1473b..19640f7e3a88 100644 --- a/drivers/net/vxlan/vxlan_mdb.c +++ b/drivers/net/vxlan/vxlan_mdb.c @@ -925,23 +925,20 @@ vxlan_mdb_nlmsg_src_list_size(const struct vxlan_mdb_entry_key *group, return nlmsg_size; } -static size_t vxlan_mdb_nlmsg_size(const struct vxlan_dev *vxlan, - const struct vxlan_mdb_entry *mdb_entry, - const struct vxlan_mdb_remote *remote) +static size_t +vxlan_mdb_nlmsg_remote_size(const struct vxlan_dev *vxlan, + const struct vxlan_mdb_entry *mdb_entry, + const struct vxlan_mdb_remote *remote) { const struct vxlan_mdb_entry_key *group = &mdb_entry->key; struct vxlan_rdst *rd = rtnl_dereference(remote->rd); size_t nlmsg_size; - nlmsg_size = NLMSG_ALIGN(sizeof(struct br_port_msg)) + - /* MDBA_MDB */ - nla_total_size(0) + - /* MDBA_MDB_ENTRY */ - nla_total_size(0) + /* MDBA_MDB_ENTRY_INFO */ - nla_total_size(sizeof(struct br_mdb_entry)) + + nlmsg_size = nla_total_size(sizeof(struct br_mdb_entry)) + /* MDBA_MDB_EATTR_TIMER */ nla_total_size(sizeof(u32)); + /* MDBA_MDB_EATTR_SOURCE */ if (vxlan_mdb_is_sg(group)) nlmsg_size += nla_total_size(vxlan_addr_size(&group->dst)); @@ -969,6 +966,19 @@ static size_t vxlan_mdb_nlmsg_size(const struct vxlan_dev *vxlan, return nlmsg_size; } +static size_t vxlan_mdb_nlmsg_size(const struct vxlan_dev *vxlan, + const struct vxlan_mdb_entry *mdb_entry, + const struct vxlan_mdb_remote *remote) +{ + return NLMSG_ALIGN(sizeof(struct br_port_msg)) + + /* MDBA_MDB */ + nla_total_size(0) + + /* MDBA_MDB_ENTRY */ + nla_total_size(0) + + /* Remote entry */ + vxlan_mdb_nlmsg_remote_size(vxlan, mdb_entry, remote); +} + static int vxlan_mdb_nlmsg_fill(const struct vxlan_dev *vxlan, struct sk_buff *skb, const struct vxlan_mdb_entry *mdb_entry, From patchwork Mon Oct 16 13:12:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13423238 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 5E244E541 for ; Mon, 16 Oct 2023 13:14:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="pKrIPF5P" Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2053.outbound.protection.outlook.com [40.107.100.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66B1B115 for ; Mon, 16 Oct 2023 06:14:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dxOcnXK654N5l2SpvmCOjR4HQ2kEtE4B7owrjVJbfnECTQpdkUTP0rD3gu6Szm4y5Dez+oBEqBAf4it4rbLm+JjyAu9OOnHe2UftZVmr/muQHiFS7rURUdk+2iAdC25QyR/7Rz0pzEFhWBr0IfDH+C9Tk6Wx1NvkVicgd5CNkbJVF+R6AgyMQkBZJScSiWIOd2wRIFcHebSgnxywvCJfzDTthAnO6yXKJ7XUo385Ek+ZJn5AKFPlxoUh/op5RWB2WMxzYgoWqQ3Y53u18J72i2wXV+10+pTUULqyZUIWLH2i8iG7xMc96LaD0fAeWOwLMc34cuaIe/GwlsH5GS1KVg== 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=AxOTaOw4cZpPZSdAOZ5K6je+j79U4reLeuBegx+6YZc=; b=oI3nf21e8BxF2Iif3LtMOX6QM9NBiBXrniuMwoiq0rahPZq0+ddpi2VuEfv/RbVDfDO3Xu1DqwLec6Y1oKMnboVqKpU8MdmM0NOKqgni04dcYBHDVuAktMV8AwtwOU/ExxfdqRLNLNHgBPpzwSUUgeZnaRd0Mu4tmeR+DCPSxV854uhw0rJ+FL8G6z0FvxEK+2Yn9mrxFnhz9zL41/gMlwFhugYHaQ6DuXzTscd2uxuSwc29tt5qj2DDo3iQv3hze080FjOxVLbhAW68sdGxErXJS/y3Ycv9Jue1DQPPRpwdpMGACb40Tgwzgr3TwdU8xUsCV4Y8l9VENlfa4IIu6g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org 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 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=AxOTaOw4cZpPZSdAOZ5K6je+j79U4reLeuBegx+6YZc=; b=pKrIPF5P5g8M9ah1G1W8Z2H7177q/9jX3Mi+pMxesKB+hJFzACYISwuBBUfI8gxfb2LrMrK67QI5teKvltGvrLWaUCqPMzXdE90NZ6WZ7ACLjYNOE1uUcBSf1rFHp7d6uWrELFonmIff+1oCY6gtFlrmroIDxCSUDMWxOkEtJnQHOcYCQjvDm4cUasx1RNQWdenxQEQ5bKURt1Et4LTMdFG4VN9UYO1Eeb+gCRORBooaoMkxkttdcm9s7W9eEEP63Xe/3F1loxuMnTLBfFZo4JwSTCB21sh32p+HIpMTp0c5zDdYu001nnFeKdH7H9lb13bup4pIT04vmMcD9NJnCg== Received: from SJ0PR05CA0060.namprd05.prod.outlook.com (2603:10b6:a03:33f::35) by SJ2PR12MB8158.namprd12.prod.outlook.com (2603:10b6:a03:4f7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Mon, 16 Oct 2023 13:14:12 +0000 Received: from CO1PEPF000044F1.namprd05.prod.outlook.com (2603:10b6:a03:33f:cafe::3) by SJ0PR05CA0060.outlook.office365.com (2603:10b6:a03:33f::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.17 via Frontend Transport; Mon, 16 Oct 2023 13:14:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000044F1.mail.protection.outlook.com (10.167.241.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:14:12 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 06:13:56 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:13:53 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 07/13] bridge: add MDB get uAPI attributes Date: Mon, 16 Oct 2023 16:12:53 +0300 Message-ID: <20231016131259.3302298-8-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F1:EE_|SJ2PR12MB8158:EE_ X-MS-Office365-Filtering-Correlation-Id: d24bdbb0-1464-40f4-2b37-08dbce49ca19 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nxfhPaGZYvLy2F3S2A/f0qK9eUsY/ldb8NlqCwjgwHV/wd5UWlTmntIMPv+X4H2ari5pyO0SXtmr6reZMk8fDelba0Ik/b0gOoixtxjKXpEk/gL0dwyo6VlI3GoHD746dpDSEvAp0nc+uW7NWkmikt4Npfscl/u8S872SckrPsovtCnim69FhgM5Ukg8u+EJMyix2eG9E/0Uzvv+Gm9n/W+UVLoz6IuVKpwrhOAGOcek7UCFDip96worLoU34CRCuViGMDyV8udh87gktha8i9bInUwEhaFlmdGmxwEUl1/erld7jHsgmot1Lc5speC0SjfDgG3iTz+AG8sev4BEPLu8S/UQKUPUlcAfg1r8P2L6v+kP66DTY9tCJqNrPJG1lH/3SOf3BdNy/u4TxikgX99ooHhmmfl2ia6VPBGIxeFwESCahlGX3zKga3kRUVNMQjTyNA7aoU8LMHn32KqJ3oK6jUa0JB3ba3NE51v2YWvqyIua6tZr6+t36Ps3FxACxKV36UoEgI2pMxmBYfoDDwD4d4E+m3ClR+hQ+k5KPV9nO6VgLycogFpXgFL8tpoGjzeDLJWdSG6Xn9xDj4nIoxeAJ+J8CSrNc/wA2WLzGEyX9DC48nG3hpJ38WrIDLMY+paxIJEknIxZJoN8QbpF84VexIpnCLUwK4RhFEyXAklwCXvgCt+4YrR9ui5eUu9AZ2Lf70rsYZ0C2Hsn+kTIWaIScXFOcRQhLo4OyuMOrvCmVyJs4PNTQjgdkKC6sxORwdun7y6Ylf55V3NmZ/X6sQ== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(136003)(396003)(376002)(230922051799003)(82310400011)(1800799009)(64100799003)(186009)(451199024)(46966006)(40470700004)(36840700001)(40480700001)(82740400003)(40460700003)(26005)(16526019)(426003)(336012)(107886003)(2616005)(7636003)(356005)(1076003)(478600001)(5660300002)(8936002)(4326008)(86362001)(2906002)(54906003)(316002)(36756003)(41300700001)(70206006)(70586007)(110136005)(8676002)(47076005)(36860700001)(83380400001)(21314003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:14:12.0232 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d24bdbb0-1464-40f4-2b37-08dbce49ca19 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.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F1.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8158 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Add MDB get attributes that correspond to the MDB set attributes used in RTM_NEWMDB messages. Specifically, add 'MDBA_GET_ENTRY' which will hold a 'struct br_mdb_entry' and 'MDBA_GET_ENTRY_ATTRS' which will hold 'MDBE_ATTR_*' attributes that are used as indexes (source IP and source VNI). An example request will look as follows: [ struct nlmsghdr ] [ struct br_port_msg ] [ MDBA_GET_ENTRY ] struct br_mdb_entry [ MDBA_GET_ENTRY_ATTRS ] [ MDBE_ATTR_SOURCE ] struct in_addr / struct in6_addr [ MDBE_ATTR_SRC_VNI ] u32 Signed-off-by: Ido Schimmel --- include/uapi/linux/if_bridge.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h index f95326fce6bb..7e1bf080b414 100644 --- a/include/uapi/linux/if_bridge.h +++ b/include/uapi/linux/if_bridge.h @@ -723,6 +723,14 @@ enum { }; #define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1) +enum { + MDBA_GET_ENTRY_UNSPEC, + MDBA_GET_ENTRY, + MDBA_GET_ENTRY_ATTRS, + __MDBA_GET_ENTRY_MAX, +}; +#define MDBA_GET_ENTRY_MAX (__MDBA_GET_ENTRY_MAX - 1) + /* [MDBA_SET_ENTRY_ATTRS] = { * [MDBE_ATTR_xxx] * ... From patchwork Mon Oct 16 13:12:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13423232 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 C830A27734 for ; Mon, 16 Oct 2023 13:14:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="lvk3zSEX" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2088.outbound.protection.outlook.com [40.107.243.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B577124 for ; Mon, 16 Oct 2023 06:14:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K/uTs04pn4jxLnN4pWPCEalogZ+8nd4bUCDAy+8O5mTmn8BoBlyjxojmausooE/Id428lhH7fH6hDQSGKC53QFEIBDD+LRIMbo17A94FiH5mj3kpfTu7gngBTA/zxMVo3QwnGlarvxNWVUE9FTNfo+XUTteecppp58pZKp6cbnJb8eZ7WqPsfQx9eaMaiT+5VQSkadZatoYPc+3du24O+EC+heVJKwbVLYX39iPMgY8H93FYy5JtX9O45Smlsr8z4YLODOcd+hwze9S3UvM/oTd9gjPKe4TvYOYZkBVQ22kF2dOZ957k3lUqS0Am+ZQz7el0ordVFNwrCM92Q9JloA== 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=pHN1TKhsg+zpUSQzmah2NESJCnPaiPmR+MA78MJlse4=; b=Vot92DQ3Idwz5ULIvovxy+CjrOOPv7AeuqTVhUHhOykGQD25+Ut1IudWh8DrM7X/Z6hh+mNj5EpAQJaX+hWc+B7a5ehnPXpBRDeoO0p7+y57FaySjbQMYwnX4FDEem4IcNXTBGVg4gs8Ex91Oq9k8tRm7pNm3qXschKcdXR22dgkRg9T9WYdg6yLiLpRs81QIwG3uOuUGpoGsUYuI3DiXBJF/fUafV8JqQI3YRiIvwhOA2Qw443td2u3ihf7ihz1fYfGNy2MiUJTGtSiVNqqddXNIIMdNmshnWjlVi0ceah47WoEr7tuB6DDcZGd/Yg1MmJVDdvbM+tykx1Otu8BUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=vger.kernel.org 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 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=pHN1TKhsg+zpUSQzmah2NESJCnPaiPmR+MA78MJlse4=; b=lvk3zSEXJDCFx2aqoXPQKyqJTNseAsTlSnIsmos1A6ny6d2+DYdfEbESfgbSLNbRgLzqVnyqudUmi3hf3Qtc5saNAQEHDQh97CNGTwK0sMo3bVk9ch7094G+1bGqE4jNvCacFwYBTg+mTNIUkNJA5P/SpeqicHMfJQjQfaPMXO0YfRZZS8iabCZZbCNQ56lvpKdoZtSr+SJzOh/LKzOdBAkr3AQqyxsPpKRUInTV0r8+MByx6kOY8FgpzYZVoUFwLNx9Lm0kn2Y4AKwikQ/5yy6HvzIdNn4Mrg13kMYT09I3uQWyPN0XOc4bS95ImIsJZvNI9K0S/nDdlFRqpAWM7w== Received: from MN2PR05CA0012.namprd05.prod.outlook.com (2603:10b6:208:c0::25) by CH3PR12MB7619.namprd12.prod.outlook.com (2603:10b6:610:14b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Mon, 16 Oct 2023 13:14:13 +0000 Received: from BL6PEPF0001AB78.namprd02.prod.outlook.com (2603:10b6:208:c0:cafe::ec) by MN2PR05CA0012.outlook.office365.com (2603:10b6:208:c0::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.18 via Frontend Transport; Mon, 16 Oct 2023 13:14:13 +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 BL6PEPF0001AB78.mail.protection.outlook.com (10.167.242.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:14:13 +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.986.41; Mon, 16 Oct 2023 06:13:59 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:13:56 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 08/13] net: Add MDB get device operation Date: Mon, 16 Oct 2023 16:12:54 +0300 Message-ID: <20231016131259.3302298-9-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB78:EE_|CH3PR12MB7619:EE_ X-MS-Office365-Filtering-Correlation-Id: 9db9c7c0-c23a-41b3-0734-08dbce49cabf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: weLEEj1dxyhYeRCo0vGQEVug/GrXmKgwcm+Xwa4NiYMXqD4mI4vvhva2MY5gnT6/XAPpobmYRpzmjytyjykXsj/x21sMk4TfUTiFf+Cxc46hf4yAwqrbmNUqrUtLfbJxK/m3peQwA1BMEC03i8U8rOlKFMtbZghSWw0O5m10eMBKY8Ix6mAuPAYSmhTgeS+oOCHv0K6/9KMZ6BzrH2pTYOeUFJribB5Y4F4eL6JISeBhmJvEy4gHQ3nQjI97+5I6JLuqMKfRC2ZrrsoBhuk8NRm7H3Ya2xSk8wV3+rBt+1QGWpmVMxhx1xT/Hc4IvdNR5edCgsWP+6CH1EcTVkq1pjXOAXTSFkN+xIyP4FxhIebZFhQE878Jc2p4OYYCunauoguJBlhNlVYPP39l7WF1LI++jCd6Va1+4zvsiD1v/F9Pja1/FsNw4ZTc7T7J4x7jlZIAlgE6H6OmfSa9eOJM7hkpQ1/Tl6n4U6I0zbJTew9kvbt2KoiLOCYs1knuBdIkM7uWXtbEL4HsARc0G+16V9xHo5QlRJn148f3V+MW0tgbP2bO7Y8/Sm3/eYVJW+m0MRzLXlscVQPOyoJaXwyOdaixHj66gtHyIHQ+ts8jhPkLGcINc1YS+lIpQdnnf7S8ArgKR5wcSIeb3QnfOzWNHHdxenpMSgxCMiWrqVCCnX8Tw0Rkj1vFGNKQPZAQu5KqoZ8Ze+HxhTg3LETYYnMFf6viXCXOWL3tkM9/nr9WZ6fvt/tNLlaclh4dT+tzipnW 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:(13230031)(4636009)(136003)(346002)(376002)(39860400002)(396003)(230922051799003)(82310400011)(1800799009)(186009)(64100799003)(451199024)(46966006)(36840700001)(40470700004)(40460700003)(110136005)(70586007)(316002)(70206006)(54906003)(16526019)(1076003)(26005)(336012)(36756003)(107886003)(426003)(83380400001)(7636003)(2616005)(356005)(47076005)(82740400003)(86362001)(36860700001)(40480700001)(478600001)(41300700001)(5660300002)(2906002)(4744005)(8676002)(4326008)(8936002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:14:13.0477 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9db9c7c0-c23a-41b3-0734-08dbce49cabf 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: BL6PEPF0001AB78.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7619 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Add MDB net device operation that will be invoked by rtnetlink code in response to received RTM_GETMDB messages. Subsequent patches will implement the operation in the bridge and VXLAN drivers. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- include/linux/netdevice.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 1c7681263d30..18376b65dc61 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1586,6 +1586,10 @@ struct net_device_ops { int (*ndo_mdb_dump)(struct net_device *dev, struct sk_buff *skb, struct netlink_callback *cb); + int (*ndo_mdb_get)(struct net_device *dev, + struct nlattr *tb[], u32 portid, + u32 seq, + struct netlink_ext_ack *extack); int (*ndo_bridge_setlink)(struct net_device *dev, struct nlmsghdr *nlh, u16 flags, From patchwork Mon Oct 16 13:12:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13423233 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 4686C28695 for ; Mon, 16 Oct 2023 13:14:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="B6E+DKMj" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2073.outbound.protection.outlook.com [40.107.220.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7495FB for ; Mon, 16 Oct 2023 06:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IVQCL0rr+G7Q8VA+3MwZYcfP3cIpKyL9xSPO42wfs3922vgz0+RwPwrvWmm57CYQD1FALsTwdWc2l/UUvXpW8xKtIDRhBQr9j8HThQ/2SXwAWRjO7ncIK9eC2TqtEwGKFkLUXjPRVopAPN11vL7D/jnZ1G6pmHma6mRssmXTFqpXA69eZhM0v5vQB0ighBrbQxBRjpEkWdCngGqgNhVtwEvQwpQbv/iJDbzHKH+PkyDt6uM6yO7shim99pKe4sMdUUEbIzge7JhIw4NlFO5UXyEyEyhsaU7gyKh9j6gardkueC4kcmudR+r3RhEYlX85RA4AUKdIv8CqP9FJocWFJA== 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=7WSgNZIgfh1KxIH01jmMzAvHYyylas9H8JzLUVFsdco=; b=NK50LDL00q/qmJXog+UEDLYXzXF7Kw0bR9OhX4QVt+rldHds53yQq+nG2jw+1jsXhgJF4XQCh5XUQZi1o/7pwXxD0Vg73O13TGJ8Y9bHckWPvbDrK9MmN5Bo2KAcWH55OZB+fA+YSNge5vksiIfS98fRpm4JhN1xlvKfuQ5Eyo6xJHnxitegDu9rWAID7mVVaHm5RiW2Aikxyfan/Eo8U3PoLTRQGa+uKv6zO0OSV0YPAN82JBhXfZA+ogzhqlAgPsPo43zeW3R9R/WNIj15fsS+rfvX7hDgDPDPtiFPppBF8U7UMEJgjJ9zwj3mtmemA3K31XxFpyh8Tkjqi9FuUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org 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 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=7WSgNZIgfh1KxIH01jmMzAvHYyylas9H8JzLUVFsdco=; b=B6E+DKMjZQ80mmSTfjgDkD2eym1+4si1UeUdwfxE2JkAsZmS9bamKBFMCoQqSXV7m0ertW8LwDNF7vBssE0mcxYZspKOtdvAeAUdaROHyyscHG3U6Mnkwx6NORkVty1mN5rO64P2IYMCJu+FDRu4f2w80ss942cGNZDoJX5SvOfFKQmw9KVfS+lTqRr65go6CcfCWXgrt/SBt9Yz7jrsjtnQrKn/DNblLeAXx6byKT3/qG/YuUoVZH3up4Op4bMo2BMQweeHo05IYWTPJQE5ruU84HXwOvaEvkuIcZmElYBwGu+PzisdumPlsUoUDigFOvqncrXPY4JD8B7/MbhqhA== Received: from MW4PR04CA0150.namprd04.prod.outlook.com (2603:10b6:303:84::35) by PH8PR12MB6916.namprd12.prod.outlook.com (2603:10b6:510:1bd::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.34; Mon, 16 Oct 2023 13:14:15 +0000 Received: from CO1PEPF000044EE.namprd05.prod.outlook.com (2603:10b6:303:84:cafe::b0) by MW4PR04CA0150.outlook.office365.com (2603:10b6:303:84::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 13:14:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000044EE.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:14:15 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 06:14:02 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:13:59 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 09/13] bridge: mcast: Add MDB get support Date: Mon, 16 Oct 2023 16:12:55 +0300 Message-ID: <20231016131259.3302298-10-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044EE:EE_|PH8PR12MB6916:EE_ X-MS-Office365-Filtering-Correlation-Id: 1a726108-d69d-49a7-a8cc-08dbce49cbe7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oxoLa31KL6A0wR3Ls88FXssy670KrEmBQ0eCCH2r5Xiyru1tFCG/ugyO6LV55UCKQAcuDDoj5rGcwF5X95BU9V+iug8kXVwIx7ZmXu6ARuTSqE5kDyRe43GVaXJ5u+ZGtkLnYVMgcDThj/8JMHQZPZvPtAxswc6m8qWbdd1o3973dWv9uWFmGtiIIu/qzqSd8t7nito/Z3N3rJWOTdsxNpmOxcY8i+ibFJHXMgPCrZ1w+l50t9VWTfddj925BoD7pYxpCIryElULI7a15UY1sBASofz6j3icpDcISo/yG70X6scwxE0/eiJXiFqFL0E/F8hhW51vM2ogupHmsCgYKuBR1dEDT8i2UXDcf6C5XxjYi42ezpLHlUMlggcfo4QqqDt1DpsO/iz2meAhOVGtGP61JlGYzfGpizsLn+6AiI87CDwikb/YLjjIb96ki7lmYdLd+0wuoq6i8HFuc1it/eBewVAfmQ73vZuZFcGN3yE0f/ls4WJB1dutaaAH6JS9aAew2Ez9eGPHImCNiR0swK7QnOqs+1f2b/P75z8LU0h2zDOLLQ+D8+3rGhRTMxjM5BLZPC+Oc/G9lfLRZuCyXDFXFLEAMf58hUaniJuptLr7Cgc2yWtpjILEJlR068QAD1Uukh1PlMueUiuECwQ61d/uANx3NZsZGj1QZChN2JK83KKqvf3HAwxI7WXaJppaOYRJH9/a7DbifbrOtrmCQuweW1GxitwpUfQPYvO0fZhxwMS6hIbThbfxTTiiCug6 X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(136003)(346002)(39860400002)(396003)(230922051799003)(64100799003)(451199024)(82310400011)(186009)(1800799009)(46966006)(40470700004)(36840700001)(40460700003)(86362001)(36756003)(40480700001)(8676002)(36860700001)(4326008)(8936002)(107886003)(47076005)(2906002)(5660300002)(426003)(26005)(2616005)(1076003)(336012)(16526019)(83380400001)(478600001)(316002)(41300700001)(110136005)(54906003)(70206006)(70586007)(82740400003)(6666004)(356005)(7636003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:14:15.0385 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1a726108-d69d-49a7-a8cc-08dbce49cbe7 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.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6916 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Implement support for MDB get operation by looking up a matching MDB entry, allocating the skb according to the entry's size and then filling in the response. The operation is performed under the bridge multicast lock to ensure that the entry does not change between the time the reply size is determined and when the reply is filled in. Signed-off-by: Ido Schimmel --- net/bridge/br_device.c | 1 + net/bridge/br_mdb.c | 154 ++++++++++++++++++++++++++++++++++++++++ net/bridge/br_private.h | 9 +++ 3 files changed, 164 insertions(+) diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index d624710b384a..8f40de3af154 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -472,6 +472,7 @@ static const struct net_device_ops br_netdev_ops = { .ndo_mdb_add = br_mdb_add, .ndo_mdb_del = br_mdb_del, .ndo_mdb_dump = br_mdb_dump, + .ndo_mdb_get = br_mdb_get, .ndo_bridge_getlink = br_getlink, .ndo_bridge_setlink = br_setlink, .ndo_bridge_dellink = br_dellink, diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 42983f6a0abd..973e27fe3498 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -1411,3 +1411,157 @@ int br_mdb_del(struct net_device *dev, struct nlattr *tb[], br_mdb_config_fini(&cfg); return err; } + +static const struct nla_policy br_mdbe_attrs_get_pol[MDBE_ATTR_MAX + 1] = { + [MDBE_ATTR_SOURCE] = NLA_POLICY_RANGE(NLA_BINARY, + sizeof(struct in_addr), + sizeof(struct in6_addr)), +}; + +static int br_mdb_get_parse(struct net_device *dev, struct nlattr *tb[], + struct br_ip *group, struct netlink_ext_ack *extack) +{ + struct br_mdb_entry *entry = nla_data(tb[MDBA_GET_ENTRY]); + struct nlattr *mdbe_attrs[MDBE_ATTR_MAX + 1]; + int err; + + if (!tb[MDBA_GET_ENTRY_ATTRS]) { + __mdb_entry_to_br_ip(entry, group, NULL); + return 0; + } + + err = nla_parse_nested(mdbe_attrs, MDBE_ATTR_MAX, + tb[MDBA_GET_ENTRY_ATTRS], br_mdbe_attrs_get_pol, + extack); + if (err) + return err; + + if (mdbe_attrs[MDBE_ATTR_SOURCE] && + !is_valid_mdb_source(mdbe_attrs[MDBE_ATTR_SOURCE], + entry->addr.proto, extack)) + return -EINVAL; + + __mdb_entry_to_br_ip(entry, group, mdbe_attrs); + + return 0; +} + +static struct sk_buff * +br_mdb_get_reply_alloc(const struct net_bridge_mdb_entry *mp) +{ + struct net_bridge_port_group *pg; + size_t nlmsg_size; + + nlmsg_size = NLMSG_ALIGN(sizeof(struct br_port_msg)) + + /* MDBA_MDB */ + nla_total_size(0) + + /* MDBA_MDB_ENTRY */ + nla_total_size(0); + + if (mp->host_joined) + nlmsg_size += rtnl_mdb_nlmsg_pg_size(NULL); + + for (pg = mlock_dereference(mp->ports, mp->br); pg; + pg = mlock_dereference(pg->next, mp->br)) + nlmsg_size += rtnl_mdb_nlmsg_pg_size(pg); + + return nlmsg_new(nlmsg_size, GFP_ATOMIC); +} + +static int br_mdb_get_reply_fill(struct sk_buff *skb, + struct net_bridge_mdb_entry *mp, u32 portid, + u32 seq) +{ + struct nlattr *mdb_nest, *mdb_entry_nest; + struct net_bridge_port_group *pg; + struct br_port_msg *bpm; + struct nlmsghdr *nlh; + int err; + + nlh = nlmsg_put(skb, portid, seq, RTM_NEWMDB, sizeof(*bpm), 0); + if (!nlh) + return -EMSGSIZE; + + bpm = nlmsg_data(nlh); + memset(bpm, 0, sizeof(*bpm)); + bpm->family = AF_BRIDGE; + bpm->ifindex = mp->br->dev->ifindex; + mdb_nest = nla_nest_start_noflag(skb, MDBA_MDB); + if (!mdb_nest) { + err = -EMSGSIZE; + goto cancel; + } + mdb_entry_nest = nla_nest_start_noflag(skb, MDBA_MDB_ENTRY); + if (!mdb_entry_nest) { + err = -EMSGSIZE; + goto cancel; + } + + if (mp->host_joined) { + err = __mdb_fill_info(skb, mp, NULL); + if (err) + goto cancel; + } + + for (pg = mlock_dereference(mp->ports, mp->br); pg; + pg = mlock_dereference(pg->next, mp->br)) { + err = __mdb_fill_info(skb, mp, pg); + if (err) + goto cancel; + } + + nla_nest_end(skb, mdb_entry_nest); + nla_nest_end(skb, mdb_nest); + nlmsg_end(skb, nlh); + + return 0; + +cancel: + nlmsg_cancel(skb, nlh); + return err; +} + +int br_mdb_get(struct net_device *dev, struct nlattr *tb[], u32 portid, u32 seq, + struct netlink_ext_ack *extack) +{ + struct net_bridge *br = netdev_priv(dev); + struct net_bridge_mdb_entry *mp; + struct sk_buff *skb; + struct br_ip group; + int err; + + err = br_mdb_get_parse(dev, tb, &group, extack); + if (err) + return err; + + spin_lock_bh(&br->multicast_lock); + + mp = br_mdb_ip_get(br, &group); + if (!mp) { + NL_SET_ERR_MSG_MOD(extack, "MDB entry not found"); + err = -ENOENT; + goto unlock; + } + + skb = br_mdb_get_reply_alloc(mp); + if (!skb) { + err = -ENOMEM; + goto unlock; + } + + err = br_mdb_get_reply_fill(skb, mp, portid, seq); + if (err) { + NL_SET_ERR_MSG_MOD(extack, "Failed to fill MDB get reply"); + goto free; + } + + spin_unlock_bh(&br->multicast_lock); + + return rtnl_unicast(skb, dev_net(dev), portid); + +free: + kfree_skb(skb); +unlock: + spin_unlock_bh(&br->multicast_lock); + return err; +} diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 3220898424ce..ad49d5008ec2 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -1018,6 +1018,8 @@ int br_mdb_del(struct net_device *dev, struct nlattr *tb[], struct netlink_ext_ack *extack); int br_mdb_dump(struct net_device *dev, struct sk_buff *skb, struct netlink_callback *cb); +int br_mdb_get(struct net_device *dev, struct nlattr *tb[], u32 portid, u32 seq, + struct netlink_ext_ack *extack); void br_multicast_host_join(const struct net_bridge_mcast *brmctx, struct net_bridge_mdb_entry *mp, bool notify); void br_multicast_host_leave(struct net_bridge_mdb_entry *mp, bool notify); @@ -1428,6 +1430,13 @@ static inline int br_mdb_dump(struct net_device *dev, struct sk_buff *skb, return 0; } +static inline int br_mdb_get(struct net_device *dev, struct nlattr *tb[], + u32 portid, u32 seq, + struct netlink_ext_ack *extack) +{ + return -EOPNOTSUPP; +} + static inline int br_mdb_hash_init(struct net_bridge *br) { return 0; From patchwork Mon Oct 16 13:12:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13423235 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 8897427EC6 for ; Mon, 16 Oct 2023 13:14:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="kL0gYPtD" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DB0FEE for ; Mon, 16 Oct 2023 06:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KiKbNFf0tZ5teXxDAU4cIe4NSlpWYjAokSIhrssLHTXLP8oZTiWrSC/ZvGgM5nCy3pzdH1wr1E3F9HT0vasoKX99QRKYa4xu5PMmqboK2TpePPUxS49Wi3Cs4/jjZVUfchsEO+z8aBs1sBd6/+bSx3SQ/y8WOTKn8Y0R1IYEUPTYYOWE1MwPDTPoYEgXW1niMvB+lktOd9w9zASw/y5AIXvc9rlY9YNdx9fcGt8MJvP2B+J36rJUVP6q2R5dcR3NLdZh6MserQC3Y3GCdgHc7KLUYBtbPtKjrzrnX+X6ZuM4RjUc0489anrv4virIZRfPZp+8OilXo7OCxx+p5zllQ== 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=MwGvxzFaRNUgq/+3HyNi1CY3UXPyoqzFSQ7rdYIziUQ=; b=VcO2WQwvaYW7wye4kcD0lYsd19ht/xnawyJUvyqErg0fX80IvDcwwvKgz7Sm4PVM0nN45iCoPuLr92KM03LXSq3VLwlsfp1JjTZd5aX4vT5+kU9Ql8gRiFVN9XFaiUCTbwO+qxpKHMrt7G7x7anle/MXH6Iu5n+kHkTLV9qheaO3oW0s5rsP7MTkpRQAkdWCIPf8AIkfdAD/qY3LeYGiX7o6KVtR95bi8Jke02uLkx3wgzh6Tm6kUi/INCe9rFrZOCslFaBGWCftUTt70ZoCznoF+xTuSxJrY2gxbsEu2RgYJeuPZAM4U/mhETeFs29oxFs7mWEspxkOtbH8vM5Brg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=vger.kernel.org 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 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=MwGvxzFaRNUgq/+3HyNi1CY3UXPyoqzFSQ7rdYIziUQ=; b=kL0gYPtDaEJJY5JSz/GDuzJnTrJ2H1xCV6QwtlyaBy8BH1O5MibxSzZSYKTxeu80BD5KD8hXLuKQSH53kvdexFctlPnDmI1SKOk7NMq0NSLPxES7stVlzolniqjqNMVpDoQ7YieR6lva+LuRRfWSJ+MUZZuIhQGmeZbP4iINsmVcB2jmPoMmqo6O8SboQD4ogAxVD8HFfq/YVkVkSK01KmaKoQ0OHTPu9YiR72tRnN3JcmfpEeX47ZLGRbOnqlwX5I28lQXzGG2/dZlUuKOkS7LqMfPv7JxuZcA/YOIfVZMnj4nfhNw/G9Fh/17WXURGIrAw87Yz8SzQnxIL1ThOFw== Received: from BLAPR05CA0045.namprd05.prod.outlook.com (2603:10b6:208:335::25) by CYYPR12MB8889.namprd12.prod.outlook.com (2603:10b6:930:cb::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.47; Mon, 16 Oct 2023 13:14:20 +0000 Received: from BL6PEPF0001AB77.namprd02.prod.outlook.com (2603:10b6:208:335:cafe::e5) by BLAPR05CA0045.outlook.office365.com (2603:10b6:208:335::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.17 via Frontend Transport; Mon, 16 Oct 2023 13:14:20 +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 BL6PEPF0001AB77.mail.protection.outlook.com (10.167.242.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:14:20 +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.986.41; Mon, 16 Oct 2023 06:14:05 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:14:02 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 10/13] vxlan: mdb: Add MDB get support Date: Mon, 16 Oct 2023 16:12:56 +0300 Message-ID: <20231016131259.3302298-11-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB77:EE_|CYYPR12MB8889:EE_ X-MS-Office365-Filtering-Correlation-Id: a189580e-3f7a-4f2c-1442-08dbce49cf17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7svVp7gldBznHA9w9QzCBcq/nCpMS5DpHiJa9qkJInNY7keWxRVEJO1Lak/dOsgxcYubG6KSqUTYN9Q73brmiev2UVtAMZjMteTeVAAI5DhGJfSxuiA3h81RdTzpjKbrxofotq4GZlm7ZxLk0x4dA/D+DzcUhNnIFH+l7f2ikwuLHuFDOOxt93YZ3+ruZLEWSGBzy/k7bBgc37sZzZXlzNbOLzkuDKbLosCUzmNIKa9dUAhAEltGYwC7AK6yQR/+v9zkB705qVESWfcvjDUdXVBZPENDzn/sPEkJtEheiccF0N521pNLSnIyrGP2pCHEOAGPfjjBs9itKNIBBwigTDJEeeGgbIT2eIMoktzKN39vPP8oQeNitYxyD47jKxtsfFvfj252NNiFrM2QAIe3rNpFgZWJFOUy7LJhgSZPEaYzVRv0s4JOb8EXpjQcY6+tF4H7tjee8YvfN8FQ8DZhUAgbWCfQQEfBHxLzS52KG5N8X9m9yDpT8n4QCPJzBWvnY+fvwvhseHVMB2wdmzH2kC7L07B1IBc7EPtSbjaWfWYE9+QtVauSz8/YZt2awNZFh8va9q1nihsBMMqGhPuwQojZN08eK8f+bNLJhI7IcplT8WDOpMgsqbdiR9kBNEAfo/wV1hOmRL6pSJSmVGeFiqLZdZ2Umd/3elK8TVO8pDfsrznTjfMDrkkLfIRFNVKUCwkDRkToLv2Sd/OzFkTPfHGZ5pzRQe8DsTl8xtSCRwmZfs1gSa1ySSIWA/iGgcUP 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:(13230031)(4636009)(39860400002)(376002)(136003)(346002)(396003)(230922051799003)(64100799003)(82310400011)(186009)(1800799009)(451199024)(40470700004)(46966006)(36840700001)(110136005)(478600001)(70586007)(70206006)(6666004)(54906003)(1076003)(16526019)(26005)(107886003)(426003)(2616005)(336012)(316002)(36756003)(8936002)(8676002)(4326008)(2906002)(41300700001)(5660300002)(7636003)(86362001)(47076005)(356005)(36860700001)(82740400003)(40480700001)(40460700003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:14:20.3200 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a189580e-3f7a-4f2c-1442-08dbce49cf17 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: BL6PEPF0001AB77.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8889 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Implement support for MDB get operation by looking up a matching MDB entry, allocating the skb according to the entry's size and then filling in the response. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- drivers/net/vxlan/vxlan_core.c | 1 + drivers/net/vxlan/vxlan_mdb.c | 150 ++++++++++++++++++++++++++++++ drivers/net/vxlan/vxlan_private.h | 2 + 3 files changed, 153 insertions(+) diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 6f7d45e3cfa2..7ed19f2cf6f5 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -3302,6 +3302,7 @@ static const struct net_device_ops vxlan_netdev_ether_ops = { .ndo_mdb_add = vxlan_mdb_add, .ndo_mdb_del = vxlan_mdb_del, .ndo_mdb_dump = vxlan_mdb_dump, + .ndo_mdb_get = vxlan_mdb_get, .ndo_fill_metadata_dst = vxlan_fill_metadata_dst, }; diff --git a/drivers/net/vxlan/vxlan_mdb.c b/drivers/net/vxlan/vxlan_mdb.c index 19640f7e3a88..e472fd67fc2e 100644 --- a/drivers/net/vxlan/vxlan_mdb.c +++ b/drivers/net/vxlan/vxlan_mdb.c @@ -1306,6 +1306,156 @@ int vxlan_mdb_del(struct net_device *dev, struct nlattr *tb[], return err; } +static const struct nla_policy vxlan_mdbe_attrs_get_pol[MDBE_ATTR_MAX + 1] = { + [MDBE_ATTR_SOURCE] = NLA_POLICY_RANGE(NLA_BINARY, + sizeof(struct in_addr), + sizeof(struct in6_addr)), + [MDBE_ATTR_SRC_VNI] = NLA_POLICY_FULL_RANGE(NLA_U32, &vni_range), +}; + +static int vxlan_mdb_get_parse(struct net_device *dev, struct nlattr *tb[], + struct vxlan_mdb_entry_key *group, + struct netlink_ext_ack *extack) +{ + struct br_mdb_entry *entry = nla_data(tb[MDBA_GET_ENTRY]); + struct nlattr *mdbe_attrs[MDBE_ATTR_MAX + 1]; + struct vxlan_dev *vxlan = netdev_priv(dev); + int err; + + memset(group, 0, sizeof(*group)); + group->vni = vxlan->default_dst.remote_vni; + + if (!tb[MDBA_GET_ENTRY_ATTRS]) { + vxlan_mdb_group_set(group, entry, NULL); + return 0; + } + + err = nla_parse_nested(mdbe_attrs, MDBE_ATTR_MAX, + tb[MDBA_GET_ENTRY_ATTRS], + vxlan_mdbe_attrs_get_pol, extack); + if (err) + return err; + + if (mdbe_attrs[MDBE_ATTR_SOURCE] && + !vxlan_mdb_is_valid_source(mdbe_attrs[MDBE_ATTR_SOURCE], + entry->addr.proto, extack)) + return -EINVAL; + + vxlan_mdb_group_set(group, entry, mdbe_attrs[MDBE_ATTR_SOURCE]); + + if (mdbe_attrs[MDBE_ATTR_SRC_VNI]) + group->vni = + cpu_to_be32(nla_get_u32(mdbe_attrs[MDBE_ATTR_SRC_VNI])); + + return 0; +} + +static struct sk_buff * +vxlan_mdb_get_reply_alloc(const struct vxlan_dev *vxlan, + const struct vxlan_mdb_entry *mdb_entry) +{ + struct vxlan_mdb_remote *remote; + size_t nlmsg_size; + + nlmsg_size = NLMSG_ALIGN(sizeof(struct br_port_msg)) + + /* MDBA_MDB */ + nla_total_size(0) + + /* MDBA_MDB_ENTRY */ + nla_total_size(0); + + list_for_each_entry(remote, &mdb_entry->remotes, list) + nlmsg_size += vxlan_mdb_nlmsg_remote_size(vxlan, mdb_entry, + remote); + + return nlmsg_new(nlmsg_size, GFP_KERNEL); +} + +static int +vxlan_mdb_get_reply_fill(const struct vxlan_dev *vxlan, + struct sk_buff *skb, + const struct vxlan_mdb_entry *mdb_entry, + u32 portid, u32 seq) +{ + struct nlattr *mdb_nest, *mdb_entry_nest; + struct vxlan_mdb_remote *remote; + struct br_port_msg *bpm; + struct nlmsghdr *nlh; + int err; + + nlh = nlmsg_put(skb, portid, seq, RTM_NEWMDB, sizeof(*bpm), 0); + if (!nlh) + return -EMSGSIZE; + + bpm = nlmsg_data(nlh); + memset(bpm, 0, sizeof(*bpm)); + bpm->family = AF_BRIDGE; + bpm->ifindex = vxlan->dev->ifindex; + mdb_nest = nla_nest_start_noflag(skb, MDBA_MDB); + if (!mdb_nest) { + err = -EMSGSIZE; + goto cancel; + } + mdb_entry_nest = nla_nest_start_noflag(skb, MDBA_MDB_ENTRY); + if (!mdb_entry_nest) { + err = -EMSGSIZE; + goto cancel; + } + + list_for_each_entry(remote, &mdb_entry->remotes, list) { + err = vxlan_mdb_entry_info_fill(vxlan, skb, mdb_entry, remote); + if (err) + goto cancel; + } + + nla_nest_end(skb, mdb_entry_nest); + nla_nest_end(skb, mdb_nest); + nlmsg_end(skb, nlh); + + return 0; + +cancel: + nlmsg_cancel(skb, nlh); + return err; +} + +int vxlan_mdb_get(struct net_device *dev, struct nlattr *tb[], u32 portid, + u32 seq, struct netlink_ext_ack *extack) +{ + struct vxlan_dev *vxlan = netdev_priv(dev); + struct vxlan_mdb_entry *mdb_entry; + struct vxlan_mdb_entry_key group; + struct sk_buff *skb; + int err; + + ASSERT_RTNL(); + + err = vxlan_mdb_get_parse(dev, tb, &group, extack); + if (err) + return err; + + mdb_entry = vxlan_mdb_entry_lookup(vxlan, &group); + if (!mdb_entry) { + NL_SET_ERR_MSG_MOD(extack, "MDB entry not found"); + return -ENOENT; + } + + skb = vxlan_mdb_get_reply_alloc(vxlan, mdb_entry); + if (!skb) + return -ENOMEM; + + err = vxlan_mdb_get_reply_fill(vxlan, skb, mdb_entry, portid, seq); + if (err) { + NL_SET_ERR_MSG_MOD(extack, "Failed to fill MDB get reply"); + goto free; + } + + return rtnl_unicast(skb, dev_net(dev), portid); + +free: + kfree_skb(skb); + return err; +} + struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan, struct sk_buff *skb, __be32 src_vni) diff --git a/drivers/net/vxlan/vxlan_private.h b/drivers/net/vxlan/vxlan_private.h index 817fa3075842..db679c380955 100644 --- a/drivers/net/vxlan/vxlan_private.h +++ b/drivers/net/vxlan/vxlan_private.h @@ -235,6 +235,8 @@ int vxlan_mdb_add(struct net_device *dev, struct nlattr *tb[], u16 nlmsg_flags, struct netlink_ext_ack *extack); int vxlan_mdb_del(struct net_device *dev, struct nlattr *tb[], struct netlink_ext_ack *extack); +int vxlan_mdb_get(struct net_device *dev, struct nlattr *tb[], u32 portid, + u32 seq, struct netlink_ext_ack *extack); struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan, struct sk_buff *skb, __be32 src_vni); From patchwork Mon Oct 16 13:12:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13423234 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 74AF827738 for ; Mon, 16 Oct 2023 13:14:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="tzDZrqBB" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2939F5 for ; Mon, 16 Oct 2023 06:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dEPy5uVCYQRvPCoO0SvJmsqbqytKvyGOnMgQozol/Lpjh5/cwBd/QRC+H8DypBzedD8nnLhV0IMlmKWzD9BcdjJ5YNxrt9BssGD6lPjLNY0iW6gy9dbh3EHEtyMjfmpv+qxLLG7Fjes8nsSqBly28hmM+vhlx/EW9UqumTTibymD3bsmNysxtQRBeWeXYNjTO8i5nP25LOmtChn+QuKUJcxV8bLDG4NRlFVGsI41YP91SFvLTwr5d20UYW9b72qQIZnEBDgwNuTwYV+BeNxp41PyDnPrxKEvN3NwbtZH/rj8euSSTmuYzCSk1aUwoYJ6eZRbUc3n1qYmzoij3pc8sw== 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=KAcIptTXNIvJ6cPUQPR8TX9wiLP5p80U0vPHJxi/qtk=; b=NYT934duX10ygr9PUM87IXjC5L3yXEwQZ45Y1jzaEZG1OIPPdIL0TQtitHqdHjRCnATel0JTpZRlEr9g7Jk7gLyNkgCdOMLMQmIq9r3PnpoGZu0rqbMmmF4GjgSCbihDPgRB9r/Lo1907054jz9VQZWaG5wV/IBEkTPn+fx+yieypm4Wi/ZcgnMyaimtulW547ddN85ukWxOzVuP00fb20ffnkLT3eaKIlSV/SRl9oCiLiMO8rNwhb8D7EozMJQCPrsSaB6frpa0Mp62nmwNGP0EcVzVQXF9MJT3RnArCXgW/hwleUKCqqd6hx/JY+5b7zP1lKydLZLUu07Gx9z5Zw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org 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 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=KAcIptTXNIvJ6cPUQPR8TX9wiLP5p80U0vPHJxi/qtk=; b=tzDZrqBB6z2LikaGMC3IEDg7vMBYFN2anhoZF/7twK6H+JfLc/IVMFoCd58tLDgRTqMWLQlSnK1khUM6BDoGbc9ibLqJGzb6NRRqSl+i/dp+/vdSWJoVrMUfnd91hwl8E00I4HR99NCUoqTANiD5nFEiwVsSf6UasReGxXxEUy5Yce8UD5+jfPowqBNrsCddRSvt0Ei4eT8wmU+S8T8kO3S6UvwQwgTsXeNtITihg1rlcLDkCNDlAiMq+DcGsp+nM46QsbcOyeUGEhD6F1nhbwj2UaLCJ+fZwQVjbji9DUdV343ijEl10hRcqMIipwhMdIhk+HhK40TM7Ij42XkH2A== Received: from MW4PR04CA0296.namprd04.prod.outlook.com (2603:10b6:303:89::31) by CY8PR12MB7340.namprd12.prod.outlook.com (2603:10b6:930:50::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 13:14:22 +0000 Received: from CO1PEPF000044EF.namprd05.prod.outlook.com (2603:10b6:303:89:cafe::b7) by MW4PR04CA0296.outlook.office365.com (2603:10b6:303:89::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 13:14:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000044EF.mail.protection.outlook.com (10.167.241.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:14:21 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 06:14:08 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:14:05 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 11/13] rtnetlink: Add MDB get support Date: Mon, 16 Oct 2023 16:12:57 +0300 Message-ID: <20231016131259.3302298-12-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044EF:EE_|CY8PR12MB7340:EE_ X-MS-Office365-Filtering-Correlation-Id: 39a8f49b-9a0c-462a-0689-08dbce49cfe6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yfRJh2NZab+QvgZDmID3+qi08ZXp82wuLWIMM6fmm0avXdOT49XuYzrUScxKVXcgFO7CTgN8cnRJns/mvl4BOx3CRbtXKXU7gVW7l++mpa2XO+BDstGrHB/CAvDsAij5SL9Z4EtwmBtqo8xuLnpf8BsPNeDImJOHGGZ8oPSpREE+hLUm59Qp9LdrHzsybsfmb5Uszc/Qvin82vgS3qGhYzVXJEGSye4LQnhvG3BRfeC9p9VwSJDYw4XNFWwDW9lD7d6Gn22ySmBgea1rPGevZOZOvhjf+I4g9zAZh5WP4NC+7N0hOTuflKs2D8dylfGZG5pmqxXfNiLRdcq0GoDXbQ2ewgWq3RwC4MQyttFSkM/JeEv7ypxQjSGsGK0MEVPs3s3oiMrRKipDSIsKl0hQjvMSjoLJYLOVFnX7MliWLfFPbks5HpJU+s7V1+a/Kd+CUvx36D8c9d2pStaYPrIc9Hr7zrp36pLETNyaJMdGV9MrKTzQnfkffQgqzlkuD2aOhvoYveL/tCH3Mp+d5mKJVRWBCSQMzushIXTmjKFLZKAh1IegGWRlEOEciW1gQmVaECuaCkUWYffAY6rdjD13jOcPcK96umZ80aWb8hwCJHrSL2Znp5YnxythRTesO6g32t5kNz6/pJ6g9cQvLl3xPYRXkO6HTpfs9aqQt+aNwenwgEHYXeZ09OvtbME0AUz9BiwTvKXF35dmvEHjpLTEVTuT12uRPfkaYTh6O2NGx4qX3eWtuZJyZixhpAQcLVOW X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(396003)(136003)(39860400002)(346002)(230922051799003)(451199024)(186009)(1800799009)(64100799003)(82310400011)(46966006)(36840700001)(40470700004)(40460700003)(107886003)(16526019)(1076003)(26005)(2616005)(336012)(82740400003)(426003)(8676002)(8936002)(4326008)(5660300002)(47076005)(83380400001)(7636003)(40480700001)(41300700001)(356005)(478600001)(86362001)(110136005)(2906002)(36860700001)(316002)(6666004)(70206006)(36756003)(54906003)(70586007);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:14:21.7387 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39a8f49b-9a0c-462a-0689-08dbce49cfe6 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.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044EF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7340 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Now that both the bridge and VXLAN drivers implement the MDB get net device operation, expose the functionality to user space by registering a handler for RTM_GETMDB messages. Derive the net device from the ifindex specified in the ancillary header and invoke its MDB get NDO. Note that unlike other get handlers, the allocation of the skb containing the response is not performed in the common rtnetlink code as the size is variable and needs to be determined by the respective driver. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/core/rtnetlink.c | 89 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index eef7f7788996..e4fb242655b4 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -6221,6 +6221,93 @@ static int rtnl_mdb_dump(struct sk_buff *skb, struct netlink_callback *cb) return skb->len; } +static int rtnl_validate_mdb_entry_get(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_ATTR(extack, attr, "Invalid attribute length"); + return -EINVAL; + } + + if (entry->ifindex) { + NL_SET_ERR_MSG(extack, "Entry ifindex cannot be specified"); + return -EINVAL; + } + + if (entry->state) { + NL_SET_ERR_MSG(extack, "Entry state cannot be specified"); + return -EINVAL; + } + + if (entry->flags) { + NL_SET_ERR_MSG(extack, "Entry flags cannot be specified"); + return -EINVAL; + } + + if (entry->vid >= VLAN_VID_MASK) { + NL_SET_ERR_MSG(extack, "Invalid entry VLAN id"); + return -EINVAL; + } + + if (entry->addr.proto != htons(ETH_P_IP) && + entry->addr.proto != htons(ETH_P_IPV6) && + entry->addr.proto != 0) { + NL_SET_ERR_MSG(extack, "Unknown entry protocol"); + return -EINVAL; + } + + return 0; +} + +static const struct nla_policy mdba_get_policy[MDBA_GET_ENTRY_MAX + 1] = { + [MDBA_GET_ENTRY] = NLA_POLICY_VALIDATE_FN(NLA_BINARY, + rtnl_validate_mdb_entry_get, + sizeof(struct br_mdb_entry)), + [MDBA_GET_ENTRY_ATTRS] = { .type = NLA_NESTED }, +}; + +static int rtnl_mdb_get(struct sk_buff *in_skb, struct nlmsghdr *nlh, + struct netlink_ext_ack *extack) +{ + struct nlattr *tb[MDBA_GET_ENTRY_MAX + 1]; + struct net *net = sock_net(in_skb->sk); + struct br_port_msg *bpm; + struct net_device *dev; + int err; + + err = nlmsg_parse(nlh, sizeof(struct br_port_msg), tb, + MDBA_GET_ENTRY_MAX, mdba_get_policy, extack); + if (err) + return err; + + bpm = nlmsg_data(nlh); + if (!bpm->ifindex) { + NL_SET_ERR_MSG(extack, "Invalid ifindex"); + return -EINVAL; + } + + dev = __dev_get_by_index(net, bpm->ifindex); + if (!dev) { + NL_SET_ERR_MSG(extack, "Device doesn't exist"); + return -ENODEV; + } + + if (NL_REQ_ATTR_CHECK(extack, NULL, tb, MDBA_GET_ENTRY)) { + NL_SET_ERR_MSG(extack, "Missing MDBA_GET_ENTRY attribute"); + return -EINVAL; + } + + if (!dev->netdev_ops->ndo_mdb_get) { + NL_SET_ERR_MSG(extack, "Device does not support MDB operations"); + return -EOPNOTSUPP; + } + + return dev->netdev_ops->ndo_mdb_get(dev, tb, NETLINK_CB(in_skb).portid, + nlh->nlmsg_seq, extack); +} + static int rtnl_validate_mdb_entry(const struct nlattr *attr, struct netlink_ext_ack *extack) { @@ -6597,7 +6684,7 @@ void __init rtnetlink_init(void) 0); rtnl_register(PF_UNSPEC, RTM_SETSTATS, rtnl_stats_set, NULL, 0); - rtnl_register(PF_BRIDGE, RTM_GETMDB, NULL, rtnl_mdb_dump, 0); + rtnl_register(PF_BRIDGE, RTM_GETMDB, rtnl_mdb_get, rtnl_mdb_dump, 0); rtnl_register(PF_BRIDGE, RTM_NEWMDB, rtnl_mdb_add, NULL, 0); rtnl_register(PF_BRIDGE, RTM_DELMDB, rtnl_mdb_del, NULL, 0); } From patchwork Mon Oct 16 13:12:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13423237 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 8F95827EC6 for ; Mon, 16 Oct 2023 13:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="iJS22y8V" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2055.outbound.protection.outlook.com [40.107.243.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5010A10E for ; Mon, 16 Oct 2023 06:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ROvZsCnra1Ty5OxjwyzKoSWw+psRApn8UHreY6UjQKzdOTGSCVHnijZZ2QnaxEuYag+qmOsoY3FKMkG4dlyX1+p7QOSh86bF5MoF7gV2q+Y1FKwhzzzuShP4qRsgCRT4i6UUI/KtQGxdrkhbLfYL7AR/MxFGGSIfZIw8yryYKIxaTYhS4TDf4SH3nWL9A0inZgGO7r8Sxrl5ozTrxiprSO5xYNybLsFj07LBiez5jecAr9sX3yv5DPIWmqL1r8PsMZzo7hbqbl2RdpnxmLogEqAssyY9NUm3DJMRVUplhRmHP555erSTjvLKgPK5kJSA1wq3VhIF/Fj708rTmm6+Bg== 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=CXk+YMjViZWz0Xi7rOdHldzduviG6ZpBxAwA2qtEgKc=; b=TXZ7x0sbA46/awBuL/MTfVBr/D8CZNd6JKyL3/wz8RWqwGJnD2UWvv5as70i5pS8gohi8NqB2nJGUUMzG6t923iTsvJO1z3IuOyTQnHcrYNdlLSyG9dieGkZtkivAOBe2rZ/zAFd7wNNXhG6Ch14haN1b6skP5BtqxMj8d5etZ0lOWT+SDXNL5+osKcPWrVjj1gH+X6Wxn1tdMFAmcna0++02arp4DetHR+Ec8AbFYACGX+WKI3Ze9RJB6raoKxSFsFWZlewnkPaHBGLkt0UQkJSum2Ew08ccGXvMy19JikBKj9oyNsvyTzomHCSvrBoHMmwQdj8LtVDkk5FKKkCNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=vger.kernel.org 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 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=CXk+YMjViZWz0Xi7rOdHldzduviG6ZpBxAwA2qtEgKc=; b=iJS22y8V2QhLU7zOmdgA/cncO5WbhSF06SUpraSk2uM/M/noJ4y24AUOQPcXVqeneHVfPRkufoZo+PZS9qsvkvrTJo0diquLP/h9LUDq8Cawq42dOpsKvAS8GjnqN/4hP/xMTUIw6Em1WNVmQBI8oAjiRfJgWZlW6GY4ap1cnC2KNA8d2+bBuNai4hAvQB/mEy6pUjwWaMkPfYpZahdvBcaDW6/m+y0u8hW8JHP9xDTaX315dpvIinNIZ8RisRO68GI1YnZGYTRNWL6/bXD7mk2hg5fHTTBBhmHVf+/qwsI307WQ3OmqOTT7WPxos/8jNn/T+vcnL4P1qml71wKPPw== Received: from BLAPR05CA0041.namprd05.prod.outlook.com (2603:10b6:208:335::24) by BY5PR12MB4196.namprd12.prod.outlook.com (2603:10b6:a03:205::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Mon, 16 Oct 2023 13:14:26 +0000 Received: from BL6PEPF0001AB77.namprd02.prod.outlook.com (2603:10b6:208:335:cafe::5) by BLAPR05CA0041.outlook.office365.com (2603:10b6:208:335::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.17 via Frontend Transport; Mon, 16 Oct 2023 13:14:26 +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 BL6PEPF0001AB77.mail.protection.outlook.com (10.167.242.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:14:25 +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.986.41; Mon, 16 Oct 2023 06:14:11 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:14:08 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 12/13] selftests: bridge_mdb: Use MDB get instead of dump Date: Mon, 16 Oct 2023 16:12:58 +0300 Message-ID: <20231016131259.3302298-13-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB77:EE_|BY5PR12MB4196:EE_ X-MS-Office365-Filtering-Correlation-Id: 588cdb84-7357-49e4-6266-08dbce49d271 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A5QlxTea+lr8FBErtiJsv/a0yDskrjwh3E9qf8Z+dX4xEFXuCHcfyb3QFMLQpVHfeXNZBAqUx2R4b74DefKwKMeTmAsY3pb06xn19lHdrw0VbP8KX4n49eAJ4icMROQwpXAYi/JDClAMAq4U4MugFH0fzEHT1h8OiorViuoYo/OMqZDM2wvRTKwvWugfIS5AHAQc0fpE2hiiEirQ5IJJbKnhdz+ed3P96NrKtRI2yxejj+S48CF+QaUPLulpVMF1ziu798X2Vr7WuupODQ8bByxbpSIb/+DVGv6Zu4Hg4/xcfLj5ue9jNPLsLaCf78so4Gp3EsztuPwK9WdpQpP6wch3v6uFx3Slkr3bftsoDGzDIk7IpPB/5NZz9n8Zktwp+R2xx97+TCudTOu/leOsxGIqdBG1zjz7JNoySbOIbZ5n1ApOxwVzkAoN1U+ZF+9Z/fE4b4C/QTlnzyWMbBaIFgqLNrKlJSYVu/FsRgaxHAxhLi2zVmhZ0BAFMoxhB1jCPnDgXOawcOQXgcKXeex3gr4n9Vryhv/L12QrnmgicYyrEt6qe4OIZzUd+s+L/XNYW8BlnZkUvw2hR4atBwl+h/WyI8ThdoqnX/ViAiDO8YEkcnau7ZFJC29/EKi+IZdZu4wsiMFe037YCGJ/plpnr7db5gc9XBse+49xzVJtuHw2SSdTPhjiLgpyGWnj86pFm0exZXMcR4u1giI3aPIJlnTHWlZ3tkEl4mPb8Hf9ViY/XT/xVzu5NaHs08jNqavd 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:(13230031)(4636009)(376002)(136003)(396003)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799009)(82310400011)(186009)(40470700004)(46966006)(36840700001)(83380400001)(36860700001)(26005)(16526019)(336012)(426003)(1076003)(2616005)(356005)(7636003)(40460700003)(86362001)(82740400003)(40480700001)(36756003)(8936002)(8676002)(4326008)(478600001)(2906002)(30864003)(6666004)(107886003)(54906003)(47076005)(41300700001)(110136005)(5660300002)(70206006)(70586007)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:14:25.9450 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 588cdb84-7357-49e4-6266-08dbce49d271 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: BL6PEPF0001AB77.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4196 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Test the new MDB get functionality by converting dump and grep to MDB get. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- .../selftests/net/forwarding/bridge_mdb.sh | 184 +++++++----------- 1 file changed, 71 insertions(+), 113 deletions(-) diff --git a/tools/testing/selftests/net/forwarding/bridge_mdb.sh b/tools/testing/selftests/net/forwarding/bridge_mdb.sh index d0c6c499d5da..e4e3e9405056 100755 --- a/tools/testing/selftests/net/forwarding/bridge_mdb.sh +++ b/tools/testing/selftests/net/forwarding/bridge_mdb.sh @@ -145,14 +145,14 @@ cfg_test_host_common() # Check basic add, replace and delete behavior. bridge mdb add dev br0 port br0 grp $grp $state vid 10 - bridge mdb show dev br0 vid 10 | grep -q "$grp" + bridge mdb get dev br0 grp $grp vid 10 &> /dev/null check_err $? "Failed to add $name host entry" bridge mdb replace dev br0 port br0 grp $grp $state vid 10 &> /dev/null check_fail $? "Managed to replace $name host entry" bridge mdb del dev br0 port br0 grp $grp $state vid 10 - bridge mdb show dev br0 vid 10 | grep -q "$grp" + bridge mdb get dev br0 grp $grp vid 10 &> /dev/null check_fail $? "Failed to delete $name host entry" # Check error cases. @@ -200,7 +200,7 @@ cfg_test_port_common() # Check basic add, replace and delete behavior. bridge mdb add dev br0 port $swp1 $grp_key permanent vid 10 - bridge mdb show dev br0 vid 10 | grep -q "$grp_key" + bridge mdb get dev br0 $grp_key vid 10 &> /dev/null check_err $? "Failed to add $name entry" bridge mdb replace dev br0 port $swp1 $grp_key permanent vid 10 \ @@ -208,31 +208,31 @@ cfg_test_port_common() check_err $? "Failed to replace $name entry" bridge mdb del dev br0 port $swp1 $grp_key permanent vid 10 - bridge mdb show dev br0 vid 10 | grep -q "$grp_key" + bridge mdb get dev br0 $grp_key vid 10 &> /dev/null check_fail $? "Failed to delete $name entry" # Check default protocol and replacement. bridge mdb add dev br0 port $swp1 $grp_key permanent vid 10 - bridge -d mdb show dev br0 vid 10 | grep "$grp_key" | grep -q "static" + bridge -d mdb get dev br0 $grp_key vid 10 | grep -q "static" check_err $? "$name entry not added with default \"static\" protocol" bridge mdb replace dev br0 port $swp1 $grp_key permanent vid 10 \ proto 123 - bridge -d mdb show dev br0 vid 10 | grep "$grp_key" | grep -q "123" + bridge -d mdb get dev br0 $grp_key vid 10 | grep -q "123" check_err $? "Failed to replace protocol of $name entry" bridge mdb del dev br0 port $swp1 $grp_key permanent vid 10 # Check behavior when VLAN is not specified. bridge mdb add dev br0 port $swp1 $grp_key permanent - bridge mdb show dev br0 vid 10 | grep -q "$grp_key" + bridge mdb get dev br0 $grp_key vid 10 &> /dev/null check_err $? "$name entry with VLAN 10 not added when VLAN was not specified" - bridge mdb show dev br0 vid 20 | grep -q "$grp_key" + bridge mdb get dev br0 $grp_key vid 20 &> /dev/null check_err $? "$name entry with VLAN 20 not added when VLAN was not specified" bridge mdb del dev br0 port $swp1 $grp_key permanent - bridge mdb show dev br0 vid 10 | grep -q "$grp_key" + bridge mdb get dev br0 $grp_key vid 10 &> /dev/null check_fail $? "$name entry with VLAN 10 not deleted when VLAN was not specified" - bridge mdb show dev br0 vid 20 | grep -q "$grp_key" + bridge mdb get dev br0 $grp_key vid 20 &> /dev/null check_fail $? "$name entry with VLAN 20 not deleted when VLAN was not specified" # Check behavior when bridge port is down. @@ -298,21 +298,21 @@ __cfg_test_port_ip_star_g() RET=0 bridge mdb add dev br0 port $swp1 grp $grp vid 10 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -q "exclude" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "exclude" check_err $? "Default filter mode is not \"exclude\"" bridge mdb del dev br0 port $swp1 grp $grp vid 10 # Check basic add and delete behavior. bridge mdb add dev br0 port $swp1 grp $grp vid 10 filter_mode exclude \ source_list $src1 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -q -v "src" + bridge -d mdb get dev br0 grp $grp vid 10 &> /dev/null check_err $? "(*, G) entry not created" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -q "src $src1" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 &> /dev/null check_err $? "(S, G) entry not created" bridge mdb del dev br0 port $swp1 grp $grp vid 10 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -q -v "src" + bridge -d mdb get dev br0 grp $grp vid 10 &> /dev/null check_fail $? "(*, G) entry not deleted" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -q "src $src1" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 &> /dev/null check_fail $? "(S, G) entry not deleted" ## State (permanent / temp) tests. @@ -321,18 +321,15 @@ __cfg_test_port_ip_star_g() bridge mdb add dev br0 port $swp1 grp $grp permanent vid 10 \ filter_mode exclude source_list $src1 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "permanent" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "permanent" check_err $? "(*, G) entry not added as \"permanent\" when should" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | \ grep -q "permanent" check_err $? "(S, G) entry not added as \"permanent\" when should" - bridge -d -s mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q " 0.00" + bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q " 0.00" check_err $? "(*, G) \"permanent\" entry has a pending group timer" - bridge -d -s mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "\/0.00" + bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q "\/0.00" check_err $? "\"permanent\" source entry has a pending source timer" bridge mdb del dev br0 port $swp1 grp $grp vid 10 @@ -342,18 +339,14 @@ __cfg_test_port_ip_star_g() bridge mdb add dev br0 port $swp1 grp $grp temp vid 10 \ filter_mode exclude source_list $src1 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "temp" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "temp" check_err $? "(*, G) EXCLUDE entry not added as \"temp\" when should" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ - grep -q "temp" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | grep -q "temp" check_err $? "(S, G) \"blocked\" entry not added as \"temp\" when should" - bridge -d -s mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q " 0.00" + bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q " 0.00" check_fail $? "(*, G) EXCLUDE entry does not have a pending group timer" - bridge -d -s mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "\/0.00" + bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q "\/0.00" check_err $? "\"blocked\" source entry has a pending source timer" bridge mdb del dev br0 port $swp1 grp $grp vid 10 @@ -363,18 +356,14 @@ __cfg_test_port_ip_star_g() bridge mdb add dev br0 port $swp1 grp $grp temp vid 10 \ filter_mode include source_list $src1 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "temp" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "temp" check_err $? "(*, G) INCLUDE entry not added as \"temp\" when should" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ - grep -q "temp" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | grep -q "temp" check_err $? "(S, G) entry not added as \"temp\" when should" - bridge -d -s mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q " 0.00" + bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q " 0.00" check_err $? "(*, G) INCLUDE entry has a pending group timer" - bridge -d -s mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "\/0.00" + bridge -d -s mdb get dev br0 grp $grp vid 10 | grep -q "\/0.00" check_fail $? "Source entry does not have a pending source timer" bridge mdb del dev br0 port $swp1 grp $grp vid 10 @@ -383,8 +372,7 @@ __cfg_test_port_ip_star_g() bridge mdb add dev br0 port $swp1 grp $grp temp vid 10 \ filter_mode include source_list $src1 - bridge -d -s mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ - grep -q " 0.00" + bridge -d -s mdb get dev br0 grp $grp src $src1 vid 10 | grep -q " 0.00" check_err $? "(S, G) entry has a pending group timer" bridge mdb del dev br0 port $swp1 grp $grp vid 10 @@ -396,11 +384,9 @@ __cfg_test_port_ip_star_g() bridge mdb add dev br0 port $swp1 grp $grp vid 10 \ filter_mode include source_list $src1 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "include" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "include" check_err $? "(*, G) INCLUDE not added with \"include\" filter mode" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ - grep -q "blocked" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | grep -q "blocked" check_fail $? "(S, G) entry marked as \"blocked\" when should not" bridge mdb del dev br0 port $swp1 grp $grp vid 10 @@ -410,11 +396,9 @@ __cfg_test_port_ip_star_g() bridge mdb add dev br0 port $swp1 grp $grp vid 10 \ filter_mode exclude source_list $src1 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "exclude" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "exclude" check_err $? "(*, G) EXCLUDE not added with \"exclude\" filter mode" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ - grep -q "blocked" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | grep -q "blocked" check_err $? "(S, G) entry not marked as \"blocked\" when should" bridge mdb del dev br0 port $swp1 grp $grp vid 10 @@ -426,11 +410,9 @@ __cfg_test_port_ip_star_g() bridge mdb add dev br0 port $swp1 grp $grp vid 10 \ filter_mode exclude source_list $src1 proto zebra - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "zebra" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "zebra" check_err $? "(*, G) entry not added with \"zebra\" protocol" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ - grep -q "zebra" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | grep -q "zebra" check_err $? "(S, G) entry not marked added with \"zebra\" protocol" bridge mdb del dev br0 port $swp1 grp $grp vid 10 @@ -443,20 +425,16 @@ __cfg_test_port_ip_star_g() bridge mdb replace dev br0 port $swp1 grp $grp permanent vid 10 \ filter_mode exclude source_list $src1 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "permanent" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "permanent" check_err $? "(*, G) entry not marked as \"permanent\" after replace" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ - grep -q "permanent" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | grep -q "permanent" check_err $? "(S, G) entry not marked as \"permanent\" after replace" bridge mdb replace dev br0 port $swp1 grp $grp temp vid 10 \ filter_mode exclude source_list $src1 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "temp" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "temp" check_err $? "(*, G) entry not marked as \"temp\" after replace" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ - grep -q "temp" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | grep -q "temp" check_err $? "(S, G) entry not marked as \"temp\" after replace" bridge mdb del dev br0 port $swp1 grp $grp vid 10 @@ -467,20 +445,16 @@ __cfg_test_port_ip_star_g() bridge mdb replace dev br0 port $swp1 grp $grp temp vid 10 \ filter_mode include source_list $src1 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "include" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "include" check_err $? "(*, G) not marked with \"include\" filter mode after replace" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ - grep -q "blocked" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | grep -q "blocked" check_fail $? "(S, G) marked as \"blocked\" after replace" bridge mdb replace dev br0 port $swp1 grp $grp temp vid 10 \ filter_mode exclude source_list $src1 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "exclude" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "exclude" check_err $? "(*, G) not marked with \"exclude\" filter mode after replace" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ - grep -q "blocked" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | grep -q "blocked" check_err $? "(S, G) not marked as \"blocked\" after replace" bridge mdb del dev br0 port $swp1 grp $grp vid 10 @@ -491,20 +465,20 @@ __cfg_test_port_ip_star_g() bridge mdb replace dev br0 port $swp1 grp $grp temp vid 10 \ filter_mode exclude source_list $src1,$src2,$src3 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -q "src $src1" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 &> /dev/null check_err $? "(S, G) entry for source $src1 not created after replace" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -q "src $src2" + bridge -d mdb get dev br0 grp $grp src $src2 vid 10 &> /dev/null check_err $? "(S, G) entry for source $src2 not created after replace" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -q "src $src3" + bridge -d mdb get dev br0 grp $grp src $src3 vid 10 &> /dev/null check_err $? "(S, G) entry for source $src3 not created after replace" bridge mdb replace dev br0 port $swp1 grp $grp temp vid 10 \ filter_mode exclude source_list $src1,$src3 - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -q "src $src1" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 &> /dev/null check_err $? "(S, G) entry for source $src1 not created after second replace" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -q "src $src2" + bridge -d mdb get dev br0 grp $grp src $src2 vid 10 &> /dev/null check_fail $? "(S, G) entry for source $src2 created after second replace" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -q "src $src3" + bridge -d mdb get dev br0 grp $grp src $src3 vid 10 &> /dev/null check_err $? "(S, G) entry for source $src3 not created after second replace" bridge mdb del dev br0 port $swp1 grp $grp vid 10 @@ -515,11 +489,9 @@ __cfg_test_port_ip_star_g() bridge mdb replace dev br0 port $swp1 grp $grp temp vid 10 \ filter_mode exclude source_list $src1 proto bgp - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep -v "src" | \ - grep -q "bgp" + bridge -d mdb get dev br0 grp $grp vid 10 | grep -q "bgp" check_err $? "(*, G) protocol not changed to \"bgp\" after replace" - bridge -d mdb show dev br0 vid 10 | grep "$grp" | grep "src" | \ - grep -q "bgp" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | grep -q "bgp" check_err $? "(S, G) protocol not changed to \"bgp\" after replace" bridge mdb del dev br0 port $swp1 grp $grp vid 10 @@ -532,8 +504,8 @@ __cfg_test_port_ip_star_g() bridge mdb add dev br0 port $swp2 grp $grp vid 10 \ filter_mode include source_list $src1 bridge mdb add dev br0 port $swp1 grp $grp vid 10 - bridge -d mdb show dev br0 vid 10 | grep "$swp1" | grep "$grp" | \ - grep "$src1" | grep -q "added_by_star_ex" + bridge -d mdb get dev br0 grp $grp src $src1 vid 10 | grep "$swp1" | \ + grep -q "added_by_star_ex" check_err $? "\"added_by_star_ex\" entry not created after adding (*, G) entry" bridge mdb del dev br0 port $swp1 grp $grp vid 10 bridge mdb del dev br0 port $swp2 grp $grp src $src1 vid 10 @@ -606,27 +578,23 @@ __cfg_test_port_ip_sg() RET=0 bridge mdb add dev br0 port $swp1 $grp_key vid 10 - bridge -d mdb show dev br0 vid 10 | grep "$grp_key" | grep -q "include" + bridge -d mdb get dev br0 $grp_key vid 10 | grep -q "include" check_err $? "Default filter mode is not \"include\"" bridge mdb del dev br0 port $swp1 $grp_key vid 10 # Check that entries can be added as both permanent and temp and that # group timer is set correctly. bridge mdb add dev br0 port $swp1 $grp_key permanent vid 10 - bridge -d mdb show dev br0 vid 10 | grep "$grp_key" | \ - grep -q "permanent" + bridge -d mdb get dev br0 $grp_key vid 10 | grep -q "permanent" check_err $? "Entry not added as \"permanent\" when should" - bridge -d -s mdb show dev br0 vid 10 | grep "$grp_key" | \ - grep -q " 0.00" + bridge -d -s mdb get dev br0 $grp_key vid 10 | grep -q " 0.00" check_err $? "\"permanent\" entry has a pending group timer" bridge mdb del dev br0 port $swp1 $grp_key vid 10 bridge mdb add dev br0 port $swp1 $grp_key temp vid 10 - bridge -d mdb show dev br0 vid 10 | grep "$grp_key" | \ - grep -q "temp" + bridge -d mdb get dev br0 $grp_key vid 10 | grep -q "temp" check_err $? "Entry not added as \"temp\" when should" - bridge -d -s mdb show dev br0 vid 10 | grep "$grp_key" | \ - grep -q " 0.00" + bridge -d -s mdb get dev br0 $grp_key vid 10 | grep -q " 0.00" check_fail $? "\"temp\" entry has an unpending group timer" bridge mdb del dev br0 port $swp1 $grp_key vid 10 @@ -650,24 +618,19 @@ __cfg_test_port_ip_sg() # Check that we can replace available attributes. bridge mdb add dev br0 port $swp1 $grp_key vid 10 proto 123 bridge mdb replace dev br0 port $swp1 $grp_key vid 10 proto 111 - bridge -d mdb show dev br0 vid 10 | grep "$grp_key" | \ - grep -q "111" + bridge -d mdb get dev br0 $grp_key vid 10 | grep -q "111" check_err $? "Failed to replace protocol" bridge mdb replace dev br0 port $swp1 $grp_key vid 10 permanent - bridge -d mdb show dev br0 vid 10 | grep "$grp_key" | \ - grep -q "permanent" + bridge -d mdb get dev br0 $grp_key vid 10 | grep -q "permanent" check_err $? "Entry not marked as \"permanent\" after replace" - bridge -d -s mdb show dev br0 vid 10 | grep "$grp_key" | \ - grep -q " 0.00" + bridge -d -s mdb get dev br0 $grp_key vid 10 | grep -q " 0.00" check_err $? "Entry has a pending group timer after replace" bridge mdb replace dev br0 port $swp1 $grp_key vid 10 temp - bridge -d mdb show dev br0 vid 10 | grep "$grp_key" | \ - grep -q "temp" + bridge -d mdb get dev br0 $grp_key vid 10 | grep -q "temp" check_err $? "Entry not marked as \"temp\" after replace" - bridge -d -s mdb show dev br0 vid 10 | grep "$grp_key" | \ - grep -q " 0.00" + bridge -d -s mdb get dev br0 $grp_key vid 10 | grep -q " 0.00" check_fail $? "Entry has an unpending group timer after replace" bridge mdb del dev br0 port $swp1 $grp_key vid 10 @@ -675,7 +638,7 @@ __cfg_test_port_ip_sg() # (*, G) ports need to be added to it. bridge mdb add dev br0 port $swp2 grp $grp vid 10 bridge mdb add dev br0 port $swp1 $grp_key vid 10 - bridge mdb show dev br0 vid 10 | grep "$grp_key" | grep $swp2 | \ + bridge mdb get dev br0 $grp_key vid 10 | grep $swp2 | \ grep -q "added_by_star_ex" check_err $? "\"added_by_star_ex\" entry not created after adding (S, G) entry" bridge mdb del dev br0 port $swp1 $grp_key vid 10 @@ -1132,7 +1095,7 @@ ctrl_igmpv3_is_in_test() $MZ $h1.10 -c 1 -a own -b 01:00:5e:01:01:01 -A 192.0.2.1 -B 239.1.1.1 \ -t ip proto=2,p=$(igmpv3_is_in_get 239.1.1.1 192.0.2.2) -q - bridge -d mdb show dev br0 vid 10 | grep 239.1.1.1 | grep -q 192.0.2.2 + bridge mdb get dev br0 grp 239.1.1.1 src 192.0.2.2 vid 10 &> /dev/null check_fail $? "Permanent entry affected by IGMP packet" # Replace the permanent entry with a temporary one and check that after @@ -1145,12 +1108,10 @@ ctrl_igmpv3_is_in_test() $MZ $h1.10 -a own -b 01:00:5e:01:01:01 -c 1 -A 192.0.2.1 -B 239.1.1.1 \ -t ip proto=2,p=$(igmpv3_is_in_get 239.1.1.1 192.0.2.2) -q - bridge -d mdb show dev br0 vid 10 | grep 239.1.1.1 | grep -v "src" | \ - grep -q 192.0.2.2 + bridge -d mdb get dev br0 grp 239.1.1.1 vid 10 | grep -q 192.0.2.2 check_err $? "Source not add to source list" - bridge -d mdb show dev br0 vid 10 | grep 239.1.1.1 | \ - grep -q "src 192.0.2.2" + bridge mdb get dev br0 grp 239.1.1.1 src 192.0.2.2 vid 10 &> /dev/null check_err $? "(S, G) entry not created for new source" bridge mdb del dev br0 port $swp1 grp 239.1.1.1 vid 10 @@ -1172,8 +1133,7 @@ ctrl_mldv2_is_in_test() $MZ -6 $h1.10 -a own -b 33:33:00:00:00:01 -c 1 -A fe80::1 -B ff0e::1 \ -t ip hop=1,next=0,p="$p" -q - bridge -d mdb show dev br0 vid 10 | grep ff0e::1 | \ - grep -q 2001:db8:1::2 + bridge mdb get dev br0 grp ff0e::1 src 2001:db8:1::2 vid 10 &> /dev/null check_fail $? "Permanent entry affected by MLD packet" # Replace the permanent entry with a temporary one and check that after @@ -1186,12 +1146,10 @@ ctrl_mldv2_is_in_test() $MZ -6 $h1.10 -a own -b 33:33:00:00:00:01 -c 1 -A fe80::1 -B ff0e::1 \ -t ip hop=1,next=0,p="$p" -q - bridge -d mdb show dev br0 vid 10 | grep ff0e::1 | grep -v "src" | \ - grep -q 2001:db8:1::2 + bridge -d mdb get dev br0 grp ff0e::1 vid 10 | grep -q 2001:db8:1::2 check_err $? "Source not add to source list" - bridge -d mdb show dev br0 vid 10 | grep ff0e::1 | \ - grep -q "src 2001:db8:1::2" + bridge mdb get dev br0 grp ff0e::1 src 2001:db8:1::2 vid 10 &> /dev/null check_err $? "(S, G) entry not created for new source" bridge mdb del dev br0 port $swp1 grp ff0e::1 vid 10 @@ -1208,8 +1166,8 @@ ctrl_test() ctrl_mldv2_is_in_test } -if ! bridge mdb help 2>&1 | grep -q "replace"; then - echo "SKIP: iproute2 too old, missing bridge mdb replace support" +if ! bridge mdb help 2>&1 | grep -q "get"; then + echo "SKIP: iproute2 too old, missing bridge mdb get support" exit $ksft_skip fi From patchwork Mon Oct 16 13:12:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13423236 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 773A027739 for ; Mon, 16 Oct 2023 13:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="Y9m2CAiJ" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2073.outbound.protection.outlook.com [40.107.94.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25AB5116 for ; Mon, 16 Oct 2023 06:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Irex3bh8NjU+LWQRM8HUJzDskvXid+d5CSdQel3p3g1RwakcVLCghdYAFZfi6e43B/H6W/9MIWexOrYw4vgdewT1/qSelf/sa3gRFuRe75ceklpHxR5K+iXqBzXSd5vTq9vicxlAFUdEyF2tGiXm3bbTapVKNSjpQc7j1VzVnP/l4uX7/bFbIHxBtIglUlRfmf9RK40RyJFQxDqg51gCpZS7+Wnl/kGxQw734/LHmcShO732LWK6ppMgOM4IamRPyDcs+YP8rcjieGB0zLzd83RBKzpRyCqkyttW0kiiDG6i5a1aA+MBkHK/0VS/2SjuVge6H2JdTWhM0Z7b8nqy0w== 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=WmxpLyIqP7Rsru/cXevrGDE3e/66SDRvoqRLeQk0CxI=; b=Rz5ZFEW8sFegr/EwMzajocJsNfGhB+qr4GUifnAB//RTSxGZfv6M2vRY30Ox6C8lFvHw2XqU3pgSunTsBDl5OpyrvFiyzWc2808IMPHzAaozlWtdtlRs+D26xfRMcE2XB4eVRe+eM46aKCE6yYTge3bhJve9kEAF6eGqLJQAMy1GbhShL9b7+/onfFDLjO4UGnBRgiOjGdaS1jOy09/uTWzv4ZOJWFNVLcZvnw3+d7kROG4zyuhhoDCbmaUT2C7fO2Ifs4fn6FkJGnr5L2n0WT6rPm8CEYGM1ElMdlEsRca8cF+KugM9V3kVhJToKZR5Hixq7ZHrZ4bzutrGp1tPsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org 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 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=WmxpLyIqP7Rsru/cXevrGDE3e/66SDRvoqRLeQk0CxI=; b=Y9m2CAiJe4LPMj1CZcFUfc4YEiNJKvtETOU5N0wUyli9GCutJLtOD/0mEMF9D3gv7tm2jnUqNjQNj8jDqvjBdiIEal1BZzbfCZSACSvInZkd4tCGWRl9hzI9z1AbUkZHi0qarnW8IGHl6jGnlccXsHuJRXNQ/FB+Zw4sfIXaP4kw8+YqMg4rXjVuAXbOOGui6EQZ5/rBrjxXRrIQPKt7IE/uLJPZNpwLoO4wcJV2xMf6o4MxfZQDWEvqPHnqlnpGCtG8vC8J9BR1i1j3JJPJPncbspiNOTMOZNE+nSquIjvwVqmumWsw04OvHuk2vO0OISG4VLlfJEpZiSmQCAh6eg== Received: from MW4PR03CA0004.namprd03.prod.outlook.com (2603:10b6:303:8f::9) by DM4PR12MB5151.namprd12.prod.outlook.com (2603:10b6:5:392::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35; Mon, 16 Oct 2023 13:14:27 +0000 Received: from CO1PEPF000044F5.namprd05.prod.outlook.com (2603:10b6:303:8f:cafe::1f) by MW4PR03CA0004.outlook.office365.com (2603:10b6:303:8f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.35 via Frontend Transport; Mon, 16 Oct 2023 13:14:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) 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.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1PEPF000044F5.mail.protection.outlook.com (10.167.241.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.22 via Frontend Transport; Mon, 16 Oct 2023 13:14:27 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 16 Oct 2023 06:14:14 -0700 Received: from dev-r-vrt-155.mtr.labs.mlnx (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.986.41; Mon, 16 Oct 2023 06:14:11 -0700 From: Ido Schimmel To: , CC: , , , , , , , Ido Schimmel Subject: [PATCH net-next 13/13] selftests: vxlan_mdb: Use MDB get instead of dump Date: Mon, 16 Oct 2023 16:12:59 +0300 Message-ID: <20231016131259.3302298-14-idosch@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231016131259.3302298-1-idosch@nvidia.com> References: <20231016131259.3302298-1-idosch@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F5:EE_|DM4PR12MB5151:EE_ X-MS-Office365-Filtering-Correlation-Id: 32eb1dab-31fd-458c-04b4-08dbce49d345 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tAMqDKoMipVRhV4JyjPKgepB489D9GV33612PQTRT2I3rXL4hPSsaSnqDSJDn/T3/sHT+P9teSidADYfoUQ9YoMZUE/P9PphkFoVXErS0pd9Z/+AolFOlVaTTCXWEhE0CTIO4V/7FB5Z6Iu6LyWN1dWYwroM+SLzsjI4e7MKiC9Y0tfu7QcjUwuIK/N1T6NrKw5sRKOEck2yKXU7jP1t2KVaWX1f4xrf5yZpmA95s3UGafrySb2xglDQ87jWR9FGNZcTeY/2NIQw0Mz6giqwfoDBsB8IMEzfEGfUFzGIbt2i2mHnmETZNa0F1Guitjwoox+xII9DQM749GsVQqCZc0uctS6hlnC994G5LFSOmrApI8poHB+lF1mk0/xZn7oh8E1W8ZYFmhsCOxdm2kocXb5hEyJIU21uU43gqBNWJLunuG6/PiC07f0QLYURJZoTD2iwjSA/EWaZx3k2n2LgTsNn0tV77WHdnrPEh+q/PG8+2ol7X9oAZzoglSHAYnKighz3if2z1skUheyCB5hhZto+Wz/pSQZxjN4C4naayBzqGp5VD4/ODeJBFKF4H3wEbgFoIzoOWeKTvc0QPiC386uW/QV93xBbFIDePYDaAg3ISawG0V1SUdgVU4iEZksv+161tqEc5HEOby3M0kVqbGWy/+eWz93GTRKSHkZNT7QY7zBGjBr3DQQQa47ed/F54NQNK2t6dHtiatqiPoqtFfzYWXMy2RgmcJF+3zik6dTQeHBAODguPsfX+uNskyRN X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(346002)(376002)(396003)(136003)(230922051799003)(64100799003)(1800799009)(186009)(82310400011)(451199024)(46966006)(36840700001)(40470700004)(478600001)(110136005)(54906003)(70206006)(70586007)(6666004)(47076005)(16526019)(107886003)(26005)(1076003)(41300700001)(336012)(2616005)(316002)(426003)(30864003)(8676002)(8936002)(4326008)(2906002)(5660300002)(36756003)(86362001)(7636003)(36860700001)(83380400001)(82740400003)(356005)(40480700001)(40460700003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Oct 2023 13:14:27.3944 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32eb1dab-31fd-458c-04b4-08dbce49d345 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.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5151 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Test the new MDB get functionality by converting dump and grep to MDB get. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- tools/testing/selftests/net/test_vxlan_mdb.sh | 108 +++++++++--------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/tools/testing/selftests/net/test_vxlan_mdb.sh b/tools/testing/selftests/net/test_vxlan_mdb.sh index 31e5f0f8859d..6e996f8063cd 100755 --- a/tools/testing/selftests/net/test_vxlan_mdb.sh +++ b/tools/testing/selftests/net/test_vxlan_mdb.sh @@ -337,62 +337,62 @@ basic_common() # Basic add, replace and delete behavior. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 $grp_key permanent dst $vtep_ip src_vni 10010" log_test $? 0 "MDB entry addition" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep \"$grp_key\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 $grp_key src_vni 10010" log_test $? 0 "MDB entry presence after addition" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 $grp_key permanent dst $vtep_ip src_vni 10010" log_test $? 0 "MDB entry replacement" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep \"$grp_key\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 $grp_key src_vni 10010" log_test $? 0 "MDB entry presence after replacement" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 $grp_key dst $vtep_ip src_vni 10010" log_test $? 0 "MDB entry deletion" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep \"$grp_key\"" - log_test $? 1 "MDB entry presence after deletion" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 $grp_key src_vni 10010" + log_test $? 254 "MDB entry presence after deletion" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 $grp_key dst $vtep_ip src_vni 10010" log_test $? 255 "Non-existent MDB entry deletion" # Default protocol and replacement. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 $grp_key permanent dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep \"$grp_key\" | grep \"proto static\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 $grp_key src_vni 10010 | grep \"proto static\"" log_test $? 0 "MDB entry default protocol" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 $grp_key permanent proto 123 dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep \"$grp_key\" | grep \"proto 123\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 $grp_key src_vni 10010 | grep \"proto 123\"" log_test $? 0 "MDB entry protocol replacement" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 $grp_key dst $vtep_ip src_vni 10010" # Default destination port and replacement. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 $grp_key permanent dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep \"$grp_key\" | grep \" dst_port \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 $grp_key src_vni 10010 | grep \" dst_port \"" log_test $? 1 "MDB entry default destination port" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 $grp_key permanent dst $vtep_ip dst_port 1234 src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep \"$grp_key\" | grep \"dst_port 1234\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 $grp_key src_vni 10010 | grep \"dst_port 1234\"" log_test $? 0 "MDB entry destination port replacement" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 $grp_key dst $vtep_ip src_vni 10010" # Default destination VNI and replacement. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 $grp_key permanent dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep \"$grp_key\" | grep \" vni \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 $grp_key src_vni 10010 | grep \" vni \"" log_test $? 1 "MDB entry default destination VNI" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 $grp_key permanent dst $vtep_ip vni 1234 src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep \"$grp_key\" | grep \"vni 1234\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 $grp_key src_vni 10010 | grep \"vni 1234\"" log_test $? 0 "MDB entry destination VNI replacement" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 $grp_key dst $vtep_ip src_vni 10010" # Default outgoing interface and replacement. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 $grp_key permanent dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep \"$grp_key\" | grep \" via \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 $grp_key src_vni 10010 | grep \" via \"" log_test $? 1 "MDB entry default outgoing interface" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 $grp_key permanent dst $vtep_ip src_vni 10010 via veth0" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep \"$grp_key\" | grep \"via veth0\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 $grp_key src_vni 10010 | grep \"via veth0\"" log_test $? 0 "MDB entry outgoing interface replacement" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 $grp_key dst $vtep_ip src_vni 10010" @@ -550,127 +550,127 @@ star_g_common() # Basic add, replace and delete behavior. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1 dst $vtep_ip src_vni 10010" log_test $? 0 "(*, G) MDB entry addition with source list" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep -v \" src \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010" log_test $? 0 "(*, G) MDB entry presence after addition" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src1\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010" log_test $? 0 "(S, G) MDB entry presence after addition" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1 dst $vtep_ip src_vni 10010" log_test $? 0 "(*, G) MDB entry replacement with source list" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep -v \" src \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010" log_test $? 0 "(*, G) MDB entry presence after replacement" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src1\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010" log_test $? 0 "(S, G) MDB entry presence after replacement" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep_ip src_vni 10010" log_test $? 0 "(*, G) MDB entry deletion" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep -v \" src \"" - log_test $? 1 "(*, G) MDB entry presence after deletion" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src1\"" - log_test $? 1 "(S, G) MDB entry presence after deletion" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010" + log_test $? 254 "(*, G) MDB entry presence after deletion" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010" + log_test $? 254 "(S, G) MDB entry presence after deletion" # Default filter mode and replacement. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp permanent dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep exclude" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep exclude" log_test $? 0 "(*, G) MDB entry default filter mode" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode include source_list $src1 dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep include" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep include" log_test $? 0 "(*, G) MDB entry after replacing filter mode to \"include\"" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src1\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010" log_test $? 0 "(S, G) MDB entry after replacing filter mode to \"include\"" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src1\" | grep blocked" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010 | grep blocked" log_test $? 1 "\"blocked\" flag after replacing filter mode to \"include\"" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1 dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep exclude" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep exclude" log_test $? 0 "(*, G) MDB entry after replacing filter mode to \"exclude\"" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src1\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grep grp $grp src $src1 src_vni 10010" log_test $? 0 "(S, G) MDB entry after replacing filter mode to \"exclude\"" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src1\" | grep blocked" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010 | grep blocked" log_test $? 0 "\"blocked\" flag after replacing filter mode to \"exclude\"" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep_ip src_vni 10010" # Default source list and replacement. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp permanent dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep source_list" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep source_list" log_test $? 1 "(*, G) MDB entry default source list" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1,$src2,$src3 dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src1\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010" log_test $? 0 "(S, G) MDB entry of 1st source after replacing source list" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src2\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src2 src_vni 10010" log_test $? 0 "(S, G) MDB entry of 2nd source after replacing source list" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src3\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src3 src_vni 10010" log_test $? 0 "(S, G) MDB entry of 3rd source after replacing source list" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1,$src3 dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src1\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010" log_test $? 0 "(S, G) MDB entry of 1st source after removing source" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src2\"" - log_test $? 1 "(S, G) MDB entry of 2nd source after removing source" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \"src $src3\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src2 src_vni 10010" + log_test $? 254 "(S, G) MDB entry of 2nd source after removing source" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src3 src_vni 10010" log_test $? 0 "(S, G) MDB entry of 3rd source after removing source" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep_ip src_vni 10010" # Default protocol and replacement. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1 dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep -v \" src \" | grep \"proto static\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep \"proto static\"" log_test $? 0 "(*, G) MDB entry default protocol" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \" src \" | grep \"proto static\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010 | grep \"proto static\"" log_test $? 0 "(S, G) MDB entry default protocol" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1 proto bgp dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep -v \" src \" | grep \"proto bgp\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep \"proto bgp\"" log_test $? 0 "(*, G) MDB entry protocol after replacement" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \" src \" | grep \"proto bgp\"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010 | grep \"proto bgp\"" log_test $? 0 "(S, G) MDB entry protocol after replacement" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep_ip src_vni 10010" # Default destination port and replacement. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1 dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep -v \" src \" | grep \" dst_port \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep \" dst_port \"" log_test $? 1 "(*, G) MDB entry default destination port" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \" src \" | grep \" dst_port \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010 | grep \" dst_port \"" log_test $? 1 "(S, G) MDB entry default destination port" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1 dst $vtep_ip dst_port 1234 src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep -v \" src \" | grep \" dst_port 1234 \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep \" dst_port 1234 \"" log_test $? 0 "(*, G) MDB entry destination port after replacement" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \" src \" | grep \" dst_port 1234 \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010 | grep \" dst_port 1234 \"" log_test $? 0 "(S, G) MDB entry destination port after replacement" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep_ip src_vni 10010" # Default destination VNI and replacement. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1 dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep -v \" src \" | grep \" vni \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep \" vni \"" log_test $? 1 "(*, G) MDB entry default destination VNI" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \" src \" | grep \" vni \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010 | grep \" vni \"" log_test $? 1 "(S, G) MDB entry default destination VNI" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1 dst $vtep_ip vni 1234 src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep -v \" src \" | grep \" vni 1234 \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep \" vni 1234 \"" log_test $? 0 "(*, G) MDB entry destination VNI after replacement" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \" src \" | grep \" vni 1234 \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010 | grep \" vni 1234 \"" log_test $? 0 "(S, G) MDB entry destination VNI after replacement" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep_ip src_vni 10010" # Default outgoing interface and replacement. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1 dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep -v \" src \" | grep \" via \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep \" via \"" log_test $? 1 "(*, G) MDB entry default outgoing interface" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \" src \" | grep \" via \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010 | grep \" via \"" log_test $? 1 "(S, G) MDB entry default outgoing interface" run_cmd "bridge -n $ns1 mdb replace dev vx0 port vx0 grp $grp permanent filter_mode exclude source_list $src1 dst $vtep_ip src_vni 10010 via veth0" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep -v \" src \" | grep \" via veth0 \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src_vni 10010 | grep \" via veth0 \"" log_test $? 0 "(*, G) MDB entry outgoing interface after replacement" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep \" src \" | grep \" via veth0 \"" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src1 src_vni 10010 | grep \" via veth0 \"" log_test $? 0 "(S, G) MDB entry outgoing interface after replacement" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp dst $vtep_ip src_vni 10010" @@ -772,7 +772,7 @@ sg_common() # Default filter mode. run_cmd "bridge -n $ns1 mdb add dev vx0 port vx0 grp $grp src $src permanent dst $vtep_ip src_vni 10010" - run_cmd "bridge -n $ns1 -d -s mdb show dev vx0 | grep $grp | grep include" + run_cmd "bridge -n $ns1 -d -s mdb get dev vx0 grp $grp src $src src_vni 10010 | grep include" log_test $? 0 "(S, G) MDB entry default filter mode" run_cmd "bridge -n $ns1 mdb del dev vx0 port vx0 grp $grp src $src permanent dst $vtep_ip src_vni 10010" @@ -2296,9 +2296,9 @@ if [ ! -x "$(command -v jq)" ]; then exit $ksft_skip fi -bridge mdb help 2>&1 | grep -q "src_vni" +bridge mdb help 2>&1 | grep -q "get" if [ $? -ne 0 ]; then - echo "SKIP: iproute2 bridge too old, missing VXLAN MDB support" + echo "SKIP: iproute2 bridge too old, missing VXLAN MDB get support" exit $ksft_skip fi