From patchwork Mon Dec 5 07:42:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13064225 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 E0F3FC4321E for ; Mon, 5 Dec 2022 07:43:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231801AbiLEHnf (ORCPT ); Mon, 5 Dec 2022 02:43:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231786AbiLEHn2 (ORCPT ); Mon, 5 Dec 2022 02:43:28 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2045.outbound.protection.outlook.com [40.107.243.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D76C414085 for ; Sun, 4 Dec 2022 23:43:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jp7qc/jAftjBCZ53oLttzr1NPB00fA9S2EJww6eHu0mwS54XRqH4I44k7PJkmI8cVdaTHR0EUbZLnXXC17tCkSUR74I9FtBt0nffxpZba1As3u7qPmDgnbxxehsEZbETuKRPl+/vucVMPR24Sfd07p/BiPEkxNf60WKVM/0OKwfBAGc3122zUCaK0wOCSkvmJzzlLODCCQCC3JDGclBh8yv7ulEqdMZPRFtszhXALvSH1VMR78ItZYr+MmMeeQLrDv3+1I7hvYKcsaHEY3FxitTypK/VTchRl6VeRap7bNHnuzr7/sTOMixlDW8F/xwReZZCMAzICiFhkZEKE0ATTw== 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=OMpP8zlpQO87u26lPL/PG2QO4xyXn4+JrImwc8Loh4w=; b=mulV290i6a0O0NhJRsoXuqWG6bsa7Mp9shKYgp5rqQxbEWfNB1jIiVH2xcFBQkRrQT9tS7rqoNSaOxo5kPwNcnNNBlKLHursPAbWwimGDNRjQRcbNe7IkYSmG54lMXcVSu+5NeTj9U0KFqknNDgWUHY2OHhpwkiFDwyNol4JpIDwL2MU+DljvUaNXoJ783SiUehvE6O/NxFFYt1fTMqbm/qlCiJsumA/0Ck10CI5dHfgenjI5W3AkLy42OHv1OGPVcxFJhmO/zWvwvz7liaJ9ZgGZKhMg0eUqj0CWatfdJw//MkKv6YSylXglcclweOXURpV214U7W2lpDwzT4UnTw== 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=OMpP8zlpQO87u26lPL/PG2QO4xyXn4+JrImwc8Loh4w=; b=eik/9BkQJmZSs19Ckd4talOAYcOjVyS98swrPLUkuhxYk+rOg6MhmzIAiU0n+UDqYPl/Ng/zVMU4I+f10kiO1K+98AgAI3H7x+y1fIJO5qt9fsVOEkKuSUehz+TF/QcwmP1t42Wbs/3KROnF2ykzYocVbMwh8jmQTqaU6SMmzlz4Sz8ZNSMAoL8JxL6hqm9bNS/PHD8lIxStmNoLD6BDkmX+NZRjFvBG8gj5b90PhYi19FNGyIrbh0wo4zqndONEWigrtGSFf3YTuPS2eVYnhksCN+n+8Vfokue28CsB2ZyqVRIy17GPr3nkRbU8LluSV+lQkYwMvU4maMNVJHVq6Q== 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 SJ1PR12MB6265.namprd12.prod.outlook.com (2603:10b6:a03:458::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.11; Mon, 5 Dec 2022 07:43:23 +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:23 +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 1/8] bridge: mcast: Centralize netlink attribute parsing Date: Mon, 5 Dec 2022 09:42:44 +0200 Message-Id: <20221205074251.4049275-2-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: LO4P265CA0252.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:350::18) To IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR12MB6163:EE_|SJ1PR12MB6265:EE_ X-MS-Office365-Filtering-Correlation-Id: 81ab1797-3aac-497b-c832-08dad69462de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /TvDKCC+lRLoCa911AiL9r6z4WJEWqwvMr41rjtmth2VOvHExmNpN+ENwXCgw/EPKkLxnihCnTA/HSHQ9uFQMBHXxfP3GB1IPsO2xnyRoqtZrVcGEjnIV8pmjo1/mfiCv4mpyDynj5slI6URlmaTrpPr6daIjA5Tm7At4SwJzwrhncMvWj4xzdzsl6BGWOWTe54ig90cMsxTMyn3BhnoEtvCsWb3xSSbl1YLTxzWte+EQS0reJ0eeUu7ahrgDjp+YdW1/Af2vQ2/3kgAAv1DE0knEF3pgEouRMxfRbiq1oNKG2aBUQW7eOAWgCJ7bzrS2CxxzWshTNcHcYdHddNXyDmYqsDvicz/vOOSC1JI3XbkASzcottdefB8LZdbvYMJqESBqLEft8kK4hXYweYrcjrQ3Q226ntYIpEkoHDzL6a8wr6e5w1lKkEkl5whDtS7/rNC827nfyteRPj4NfdaZZD5F0flSB4+PcZOuNTEJwXXJXjiYPD2KxeqgHPtjM4IrnSOh3y5AHf0rNXcHtVUp5FuDdXkSf/sokolRa8k2C6232sO3UCAQljCru8Hb7GhvTCiDiqirM7/OIZx1HYrcG0HshjOFwvzSV4h6V+Gt+BhS/5OZBNItBPG4a3kCFERuzGEMQaUYzdgD4+XmsfR0Q== 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)(376002)(396003)(39860400002)(136003)(346002)(451199015)(2616005)(1076003)(86362001)(2906002)(6506007)(5660300002)(186003)(6666004)(107886003)(316002)(6486002)(38100700002)(36756003)(8936002)(26005)(478600001)(6512007)(41300700001)(83380400001)(8676002)(4326008)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tEkJ2dZr5ICKoByrYUW6jfzY3PZiEJSmWhpEWQ376gymgRramg59PQ+y2450vsoyay/gj62CfQ5g7Hv94vPG0YgmH+H6fxBo1FFzffwBu6JtfnrXaliOarBsBe0TXnitpPM5z2xsQUyElmGwOqmuegImpmtVhGX1TtzzT745kN0rSRReTdq9YhjXML2nR8MQBzLjsPDquk8fdvQp4l67buw0BIyioBuxZnjVxnmAcU60Ydw45NvStyafwcjWcm7ra/etCZazFZAartHZtgTTfxAy+jATMEtKg/vuChomDyOTBD4adIhfa/zSTpAMWcVilaztXRyuPy+S+DhH5VkeiTX8Bnl9/s1HkUjyTvC2X2gYFZfK4YTUL1HCi0BD/t7SKXlqJ1hqqvSf1B99pPkCBKSEwwXg4hfRHNWQj4YaDlQlK9Y8Z06Mmgf+BJqe8x3duteShjrOyYRYzoIRosfeSkLZCXQw4IBVvgtS426eU6EBnJBr5nScfVKOz0A0RmETekamCnddAOa8acP3V49G6VJHeAJFAeCSxkswz2nx9Cv6GPEKwE+lGmSIft8ADSiVgZZIp35/F5F0aM+ZbIM5iRktCwToU5jJHxdupzvUu4HyukstnSU8sCe37lU9QcKJZF18a2B/469Jxh5KUVXEdgqQ9nWkmByBuluThfZXhHnXTFWcJOVX//yLQhqlc4Sr6ZfqLNfATKWZoUXjQ7vIMxP5WzHhUVS3K09/GMDVVF+rGtOxlLVAsdcZ6cCdotagrIujglNYsM0PjQSpTtxHlDALwsugNXhTzCuNLeMcLd0RJpybtBtLXs+V6Q9QB7oN2XpebMronUE6axitAndURfTIu/cfsm51JW8FfGx2xSxIXAyXxmEo8YvhyRe42kLYYkdeaEBfNoB9e03dnjEilIXXku+e6OiNWeFuDDjTCYJDcISeYi2fY+z7jaaxm58Sw0Ndpssw2nx3LteymPC2vYHeugNZk4KDustqML02kocAMLIZGdHJkd6sKhjm89jHaV9IBVKQB2M2mte7ZzVsmnGgBWOIONFezJHCIguyC+7MbixGZM9XzJyIUmHaCpjU7h5neuUu8MVKGFABeEJcGrhjba9giB/lZ5QxnljI1buQJ7opjyEhWevK7wglF6+Gy+eH9dITBaw36k5Pwg2OznHZ+jNdMBIgXGaZz8gwvxmOitonORGdK585TTB3R8Lvq3reogIf2rlDG+mGFAu31gFzezSUt+xh9QPdlTCB/8Fyyo5YmsWlLYNnCeLVUIWK38M+Jpgn/K2DzB0rOWoyUNA2RCq24FRRThdDVnARK6DJMpuyvitfRKV7QRJTH69SM7WW6LV8bqeQSYpP1r/kiXHExRcGaUyHONdyrQuCGU9pyxwXFc+VdPgOQij1t/WObMYdDN2l+xNyx0qfZxBjy8mbM9AevJi817JPKwam2RMzIQF5B/adXm0QgIBDQZs/r2qJuROA84PWU9Txz2s/hpgclPwM2ucB/wB54qiCxEymO2ZBEYEkm4Q9AnoTqSbF0hhxGUKuu553/dTROwHK/fUc/FI8A8ngv6Yt5lnct79nUp6Sy7RVtfMaBVHtyPMW X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81ab1797-3aac-497b-c832-08dad69462de 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:22.9711 (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: V6E1scrAYlxRbDfjQc4zKsIhCEiZ8DpL3k0dhMIgXS3qMopytGKDlvfftwsiTpfydw+3KipeHjoFh3Hl4JNLhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6265 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Netlink attributes are currently passed deep in the MDB creation call chain, making it difficult to add new attributes. In addition, some validity checks are performed under the multicast lock although they can be performed before it is ever acquired. As a first step towards solving these issues, parse the RTM_{NEW,DEL}MDB messages into a configuration structure, relieving other functions from the need to handle raw netlink attributes. Subsequent patches will convert the MDB code to use this configuration structure. This is consistent with how other rtnetlink objects are handled, such as routes and nexthops. Signed-off-by: Ido Schimmel --- net/bridge/br_mdb.c | 120 ++++++++++++++++++++++++++++++++++++++++ net/bridge/br_private.h | 7 +++ 2 files changed, 127 insertions(+) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 321be94c445a..c53050e47a0f 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -974,6 +974,116 @@ static int __br_mdb_add(struct net *net, struct net_bridge *br, return ret; } +static int br_mdb_config_attrs_init(struct nlattr *set_attrs, + struct br_mdb_config *cfg, + struct netlink_ext_ack *extack) +{ + struct nlattr *mdb_attrs[MDBE_ATTR_MAX + 1]; + int err; + + err = nla_parse_nested(mdb_attrs, MDBE_ATTR_MAX, set_attrs, + br_mdbe_attrs_pol, extack); + if (err) + return err; + + if (mdb_attrs[MDBE_ATTR_SOURCE] && + !is_valid_mdb_source(mdb_attrs[MDBE_ATTR_SOURCE], + cfg->entry->addr.proto, extack)) + return -EINVAL; + + __mdb_entry_to_br_ip(cfg->entry, &cfg->group, mdb_attrs); + + return 0; +} + +static int br_mdb_config_init(struct net *net, struct sk_buff *skb, + struct nlmsghdr *nlh, struct br_mdb_config *cfg, + struct netlink_ext_ack *extack) +{ + struct nlattr *tb[MDBA_SET_ENTRY_MAX + 1]; + struct br_port_msg *bpm; + struct net_device *dev; + int err; + + err = nlmsg_parse_deprecated(nlh, sizeof(*bpm), tb, + MDBA_SET_ENTRY_MAX, NULL, extack); + if (err) + return err; + + memset(cfg, 0, sizeof(*cfg)); + + bpm = nlmsg_data(nlh); + if (!bpm->ifindex) { + NL_SET_ERR_MSG_MOD(extack, "Invalid bridge ifindex"); + return -EINVAL; + } + + dev = __dev_get_by_index(net, bpm->ifindex); + if (!dev) { + NL_SET_ERR_MSG_MOD(extack, "Bridge device doesn't exist"); + return -ENODEV; + } + + if (!netif_is_bridge_master(dev)) { + NL_SET_ERR_MSG_MOD(extack, "Device is not a bridge"); + return -EOPNOTSUPP; + } + + cfg->br = netdev_priv(dev); + + if (!netif_running(cfg->br->dev)) { + NL_SET_ERR_MSG_MOD(extack, "Bridge device is not running"); + return -EINVAL; + } + + if (!br_opt_get(cfg->br, BROPT_MULTICAST_ENABLED)) { + NL_SET_ERR_MSG_MOD(extack, "Bridge's multicast processing is disabled"); + return -EINVAL; + } + + if (NL_REQ_ATTR_CHECK(extack, NULL, tb, MDBA_SET_ENTRY)) { + NL_SET_ERR_MSG_MOD(extack, "Missing MDBA_SET_ENTRY attribute"); + return -EINVAL; + } + if (nla_len(tb[MDBA_SET_ENTRY]) != sizeof(struct br_mdb_entry)) { + NL_SET_ERR_MSG_MOD(extack, "Invalid MDBA_SET_ENTRY attribute length"); + return -EINVAL; + } + + cfg->entry = nla_data(tb[MDBA_SET_ENTRY]); + if (!is_valid_mdb_entry(cfg->entry, extack)) + return -EINVAL; + + if (cfg->entry->ifindex != cfg->br->dev->ifindex) { + struct net_device *pdev; + + pdev = __dev_get_by_index(net, cfg->entry->ifindex); + if (!pdev) { + NL_SET_ERR_MSG_MOD(extack, "Port net device doesn't exist"); + return -ENODEV; + } + + cfg->p = br_port_get_rtnl(pdev); + if (!cfg->p) { + NL_SET_ERR_MSG_MOD(extack, "Net device is not a bridge port"); + return -EINVAL; + } + + if (cfg->p->br != cfg->br) { + NL_SET_ERR_MSG_MOD(extack, "Port belongs to a different bridge device"); + return -EINVAL; + } + } + + if (tb[MDBA_SET_ENTRY_ATTRS]) + return br_mdb_config_attrs_init(tb[MDBA_SET_ENTRY_ATTRS], cfg, + extack); + else + __mdb_entry_to_br_ip(cfg->entry, &cfg->group, NULL); + + return 0; +} + static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, struct netlink_ext_ack *extack) { @@ -984,9 +1094,14 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, struct net_device *dev, *pdev; struct br_mdb_entry *entry; struct net_bridge_vlan *v; + struct br_mdb_config cfg; struct net_bridge *br; int err; + err = br_mdb_config_init(net, skb, nlh, &cfg, extack); + if (err) + return err; + err = br_mdb_parse(skb, nlh, &dev, &entry, mdb_attrs, extack); if (err < 0) return err; @@ -1101,9 +1216,14 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, struct net_device *dev, *pdev; struct br_mdb_entry *entry; struct net_bridge_vlan *v; + struct br_mdb_config cfg; struct net_bridge *br; int err; + err = br_mdb_config_init(net, skb, nlh, &cfg, extack); + if (err) + return err; + err = br_mdb_parse(skb, nlh, &dev, &entry, mdb_attrs, extack); if (err < 0) return err; diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 4c4fda930068..0a09f10966dc 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -92,6 +92,13 @@ struct bridge_mcast_stats { struct br_mcast_stats mstats; struct u64_stats_sync syncp; }; + +struct br_mdb_config { + struct net_bridge *br; + struct net_bridge_port *p; + struct br_mdb_entry *entry; + struct br_ip group; +}; #endif /* net_bridge_mcast_port must be always defined due to forwarding stubs */ From patchwork Mon Dec 5 07:42:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13064226 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 83A2AC4321E for ; Mon, 5 Dec 2022 07:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231803AbiLEHnr (ORCPT ); Mon, 5 Dec 2022 02:43:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231448AbiLEHnf (ORCPT ); Mon, 5 Dec 2022 02:43:35 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2070.outbound.protection.outlook.com [40.107.243.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E580D140EE for ; Sun, 4 Dec 2022 23:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ayeQiOS9Z3HG2Ta7WgdNamfVnGMiRkxVEljlbE3U9qZAgGuUS5mavsan1pTagRZZmNsdYqRHGRcTzybgPTLtQXoqytW1DSEg2s7zyP90hrH38/rjR/hfzDFC3ik58kjT/7UvYcYvHaOTi7AF7KqeoEcHu9s6Y3KHGi2cTjRjY6aZDJInrRYW94McxykPkMyMJsJusQefY2AklsWWfxFT3VrZDxhmtWlHqlzS+/ydItkzr/WaQpIydxWPXzR3WSYQNhmDMDt/soRsnNbrOqWvZy1LURbilRx43lS6C99ZA1F6DIZMATWT8jT49PoQ4d45Vih+VQQp+lc8LNGhgRBlvg== 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=/Yja9VsLnagC72ep9LTUOr8dSAjGOieYh86W4wK44A4=; b=jVIIVk8Q8wgQrd6Nr2ZWS550bXaXitK7XKtOjlfxN1SyD+mMv+wbLYdsmSD6NvKTvQeRieYgHHGI1cv5zYDd/brEZ2QPpaVQPgIHsB23MgG35miyWdUb3GFV8M9bBow0LtJmaGStvU5KfV7q7OJBkE48n4+KDGRZ5avbY4L8rf1+Qx9MSxEmpZNNrq+c5HdUEqBvaCADXL5MGkjbDfAZP+SpUh6pDMuv5DFUwyh4BhlUOruMgedFOuTMtRDneb3ogBhEHxSm205WFwqjmEM/ki4rBweid4hALY9aiXOQ1z9X/mVAPYA5Slg15gOYr2M4m7Tt/7afPO8K1Z2Q/DVdTQ== 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=/Yja9VsLnagC72ep9LTUOr8dSAjGOieYh86W4wK44A4=; b=BRkcklSBIIT0Agbf25y1wUEBF8/6R2Hrurk3TXulCkxyEwXMu3GELkyeAr2PhYSkZBEDY4oMrEeJXKoGiip7yV/17DyJJ6XlUAMy/kZXUXhc0ZlSftuK+wNbz37jLbhx2qqL3JcP6ZNzKIkJ4TWrKrMWWJQx+vN7l1dydORRkdba+5qP4W5ldh4ARZp18LRaMYI89Ed5WoVcGsJqyj3lrFK3ANna274XE7db4bvfjlqvxPE5P7KT0xNNB8StQNM9q8yT8CqO3zNNqlEQCsBQ3JMSVliLhScaENq1Sj2c34kH55dW9aFwSYOpSmZnLB8exT+IZsArRz5suwaEth9a1A== 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 SJ1PR12MB6265.namprd12.prod.outlook.com (2603:10b6:a03:458::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.11; Mon, 5 Dec 2022 07:43:28 +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:28 +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 2/8] bridge: mcast: Remove redundant checks Date: Mon, 5 Dec 2022 09:42:45 +0200 Message-Id: <20221205074251.4049275-3-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: LO6P265CA0006.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:339::15) To IA1PR12MB6163.namprd12.prod.outlook.com (2603:10b6:208:3e9::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR12MB6163:EE_|SJ1PR12MB6265:EE_ X-MS-Office365-Filtering-Correlation-Id: ed56ebb3-2092-4113-952c-08dad69465f6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9C4SdzzC25M6aFtPitc98xzTf8mEZ6U2Xc/BXDVDeSuCz3AX8+9gax6yDlMTZ7XFlHqAxg/jo6pc0KKKhrh4p0UQWSmt6VYS9BlypY+oF6xdSxPI7I+d7ZO4cFmYS3eIj/KT3hp/Fnk6cAD0oyVt/6QCO+qXrpzPWlzHzTNfUaUIK6vzEdFKAw/oWZlBCj17Ipk+ln7VQSL2TUWkYmQ720LfiwZ5jWKYYKE3p46qV93QnBJPKEDdJk4wT1ki4ycmLnhV9FN24K1xZBzmKAZ9830/HSIkjyND9CtVerU1IOsyhzzl8/6IHfOZb0ivWq2H3rAnfX55P0cG1gzC2vZdLJA3eSBKsdutDOay89iUbT5xcPqK23qg5ENpE3f+uV0prn8kwilVbofMyzg50/FUgHHTMXvZorrgZYdzjuLoywSl8Itq6xhmwUY0CV3iJYn4eN2eZQGAK4hJGX7zKH1P7J7VlJjLjjpt0leHjgF4FAcM7tNWpqORtDPSTqSIC+CUjivXIWCpde331lmowad8idYTTUdkTKG+1A2T9uTMKkVFiJHPtAmbChMXlmqyjE/AqKbbuWLni8HVfuXth/0B7PQpaOf1Ah4OeQPEh3aD62AKD6xv6KfoxJiuFWaBkaUVBMr04dN3NFs4RtdyQh0LVw== 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)(376002)(396003)(39860400002)(136003)(346002)(451199015)(2616005)(1076003)(86362001)(2906002)(6506007)(5660300002)(186003)(6666004)(107886003)(316002)(6486002)(38100700002)(36756003)(8936002)(26005)(478600001)(6512007)(41300700001)(83380400001)(8676002)(4326008)(66556008)(66476007)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zzTRZTR+nzDra2CWa5P3J3BNOFyZnGmvNxm8cafhbMbbkMCJ73l7a+IgEKo6c7kXXqK6EeAkHMOqIHRUmODHl86V9m99Dbeb6v9vYBdkUc2FubhcEw244S3H6GvHGJa2GMGUV6SHW39NXrr0KiZnD2jqiKDV2ygkE75/T0zz3B7e3zFCWE/KrhU45Bpxx58KrVyFY0Y5fsD4BhakLOtsblQLXNhASFT5mPTwGnlrcuWRfyq94NgQs5+qpJned5pM9PS0x4wXenoRU5gL8TLd/vIu4+MN6GC2rNCg2QxUPjY6sLtiaOAETO9vx8nr/jtbdpfB8zIrRdk3mJT6oBGkt6BDi+b9tXGGX0WaDNteJgdkY/kB/RHB38/FmcRy20T9LIpnWL2XOIqUczcw89Fkc7zas56puJYRbuG7M0Ds01Anpf9Js7xl5/tSxanOpW/miXCBEcyyGxGAIknzUVtmV5YAbTw9BcmNzahnKjpWCE8LYChgqFJdcjrcQbjDli0L49b+bzL2etnfcdrAOThKEQDBxpybCKJTfBxhFVe/qYhXwtE9/vopidCFBLh7j63pvtcSOvP5FkABolDtnfEgqu50KjJ2L6zEISqal2qQjh/AAkkB6K5k4uwbYYcVJPYovvcYwI7qreKUzwqjZbRV8uhRWj2Cij/GejZ8RGilrFD4po+ubpyObG8W9cn+Hbam7CoaSP2OLhlbD0oucnJb4QmkShgMVyspALAvdaayKDnhUzONZ2so+IjbvOlvgweYqZbDSk7kqZt1O5Y7mAPjZNZDgH6AlZrp5pbj8eGWpnG4U5JC+VY5Obe1VEd3Zn8xFdMwQPNZ9wMWv61fy5ijq0PdzmrtdriwMxAORAJmcIti/nOux/iVcfwmZnlvPdaigxda575r4nRY3wQPgh0TAbpHZfaoh604Mgy3P+2ag4JSwNmXM1QO7+obV95FoI6BFdSYGVdsG+GCMOYocSCgWP66S2b++iGJFmdghNEZLJo/Y1dmX8i2tcjtAwLLlS1Uddw3g/XjyVexDMwa68HzGgy5Zi/m/4kDPEPhh/tCV0eK0YCyfKwpKp3wWPDpeczICI2VDuvRMkBaiYDD3Ob9c7ORWzCe2YMf75hSjrULiF1r1yKRbzz7Gox9XuiW+TZaus2eE7kdMv1X/C0KtoyzmloYORUgQpq9tGYC4Ly8SIgW5OWb5D8kFsVxHe7f5kPa+r/cxLVRZPMrL+pFbcnRPSdkONFsL9kXP7c17kS8VcuIIbvPadDKUgR39vA526+zQrjuUSx/XawjU32HodCK+WLX+9ixeM4XKF+pN/dV2jUa9CQAsY/KlLjkmD5CVJAe+ls3h43Bv8FtPQqwhPbkLjuHJ/N7oW04ii2ZcSWCqoEYTpYXQUqh23YBfeyA/IqJv0Kgekj1ZPRtSbGHHrMeAqZpc1+0p0iqHorpLZi179hpT97qt9f+QavmysUyJ8i5Bo28rxm4aVEy4bieCde+ovQ1TO8yfcPb9ewiU3svvXhOiai3nQEWnAZjp/6IncjdOK8K55JPxk7Q9L5wiWg3tv6tNyZ2GVYv76XzSFfZVvw0hl5V1MnhhM4f/1EVG9uR X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed56ebb3-2092-4113-952c-08dad69465f6 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:28.1602 (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: CMsR69fQoPyI+XDHPQGzbjpdJhOdPS4BnaiRQvkEIVEylzFP1u9P8VOHqyprwQl8yq2ocw9ti2RpXvkijvRatw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6265 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org These checks are now redundant as they are performed by br_mdb_config_init() while parsing the RTM_{NEW,DEL}MDB messages. Remove them. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 63 +++++++-------------------------------------- 1 file changed, 9 insertions(+), 54 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index c53050e47a0f..68fd34161a40 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -1090,11 +1090,10 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, struct nlattr *mdb_attrs[MDBE_ATTR_MAX + 1]; struct net *net = sock_net(skb->sk); struct net_bridge_vlan_group *vg; - struct net_bridge_port *p = NULL; - struct net_device *dev, *pdev; struct br_mdb_entry *entry; struct net_bridge_vlan *v; struct br_mdb_config cfg; + struct net_device *dev; struct net_bridge *br; int err; @@ -1108,38 +1107,12 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, br = netdev_priv(dev); - if (!netif_running(br->dev)) { - NL_SET_ERR_MSG_MOD(extack, "Bridge device is not running"); - return -EINVAL; - } - - if (!br_opt_get(br, BROPT_MULTICAST_ENABLED)) { - NL_SET_ERR_MSG_MOD(extack, "Bridge's multicast processing is disabled"); - return -EINVAL; - } - if (entry->ifindex != br->dev->ifindex) { - pdev = __dev_get_by_index(net, entry->ifindex); - if (!pdev) { - NL_SET_ERR_MSG_MOD(extack, "Port net device doesn't exist"); - return -ENODEV; - } - - p = br_port_get_rtnl(pdev); - if (!p) { - NL_SET_ERR_MSG_MOD(extack, "Net device is not a bridge port"); - return -EINVAL; - } - - if (p->br != br) { - NL_SET_ERR_MSG_MOD(extack, "Port belongs to a different bridge device"); - return -EINVAL; - } - if (p->state == BR_STATE_DISABLED && entry->state != MDB_PERMANENT) { + if (cfg.p->state == BR_STATE_DISABLED && entry->state != MDB_PERMANENT) { NL_SET_ERR_MSG_MOD(extack, "Port is in disabled state and entry is not permanent"); return -EINVAL; } - vg = nbp_vlan_group(p); + vg = nbp_vlan_group(cfg.p); } else { vg = br_vlan_group(br); } @@ -1150,12 +1123,12 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, if (br_vlan_enabled(br->dev) && vg && entry->vid == 0) { list_for_each_entry(v, &vg->vlan_list, vlist) { entry->vid = v->vid; - err = __br_mdb_add(net, br, p, entry, mdb_attrs, extack); + err = __br_mdb_add(net, br, cfg.p, entry, mdb_attrs, extack); if (err) break; } } else { - err = __br_mdb_add(net, br, p, entry, mdb_attrs, extack); + err = __br_mdb_add(net, br, cfg.p, entry, mdb_attrs, extack); } return err; @@ -1170,9 +1143,6 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry, struct br_ip ip; int err = -EINVAL; - if (!netif_running(br->dev) || !br_opt_get(br, BROPT_MULTICAST_ENABLED)) - return -EINVAL; - __mdb_entry_to_br_ip(entry, &ip, mdb_attrs); spin_lock_bh(&br->multicast_lock); @@ -1212,11 +1182,10 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, struct nlattr *mdb_attrs[MDBE_ATTR_MAX + 1]; struct net *net = sock_net(skb->sk); struct net_bridge_vlan_group *vg; - struct net_bridge_port *p = NULL; - struct net_device *dev, *pdev; struct br_mdb_entry *entry; struct net_bridge_vlan *v; struct br_mdb_config cfg; + struct net_device *dev; struct net_bridge *br; int err; @@ -1230,24 +1199,10 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, br = netdev_priv(dev); - if (entry->ifindex != br->dev->ifindex) { - pdev = __dev_get_by_index(net, entry->ifindex); - if (!pdev) - return -ENODEV; - - p = br_port_get_rtnl(pdev); - if (!p) { - NL_SET_ERR_MSG_MOD(extack, "Net device is not a bridge port"); - return -EINVAL; - } - if (p->br != br) { - NL_SET_ERR_MSG_MOD(extack, "Port belongs to a different bridge device"); - return -EINVAL; - } - vg = nbp_vlan_group(p); - } else { + if (entry->ifindex != br->dev->ifindex) + vg = nbp_vlan_group(cfg.p); + else vg = br_vlan_group(br); - } /* If vlan filtering is enabled and VLAN is not specified * delete mdb entry on all vlans configured on the port. From patchwork Mon Dec 5 07:42:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13064227 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 A90CFC4321E for ; Mon, 5 Dec 2022 07:43:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231797AbiLEHn5 (ORCPT ); Mon, 5 Dec 2022 02:43:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231796AbiLEHnn (ORCPT ); Mon, 5 Dec 2022 02:43:43 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2066.outbound.protection.outlook.com [40.107.100.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 147AD12761 for ; Sun, 4 Dec 2022 23:43:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iPrXFPtg7cwpbJtKtCPFGqfh+S4nu1SZSlvmJm3dupEfLG+vaMkb93n4WITieJ2kAYL72MtxWGK0yVk11ooBbxhVFZylbxk+lZb2WTVfnyb33od8dYET9PgpiTz7QCUi+EGC6yBdme4n1WrH2jJn4ihe1Qi7GjbQucwQ4Hxx6IMc86G29iznCEnL4tMT9cMqSCv/Np4+OdYP1IA7IGXuyoTglo8EH+oyrDC0tGeX2+rY1lOxzO43VA13cVFIVSYrbt5WSzAstr+SgaZ2TEQMTQSkn29DW+RcYMkBwDi7b2DXFlGHsKib5+8uFc6U85BoML9xEnnIru+AAjz/jA4sEg== 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=XwVO3MdJewVwL++HqzQVhHQuzCLAJInR8kaZP71v4JY=; b=ejETNYkb2vxrxsaiw9OCBaKEbtsWgY5gkNcaMMm7hiSMnMViXszfU/5S3/VtZZjkf7XBCDbSpwe3gSRcxwQMLirHbDb4RpabSYCdrVMuHluzIx3RRM7CyyCM4/VXWOfGIXlQOkJ4SU63W9V1sG9Z+HKJmVgsL2nf58e58+H8TZuSIPodt3ggF+0OcCcLl7fVcZ8HzbXZPgOWAAhfcLVWSX4reFb12UgGMPOuY7AWIUwLcIab12yG43e15HJEDahDf9uryGsJEDinn1VAEkNo5xpIlwhjr3tS8lZEKWhOlzwoHINDIewSTymAIe/tsbx1+LAw8tJpgK2UXcuEn74mwA== 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=XwVO3MdJewVwL++HqzQVhHQuzCLAJInR8kaZP71v4JY=; b=iTgdTdDGO1zFfng4t8Et0w5fRjg0oSdD7UnLB3qYFMiio+S0oLDgw7pct2DsMO0Top19SKTGBZe6SjBIu6Pf9WfO39Y4oBs1OfGq/KfqhR/JFAvdWC/qKzrS5S/GPeOV2j6q4lWyK2XUsDCm9W7l9vAEVMMykaeOrvHnBvqhbZ81QQtMSNEKpjZXFiKDnVpTdxLC+mqaA2osfSPiH0FXYmshZfAtUjhOaz6EbzrPeafzhIznc07de4traaqz/Kei2wfLhrhx+LrUBrc3lzJx7LieBe47BZpXOSHfJV/IowPGgMXYr/IfQkjG961pnTGBi7sTTx0tnRvo24t31FZx2g== 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:34 +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:34 +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 3/8] bridge: mcast: Use MDB configuration structure where possible Date: Mon, 5 Dec 2022 09:42:46 +0200 Message-Id: <20221205074251.4049275-4-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: LO4P123CA0326.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18c::7) 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: d1685251-c4c5-47bb-8857-08dad6946977 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o1CtjppiuPvnZLuxts/6NW4RVj8YDuy8yXVHNa2iLpUUaAiBsRaX6I7t7DpyE7ylhke1RPsTYVG7Qo2c/iOyVS3DsC4gklNlvGxh0NmUak/t052UfHdGx3+J/29rk5F/h5/sxMVwoQJMg22SDRBOf27xq/HEjExBBP6rbQnw6uFIAYDIzZJU+0weeVLQZ+VJZJkR5APxk5UYNGrND2hiGy3vfJYejnpdN68T9z9Ws7lb/1mpYrPo5XlArW4h4bOOS1iozOEK1BTUiARcRuYfiSvn5dmKNpAeys7xjuppPK0jDXTIxE4pGO1J7RaDNJM1+Sd9eY7PWhDA4jcHzzdoEtwVqZM+9FQyfRBh44WoR2i5SNpqLy8ipA5JMzJfjh8vMomqF+36K0KBzLla7ecBI+kxpUHbbP05iS20zcjFr3YTiuDxbmZX/vU50XJXH/ieyAzJXaAxNwMMgq1PFfTfDrm19dE1bxeMLwMReSBQfXKcx3gAk4FeinR5S753j75gMzJIUYtE32f5uZ78DKmXGu+Lo8URKa8CWlXzuMdGb7IUbcN/8S3v9dF3WZLy9bkYcAvxiGyn5XLcEO84NrVrZ4N2iPVoDAB1plZClcjQSP8Zb423gNgCACZ9e0vUl9k3QG0+tTeNPsFTeW+0hUvZYw== 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)(6666004)(107886003)(1076003)(186003)(6506007)(26005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H028Kyem9jSAma6Vk8h0c+izdqXvySXbtxpYFhbJvg+qeJS2qhJMO/I09qK12ISZjWjHacTTSD32tfTdqZgYhxx3heGchf2Gon6udLkhEOKa4V+1DhObSLLDdjYh144KiLEgOo7GM6UHvPlTl/9MvEmre0YY7wZX7M89Xs5BcCeaCwia21YzUPoLixETPovbodCZyzPv6e7Fy4vYfdpSOB1DjhVuGCbkLCxHTbFakXrPxJTwSE23hS/H1CPFY6cFCZ7hpKuXqN6YWf4IWCcyKpSI+NsAzlq6TMG1aA3A8FoyjcQs/AT0R0ewZpS5gJhZnZ3XgCKp032c0FttTdZmMWOuoMxz86BSEy83Jc4tX9sWmkPKZmifIC/cFx/YY7fj4CST1EIOmLr7twmb8KXrA8ZshN2nVI84tAnNpEHpjaUSWpcXEGlchKVC9waMfZkDkzJuc3UeT+ddx5qxZHlWq+ndQCi1Munl+bpDp3x6qXJdAtF9N3CDXzL6lGoyzGo36tj97QaegDQomt9ojVGYq6nTfITma2e/Km7Fl4qztSVXVpZkgRH5msqWJViJXCNuKCGPtDD5mAN0XGENIN4+OllkLwQH8oagvWBklpI2VOGTDFOmZROe0EcSTzoFHHycBIJjwyNHelukRLKk1w5xuDUz7GPJ57Lcss0vFgWUDbUs+DyNeKFvR/wjTFrUdVO+xJe+pbxxPRqYPDju/LMA/TiCUD2Sx8MX5F0BNZj3joMIUu+H9XeBwLJcXKBKY8B0c8I9d5cBfkG7HbaTcUh5WGGXd8IJgVNfvGEiLxCRMOc8lr889fv1lGB6VpHlc2NJKDkDuzveJHp4PpRKcOlhlA+sFFJ/mDD3/R46zKCto599Aw7L4P6ibP52VRMmegx1CygzLfs8hV80qFHN9ljOVqUy5NSbb592GNH+TQ06u6P0nWFh4UTFZnXIIP99p0kGYodBpsQHZrsFJuOOBA3lJnCju89vV/UEL9ACm3Ch4md/suFGgMbywT/vwQOdslqx1wg0gI8bV2x9uExO00Ve+h8AE5ev7jj7IU3Llkden8O0Ufez0e/QXJ4jAa2n0gvli/CwuMktKDuo6D4nqvK8QzfXUXY2OTDGZQjSaOaY8A2kogR2hqLVcghq0cC9QgKOONOn5PRd/fgR5b+N4YD5jd0kZEeIZGFrBlk7WsGQEvjl6S/Grut2gqZUOaGRspFfcTrsp/eGEuCT1NjmMzKkNrMQjNp6+K8iLKdP34a2FOOQ0Au/Zngyy9MVdByoQJ13gdxzkC9nsnpBHdHYeBCsPMT8f2diGeBMOUmNHsk5gJsgouhNbGOk1YKi2r5iJ3S26IKbpQTIEjTAFkUXMHRhhTalGNCyOi9c5oVqNcUj0eYX/19uqkWmiCyvBYXm6329x8Ec5F0TS9Yn8HMwmNDG6hF3laN7lK3jwgxcxNPJazi7nV9rCH2+fkpt/vtkSKMCOOZBdNBFo0zE1xDM4RxQuKqYkjfpv7aBuYYBNuyxhHvqXGNJeOoB4O481PWJLtAIV+tzGvQUcGWPTqncsTZkS5W0H2uMsLh5hqijTfM6wtmei2JePmLTtYEQevGnpO5i X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1685251-c4c5-47bb-8857-08dad6946977 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:34.0697 (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: eNSKkjnDyi4yJlRh+lADzxUSAvomUZLrbcQBJj+R6ArlKjQdLArpOULKcWovxtdl9axoqlOzvsq8NtgpE/KTkA== 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 configuration structure (i.e., struct br_mdb_config) now includes all the necessary information from the parsed RTM_{NEW,DEL}MDB netlink messages, so use it. This will later allow us to delete the calls to br_mdb_parse() from br_mdb_add() and br_mdb_del(). No functional changes intended. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 68fd34161a40..cdc71516a51b 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -1094,7 +1094,6 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, struct net_bridge_vlan *v; struct br_mdb_config cfg; struct net_device *dev; - struct net_bridge *br; int err; err = br_mdb_config_init(net, skb, nlh, &cfg, extack); @@ -1105,30 +1104,30 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, if (err < 0) return err; - br = netdev_priv(dev); - - if (entry->ifindex != br->dev->ifindex) { - if (cfg.p->state == BR_STATE_DISABLED && entry->state != MDB_PERMANENT) { + if (cfg.p) { + if (cfg.p->state == BR_STATE_DISABLED && cfg.entry->state != MDB_PERMANENT) { NL_SET_ERR_MSG_MOD(extack, "Port is in disabled state and entry is not permanent"); return -EINVAL; } vg = nbp_vlan_group(cfg.p); } else { - vg = br_vlan_group(br); + vg = br_vlan_group(cfg.br); } /* If vlan filtering is enabled and VLAN is not specified * install mdb entry on all vlans configured on the port. */ - if (br_vlan_enabled(br->dev) && vg && entry->vid == 0) { + if (br_vlan_enabled(cfg.br->dev) && vg && cfg.entry->vid == 0) { list_for_each_entry(v, &vg->vlan_list, vlist) { - entry->vid = v->vid; - err = __br_mdb_add(net, br, cfg.p, entry, mdb_attrs, extack); + cfg.entry->vid = v->vid; + err = __br_mdb_add(net, cfg.br, cfg.p, cfg.entry, + mdb_attrs, extack); if (err) break; } } else { - err = __br_mdb_add(net, br, cfg.p, entry, mdb_attrs, extack); + err = __br_mdb_add(net, cfg.br, cfg.p, cfg.entry, mdb_attrs, + extack); } return err; @@ -1186,7 +1185,6 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, struct net_bridge_vlan *v; struct br_mdb_config cfg; struct net_device *dev; - struct net_bridge *br; int err; err = br_mdb_config_init(net, skb, nlh, &cfg, extack); @@ -1197,23 +1195,21 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, if (err < 0) return err; - br = netdev_priv(dev); - - if (entry->ifindex != br->dev->ifindex) + if (cfg.p) vg = nbp_vlan_group(cfg.p); else - vg = br_vlan_group(br); + vg = br_vlan_group(cfg.br); /* If vlan filtering is enabled and VLAN is not specified * delete mdb entry on all vlans configured on the port. */ - if (br_vlan_enabled(br->dev) && vg && entry->vid == 0) { + if (br_vlan_enabled(cfg.br->dev) && vg && cfg.entry->vid == 0) { list_for_each_entry(v, &vg->vlan_list, vlist) { - entry->vid = v->vid; - err = __br_mdb_del(br, entry, mdb_attrs); + cfg.entry->vid = v->vid; + err = __br_mdb_del(cfg.br, cfg.entry, mdb_attrs); } } else { - err = __br_mdb_del(br, entry, mdb_attrs); + err = __br_mdb_del(cfg.br, cfg.entry, mdb_attrs); } return err; From patchwork Mon Dec 5 07:42:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13064228 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 B0AC5C4321E for ; Mon, 5 Dec 2022 07:44:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231555AbiLEHoB (ORCPT ); Mon, 5 Dec 2022 02:44:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231820AbiLEHnp (ORCPT ); Mon, 5 Dec 2022 02:43:45 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2049.outbound.protection.outlook.com [40.107.100.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C95DD140E9 for ; Sun, 4 Dec 2022 23:43:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OiMVrtcfpwPgw6aFFpsCCnPzOQrTGjXqNB+LbVuDed2uwOImmg0ByylVGfXsapf1LtXyWAp8hhzG1c68wGNYw7hNZYnCzJJ901jjkyIc3dyB2ac+kX/d+EoXF+hzG3Ei33/xzZda7VY+ck9ZTKAIVEcJtFp449ijXDyLSrOnBxWMvE22/mSiT5hy8TjLFLVGmEEAvIkfuaaXJj5E4wuC67za9UOZi1cpb7MO5diJfTVCpxldtZWpEtEshD5EagbvSabD7H3zzV7tWXhS2RkP2aOoNWxCXfdzRJxmaJHaSWU+vMOz+IUCAdgQyJS0zA9GHkOui105ZMRes0XkCHXweg== 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=r7KoE8HIJ1pu5VQO2POFsxCEe9tHwXnYbaiO6W4KMMA=; b=lr8d6SoMU2XKFHCMxvhz0+Aa3TgE4Z4RJRjrlYBwn0c70+VJ8SCaq9K5r3ydwrqdWwgO4WdAzUNUJqWfxzkafYg4bELHhdSV74vHgz/BUgDlH3ol4vcv0ie6Cb29wpZogMfnMoi5ChNJlvEZo6G0aBwUbenpXBZuf8zNneRWTKhp586YKWmS2EB/YatDmHnSnXFHZki3tFAm8m9brcN7q5soxRG6+RD002ziTN23PzI7PFUKJGUDf6SQHbOvR+banWgja9KypbU8XNmR92ldJom+mbS8TeNrtM+j7bPnWNLnLrukk+byBMxsTB+2IhWVe4VXBxDdteO5bHyzuXliIQ== 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=r7KoE8HIJ1pu5VQO2POFsxCEe9tHwXnYbaiO6W4KMMA=; b=bpacDoNwCR+TJ3QvPi+vdVdgcpELh4uTMKuLF1AzUEYgXuOGP8HUwWMccdt4s9k4s4IMQ5FBVNXFDjcPaGxgbom5drTwfafIu5qNOmxRWP5BIp9XbBxu2QsYPW7suhZd/f9daRAzsnrZkq6kIMHGITk7SCLcax+tvlh6bIFFugw93cRN+LxDiAqkp+yrzkw2/wmtAbGWvO4WZAkj0oL+aeB8trUT/5vlY8Ezr3pUOrKQTl7NVlL2tQtMwivA2ISfpJX4v6i6IaxZsdxFpsBMd96ecPXyQvR8eC1GBEtcTciaI3n7/BxUrom4NIW+LBB9j4zF9mcFOu1hF2Qin/S65w== 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:39 +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:38 +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 4/8] bridge: mcast: Propagate MDB configuration structure further Date: Mon, 5 Dec 2022 09:42:47 +0200 Message-Id: <20221205074251.4049275-5-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: LO2P265CA0340.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::16) 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: d2333a78-adc4-4b9e-f6e2-08dad6946c55 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: A3b8Kr2U7FHsbOsBx1Fcvfsj5alvmo4j2rrngtMHIWOom+jVJ0m0MdMdsyCTdVIFLVRt3JpeCFwebigaD7AA2ANEzKsmlyN8HPGNC9G0KapBpMz+B6h7W0KI9efyhvNok7yvwpf+ZbDYwS9TEXRAfxl/L8XhuhKr5XQbIcfa6UQI7m8qZM9DaJPi5c1cus/sDbBF6MGp22z0884NoWyj/lSmaj2S5ySNMVuAuNn4v189N6loiag7oevX8QSXFPrE9Fk9laWHz1GPBbJzSfffAA12RL+Qxq/h04eS8T86MrwCY5puiPZX/sHNgtoZh8T0LOHwv+Y0AuKee+78P+tsljP8rxgPazEWrW+6gKzl2SvKSC/ElotNo3VN7QOpAzbJDdMNsTqkO8Ih1FIIlbLbJFjWWynfqkUCJ1ipM2rSHX3ZJbRJ8IlPdu2q4fs2+TRdwF65k2pVix41YC7s4JfondTOF2pYTbryOrVyDONXHULrmAruMQXJllW4DKPg7rUnm6EzYI7VrbY/wSF8AqNDg9HshLzTKV6VlZ+GXtWqE0XCvHlRzpO13jqBAGNO0Ca/9d4XyhiEs/qO4xSpoRxx1eLGwbSehCJXymCYJNmrnmmxP6QKd8otEOFz5IFq1pt02gfiYt7CSfa2HH7dXRDxXA== 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)(6666004)(107886003)(1076003)(186003)(6506007)(26005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6CqKdW2HHjRrXKt/XT1cA3+dhotSolzLnd2XTbsIVKgU16TtrpYGlwypyTVY7K3TPYB0krTMkNNO1Bb6+aaBfXNgmEROs+JECWN05oh+nwkzeSBq9slu+9gMOQgaNzmm/yqi0bxRr3NUVLZbiXx96qgyDYmfFTFo4h5C8tYRhzIdwZgeWjzGA/C5UI6FXLUkNU2YpOafewLoHbzqMtk/6teJtxy1BCaFsMlC0CepJH1czjUUbxy6w2yRkJaInm/NvEACGnwl6fU5pE7r5pGc91o3n7j6mRV7TMcZWEBvZy0xiCziNTL7eG7jdn4LeQkVt5SRZzj/o6pLJK0jyKCMYAa/Xhrf43hBoJfuYMqiZi6HsPzhogmxcP628hPVJjTCkaEBUYL3C91UyaZfuilue8eLh+74gYbBkzhD5CTcII2ujQQ4e9kOlKVKNbEZABRmtGD35OY11gz4FXtaRQk5RmA4y+rFVSSZthTObahd5kjQMQv9v6DdBeDF4UR1Whcb9Qx65ufntZl0GOnDtGvW7KGx1WhR5pYywh/jBX7LmFY6n5ngioRl5hM7yWoqefoJRJxbdaLiO1tro4ANui5RDigR5gWVUYO2MUTB1D/Zwn1VP1MqHl60WSciTzWxRsTM84KJoZy0osY5eES6nXnPUQFKqKIBrfLjHWBJzipJA5B1Voh/3bMlNw7OQi5QE95Wj43ZW4qoqnVCj7QD8km4N0CEFtWJ6e6mfP2RYYPaK3AD5UYQWMBm4ualRaS4wmvcm5sM976mKl01By0vKNjsj0WxS1+QyBO7kVschfrKQyiwrCNbOrorWglmDgOSl2KB+hVdJgrFNjSODvBzWvOdoicLwrnJywWz8Ff7h0DwurCVYLh9eifSWrTlXbDSpydthD2fJd8Dr7qhvjkjTt8AWtN+pP8oeN6B9PI6xUWipjBc4SiNELxDKklTf/9gNbHEeAo2m8uA/9GN0OZW+17r2kYDUraRrj7OyeyC5f/alKijnXjvIEAoCdY8r6ZAQYzTPW9Qs8697whGK73ZGB8ueRloiTk+6Z5vh7rcr+9+G9vxwjdozSxl3hZWT03jEkBk29UmzhXnZcJfmxMgyr6PjlkR7NQmSf4IPJVwHATBETzdRGMrvJoOlQyXYEWmaWIEdvQDpd9pnK7qaM9VRpJuxpzKmFuT+ZFwUqfTfSmH8KPYZhWqbj5BnflnKjdOMa02lEavVrpIzUbX0uAoO2MgyE6kUTsaRJXOLPgk8gEnVka3zZ+cQaYsHZpXdmVTvnouSxDOtbw9qxd53xprBgIbRkiZM7/0v71sSNMjr5JuO5Ast6iBB+fUD5PblS1llnNQK/ljR3itzvNuqiS1ECyi197P65XgFmom6c9CnY14lquAB4jjN5qbZ3mNpKnmyIOwOWvX93Q5SSYdwzYKj2dTqstV7cDwMy6qXzfldAx0SJoIAf4r6MxloqiEW21CYtLL8gbKz2zKw5+bB4kwgrjuQtghvHPGLxR9vZFyVWMUSNAxOTtn8C84T9tkqBKyxaj5IKjUQa5rC1IWP/rDNc9rNqnAObzeUpr49tlf5rXChe5B8rdW1RiDF3rXmPjfdlot X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2333a78-adc4-4b9e-f6e2-08dad6946c55 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:38.8673 (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: bolJnN3/1RjEuOHb5lCcxM8YvhP/+3rsESAwFVkhMdAHCMIlswt6S+CyZfRalzp+av4RzG5l1QobQolQWp69Ow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5607 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org As an intermediate step towards only using the new MDB configuration structure, pass it further in the control path instead of passing individual attributes. No functional changes intended. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index cdc71516a51b..2f9b192500a3 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -959,17 +959,15 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, return 0; } -static int __br_mdb_add(struct net *net, struct net_bridge *br, - struct net_bridge_port *p, - struct br_mdb_entry *entry, +static int __br_mdb_add(struct br_mdb_config *cfg, struct nlattr **mdb_attrs, struct netlink_ext_ack *extack) { int ret; - spin_lock_bh(&br->multicast_lock); - ret = br_mdb_add_group(br, p, entry, mdb_attrs, extack); - spin_unlock_bh(&br->multicast_lock); + spin_lock_bh(&cfg->br->multicast_lock); + ret = br_mdb_add_group(cfg->br, cfg->p, cfg->entry, mdb_attrs, extack); + spin_unlock_bh(&cfg->br->multicast_lock); return ret; } @@ -1120,22 +1118,22 @@ 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; - err = __br_mdb_add(net, cfg.br, cfg.p, cfg.entry, - mdb_attrs, extack); + err = __br_mdb_add(&cfg, mdb_attrs, extack); if (err) break; } } else { - err = __br_mdb_add(net, cfg.br, cfg.p, cfg.entry, mdb_attrs, - extack); + err = __br_mdb_add(&cfg, mdb_attrs, extack); } return err; } -static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry, +static int __br_mdb_del(struct br_mdb_config *cfg, struct nlattr **mdb_attrs) { + struct br_mdb_entry *entry = cfg->entry; + struct net_bridge *br = cfg->br; struct net_bridge_mdb_entry *mp; struct net_bridge_port_group *p; struct net_bridge_port_group __rcu **pp; @@ -1206,10 +1204,10 @@ 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; - err = __br_mdb_del(cfg.br, cfg.entry, mdb_attrs); + err = __br_mdb_del(&cfg, mdb_attrs); } } else { - err = __br_mdb_del(cfg.br, cfg.entry, mdb_attrs); + err = __br_mdb_del(&cfg, mdb_attrs); } return err; 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/hmMW1C4D7gTCYfya5WP41Dggx0utHVJEPQsluX33JSFHheU6i60NNfgnTyBCLBC4E7Bie1W9TzsCqf4d1Ov5AcdbuLIzM5qBVsnwOm1JGQpcwc6RJgIvtFwy2T2/KzwKV4a1gCQYytZE0qSJo354Rt8wZb+y0JBSwdS5riTTWsfPZhKUqO6qbEXJw6LObUoTbZu6WDe3hNcw4upv3b0EwevQN8cpBHkNsm41iW2042R3T5lbiFSvTQWgFyCH+MIDrbYkphLiJPjLFvtZ+mBO8iB5SlLhfYhpHCrit25m96FEqRwDEWs2aQXEHjb0J68cbUzsV593XOiaUzxcRLMf83aIlUvPMaorxuPJxueR1p1k+rg01+KsDS5jrCIJRk6iUkuIBVjFeYaBgPCXR/qjCKFvoJ5q5xF9dhH3uiHv94liQmkz3VtZDPRGL+/knMPd65co02j7C96r3AaZX7YudUqgPN+zLpLxpZriqxJcim/k/fH39a+wg4YFGXBUzedWjMphHR4WBejxKAC2UvW7tSYk1fR1ZKRxxoqURH/z8oX1BOih0KSkwT7Y32JhQ95MafpTA2LdcnIFmN9O+3svI4dCDUrAmXijcTAJ/XQVRepv9wsyLGME/eg5Fd9gCBegw5dPtl330B7HvGv0oSHNr7+WJ7I4GOcxWXrDJbHhwalVdr3hBli012Ualuavm0Aj+/0pphvTCSae+9TfkrMCgtxR+rdfZo1PMC2WE9Jg/RwQtY+XlWXSNWouFg7H/ATRFINoQ+7OwXj47TpCLaDvmqK50VhlE75qmyjLXPMnMrZtplLjjBIXDzs8Fren80iO5lkNXQM04yuc0Xg3OL6JQKQ7gszjNJMxOT8gwE/ad2szRMrzEL6vgNtEWvrMjrxVN/1OzMTsruXPngAyaE2VKxErMw7SXfEtjP710i5UZzoAF4yrFzFIR0si6OH7iKfVWQXwuVWFlv3Ke7K4cXqFGmLgp6fctruM9YO8Zl8OniJyOXH/Upms/82iRI+UMXgXsQ+kSH91W4KbKDU/SY37rmHJtHYVuOoMZFCmKrSiZmPrDpFOHgVXZKUJRlZNah6tytBMpeXZ9rSfW/bNPyVymDf2fVwAdd0K9loGxSj7h2GgkHoh3p6r1aW5mLgrveBH+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 { From patchwork Mon Dec 5 07:42:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13064230 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 17AEDC4321E for ; Mon, 5 Dec 2022 07:44:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231799AbiLEHoM (ORCPT ); Mon, 5 Dec 2022 02:44:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231806AbiLEHnz (ORCPT ); Mon, 5 Dec 2022 02:43:55 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2058.outbound.protection.outlook.com [40.107.100.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A91214D00 for ; Sun, 4 Dec 2022 23:43:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=luixcjMmCEdH4SbCINBvyZAwg5LupnzMBeRgvx/DUYYs/lRet0MDU+Sio7J/DEzmJtZWGgRQRFc6tqBW3bHnR9tcBvmEXCc1DTXSxyxsPaY4GgjTuS+VSBUQdWEhn7ILalqmN47RxOrf0RwfqvpOZ1wbWkP4Hwlt7b9cwssdVftCKDlk7+M0oPNKG/kIm9S8mK7JKHjvbmo6W8sp/gnOM9HwHVhgrUkXmMyLWrj9aSljOd43hFMWA7vKtoFAyZicPYI29RmDtfDUrtvGaIWCbdIX4u/Ati0JcPxpk4qAA+D+mnYNofS/lSb+lruAUmWxgZJJomWpVQj/IyMUiKHcPg== 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=4RAJY2CjoYY05o8YbqzrUXnRhRr9qjw5s82Fb6RBkow=; b=LZvZuB2Mkz8UWWq4S96swuweIBnfzs92lv5Sl+MTsOneafad4xSa0L1fFW/v2G0wV5pUAbtoLm9abGS3FWITsERRAUpeq9JSiT1fYgqSKK0z7TaMj5g18AHl9nx5ENL2jyL5K8FEZdQhVplx0nNNWeZWhQcsks5UneAbWuc5qlMTwEp9cREdzCanzcHvVoGx9xiQz0LxCQXP9BdHZ5apl+U3wUYk4tkBfsnXcYc4CEH9PLa5PDEJvTKu7vNNpsC2uAnkcPEEmLYSxRlVGE3ELoXADHIXYenh0ylF0mw5Rt2RQFEfp17AsCEJA3+aZssTUGYbsgH2OceO9IrDEe22Ow== 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=4RAJY2CjoYY05o8YbqzrUXnRhRr9qjw5s82Fb6RBkow=; b=IYbWt7FX7qC/U3nNPROdVezjtAW2FKx2WxtaiGV7QRvuReD7Em6HqzDezSMAiJerrMvMImD97Z77iYpyIoqc552dSlAFbJJ/dBeg8Tr1DCPHlGL7iQxIDv8n02DjiZHN7O1QY8SP42w7GE7Ey3oguufllXRs2h0lsR5IPoOUp2Ifd0Y03ZWQKSo8b5nr0nIfXBEZ33AJfupvFW90KPNTz1dSBk4K/zOWIlYuagskSyhwy/l+XkCxRj3iDHHb6Z8UhVjG2eTcA9Tv5Pul4pIMKxHjBPZxj69ZkZZ/M8Iah4R+1s4se5clvmgy/nqYOWwcyfeQdWBrhF5JLeCygOUJ4g== 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:49 +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:49 +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 6/8] bridge: mcast: Remove br_mdb_parse() Date: Mon, 5 Dec 2022 09:42:49 +0200 Message-Id: <20221205074251.4049275-7-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: LO4P265CA0199.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:318::16) 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: 1d6b0809-ba9a-4a99-7415-08dad694727c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XqulTcwvcSEZ5loauKLznQUSxk/vKKUnQIWDF6VpuZzd9TX22oUPuK85zGoJVQ5dLzbzA8cSpmm8A1OzyDCOJbKT/AaLaE4l+4B1T/bNucdt+Q3b0UzezJoq4TDakSXA31ITVxWvGdpdU51e4uL/C3ewhgSM6x+iWv+mr2JZ28UOVRzcsiCnn2Rr+jGrn5IMs7H1R3NG3W5rFMXQuZh/FI2jqyC2FBFcFuONyIdOIThUWYTV4sxEGjSJj16PzQv73qWVZ41R6KAJPrgDS1JaMk0IKBpHNr5oNzvywguGQTRpHREvS/FAtboV2oR/XyUbWuk9ATsbwbp8rXqZtKzyURhLz09gRoMn6K4pYfkjfZWyaaYKt7WqY27Oy/WBGku3IHQE/zPoTrIVfT098rFC/FeJoeghDLpWTf7vdHsHbiw7kjBwz6hMuHnvZe+MJNk68DjNXsrS9f5Vlmzs+X+q159uGW09qlLVz1NaR7CdMiPdxz3hkaXBQt0t6jScfhLDPGkB8WD3QyjC0VVREOgOkmREC50CpjZSXBo404DO0917KwjTuYcQ2I1SqAEoTIYu4iObcnSuUvoo30NAC8PH2qGyzYx5PM0SfQwLPj6s8xAKsJgFsQIzJ7+Yu83t6vDvGBEphDaSnXhHQOh24F9TtQ== 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: juWhlYrI6971Rcx41f3aQybBKvbo4ql/MlS5MPbqZk6rdXh+f7axbX+Y+ccgL/it8q8RhvPmb9r5oxk33HC8IDsjD5opvLyiTWnlvFPKKMyn5JeSjXE99XIg4ejZsMCdKlIQ4dOupbl63/OQVFiiksCnjQX7y1i4NsY6o6x+3+n8jVL2Kmt/ydiAxPkFrHthM13nfz+2KrxNRt5vHb0vNMjJ86GRsIUvfDoTCkXJ/3WKLXXOByK5Za5eY436UguXavWW2THOct/uEkm4qg4u5QpHV1ALw2QdHD5VMWKl09RYZhlrmcL8xRxWwlAzawzd1GDDg8QDqLwGveJfnmAsf4vxvkDq6NoulMpqTL8xKAYmIitt2qdqVPYA3UkSecjV5TA7qmgyLBgJ3YctSrU9liOxVUM9jLHRB8tvywMkRgKFaFlCl/XLwQo4cnuy7mj0eFDKlIDH1glifMjeXvRplWje3lINH9g/U/J3IJR0wxPn/J1a71Uh9FyopyZts5x69CO+sWU9Tt68w2imjYoaXFkkKiPDr51IuQ0In1OHH6m3ofnycEstgVkbVaiUR5T4lGjokyD72EuSSSiR0/TcT1z/X7l9Vt7JU+JKgYslZk5zMhRIr2SR+StmdkAYNzanF7qy6lZII60nR98HESYIg210LvoAiFyZf3xDLm3qTsCNOmbrmTYOLTmAQQRKJSI9GlqghUUjExhbgR+Clzie2RHz1TqE3jAGZ4d66MWH1Oyn9d/LcV+bdk5GyZ6SCQqDPTH7M6fIvaywpVN4MXVv/i1065HBjzw+wj9FuhLbc9o2/3peI7Jbbr8Hg3JjCNjFcbQfQFUS+Rw43hRQXw+2yFbQmOgZw3BZUsS81V0u141r9gn/ZVxIt3DKpujeeYqgaWGLZXrS/nF/VHYgUhxTM24t7ocoPJCLAsY7ldv3b9uGHEGJ/uCKEgaeSrrpk7MtHl6f9ed/+t0EwdtfW2NBO2kLWpfsFqGa2xZjb7/P0nknNUmqboN4exeXjZwUBLQkjMKebBgm7BX6DHGKWSaNA84sD6/D61i5ryWxDOMIUfhIgDX1ythiFK0ZaxCymCMYBM5zShrwz6dKAVN5Rn1rbBIiQcj/TeJ4WQCllgAjrDz/h8yUQU5lp62qOFZ7xyaZkjvwwrQjWXZE5kDf9zlmuIxOig2SvhywKrkwCm3pMjDwsj6vBt47yveZzt3CImkeYVqI6fVYZAVJ7LdfL0dPSr9gqNWwriADRjjdXvoQgMjf2tFeqliMzsZtfrthJOUwFG3SU2L8QB6rMdPm5I06wqEUcwEhOOW8j1K2ZkNrVteSQ/DUJO3daCJtZ+cneqa9TEpk9v5JOnDMIfFfYibMymfbb/BFYWHWDgZ2GEZ4mjMfdXtPj1V1dZTHNmDwD/UeUnr85CBpwD+JeIKjKmKuxdcDxqD7d1hgCGah5eENumdf0RCPhrztEQiBXF4i8C1ToiZR8Dwx0lVKWAoaXWyyumfd1Ei4PRPr+XCJJ4Yz/zyv3vfpeAAEAq2Uo+8jrrtls+4pLTUkTfcZyH0tEwx2DXbyghWhjqYrt7me/1uICCjEfbfuUTuDBsOn/jDEuhYL X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d6b0809-ba9a-4a99-7415-08dad694727c 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:49.1702 (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: /aQzKi/A6gJ2RhJTUV4qqocqmjJGjXeXGtWhtO9wSSrluXVfcApjPeqMuyO8+BmGLvRAZyKMFqODNrV9DILrqw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5607 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The parsing of the netlink messages and the validity checks are now performed in br_mdb_config_init() so we can remove br_mdb_parse(). This finally allows us to stop passing netlink attributes deep in the MDB control path and only use the MDB configuration structure. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 93 +++------------------------------------------ 1 file changed, 5 insertions(+), 88 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index cb4fd27f118f..67b6bc7272d3 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -754,73 +754,6 @@ static const struct nla_policy br_mdbe_attrs_pol[MDBE_ATTR_MAX + 1] = { sizeof(struct in6_addr)), }; -static int br_mdb_parse(struct sk_buff *skb, struct nlmsghdr *nlh, - struct net_device **pdev, struct br_mdb_entry **pentry, - struct nlattr **mdb_attrs, struct netlink_ext_ack *extack) -{ - struct net *net = sock_net(skb->sk); - struct br_mdb_entry *entry; - struct br_port_msg *bpm; - struct nlattr *tb[MDBA_SET_ENTRY_MAX+1]; - struct net_device *dev; - int err; - - err = nlmsg_parse_deprecated(nlh, sizeof(*bpm), tb, - MDBA_SET_ENTRY_MAX, NULL, NULL); - if (err < 0) - return err; - - bpm = nlmsg_data(nlh); - if (bpm->ifindex == 0) { - NL_SET_ERR_MSG_MOD(extack, "Invalid bridge ifindex"); - return -EINVAL; - } - - dev = __dev_get_by_index(net, bpm->ifindex); - if (dev == NULL) { - NL_SET_ERR_MSG_MOD(extack, "Bridge device doesn't exist"); - return -ENODEV; - } - - if (!netif_is_bridge_master(dev)) { - NL_SET_ERR_MSG_MOD(extack, "Device is not a bridge"); - return -EOPNOTSUPP; - } - - *pdev = dev; - - if (!tb[MDBA_SET_ENTRY]) { - NL_SET_ERR_MSG_MOD(extack, "Missing MDBA_SET_ENTRY attribute"); - return -EINVAL; - } - if (nla_len(tb[MDBA_SET_ENTRY]) != sizeof(struct br_mdb_entry)) { - NL_SET_ERR_MSG_MOD(extack, "Invalid MDBA_SET_ENTRY attribute length"); - return -EINVAL; - } - - entry = nla_data(tb[MDBA_SET_ENTRY]); - if (!is_valid_mdb_entry(entry, extack)) - return -EINVAL; - *pentry = entry; - - if (tb[MDBA_SET_ENTRY_ATTRS]) { - err = nla_parse_nested(mdb_attrs, MDBE_ATTR_MAX, - tb[MDBA_SET_ENTRY_ATTRS], - br_mdbe_attrs_pol, extack); - if (err) - return err; - if (mdb_attrs[MDBE_ATTR_SOURCE] && - !is_valid_mdb_source(mdb_attrs[MDBE_ATTR_SOURCE], - entry->addr.proto, extack)) - return -EINVAL; - } else { - memset(mdb_attrs, 0, - sizeof(struct nlattr *) * (MDBE_ATTR_MAX + 1)); - } - - return 0; -} - static struct net_bridge_mcast * __br_mdb_choose_context(struct net_bridge *br, const struct br_mdb_entry *entry, @@ -959,7 +892,6 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, } static int __br_mdb_add(struct br_mdb_config *cfg, - struct nlattr **mdb_attrs, struct netlink_ext_ack *extack) { int ret; @@ -1084,23 +1016,16 @@ static int br_mdb_config_init(struct net *net, struct sk_buff *skb, static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, struct netlink_ext_ack *extack) { - struct nlattr *mdb_attrs[MDBE_ATTR_MAX + 1]; struct net *net = sock_net(skb->sk); struct net_bridge_vlan_group *vg; - struct br_mdb_entry *entry; struct net_bridge_vlan *v; struct br_mdb_config cfg; - struct net_device *dev; int err; err = br_mdb_config_init(net, skb, nlh, &cfg, extack); if (err) return err; - err = br_mdb_parse(skb, nlh, &dev, &entry, mdb_attrs, extack); - if (err < 0) - return err; - if (cfg.p) { if (cfg.p->state == BR_STATE_DISABLED && cfg.entry->state != MDB_PERMANENT) { NL_SET_ERR_MSG_MOD(extack, "Port is in disabled state and entry is not permanent"); @@ -1118,19 +1043,18 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, 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); + err = __br_mdb_add(&cfg, extack); if (err) break; } } else { - err = __br_mdb_add(&cfg, mdb_attrs, extack); + err = __br_mdb_add(&cfg, extack); } return err; } -static int __br_mdb_del(struct br_mdb_config *cfg, - struct nlattr **mdb_attrs) +static int __br_mdb_del(struct br_mdb_config *cfg) { struct br_mdb_entry *entry = cfg->entry; struct net_bridge *br = cfg->br; @@ -1174,23 +1098,16 @@ static int __br_mdb_del(struct br_mdb_config *cfg, static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, struct netlink_ext_ack *extack) { - struct nlattr *mdb_attrs[MDBE_ATTR_MAX + 1]; struct net *net = sock_net(skb->sk); struct net_bridge_vlan_group *vg; - struct br_mdb_entry *entry; struct net_bridge_vlan *v; struct br_mdb_config cfg; - struct net_device *dev; int err; err = br_mdb_config_init(net, skb, nlh, &cfg, extack); if (err) return err; - err = br_mdb_parse(skb, nlh, &dev, &entry, mdb_attrs, extack); - if (err < 0) - return err; - if (cfg.p) vg = nbp_vlan_group(cfg.p); else @@ -1203,10 +1120,10 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, 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); + err = __br_mdb_del(&cfg); } } else { - err = __br_mdb_del(&cfg, mdb_attrs); + err = __br_mdb_del(&cfg); } return err; From patchwork Mon Dec 5 07:42:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13064231 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 40CC9C47088 for ; Mon, 5 Dec 2022 07:44:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231725AbiLEHoO (ORCPT ); Mon, 5 Dec 2022 02:44:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231812AbiLEHn6 (ORCPT ); Mon, 5 Dec 2022 02:43:58 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2058.outbound.protection.outlook.com [40.107.100.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5FF112761 for ; Sun, 4 Dec 2022 23:43:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PbVTTZMwVE+BC6BDGvPTezAyV1vCizNSXZKEKkpXEXPlSTyUaREtC7PMEB6yylZAMwzSlpijc715p1YpqA0drRQC2MtEt9/ojPWPejAIngNnKo7c3OlNGuRKlb9lUypHAAy6yJ2OZoBi5rwb6kxFZ0JM0jY16YaliB8FPo+XYBSXGyXV+KB+BmNSoKY+I9mLqSyBOzjc55mzCZmQtHl/CHPXdgHX03Va4RyLVkNjZEWbmWfwDs0NuwLZ8xTsA3ysgF0kF+Vg0fR7//NqIzKC9eEv0hNMohbj4rGAL4vxZWTD/oBsDTCImFaigRYbSXwYi8xlQGF8ciIa4V5Kjs2MqA== 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=4GfMsVv6H7/hWq1qWkAPKSCxsToaIVqZEZ1kBwsImrQ=; b=UtppfDXnUf20XjLPjAYVHbg1H4jlmELVO1BrLgoLF8If9DaQORodKSUlI1+IjqIarOHqRgOhQoKSZAzbgXkLbhqlQjar43SjNAIbhiNtPQ1yeCclAme41hWbdDDgDt8KMirjNRn2MeXLWh66l3iEKXY1t8eGy4pMgOd9qKgY1/1rXHLkAdUwbdoP45Ox+fnWZT9R1k6VbFgthyYY3nj+zhJXFA++IjRFQ9/6Ew9fjCoF608ZI9pe1STnXKCeS3bqHSH8lq7THWXnhvXFBYsSaB4uGdCv7Kv7eRIPw++yTh2f/5/q7PKWWueET1izA8AlpfZTxJLhBAwF7tHnMQXrFA== 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=4GfMsVv6H7/hWq1qWkAPKSCxsToaIVqZEZ1kBwsImrQ=; b=PhYRMTQovditbP548tRdVDJzY2e8EfqMG4uh6SqYYJIvBwSvJ13gXMtW4cj7IBSGdssDSrzkYDpc3vzxRKdw75Vkp/IHc4Jhbuxs6+ZvefYGo4pRVsa3psv+zZS1oHXUbDEQqy9D9szTBU+fv0JfbtkTnx1yTr22u8sTlYtBBfKTWvlcguEoI2NpwDOEsFm2+Zt4xyhz4NdS117u9CwpXwiHaQHJbN60elA5RnaZAKlz6n8gn4Dbfz6h7jQ88I6ja0KG4NEPsZ39ZvKwOAQ+NlhBghg1QqRaek3zlwtgEPeBbjkyOoNsarMms6GFC0nSL2nYAUFxIwmRyZLwUubtdQ== 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:54 +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:54 +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 7/8] bridge: mcast: Move checks out of critical section Date: Mon, 5 Dec 2022 09:42:50 +0200 Message-Id: <20221205074251.4049275-8-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: LO4P123CA0665.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:316::16) 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: 35501c3e-c0e4-4e07-990f-08dad6947570 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nt07XgihbKDemplfvr9wS3mcy0wEWqkdN4gnXrwh12QKmuSfj+6kYB8+oTepFMvijrQQy5P4Tm1rVYzQ2uO7wYhmjgSwLP0pKAxwxxw7T+xiIPuXDSqNl9EA1XZexcjzYhoOaN0sg5Cvi5cp0bPLfDXiJseGnUQl5PkyCtU3zq7L65ouroHthG0Fr16Ut/PipVL0rA5ZW3Zuc6kx07le+yLiW+KFkcQrYfeEg+5kN4gpHFNGfPp0g6isTUriZ4hT0Mq0V2xt9CL4PORneomObnqog/pSzt82ecTU3gR4tZ+Sr/nxF61E5MiQ7HTlclfzbYo0pYDhVN+HdeOyySwoDc3Qq5eRK841wYcccxKoDBtjzHkfa8h1vS9KMzmLp/HIw2sdXzGkEQETl/MGiYm3UG8jWdPWG5vCK50rBrUQPeQc/iWdXz4skk072AJ/FDTKKE8rim/TULyDo30cVyabcZ9xi4F4/KqhO9bdsY67CaUsl8+qVHLBlOOPx8twoG2Y9wsBQF2Y62s5I4K/xdPNt7+FGgs9h126ip5Mr6p5GcCzmw8acdhD0eLeS7+qu59Y6phsXnXSGp7wpbek/Z8NG9HTsRcPikguzrOu1zdzVsraai7vAZqtIljdO4mAycjk35dS+Bnpbl3qliUkgTjgrg== 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)(6666004)(107886003)(1076003)(186003)(6506007)(26005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ftUODylGs56QBBkugPuGpby52ixzhR1UaTlkyf6/2z5bItDig6aWJQZ3MEF7rjfQHqBczvAxMREsS0iy7K0D7Ylc5SnqT3SF2xLTGEN9fn81Q/Pon8iqe1/JoFRAIIKTAcBGok04LjohFoXjpLeMuK6rFiq4tX9/O5kGn0xENZJkquTZ8mnMT19YJ02VYmfO6iPtTYdbgX3+XJgYzkF7+gg6PyOMo/FMIzdYfb4FPL2941ynSbTNnJkqJ6il5cyLmTwu23niliX9LpMwDpWnFdVKiRl70nHmvnruUz4hkR7YiXUGPjvwu4TGxo7Drl1DXDhOIY/giKB4HYxYljnERGiPHh6I/f4wD0XFKe5t5j2s8C8I9KdM51c8SUW1p86QcMxxJqvzHd9sVANpPNI5nw0JLPzO45XYMHypKSrx5pVvmKzD/uZwjBxydRlAhDvOYkeZR52cYeUPrRvE25igzv3cbQsQ0iIkj/8M4bWKeW2yDOCkiNa63kJ99fppBABTAvsgdU/TonZj1V/i4WVxX3H4HTnTjhbL92z/T0A/z8s51DjIMVYb08Mp6KoBq/qHV0DuVfplI8rSe8wa7Pg2wHkWX1ib2xmkWMDBls50OMOPEAUPlrlADgP2ZajXiiraiBVGKfW4dby/Qbk8d8OdRPUFPH5xJKO3lix6kY7FSWv3+Iaj/OYEs63Fh15IerJ/IdsocD/xsX4VHnG7doxg0SCUybGw/1QzpZfWgO348j9Omu6Mz4jS6TUMkZ4lEkwLvLU5kZS58vn7CSbeNwOgq+OAbUasrRk0RnuoECdttQLMkTdslZH3MWtrPk6YOsKWVzeFgplc4umA4y9D7e3KaNYZT9WvpwjVGbGRiGN3BhztEtfT15+37tpTOchK1gB9z/V1qg8InX7rjIq1eDWMSD76BUoJq6dNTOzAaPC/eNjLh2G22c5Pe/F9it/y/YKAg1RaOh824FxK1mC1QBt8SrvOtB1BxwlPqwZXW1VAoPcEPCj+9eMBw2dRqoFC9N7W7Sr4iyk1EBIjc4Os1JOgpHIZxFZXOEr7vWRd5K5pnTAZy+nPoOoYlx76r52/JLJL0FZcHiOEBTIq2eMskxUdvOl+OBQmj+N/IjuRHHYczvwHsSq8BcSLtpqxS5dAUX0qWq/PytqQZ4djZw7gCxGNhz3so/ooWpla1pgPAsvHP9qMRrEFEzZdGKTGbs6dDog7csAqcdgMYlIuoYtCagcMxVfr5vq/H8f/yZ10+If20wrOw7N24NEO50j1/aB7VhO6cS3CFBjcP4sI2k1WXHnvxjzmRZr8bH26vmD4AIT5dQNijTLzotUB7Zz3O4E085AXCjwcGAdYHg1nfCcMhc02ve9+xhsXAiNW6d8tL8NoqPT9nM0h+zXlGLLCT99PwUhj6MN+9YM97u6HIO/zoDsxr3E0T3ayUfo1NFX85YOp5iyQ9esBXaAlkEpoCWThyzafW803VfgjghXd1csvvhk7Bpy/UvdU9aMGgVgEUae8L7CyrPIPa+hXd430LzWGpfACIswtvXTqYkILCIJ3wkrKdKj7Z142xJtWM10wORP2GfYRrY7PIe8nb77j0yBzzWT6 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35501c3e-c0e4-4e07-990f-08dad6947570 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:54.1414 (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: ZBBRiv1RaV+1VfcWas7veRssrkHudn0cJ4uWj6rf23krkLcHJpyb65BlmI2qGVyO6wa8zaae6JgYK5RK9X/3hQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5607 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The checks only require information parsed from the RTM_NEWMDB netlink message and do not rely on any state stored in the bridge driver. Therefore, there is no need to perform the checks in the critical section under the multicast lock. Move the checks out of the critical section. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index 67b6bc7272d3..aa5faccf09f8 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -805,24 +805,6 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, if (!brmctx) return -EINVAL; - /* host join errors which can happen before creating the group */ - if (!port && !br_group_is_l2(&group)) { - /* don't allow any flags for host-joined IP groups */ - if (entry->state) { - NL_SET_ERR_MSG_MOD(extack, "Flags are not allowed for host groups"); - return -EINVAL; - } - if (!br_multicast_is_star_g(&group)) { - NL_SET_ERR_MSG_MOD(extack, "Groups with sources cannot be manually host joined"); - return -EINVAL; - } - } - - if (br_group_is_l2(&group) && entry->state != MDB_PERMANENT) { - NL_SET_ERR_MSG_MOD(extack, "Only permanent L2 entries allowed"); - return -EINVAL; - } - mp = br_multicast_new_group(br, &group); if (IS_ERR(mp)) return PTR_ERR(mp); @@ -1026,6 +1008,24 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, if (err) return err; + /* host join errors which can happen before creating the group */ + if (!cfg.p && !br_group_is_l2(&cfg.group)) { + /* don't allow any flags for host-joined IP groups */ + if (cfg.entry->state) { + NL_SET_ERR_MSG_MOD(extack, "Flags are not allowed for host groups"); + return -EINVAL; + } + if (!br_multicast_is_star_g(&cfg.group)) { + NL_SET_ERR_MSG_MOD(extack, "Groups with sources cannot be manually host joined"); + return -EINVAL; + } + } + + if (br_group_is_l2(&cfg.group) && cfg.entry->state != MDB_PERMANENT) { + NL_SET_ERR_MSG_MOD(extack, "Only permanent L2 entries allowed"); + return -EINVAL; + } + if (cfg.p) { if (cfg.p->state == BR_STATE_DISABLED && cfg.entry->state != MDB_PERMANENT) { NL_SET_ERR_MSG_MOD(extack, "Port is in disabled state and entry is not permanent"); From patchwork Mon Dec 5 07:42:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13064232 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 4A551C4321E for ; Mon, 5 Dec 2022 07:44:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231728AbiLEHoP (ORCPT ); Mon, 5 Dec 2022 02:44:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231787AbiLEHoC (ORCPT ); Mon, 5 Dec 2022 02:44:02 -0500 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 25D8513F22 for ; Sun, 4 Dec 2022 23:44:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cRxXVZGQJzG90bkOtPwKSTLFQoGAUJQI0NO2zUg4tpYi79jgDn5/eS4mrS1PLoqzf8/NvOYLcpedJVR+HNUVKzpMLT8wLdPdyJXljJ1j4CTe0nLFszxADXQUNV7EWwg3TeNqpKdvKPVGXbzh9F7e3c75aK24oYgNfBOqD0i3gv6oX1NuDzOX5NOUSCWf5bwuQpLkUeemNTiEJJcJ58zi5a5OL5de308yfjFzX6dTrr6IMu51n1laq/4VLkP7DitSMsihcq8tPStwEc6j/UpuUASQBXlzrJETJnQs7wJk+mAuLdHn6kJJgqvu5Ebr6sHny6tWm4l18232Ftwcgv4h1w== 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=+ETmXry3f+7bWBnHi7TJsQfqt3JBJsRP1p6vLGxiN1E=; b=N7lfwZJZKKYzLtHHgoBC9/pvk6fztP7uowH1TElWj31AhzOFxeMddyuA2RlGEnXkfe8s0QMeOBmFC0eyvwK44EstVq387zQJ8jNJhoa0JVJ4LNcSnVlkMU2JLG08oekywUmbn+IRKBjW3hmFWeSHEtvUZp7IJo9QilMoqNuHUKUTwQRB+uL2cwnA7BgQRgQLzV09lHu3zQnhRVu70zOk3mgGDuNx/iiNOioqfSkwANVVfcEYUt4hKYcc57ZzQY7dhWdOvCVJzOLxxYT7/8/hIgoD8JLNZLed85anCzFMYHXwJg9aH1IFKz2A/7dwYkThEbHLzwqdBqB5sr/j3c3uUw== 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=+ETmXry3f+7bWBnHi7TJsQfqt3JBJsRP1p6vLGxiN1E=; b=dmS3GNK7EyH+j7/ElNVBl6befusVxEimB/SUfZxBeX1GhAAB50DdqA5nFIhMz0f7jh/Ahm2fb1RzEo/X9AEslDyX/s7KSuENJmlhcykksrKGvtxLM2CN5JT3KDgBWK66Mg/QWXXO/Xs3M40h0f0RELUsj1xt613jQ+WBZ7nvQExrGs+hfI92N2XRRuRrX/RZ9OTYdObWPhmMQeiqALxUVeQKQGKWdWbfLI0Eh3NVRASPu4N3UNLiZwT7m1egVOyJnvg7k0JpNTnYdRy6LghhXOOV4RgOj51EhyowgWkYXf3vqV/Ltf9Cgx7nSi2mCPNqt3wZRFccu3NcGp34Tch53w== 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:59 +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:59 +0000 From: Ido Schimmel To: netdev@vger.kernel.org, bridge@lists.linux-foundation.org Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, roopa@nvidia.com, razor@blackwall.org, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 8/8] bridge: mcast: Remove redundant function arguments Date: Mon, 5 Dec 2022 09:42:51 +0200 Message-Id: <20221205074251.4049275-9-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: LO4P265CA0068.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2af::22) 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: ace697e3-097d-4f9c-0544-08dad69478b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CaS8e8RvFwp4mVjJorgcMuL8lArsft+qvPhCKBnxk/OYovRH5DAsGEZ94p3XDmw8Qi1wuHrrVB3nI5L7Y44CW5crhLsH+G/6nFYC9wH/6ZEw3AQGFoc/Kz/bT/Cbi5yLSleplo4QpmFxe8f4GNqUhGWG1hyMI6FrcMzV+sovwfVhJYqN1/wEhFL0/LivXgJrI6eyeXUXgPmRQH2CZM4TmQhVH9badbsqRcK5oZt3nJrlUqdOaqJc/vzsvC8khFq+hQ7OQ7xTEPVaXob6o11QsfMGkmJZMrGry2Xoia5JbkHx/e2wHHG624vvxPGlXAgz1FgoxnYNHIloXkq0kj5a33jPqYWzSN1E8ZgN329LZoefSw12ETQMZJSxZvanoyoFoCtkJ4qIoJOhMorshqGK6KsJHqiKjxwqDXF0BzpX3k9WKy2l5y1/bMwEMBw2MExpCNsSzIAC/L/aGhNC2+Fsx5ROYaBKggOJMoTgdEJbG3s450O54vSQZ3IYLTjtag6WCyZ871jmA7onrb6BBqDa/k2hprVb6jIM0pu8WqKHNQVvRrCbMqFp2Hg9usmef+HRnlfcImzUHcm0FQJR8die70q4E8A6nitcAlXto98MZl+gEszju5miGx95OHJrIffP0ehQrwomjID2A+3RyygM+w== 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)(6666004)(107886003)(1076003)(186003)(6506007)(26005)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xT9wDPHm5VZSZhg6rmMyRcf2ZozOroRxLRqeRhyl/kxcncQZPE7E5z7DQRLYIKbur5074Vyv4hNmnD7A0Teh7PkEtE731O/+OwF5ShkP3G/neFdlDp5LsyOmoHVLG0eNx8kNJlHU3y7AfD/ywKbHqm+hOuUxrV8KC0yQQqIrjWPrrgmqdN4SVvZi9gv0IDzYfKtwDkF9des4W6GgAklR7IrUkjoDxTqhVQ5BqXTJprBgF0dOyIsBNY8JZElMATln/TJmpoSo4D/H5MGyAap19WZw0H14j2xeMtbF/stg6Ha0z5hSp848hI9GS0b6g0E9XBVNxHGP+uGrLiYDwnuKyynxG8fud3cDfVBppkPvItzDHLAL4F11s8i2/bYUtEUX+ySui/OiRgSekrYK1sI6NhmSk+2aeOcviMCnAByPiomvHKj4ZiqtWuSmquS6rIMy1iT4RHO8tC5g05LyCUN6EA1cpWVmFqEmaMrrKkCT1/09OJQAOG2/fVlveKy9TPqkIgoOXCXDTS0nx696XyL3O6uA+J0/7mk2e7TCC9QSqz2iBcEv18Y6pgmAilaErRCl64JYtw+0Jk5fYDzIQtgj0OoiQzdRkq6VWWmk6wb5sMOV40CujA0EIzVch5bCVRC9QOmgm0xSzQcnvqrNkX8maBcXYuqWpSHT+95BTBtXTOkyMXiKyhcpYrESaPtkXTdoPY9x7C5bK4ruYj2HBe3PD7sb1oe2yA11ySxN4CJuYD1HTr1DGRTaCxrOlrzBkWN4sEqVX9x5xh31PlkDNQFRHXcvGQSSmm9kdbDZKoVGMHR4mlxRRdPeXc6iPAu8NpzpzgwWohzsKRMwYCcnkmPfUwDPku2BuGnS7JXL4F7TMS6+KeE5z2ad1k7lie8zhiA//RjG4UO9zIuhmqb0lMSCR9PV05agJcMcKycBRZ7qMnUGxeQkeS1ykYZ8qMpWIA5nDiKPxJx3jjrMtGYuGBq4ymNsHMojymfkDWpLQnmuL10OagYASupvCd6oILuM+6G9IIz4pDIh+XNpwbOqQWmY4YTeQ1Fxy5XAl13HS6RDhq+4irALo3Y4K5XQlJMfMf8JHLDbXP40Yqt5tvv06DBSjSHGXFxrHbwIItdEOqZ1k0FB9JUEAO3Oa8+8v5V6rpl4G3V3Jq/42EpQ++H1emcZjq/EeASJaspwghE/odeI2ZEBXdfSOPmya3yvgNL4D9u8q8NJbalMWFfS+P1wC27B31eG7Y298WZegNWhmqiqNCAieMuWujukhP/NGlbotTuaW9emCqesdNEPCY8X5HjkO7a3FSFCrnwf5fzv+Sj7qEP+hHkImFm4NeFx2ifH6PERAXMIJ3Sqroyt1xbEFPHWvKqaf/ka28WGrJMGtkTOPmKotSH5udkB2COKwf9SaQYEk8wCnLnH1xWWeOZg3lkBh+HPhfSgWnXBX4UTq6qbdk4xl0iEjX2NKoSoneb7VgMJMh1BSspDI1gpQ3t8kwWwueYONOax1qO6qhYNpvE8WlLB83z6wQgDwGaf7Ed1cz9uDx8Sj8BweC9aNu4mKsi9PQyydmnQqbG2k8bJI7cS0m7fHZ+WUUqTJ81sHbcphP7i X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ace697e3-097d-4f9c-0544-08dad69478b3 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:59.6110 (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: tRNg66xDxIRdiJ+8cbnl4re7G3Es58IjpJUaDiBHexRzbhNSyBzQujQk4ZqCIcOLPHj781mQvsfKaInCEBWlyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5607 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Drop the first three arguments and instead extract them from the MDB configuration structure. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- net/bridge/br_mdb.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c index aa5faccf09f8..850a04177c91 100644 --- a/net/bridge/br_mdb.c +++ b/net/bridge/br_mdb.c @@ -786,13 +786,14 @@ __br_mdb_choose_context(struct net_bridge *br, return brmctx; } -static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, - struct br_mdb_entry *entry, - struct br_mdb_config *cfg, +static int br_mdb_add_group(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 br_mdb_entry *entry = cfg->entry; + struct net_bridge_port *port = cfg->p; + struct net_bridge *br = cfg->br; struct net_bridge_port_group *p; struct net_bridge_mcast *brmctx; struct br_ip group = cfg->group; @@ -879,7 +880,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, cfg, extack); + ret = br_mdb_add_group(cfg, extack); spin_unlock_bh(&cfg->br->multicast_lock); return ret;