From patchwork Mon Dec 5 07:42:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13064229 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE6A6C47088 for ; Mon, 5 Dec 2022 07:44:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231814AbiLEHoD (ORCPT ); Mon, 5 Dec 2022 02:44:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231790AbiLEHnq (ORCPT ); Mon, 5 Dec 2022 02:43:46 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2047.outbound.protection.outlook.com [40.107.100.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA78D140C6 for ; Sun, 4 Dec 2022 23:43:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HdL2NBRV4Y9z5aS1IKiicgAmzJAEvSLzLcEWRTSKyGYnSiHc6KS3lgslL/d2reJIo27Ui9+3Y0NIShDb0wW9QIzBwkMP40MJbtzdlvWQFOu+Wp+7PLxBHBFE0+kzj3eVUCGKAKJo+Pz94xH3wyExItuxHSOu3RxFQ6TGqP1ZQwofdEjSAcGcVXR5OamsRZcsjG5g7X4bYYNP7gZ68eodLAJKxIisyBWvG95qhl/eETYzn4IuBG6AoJ4nC7IVMWdB/BZBPtVaFr0rN2ZCLPI8L6e/4TYPgEcrHcf0Ab565NlsiNvVtN/la5fbanY1sRWmKjg5wYnyk31d1srEQTjyvw== 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=osLKPcm17h6ifVTy4t+AKITNCG0OSYf4BrOSyz36crE=; b=X85nQXeB8GlQa3zfSOqom5i2PIuLmnrJ2rCUejlGQGtZqtOEoPVNJEZ/1brKFSKwVH7ysdyV67YK7kU99wDQ20fznLi79CMnNKRgzWnMA7dkNzxT67kk5wIDV6K/k7sKczomdxxKP0xW+6lak/Ru6cIXNQjK4qDU8A/Pxwp9UxZ3plGk3eTZFJ8FMx+VOtwUL3MPSoIhmjwK5rOEX8sOhvnnmEVDhVaEOZkcXiNC5k3qJ1PN4CukDxSxGURbc4C4OqIQz7U7Oq3imJ9+L7iasK7+sjbe/Zz44WMhH75/qMOPp7JyPc4n+R4Ztdc5/wghMGI9WjTTQciQkRSrdaQD3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=osLKPcm17h6ifVTy4t+AKITNCG0OSYf4BrOSyz36crE=; b=GRgYn5V2SJL5ja2XllKreGL1/HwONt3/GUtJUE15HlkonMfgaBdAkdIQhjyxlV16z/9VHB9FXv3UACiWyz0OXHZr1d4+qDraw36WipdRI+N24LwQI8smMmcbpv1ry79IOkhcTwzXuf+2OWSdcrfZ1Sr6oXtalUHqEiQcP1BXxEYB1Usr/8jAr6/XB6FfacRQBLXoprob6Z5ZOcS49Z4p+r01ILzScZ3krZdObLAW0bAsZKMhmrA3QGKnIWZdlx+/TMkZssBQVJb88fY6n/DOlc7bcNOX/5dwvPYvkvJN2MdADFkoP9K2qejMs3u8fLD1jtKh8su77E9i5aFhWpR+lw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) by PH0PR12MB5607.namprd12.prod.outlook.com (2603:10b6:510:142::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Mon, 5 Dec 2022 07:43:44 +0000 Received: from IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::193d:487e:890f:a91d]) by IA1PR12MB6163.namprd12.prod.outlook.com ([fe80::193d:487e:890f:a91d%4]) with mapi id 15.20.5880.013; Mon, 5 Dec 2022 07:43:43 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, roopa@nvidia.com, razor@blackwall.org, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 5/8] bridge: mcast: Use MDB group key from configuration structure Date: Mon, 5 Dec 2022 09:42:48 +0200 Message-Id: <20221205074251.4049275-6-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221205074251.4049275-1-idosch@nvidia.com> References: <20221205074251.4049275-1-idosch@nvidia.com> X-ClientProxiedBy: LNXP265CA0031.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::19) To IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR12MB6163:EE_|PH0PR12MB5607:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c707734-1aa0-4b1a-f3ef-08dad6946f53 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8sXjbNbwKvdefJd961yfB4zrxeQwtU7Qvd3x9vw/zgC9cd7/irZng66DaeZ8vB9aCXNMf7U5iKKPRxrA6cjrflgSvotZ2PYCivjvtsyNX5F6HgjBusI2g09C+7EvJ8m/djB+0kh5VxMOw+wqXFThCxgupajKgNqxZ6Oyi7mZ9zB6RLN1e1NPONv1YMyY1mTKhuhP/9OkBtYQCR4pNnBTrOo/67FV8VCtRV3lbqFYYxsTfEV6/gnT4sty+p4MwdzjFM1RPIjpM4KgnXjEQ1hY1Ez/h8R1iqca5klY6TEaNhccrXF0FoqyXWKqdaZMk2alJw5vib8vPgXA+gHYisteQDowNToWGCtzHGzDA3OIF5FK2LJC/kSgCB1K/NNywZVzqUsERH9eT+AwcGW5ayjUQW/P8YdVRJtww+lvi6j+kddhf7QPSauv0T8RzAlcbPMrWQZr6aAm7DErmeWm4ntHkbONZsKtK3XawfCEvS2udfmVevI2uQ6N/ssvzWq+iZ9oGKCoemGJn9tfABIbOhPA2EMzSDvc9/6Mq0fbbPgT7IUIIef5AfNm3pkaFxdKwPbdev2sIrC5kbO8xpmPeDhaLKWIpAfjdJzRCow4eP7oeKgkbMQX13YkWoitJR2gRxZWpQNV/Ty1BC7CXh36oKKLfw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6163.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(39860400002)(396003)(346002)(136003)(376002)(451199015)(36756003)(38100700002)(86362001)(5660300002)(2906002)(41300700001)(8936002)(4326008)(83380400001)(66476007)(66946007)(66556008)(478600001)(6486002)(316002)(2616005)(8676002)(107886003)(1076003)(186003)(6506007)(26005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5aMdULAIG+aAbRgS49TQqpMTefBLWQFwZEE/hmMW1C4D7gTCYfya5WP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2fVwAdd0K9loGxSj7h2GgkHoh3p6r1aW5mLgrveBH+xHd5bUk68Si8Si8kSQDlXHUvDwnl1WCD4NO/zaOs0qn8OY46f6WEJB0kVb1T0RPXqck6NqRLGnb5MSg89jTMnewK5K5NA4a2OekVvsi9OgsUg/GPJs1KWZPDpt6d0xr9nX1CrAbq+CpeBYLxk3j82HqbPD9k4DagaqYv3yWlAT7T9FSnQKVrm0mMSgMmHhy+VROndON24RUhDEIE+fg/I7Gg/a8Ia8PYJoyhELECpP1uS1U1LlLiKe+LW5zU64/jW8Ap5INnRCa0yoWIcyokQCUV0DyjdDMJqicN2eP9i64NYSjbVyEO7X2/dv65QJ9vnHOKcn6+7H4vXOx27hiSGu/qhoO04I1/tCpnJNjU2uRX74/BxKe8zknj76rvIj/vwh06GOup7Cbb60svJcqJ4Od9WjO X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c707734-1aa0-4b1a-f3ef-08dad6946f53 X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6163.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2022 07:43:43.8716 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +Tc0c83/K7ebycMAoo5bg3npROUxwHD/cvPN90okAox5ckP2uFJ1HHcleAjfgdeu56jYnZmRDUsQRbHEr1Wldw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5607 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The MDB group key (i.e., {source, destination, protocol, VID}) is currently determined under the multicast lock from the netlink attributes. Instead, use the group key from the MDB configuration structure that was prepared before acquiring the lock. No functional changes intended. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 2f9b192500a3..cb4fd27f118f 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -855,20 +855,19 @@ __br_mdb_choose_context(struct net_bridge *br, static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, struct br_mdb_entry *entry, - struct nlattr **mdb_attrs, + struct br_mdb_config *cfg, struct netlink_ext_ack *extack) { struct net_bridge_mdb_entry *mp, *star_mp; struct net_bridge_port_group __rcu **pp; struct net_bridge_port_group *p; struct net_bridge_mcast *brmctx; - struct br_ip group, star_group; + struct br_ip group = cfg->group; unsigned long now = jiffies; unsigned char flags = 0; + struct br_ip star_group; u8 filter_mode; - __mdb_entry_to_br_ip(entry, &group, mdb_attrs); - brmctx = __br_mdb_choose_context(br, entry, extack); if (!brmctx) return -EINVAL; @@ -966,7 +965,7 @@ static int __br_mdb_add(struct br_mdb_config *cfg, int ret; spin_lock_bh(&cfg->br->multicast_lock); - ret = br_mdb_add_group(cfg->br, cfg->p, cfg->entry, mdb_attrs, extack); + ret = br_mdb_add_group(cfg->br, cfg->p, cfg->entry, cfg, extack); spin_unlock_bh(&cfg->br->multicast_lock); return ret; @@ -1118,6 +1117,7 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, if (br_vlan_enabled(cfg.br->dev) && vg && cfg.entry->vid == 0) { list_for_each_entry(v, &vg->vlan_list, vlist) { cfg.entry->vid = v->vid; + cfg.group.vid = v->vid; err = __br_mdb_add(&cfg, mdb_attrs, extack); if (err) break; @@ -1137,11 +1137,9 @@ static int __br_mdb_del(struct br_mdb_config *cfg, struct net_bridge_mdb_entry *mp; struct net_bridge_port_group *p; struct net_bridge_port_group __rcu **pp; - struct br_ip ip; + struct br_ip ip = cfg->group; int err = -EINVAL; - __mdb_entry_to_br_ip(entry, &ip, mdb_attrs); - spin_lock_bh(&br->multicast_lock); mp = br_mdb_ip_get(br, &ip); if (!mp) @@ -1204,6 +1202,7 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, if (br_vlan_enabled(cfg.br->dev) && vg && cfg.entry->vid == 0) { list_for_each_entry(v, &vg->vlan_list, vlist) { cfg.entry->vid = v->vid; + cfg.group.vid = v->vid; err = __br_mdb_del(&cfg, mdb_attrs); } } else {