From patchwork Tue Dec 6 10:58:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13065671 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 01AA3C352A1 for ; Tue, 6 Dec 2022 10:59:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234428AbiLFK7C (ORCPT ); Tue, 6 Dec 2022 05:59:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234126AbiLFK6o (ORCPT ); Tue, 6 Dec 2022 05:58:44 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2F052228C for ; Tue, 6 Dec 2022 02:58:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bl+krcfwEhjiUcWfzpqvP7MPC7h+8ydbseVakV4aiX3WzRYCmDzaGw+uHc6FYrA79O6JBd9hY4VNDU6iKL8NMmN3x/wQ3BtO75UUkMq4PGebT2WlBk+VrYCiOjf3sZ182kV4B/7oQuwT4a9VMYKtxYFAujusC5n52Odbvc09DBhTWYNhU4EnKP9mfXg7nVzip4CNNZKv2gcDUo7smGxNqC8ePPs2Lo2xnO1YMdnrVrYDaX5+8dhvRuUAFebpn7xK9dsIMQLo+oacjspbHyKCnjZmgAX6/0umAW7DiaImAWLXO//Oner9yLbu9xUR0VlH/lRdldX5w41M6V+LsmK2Qw== 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=AhzMinsOnZIvpFDMO8yvvMa57KGkV5CNRbqbQ+fgRsY=; b=kPCGWYaVeQlWfGFMII+g5/9kZG9bBj4au0IERrZW9o7IZ/iCYem1VNOfvEOXSxGYPbN1+mFUbUenGA33MQmccca4Rpzn2D/d0YTkJl95rQOG0VLr/vu2ROQZHdZjlsVTESQSgv2P+Vel+0YYu2ECQ9vU7BVM/VPnho1toofQUi9WhhNy4zEhkXEmd7GMOban1TkJk2rK2etU0yiVHMY/M3gLwWA4CfHCM+X+AQzFRcuPC8gPUj1Ihrz0SMxCYSEpgsaY3aoveleSM68oWtC68xE9iNbhU5b3C1t2Uea0GSJWQ3y4EYyKO2Vx/G7egdDb3sm0jxR+48iI2YX43pAGHw== 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=AhzMinsOnZIvpFDMO8yvvMa57KGkV5CNRbqbQ+fgRsY=; b=fE8FaS+zZvwAi+9vBXMQtY3ow60gh+Gb2RMTkbOCvWLSLTCFVQ/tQ7VRa4NGB9SRs/NkNJhZHLZBidYZ4kd13p2gus8ZdvRya/JluZWKrXYb8jMU4Hbk86kfI7Uxp0/u42mULUB6KZu9k9jKyE7ZNOy14Hryk6VU6+slEaA+QsjKULX9aVpK8mliN5BbjQg5fqGZxegZ1b7Mn3OOIaBcVUNj3RApbeJCSKo7c1r/rvthRQT7WlHVurkyIETNjVOj6jzrQz0MgO5HG5ezVVFJGTVllUPb+hIJr6H1n58HcJFD8G6wNdteJqn2X/bWVDpaPybSq4947JkjSgBQ7PcR2A== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by CY8PR12MB7100.namprd12.prod.outlook.com (2603:10b6:930:60::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.13; Tue, 6 Dec 2022 10:58:42 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a%3]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 10:58:42 +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 v2 1/9] bridge: mcast: Centralize netlink attribute parsing Date: Tue, 6 Dec 2022 12:58:01 +0200 Message-Id: <20221206105809.363767-2-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221206105809.363767-1-idosch@nvidia.com> References: <20221206105809.363767-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR0701CA0033.eurprd07.prod.outlook.com (2603:10a6:800:90::19) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|CY8PR12MB7100:EE_ X-MS-Office365-Filtering-Correlation-Id: 381a5683-41ab-487e-5b6d-08dad778d649 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qQKPLDl7T7XaNhrO/2AS22ctBV2V2YTLQSyrArVcm1c/8RYgZ0potZlcfWJrdT4xtsgjzr0vlFbnLnh5fmEUp1P9b0/p2+54JE7jmxsMALMUwPDZLRgvKwdbNo6qDGRjDSbs5DK0EDGOWGzFg/y0RFkz9/IJWquT86E7OYG08cXCyA3p11j/OwNgOTXdfOd/25FgTOB+NbVMzXTKYEVgiL7/OGb2XGYAzfhPJGYyhC69ttnkcshKgoI6AJ2JgUWVTWTB5TgUppTvZZHS7O7EI/npB0///JaJvLiyGQJBM87nD5jBW/zP6aRQZ9vQalPb/U1rWWQQZ5m35IOvmSGnBl96Ez8cXcwN0tgfx6wRFw3+6u8oEWqqe9ww6yoR/xj1ZiUDLcQ+Nh6/jFQI2zJ+qg2fqrSCdLFu7MuiBey1zIgWPmp4sRJMMvCcpDRUSjG4yYWMu88d/28mwGymRAw5YbIxcuHuHjBYJKhw+TGGQztdEwaFmq6WPPwKwkiWWfEUMPhIme8st317SM93PWiXc37PwnQ80lnosw/74SR7vdESJf81yOVSkoutSeBuBOabLdSXd2Mqidd4gHqhZsSD/NEtEAf8oA51xGrT0CncscseCidEFxhhTFiG2bymVdKgnTPoCNTGp521uR1ZiaWNDg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(376002)(136003)(396003)(346002)(366004)(451199015)(1076003)(83380400001)(186003)(26005)(6512007)(2616005)(6506007)(6666004)(107886003)(66476007)(478600001)(38100700002)(6486002)(41300700001)(2906002)(316002)(66556008)(66946007)(8676002)(4326008)(8936002)(36756003)(86362001)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: APgu/i56kM8/WIR+cMS5QKOZwjspfXj6g6H4Pf3tsl4IZJh/2rX6F0d+n14DSvk41LAgXLxThjG6Th3tkGGemICADC0i+deOS2KDoNVRcBcABLZe2uAB29vVUkthGuMysM7/Rm9nBc2dUtVHAkdf1b1o0iKy2mGJ3lPnYovdCUjTb8ICYBE/ZV8U5HEOG97nr8EJLHygUqeBhRbW+DHy+/cpfWWUsHVKc4mLvtP/Ul0m+JvXCb1xZhH2/jFiA130jYe3pQXf6hHBILAmSrQhgVjyvNbd+FnhE7qB8ns5Wja/eXPTX7mFhjTK5qLSSikXrcG0YXU8K4hsimgnt0avx26rg2RE8vWoIN/SMkUrEZ/HDQ/i2vN2QUsVV0Nl2htppap0g+zyUOniB+qz1PWt0VfTiubR6v0Qf2395pGzSK5qlD/2vtNyQ1/hknWuCd40lRFV7aBbOBGyed6O4e80wRyIl6E35IZ21oTMAlB4bagrMrQgWBF7ebwMDtrP7KLN3iXTSnmh8oO0O4zvo0OjHvdRt5Su9nrQsiP6xVa6NC5OOzsNi5FicsjTsl9TzOmAX4VVw7z+IBzK9b8SJpIVC0irG/oOIqVtZpHZwYIweWLt4WrFZ7/bXDV7XCAZ/NABM/lt3jWdlHo2nLFtoBQiweXe/YX0dMAjfyBvaVMEZWQ/l2bK/xHXiIXDEZoqMPtq41iyTEzTpWTCeJ2CYGkHIzOQNHS7VNzhaGU8zdySpzlVk/AVFBnarwro178/mWHVv8NI4OJ5ZkhfeYQ8owieNpYdXZb8/Jdb3a+gpfRkXtkvODW55n9apVkv3t+8+EVXjVcau5XPUuJSLGLm5ynsv10jMhpcTAelBRkD9cqq43i64pFAk5FfQCJwo2O4fwD0txH+87iGKtgwndJKLF379I4GEVABZ/hGbDlTEZa25TFVRFiknQDwH4OQ3zcAfEctXdX8dPpDUhh5jXYKo8T9sTSAGkaeIaqbPzklvE7hQI0y22i0djvWccEObgwZ05P3BbWob3Jzu7pwEyUH5IWgNMT4yF/wBDJMB4MXqtW5qPip6xjkmu33v5ZowG91V8evzMMbzWxwKi9KmioK7BjvWJh55g/EHBkJ+fwzVfwZAW7hL9dcMp4Tj4J9B8sefYhdxVKW2eApzUt5MxVPvCT7uvJNRI+yhFqvgym5CykPbd1eyeQW+jBnSVozroxl5n9uh2+c4QEmmxvidKHafUlGc+5SvSyX4GJkB9tMSQw/xxQYGF43YomxBItlCN7kiZemRHYGE/B+FU2pDdLj1QtszsmMcJivygUv1ChSP5JLnfRCMlVnz0ATS1rSzhm55wsobhK9znTYorOxqGYXSgQ0ob5XrK4UNEB1cwLRZf8B8GvBMMJAx7ry6rgMcNm3/hiIg7yzbDaJGqngu+Ni5ttWTedd1a1ocu+ez9Lk8UwHTj6l9E/Zf6LSYxfe7Tt+ax/reZWNlJJG7vLOwvZNUy+KHOJi1RQX9TUhFDoN7XuSHm1xV+pQ8JjZMmxZtrZW5Zby4wTEve9rNdCRpSMxIkmj6Q8r28mEiIO17ENQj4vblo8kF/Do0+dsIo+Qk5iSTVfZ X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 381a5683-41ab-487e-5b6d-08dad778d649 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 10:58:41.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: PavCYhmKsJY1P9ZRqQAEkLPngzndGqsaXVE6SpAExGT3AMdxBRQhtDKrLR9eLQUza/dDqrW8pVFY5NguKIACMA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7100 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 Acked-by: Nikolay Aleksandrov --- Notes: v2: * Remove 'skb' argument from br_mdb_config_init() * Mark 'nlh' argument as 'const'. 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..bd3a7d881d52 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, const 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, 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, 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 Tue Dec 6 10:58:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13065672 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 6A09CC352A1 for ; Tue, 6 Dec 2022 10:59:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234595AbiLFK7E (ORCPT ); Tue, 6 Dec 2022 05:59:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232198AbiLFK6w (ORCPT ); Tue, 6 Dec 2022 05:58:52 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C025A2182A for ; Tue, 6 Dec 2022 02:58:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IP67N64BCYed8aNxnd3Eqd9br8CKm0iQOpNWZUC9rWDWvQRG9/8gMypEkikk0xiIJs8Q0CyAJ6m8nPgUaGPv1pm+kqUoHA4so2ngYxf3xfd8ZIx8yTcA3jw70Kdx+LPrn5MBKmyRgyjPVxVET+L3DcZo+NjfCmMiZtDq3DYVF9HDNGgKG0NcYpJWW0my12zyiS2xsTJxgXm7BfX80nZNHpFjD+f+c0oDmiKCzNmXpW1zOP1idx/XYiY1/BS99yUNPp7+IAzZgdy4+amHDBSpNK0yvLbiUgiL43K2DyDWpYZEX9AU/smWk3wqMhqqLgKzc1qgOy1PD6iuPg4eQsk8eA== 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=ZFRA7drTZfsote0ZE6CeV4KnGMyG1D7ae+0TshoiI18=; b=eJZ0GOT9i5gUJjFKY4RJumm2KVoWxP8JFDzO+vBu/DToFeMXUhxiCm9LmqmbYfKu1bKwVfbSMHwBLF01dgsv9yJWDgiW4zwxAI5v96Y3docppFsmaoaTSbfwa9N79FaUmDxz/VgXC8Cp26xSTilcb9jD5Ihdhtizs2C2cJ8ZLWyO5GL93BDa4iepwnRyX5AWa30BlAilrF5QEagAda9FW1OKPgI7C57BTK6VDVZ6O5NYMiMhrN3mHt/vkDMERKLoMMz0Wz0oyhwBJbVVs2R2GOUa5vLw9MaqGqw9ty3Ap/VnY5R2o/79O80sa31lSEXQc5Ps1RgvVINrEy0NRL868A== 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=ZFRA7drTZfsote0ZE6CeV4KnGMyG1D7ae+0TshoiI18=; b=GjEFELGixzPF7pu4KFTgOLQxiNpVPSUBaYBGtSIut+tCNrsK3GNjLyEEvWc705clDClzpx/4zYZaT4jCCgs6Xd5ACs+W/LzXwXFFMJFppyp+mBqi3YhFwM/fwL4NNO06WRZUN7yUpvO9q816V39hc8Mu1AisYCS83lXKxaWS+nDT12rF0I1w4Jtj4FgPndpivdPdS7SY0fv7LPBH6FWi43pNCFQN0f60rj2PcUGGTqUURe9E6L60UAcwJGmUPMBcPCfiv6XdugnDUCVHhoRMpTZHy1sUIYspBpSdqJ5jaNyesCMzeXQRpqn5B7dQnpIVmop/dT8VeJKxSZ2X6v3BYQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by CY8PR12MB7100.namprd12.prod.outlook.com (2603:10b6:930:60::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.13; Tue, 6 Dec 2022 10:58:49 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a%3]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 10:58: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 v2 2/9] bridge: mcast: Remove redundant checks Date: Tue, 6 Dec 2022 12:58:02 +0200 Message-Id: <20221206105809.363767-3-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221206105809.363767-1-idosch@nvidia.com> References: <20221206105809.363767-1-idosch@nvidia.com> X-ClientProxiedBy: VE1PR03CA0012.eurprd03.prod.outlook.com (2603:10a6:802:a0::24) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|CY8PR12MB7100:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c231937-1d7c-4597-5252-08dad778dab1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fsp37Y1p7THTJGJoyLTcOJ9mj6L66Ry/rRTcRcygT2OCpxZI/mhKSIwamO8nPv6lqm9DxMq904wtAiBQgMNgt4iubbWO3JDgz1HqY01O/JfA6pZe++RIfD2i7xEf0oq1F+YIj4EV9nhGDP074u/ItyD90zs8tcdXPNq7K/rVn6FYLc489+U2VqnT6AcOYbz2xyprNTO0AZRW/IilZVfh9WXXYog8jYK6oY+Vz9mubi8m2j4oMqfHl66iN1/egxfKxlkAjl8/guNRdtH2rFKk61Ylx6gMpPwkbzh8Dea17oZOsqTrOqioBV69Y1RMZYY6kHk3WBP+sbABiKJWnNOEu+oQV+34bMkK0Mkc8M+xeE6LePTJAunp9rnQIsf1SdjLXJI1TL0IhBR+A7sl/vkNHxgi3I5vyhh0aJqhxPCyJVTHXFwwn1rjQGuSbhWu2ZQ3dx8y6St6krhZZ/ll6HxoJswkm3UgDhc41g+5nZzSG1hit7aQ3i72UZsyNOP3R6GIaHUXwhAmWhBzXQFElFFrWuv9dDtHReYMlP9ZkPZGKg2jAzFrb8jw+VligxdEP+FsXz1iIUVXEzQxHutSEstWWA4F4cG8jSOmq2m+ByzJu+7YykQ+DPZPROu0PQsHYFU/rTt9Gmv/rQvIHgyHL/JuoQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(376002)(136003)(396003)(346002)(366004)(451199015)(1076003)(83380400001)(186003)(26005)(6512007)(2616005)(6506007)(6666004)(107886003)(66476007)(478600001)(38100700002)(6486002)(41300700001)(2906002)(316002)(66556008)(66946007)(8676002)(4326008)(8936002)(36756003)(86362001)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ey8i8aklpNeh0oW73fHNNGidtH6MzduC/U7xUW8J9biiYtBnUQAnPujSuwaiqNTytypSlRz8KHMozAborv4meOVXoz83KisYBD3K1mr0ZRcTr5SWplWYYz1j1IUAl8MqVcnam+Fxa9/Wab7yQzvrsrRkn3x2U658EsYGi7oxPHp0tatsEv2762Z/+WVeK1JRw62CpDJL5Ix/5ryd9kHi/DEjKoc+BA0a54YIme1Nq4wotNP4t+3hXcb20GPdvDR66g5As/Y3xnbYewcnOH8yeY5kPKWpwyFXNexONnYXgmGQZFQMXr4DnZ36jhT8qKzt/aFkarIRJpY+0NZe5DjmRIp4dNpsz/T//eWhE5tibf3mva9M1uQ8mhArFKgXTBp+X/gVeTzpTUaFf4hJU4vDITTegknf4Wq1QF3Lmoa0zofP7fKm+qGG1pRMIQD4ohWB5Lns/gdeATroIFumRgdGqUjzAEy0zWGOWG3wHbBmN/SFWdpq6TrGR+ZgNFaVtO2z+q6a8Dj9OlRVFqRLItgPF8cSY/WVXpQFO8VJBOiLimUQfGhm+eP2jwebqKqd13vm88JDCcPovt9U1u0jmJwfNura01Y1h+IzXqI4x/L0s6vmkE9kbao3oRneicdB2lxn0YY21TIUYuYnw0LLW3rYpVTHRu5JimcKtCZvrWrk/ApIztGkElFIQcgH23619LTCJ+AUNH2N6pWEWCF4IMzNRkw1o/NVjisj2UJGwGjH/Q3/Qw+gMGplY4rz1zq0D0TyZQIR+Bgg/D0HT5cZqckgtZ5ICvsruopKGqiZz4OKh5NdRl6gzo/aQ+JO/nCmjhk7VbPTM6H96sVPi1q2/GciUtqjWZeyAQKqp7daZ5YE8s9s2eoTHId7mTUMrGFTJnlWhJ3uouK9BVH2lYdlxdpBY1Aq81+JSuO4k4rL4cmiRna4ReSlpFL/vedJ2KoYmo1QghgDnHGyK4Zg25f12yAH4k8XK9T2JGY7V3zpvXK5nWOgcwJSvyMRPurRuTevVVn3A/cUsSnWjGtYca1v78R4dsBLTQEaBfveZeZDOnC5uOhk6lSojICf5IyNCaRf2jfKrkxDOvzm++kcGwhrvTw1n/0sAHbyvynHikcILKe0WBySGtuMbcIROUO0bz7OuQqlt5j/MRUpw0/vuOCBonjTYf6Q1mngrHNC7FZahoRrIXUsOfZPqApYdyRA3xtffNe5GhtaR/FuVoFX1oa94BZCmHlDbR4LtuHKRLOxErgAM6B5WGlH6ItBAWbBC299rOZ40kcmH7x7VGowXSmRFcyT6pWOJbzkeaEjfiyP+gQB3wusXCSDl3LzeUZ+ipdIsFqv7jMjOGwCa5xv5L+NJmwPyAidR+CUDftcFJ93mjtfbJcHU+uKoVD8j6GfEefi/1jnANm18g5v2LofpDBax4EzG2Q0EYV2Fgd/loSuDUQ+Wsvi1k7P5Kkl86drxuVEVSdqM+Ez8ivIMwn1Z1VBVd+D9i1Vo/rAn4hklCYDIiqwDEBaW7bip1VAC0paKHoE6KGlM856I/16wvcZb5YTf3klTSyBqe0O5qQ6qx107wX3fqwnUqsXcnSbdarAJD5L8SOS X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c231937-1d7c-4597-5252-08dad778dab1 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 10:58:49.2228 (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: FeDiCRb80qhom+yiAPIia/6DQt2T+p2uo9m4VdxwRm+lJGfY1NNyAQMg5MZfK0dm0PiJy4E8X4AOijCKJFYOmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7100 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 bd3a7d881d52..c8d78e4ec94e 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 Tue Dec 6 10:58:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13065673 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 DC3C4C352A1 for ; Tue, 6 Dec 2022 10:59:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234612AbiLFK71 (ORCPT ); Tue, 6 Dec 2022 05:59:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234553AbiLFK7B (ORCPT ); Tue, 6 Dec 2022 05:59:01 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2044.outbound.protection.outlook.com [40.107.93.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DA4323156 for ; Tue, 6 Dec 2022 02:58:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AEsXlnlibm27j571aPJd/pXfBZybTmdl4O3WgCOY6+9LxzvmyhjWi9Qaq1Iaf32fZpkRUhu/iS59D2q9Vawb4FgDTWpz/ZKxcXCqYO3eQ+/LUhEola2l5vRPNfhG+j1Mbo42le5RccofEPMiZUb5mnG0RgEeGHEXHMAgp1eHAiKabTEIfEdN1//ryGH3EJ2Q+vQXRUIpsM3qLspdIbvht3XOqZhp45PnIfVuYiXhfsr8ImA6lI++zM8f5DaHIsPrIOKG7N1Uz0hE/RYgtobk0jLutT870emgL2BQ8o8+ZxrQ1dz94VULh5NidZQ4AXg/b31wiPGTGcAYw+V3R7QnRQ== 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=F2WL7m/8ONJG969UU9V/sIbFR4k6LPwn/Nv7iM09AZg=; b=QTr5Vo/DHqvQ2bDidV6ni/ofCNJKJGkJ2nqLmsbuOqnBhOYJDbpXowZqz47feWKXdSVkkptImwpyM4um6iJ1znifPI46UGit5lZ/YfC9zfCOs1FbOqn/C+qNHDlEAzPzG0u9QTp/DuieGoFGdvvUiqaq5sKihwe5c5THXFqwrxKQIiR4jDpJ3xnAPQq/M2hM5P9hlsW/rvsu5vQ1DrEUAjoIHCdKhyb9PEW52+pAiH+gX/h2B5IiOrIo6RInLVxoNarmJ6O6e9ZxLp8Zueh6FGkDBiQf6aQNpdGn9GDhmchcPWgVVr2weGUokino89rlIO57CtZ2zLmgFE2gZ0+yZw== 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=F2WL7m/8ONJG969UU9V/sIbFR4k6LPwn/Nv7iM09AZg=; b=S7UnT85H5R5QvEgk0Yndi4uBq2XptzRHYXH8kxqXieZUHdaA9K3+4T3XZyp/hu6tArT4cevaVvjtduIn1T8x6Fxbp8fj8/skTGAAI99zk66ppoA3L0hspBRdI4YUDgcGaqtrfiTAuDqYrRK4kMLrjMa4lwO5n6GM5JHtYaw4Bn4yxjvC/MT6fjFnGKVRGtwHB+cwaTOUn7gClg9vR9vs354Wg19tz6uqwLRAVl6Wq3jKJyA0XxZ2VJsWxi2pAwc+gIkLI7/GS5MEldlWih00JfDRFc/nio5GKAApwEsvv/kCpQ41UVRQcw6NtpHbV0uYKcll2e7wrikV0dKECWhNlw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by BN9PR12MB5131.namprd12.prod.outlook.com (2603:10b6:408:118::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Tue, 6 Dec 2022 10:58:56 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a%3]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 10:58:55 +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 v2 3/9] bridge: mcast: Use MDB configuration structure where possible Date: Tue, 6 Dec 2022 12:58:03 +0200 Message-Id: <20221206105809.363767-4-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221206105809.363767-1-idosch@nvidia.com> References: <20221206105809.363767-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR09CA0144.eurprd09.prod.outlook.com (2603:10a6:803:12c::28) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5131:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f6c2558-8210-4c29-2865-08dad778de83 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rzYvOL7e4dyM5bQEL3jDfnpbux0yX1G8ceHLSN4JONyGGt99C6bhwDMQBp00qKVQeNaZ4d8FGsVl7I8JKeYZj1hKfluCjVTXlICjEe/wz0Vhlk29uxmdJXtgXq/1GA5FZF2Belkp0e1651JqS3CweNgFAQhiY6VIg4z81LR3QQeUUNlimjCNq+oSwNAfQxHYBTAEPYM5ivrqDyGkQq9Yntd8uI/stJqjhKxKJUtZxypoRTA2SOHNp+aMy1oi+DFIn7TEQRhml4FDtrsuPEafdtIdmgICldvsagW+04wM8nJyrHCvxyKtQqRkc7Glt8Bn8nQrdrbD6LIdFNUMhz2M0+NA/+O0gjHnDE480ToqrYgLeAL9a9nn1IpBBgujWi270bUQFa+o2NqiUkzZnZXO++JAykxXyHYcrheVTCVzkL3pAw7HkxwDg86RNyBb/ThkMrI01I8ipvaXemlmjTsYXGSZQg8X7aIJdeKllFaKbowdxkmauB99nXMTnEZrmikD8Ux8ZQbpYoH4eD3Hu0iLyTNPFl54S+iNc+X+VyZYYGH5Ma5exa3C2J5utcSHqlyETcOUdl6e7UNV4oxc9HwoZvvEXVL5zTavGVM9VRRVqevkaiqWhGGC6T5QvYXqnru22XlzORdBDIEQF04L/xIB+A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(396003)(39860400002)(136003)(376002)(346002)(451199015)(36756003)(86362001)(38100700002)(6486002)(478600001)(6506007)(6512007)(26005)(186003)(107886003)(8676002)(6666004)(5660300002)(4326008)(2906002)(316002)(66556008)(41300700001)(8936002)(66476007)(66946007)(1076003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8jEAXBGDGRBL3Dko0VsPg9jIo3dfYmwXmIfAUTVOnaKs4LGZ7mU9UPlaoZziQMhFH/K9IPydX+j4STa1FYG6oFGfOcjKnEekPOX+0pcH4oikPvuRK8TrM4ivMdA+O3/wje/4RwMRlmMoRAoTP5wc/x4g/uoMGoXyQVW+KqsuYTI2Wk2r62QlONAoiYnfcsM4uHj+SdO/kmLHpDGsvzUArJPS7fRS4Qv/HMshd03Cg5Q0OjwoElo48Uk2hxwZqNMbyc/8WCuY5X4MnsfmOKsjmLbCeiLj7VIVdvhfEopCb8EGbjnLNiZJsMeXHP08TZXp/CwBoSlfhRjF150f7iEpdooZOX2gcZrHX++GJoD/k1PbX0SmVq2wwKWi9/wOWhzJ3C5/1hSjEx3tUEW0xMxLDWWnGtnm/04mlYm6XYEpRUCAH/jdBzqRs44D+ZcT1CBO0AoVM9yWFM+Wr6e1U7fvWRLbUdt0Di0zsXniBxd4tXnO1vjgQJziuzTak57ExBmVmi1l29q+mLeZ8ahZhOqzwaLRIp+ROBgvK2VhM4i3yC0la+r7WtIK/tb3kcrdKp0w2cYMXTAjTh37MjkF0+w+bjwzJpYhEv+3pi9C69trER2BjDRSN6x8BUNkeQZp5fWVZX/AyHDv7RmZ46wSRf6UMa5wXizF4206BlQTaiY9SQqwT0kEY6frsTUgdzzhhKQZ+XRou59skb2IToq+KVdhD/zrZoyWxHFgHL5nK1PT8eSfCpZBEeqgWZKbi4GBwUw+yS7jGULC1Tb69dmzTjciJ5+Z8rOAalT9i/irmopbyQE0UM8NlGMgW5vYuegb5hUmTq6nXmqTIVWbQWNbCcgizBXj5rdWgkmgXGpoqOTLuHFHqLbLF2iCQyNqcdJbDKRPCiNtkDMCqrWSz4NfNuPutc8V+7h0FVdGuJXgEJ8rkOBD3RyFmRp88/gdkFvccsE3Xqw7+8X/6sJwrPSl8VcScdcLLbGeqPnUXhj85d3sx/BAAkpKZcbqGSCoe25E2KJ3LWFQqvLfkR6n163y0TjLSZ/1C6FhlznBV3TcigXh2uvQxUjkscz4IREYZ7s7kbSO8W2xGoubX8WA68nduVTk7PGjffYO7u1raEd3AWFmNyeq4MLj9Civ4CPFxhIu0NJ6E51ulw3uOrMXvnisVR3xJbUJBdb+xy5Pcn4LLOSmOMISl1PdH2FAHcFtnougmmSmUcelwjzByt0CSRJ9jgKQK30yIVEJ77m86Pj+PGbPlIdPekV2jhnPSH/D+sJ/xqmNU4m0K2F0kU4AdywF/wV8pOsA7at38/ESRXrYchhvLCmhpDvvztAnU6imSdckwH9uoBqbvNoReukZIhxpFN4I5fBnOvV89IeH7mipeHdacI3dalD4jOXs4/4qiSSfrtEsKFHXtSGI+9L+NcJ/OLhAcWT+cbzQIa0nUEH80N8Am9vlTwvDqoAHOeTL9W2wvJH4xAhF63np8utlTFrtAesR8/kGL7WSsQ7SZ9xqsg9TR5X1YvH2JpuO80lX/TUuj6xwXRsR0oKanSdUpe9LFnG4KBp1BIV5vXSGN2VZ137bmDm4YIu4ojwZKfN8hUrxlP6A X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f6c2558-8210-4c29-2865-08dad778de83 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 10:58:55.6937 (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: mF+VRy0Z81s4RT+GguKfY20si5iqmeo4pnZfYLSXmnqbctLdVazQZFDbU4qiN1/Lul2CrjGGYwcf2TPV3UP79Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5131 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 c8d78e4ec94e..080516a3ee9c 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, 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, 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 Tue Dec 6 10:58:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13065674 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 81E78C352A1 for ; Tue, 6 Dec 2022 10:59:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234742AbiLFK7m (ORCPT ); Tue, 6 Dec 2022 05:59:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234534AbiLFK7I (ORCPT ); Tue, 6 Dec 2022 05:59:08 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8884822524 for ; Tue, 6 Dec 2022 02:59:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AneFufhXF+BF4Cyx3x5z84MF5gRuI5uvuDluhK1AeSSkIKbvBHZTnZaXw3QFyKvgLCG0ikj5eKcFiQY8lFJgGdQBUYEoutOSyBQWLEdQTG+f/w2mpUuHAp55GsSrJR5i1hxR6Qw3hxG643daNi4++qS2RPKEzt3gZSmb9Sbu2exkfv/saEOIjcTug2l0/dE5t5fKReaD95aAOE7Zzk497ci++brruRMCAxFfizH6l9fs8QonqCsHXBA7vAn8jQQYlrJhv9RGXdnUMptN382eMXmrmNKPBlGXb19fEWqAL6XHGEFsgRxUshgnBhoVC7rn9mhfBMHgbj6PFxPncjW8pA== 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=dXV2/wFaM/FmM2Zuy8SrSPKa4bOiS4GZJHNko+mi8r4=; b=OHG/MQ8Jpxgln2mfEWGoI/x0nO0eq3Zuw8crv9LdzWpL0DJAECLsIhymyeW7LbxUFlC91S67TCwNGFun6NJmORloOl41VpHyWFlZ4KJJndpzkvAdGDDZRwVTG/CN8GC2Q4+E0A1mhVOUt7LcYcwPc/N4vSE134Vdlikwu63RsrSfocbLtfoAb1I4lG+k8KJLWuVfuSN23XwF408dNYlv+9VMBBNi25lCR3Z7SBO9nngoNG+EMvoWPGKlNGbeFnfUlRzO9MyUcOgVa94bJ8JmUTOgQ7po+UTts+b2sjDf5YM6ULfUas4B+w59KTsxspDovdo6GcrwN/2KZ+9SWog25Q== 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=dXV2/wFaM/FmM2Zuy8SrSPKa4bOiS4GZJHNko+mi8r4=; b=jzb+uccxKMLjP6bGzbShWfUZa7568z0uVzVjGoGYG2jwAkVsVJH2mrn8tNB/gKBAwTXqRHendC+FBi9OeKMFxrRGRk9HyfHlR4tyJs4O2trRt7xtut2A/lb0OLh6VyBkYKpDR8xS5cMzfeTbQinPHHAG2yw5lDrB+xETW9jO0CpRF9IvcW2cUNUQF/StlFmxa+Hwx5uFdo3p5Uzvf2RM2dvhRxKmmOfonEy+1PkmzptW4s4DmgjY8GdwAk0sRi7CBDZUPisfQsqR9oq11MZ+GApQMFUIvnBqwYf0DTxzpceJNY4dLZAIFOfvpW3MKHO5vlmKTY/P8Z2lERzrkT5dzw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by BN9PR12MB5131.namprd12.prod.outlook.com (2603:10b6:408:118::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Tue, 6 Dec 2022 10:59:03 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a%3]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 10:59:03 +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 v2 4/9] bridge: mcast: Propagate MDB configuration structure further Date: Tue, 6 Dec 2022 12:58:04 +0200 Message-Id: <20221206105809.363767-5-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221206105809.363767-1-idosch@nvidia.com> References: <20221206105809.363767-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR09CA0150.eurprd09.prod.outlook.com (2603:10a6:803:12c::34) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5131:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f4dd635-dcfe-41ab-c587-08dad778e2e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gPYRdnDfjmG+C/+mumFurrFdOklr+rEsdIWqjkF7WaKy99pvzR6GTOmAirF9dA4NuKvCaGMpotE6eOm3Z1SgSee6hsw5b+JpiXibuNY6gzqLa4kdhO828FEG/6MdtG8+OO83BPtNusB7XqYFCSPLONXarrLHbPGvJZeZHid5uSJtgrqN/rFbCdKZXztnxbA/QbkM85ezD/cfMQdgPqfgUL7LVFJN1RG+dl97Ay74aSb7BTEItyv09HMmcpEcOzhFvJmH/REFJwZYvAzR8h92EfNjcLcA9YuiG5YYL/mv9RMUnHcnN1aFRF18law219+zgJWU3YhMmxwKDkpRHSu/bmZg8V4LjgdPa6MjM3XRtd8Wqe5KSJiW7Ye+0MXIbTZkV3QcYuXcNGFz89YdjkwlwXrwzugQuBuZBedVAjVry58hIf66A8QM5OGc5OLjyD3cVSbke++2B3s050GwcQUbkuMMzaIfqdy57gGq7zoEht1vxcTD//mUZTwIChYDsZNPacV1P6UBDyI4eYnYrTgU6bZhwvmo8sc+2P8O/JAXRFecUBzpKkZR4nvyR3hdRTowiPRjcWYNZhWtFiyVmIdS5c1noPwtmFiLW8wIfh7bhvkm8ncZ8Xz18HTaApBOBf7+EwuEzgXnyJ5xTrhr+U7hwA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(396003)(39860400002)(136003)(376002)(346002)(451199015)(36756003)(86362001)(38100700002)(6486002)(478600001)(6506007)(6512007)(26005)(186003)(107886003)(8676002)(5660300002)(4326008)(2906002)(316002)(66556008)(41300700001)(8936002)(66476007)(66946007)(1076003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lE4QNg+BUKFBOG9y762jnAJolQLUo/kxwD6npFlALoz/vD/YkqqvVEQwt/aczUiA09bD4D7uddSe0eeQgYsWvJxGUferkP2mtGur1ovo9g/WfjGLB8PmZTb+dPGSguVj+YtStwwj8so+eyPMErlD7vJ1r25AWl1HFrdhxR5n0XSz7hNXRpCU3o86ihpdbFt0wi4N2wxSaK2D1OudmE0S0mROjXrNHN5bUn6R98LNr7zPJgjJBGtqbYsh8npQH1L/1+a0qRkFPl7qJGhv2HCHBqACwIYJECc7XshOui6p7/n0aL0dBPKEfSClWxYarTnszcJFBvuQ1M9OUuTXghw6CTl+wQ5ReiWnGL41UFXqDFYbOs29SUg2f0eF8IQC3fgeCrGXUfEMdz5zELjxgyE1GlD2AL1Vn1kso+6i5VMIxLPofhGL4XEp5aY7ANuofPuGj2z5YhWaXED0N9w3IXXECbo/TyEmysEqr5qklosjYxi8D++q55xUYhUYHX33lhFQ5QAuqX4KhqCVjycwpqACjQ5V8VbHa2nvcnLRfOea4rbc77UGO3Z5fJRlQSfC18kdJQd1hm66cW2+FCaj5j0lUsUpC19oRfbNDYQBGMiVHnHnAl5oKV4J0vxFAje+S4Irod2z7d4JCPeFZG7iTyrHCjpOfEj5a4QJO0ZqBg+9bJ+wQjNit0+WgkZhalntCp/KYB2SpP5n7RkFzWgBcLsfgQlVmbCjnqoLqy7pi7WZlVHmVOJiNPP4PWe/eFM+dQAOWtmsalorvPfDvUO7Yq91zev4+hsKQUwj7sn8ChE2Y5NOtp2HNHB39GnImAcu5zBVY3OWBDBtH0ygbyoCf1SD5UXffBPdZUjAdq2f2N6xPjwLp0/AQqnNvPm1MFMpgjTo+aQbTGFugcBE9tJorpoqXeQFC8K17TCnqbopZwaZZmWkfpeyw1Jirl5q6Sk4KntESJmikEyIcloBB88tAnGvYkeor4DUPuyHPOUGUP3A3xipqc7/Kmp2J83Hg8ZuPpQiEjPslmsEG4BH0G3L5uYeRMzPyC2Zp4OcNMWyYGNDqovq+GAcX079lCaXNFkV1yCQdwCMeXnQczABQPKAvtJgWYK+u3sMhvyGxNBxB2Kd91n3wOuD4JhUVhJmFCWZqeRY7QuThtH1aEN27ALvQ/HeqQ50aQLM5mDt96EnKyhVT+is+X7bg2bnwOnYhoHhPYaSq6sRTp0ufE/FKhFz0KBpjtlzYLZUwbk6KHVz1cR0gEq3tn44mhY6+Jnc9fy+eAv4PtzhfdsB9DHojEKD1pZ0fl3UjRNc0mVKDItrW5wcx+isUzhlTbq2WsrUDlgIP//PYRn+qLAmvirDPLnFfwAIxG44THfT6nt5pC8iatQkVR3EUXFdb8v3bn0b4CBVhMesp+lX5eB2JqdXmv0I2DbIsp7UL8RToMKONG7hFvbZwHIBaj10FwF7RDTktcXDI0MehYX27gXnqKl0yzZnWWCYuQoGRyZyRmXc/tMHLbDAKMVcw61BIIMCy4JWHAoXl7gQF+6CKk32BY+FOqBmwOy/KOvO7FA2V4QEV3j3XVIL0ACS6wpnYWEuzGZs/wyPAVCv X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f4dd635-dcfe-41ab-c587-08dad778e2e6 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 10:59:03.0105 (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: VU7hGmlZvyFomAkuprWfuVj6dqlDqAuST0+9lzn9Su6XNtUWWfY6xU2wZGjbnrAR5pGQHEn08ebAyPIuMgFtsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5131 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 --- Notes: v2: * Pass 'cfg' as 'const'. 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 080516a3ee9c..6017bff8316a 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(const 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(const 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 Tue Dec 6 10:58:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13065675 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 AC9CBC352A1 for ; Tue, 6 Dec 2022 11:00:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234775AbiLFLAC (ORCPT ); Tue, 6 Dec 2022 06:00:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234567AbiLFK73 (ORCPT ); Tue, 6 Dec 2022 05:59:29 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2049.outbound.protection.outlook.com [40.107.93.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8B4423BD6 for ; Tue, 6 Dec 2022 02:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hNwgZICqwPM3Us+g0CMvD4Wiu/Zd1QVi/fqiBH0d3eeZ4YVG0cBnPfWXAk51GaLBw4CENb9gjamZMWsfcSSY51kmSoDm0zaWzOuVms2H4vROWLwr3vgewdZRFe1oeldpPnJkSo36iLrvbhiqXAJSelaDTmYZNd253iLr51L42C5lMuuGdg3uaezgPaq2xE5ilS8CkL0Um0iDFSl42lG2WlpShT1uQhFn84Vle87oOJIONZN3P93LwR9L0RX/XEDgjyzaSJIeLRG1GtaL+6gwnDxiE/XN83y2YFqk0VNFJLpWfJU0hadBXPzM5SSaeA++eGnzgj9CwktSzkdT2YborA== 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=m2UuOzLm+cUz3HNhxRPB+Jh5RI2DyHSGrhLikshtd8c=; b=Dzs2Pvv41kesIzRxWOKl3RLv12l61DW9u96MuYfJn3s4/Ypmx4+zos4nbwo1L4k5ZDb/CiPwIeAsYY1cmqi8RZQBaRw/OClvDNU4cB4Z1adHn32tzHAdLZwYxrRCon+2ZWqhRn7MA6mmiODaqKaEgTmjGLZeSolJwaLYIgM/DNrNE0cpueQw4vlKA9mxhMKMGhDeAapHbtO1fScYEU5jHZPYJA/SOI9cUyyzaZB9uytZeyYnZ6Pl/E0ahspur5WTFaZwidBLdNSeFZZHB6ZMb4qaGKflZNWnh/KspBMkr/9f37mtPKWjA4LlL2VcUVdIcZsIP2oAFAQ6ak6NlmZ9Yw== 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=m2UuOzLm+cUz3HNhxRPB+Jh5RI2DyHSGrhLikshtd8c=; b=tQ+f56NUmYJZ0viQdjupaatD1/nZswbEaRhH/swvOXfNj3VeAZlW3KHTOwaxZlGFtVficdlznWuMZT98iZ9QEAwurDrQGpf6Px6G4GDVxDWk2fR+JybMJxz3/g9lLZ8ge6vItxROAFrePb7krHvGh4seJi+1j7VoxsShMW8/M1yUHawyKX+7TAAJYKzk3l8oWn5S0PcN+dX5IXYvo+c9Nepf8yZv4R6V6XC2sBX266H2CwsRJdqcWe6T7UbmMwYExkcDNbyuZGQi8zDx1YQz/Vu5N/M4SBhB073c3VITmJm9Qd1bA4ZMZa2uVcs7O+UD7lErsIlVb6X2YBLL7BUhTw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by BN9PR12MB5131.namprd12.prod.outlook.com (2603:10b6:408:118::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Tue, 6 Dec 2022 10:59:10 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a%3]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 10:59:10 +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 v2 5/9] bridge: mcast: Use MDB group key from configuration structure Date: Tue, 6 Dec 2022 12:58:05 +0200 Message-Id: <20221206105809.363767-6-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221206105809.363767-1-idosch@nvidia.com> References: <20221206105809.363767-1-idosch@nvidia.com> X-ClientProxiedBy: VI1P195CA0072.EURP195.PROD.OUTLOOK.COM (2603:10a6:802:59::25) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5131:EE_ X-MS-Office365-Filtering-Correlation-Id: 5da5200e-42ed-4625-b816-08dad778e738 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9Pp3jHRi8qiJATssVkgaFvUVKVfel8UoEIt0k+ZuzMitvYZCrfMTrZlfmVeSgYNgb33WM/2aT7Il+cvI8QhmBn9IvnQP1JkgFR6CgYk9to0DWuOHXqoIOJt+fSFVUZU1ObR6PFx7TUGrXC2D+nySUWFk2g7k8/RLGKgoVxOAGoG/zQNYLNMaPNNqTP+v5a7K65mDV2Tly2tWsOEfok6EJLb5aDdlmePOwmy/bDYdPFRXHNAIQ/8tyHp2bmIjkwJhIRd/5P5EM75gvEBdBquD5+ZyozviCZh/s+coNsUbKCmzSPOpcOHv4nqT47FCvCeKF5frEW/loyHOZolFRCBDos1iII9VTs9zADF7CbnJVfLXUxlXBzj+egWE/tcXeoG5lxtpjym2KacaI/7dogcCBGTg/NXozEvwGsbp2eH1TgG8fk3P0iz3gNQFHxuACsKpNhxxxqYt7iww6H8WRLj/8xTRBfYZwGZMMWVn+BO9HpklsZBY4CtV16rjmLOTXQC3iwMlnhbA/AGP5H9L+csoLclkcjifr3GV3qQqsc+5yUwXqSj1RmDX3xHSKfVixAQqgLY0onDoNcY0+N8t90Ip54qT2lXag4n4/SiQiN9ndZrWUe7hZ40sttO5GGgXpc1Xaw7kfa7k8GoamUTLH0+BDw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(396003)(39860400002)(136003)(376002)(346002)(451199015)(36756003)(86362001)(38100700002)(6486002)(478600001)(6506007)(6512007)(26005)(186003)(107886003)(8676002)(6666004)(5660300002)(4326008)(2906002)(316002)(66556008)(41300700001)(8936002)(66476007)(66946007)(1076003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1EPWoz0pl8gVfSl5nZ4qkv1W+XNntOfl5CNk3jhZNb1iDd9Bwr1Yc43avLzLd9rRnk67z7lPsxdlGuKpPnOMojmu3Jzx3pSAoU3KHqjQ+bovnCNa0s/YYfJS6ehDkYN3B1ame5XgRXmYtfsb2tEzAr9eKxoeHkDwB/1s2f/H9E8LCeNuizdhG1yLn7+DoqYVuLAzQof7jZmAikX0WzF6ulkXeBHLo1jHHkcGmzwZmT8RxoBW+NyDtIgFiMUAf3KLmV9T0f44HfKRJGAoBhTLnukIaMnIURzayIDMLen4xrhltCYSPgyZ9WbRMk9OPlwS9P8ZPaYw1P+3NyxIEu6DuYCuUCEhZ7WCgfS8w53yovtdITsAjM1yYYMeaUHmActK13bfPQ953SXTtxsPXDDpP32xcn2usdtV8Iryu71x5igetFhfTirjIQzX61wlZz/XY7YrENTcy38joSF32trUVDtB3kXddMdpv4Wu2pg9CbaiYF6fv9YkCIzEVhtdqR5rPZ+mFHxaG9W47hdPNRk3hGoMutqT+U3VvRNgC8uXWCoICUotJxL+7qb1WCBHmdtpOQ7AW4+J1q4+UQjOHvMVjSMaZu9mWDyiU2YWJebsVZk0UOp/rEvTw1/vdUB6uVLCnxaALX3DBRqQX+NvXMVyVUStXiI0rCoA7CuC9EoeBD3Ke5Q8EyfjuA+IOxVfZB95XE5b/vDo1RvUySwBmPvnkQMrLC6Wnz1tQRL0gLNMoPTvAEYEB86qO8Jd6aaG/RSOcoJyQzSaqzmdxI4qBOscree8s4O7lGRxMkeFZf8xeRrG5Dq/WZqeGyvLd75zv5lTpDnVrTelB3qLtiO8ux75un5d14Q3IJor23zsLkDqh5j1aoEjDP+THvJOsOxeyphho/CmHlG/ubmx1ozZKfMtP/t/hiHCEq9vg3YRv6/hWvHHp8RJjZvCew5OC47XPBTyxa1xtBx2aMKPEhAw9tEiPJdT4Fak1v0nZzsTroDp8rrR8toeTY+CWvX850NRpwPK1vLlgpNckOTGk1HY3CWUtH+aTl/sOUe1GWjCnCcVCUKJyVEHAI6DRkFaVDlyuTZ5WGLaSEm+MNQ/nKwRg6zHu5Pmm8yPPmizuP5bW/LlBedGn/wDRyxuecrmImgqWchYZzOLOdo2IRuD9VNDB2F9dAoRXmiuXPycOAMZCczH73AfZXiXlx5CYLdix8MoKABeR1f/K68d19lC0FZLTNY5VBiqTii2NGVjQqJXEekPF9F9c2PQcs4WXVVneuT6Nj0Ph2r2Lxzmk2il8MDm4bRnGpfJSF7e5D9FdhVZRuHM+AOSXvuz4wZUvb2aE2UQ1njgznlTJyCifwYj6PAO/0wMrrqYbfjCrEgRbe8hq1qChJy3PNaMhaYTMd+ePuACI3ZPCilH4fK0c4fEQCcm2YVLjz28I43NGOBRZbhEFEMZlAOa3Ygrke7X046Jm6afzRuXEDK+6Zli6qdI89La5k1OowWtxdqLmp0ErqQiaMRTl9uNQHANk823fPSVu6ue3xbaJV+7JIj9FCfGLvTBnpJ2e0YjQnW6gkzRcpcuAiGffx81P4VzDuy6Efdop2Bd6zVv X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5da5200e-42ed-4625-b816-08dad778e738 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 10:59:10.2585 (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: gT8gFYxegB0O1rMfq+UIQZlnYlZURqW2+1x/DvBi9Cu2AFuWEizk+ebPNbLwprE+tfr5Tsj+VAJd9G+cC8niyA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5131 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 --- Notes: v2: * Pass 'cfg' as 'const'. 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 6017bff8316a..b459886af675 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, + const 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(const 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(const 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 Tue Dec 6 10:58:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13065676 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 E0D14C352A1 for ; Tue, 6 Dec 2022 11:00:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233171AbiLFLAb (ORCPT ); Tue, 6 Dec 2022 06:00:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234744AbiLFK7n (ORCPT ); Tue, 6 Dec 2022 05:59:43 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2060.outbound.protection.outlook.com [40.107.93.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1818F24F22 for ; Tue, 6 Dec 2022 02:59:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iJ/7kGqoiuXLP9+DwNnf/dMOnEJ+AI3CCpyiy5dMro/Y2BNH2JpBLh4U1QY8GPmUXWbzi7Q5LNJOQwtlOkFJV7szWX5b7z/6lThQqwEWm4/+fRLdnwbgoZYyzhZEdRWHw0dPq3HBOoZng9rMxnmydET2s5DG2GUWC6Kijj+0Z5vF35wA/mYnwMebPl1b4pcCyEw+ZM9QX8d+v+QC0zPJ2OpF0MDcbRGW450PsXU/piQYxdCz9QsErRewYsfLiQkQl+vfcbwGBkm3ICeBB+9M90g35bHsFwKbGsHeb71PX50uG62QvRNffucbwRKZsHg/dbRKC8JyACBObVWBfCnjjA== 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=uB8JxsTiF9rS8GVOnoXsC8O6XcScnXhYRzE64mek0nw=; b=HMV4oMGYmikubiir85W3CwQKLNclkVTGTqZC0QzkJNZxP5sWIeeY+Lq1Bv67CyTKhdKLExRIy9zT9qWIGpPx1xhJtdirjmThHN1rpjbBFyuoAKM0yqLBft++mWC5xUdFdPmGbixua0FM8I4I7rdl3aGeHE35mjVIjcpEWsn3Q9KGYQBoC6FPhBIZFhSHseWlPUFqeuT2jxg+HchUTlmqkbF15vDmKFQGmbJ3KhedYJbUBnY4JZMRrlBvu3N44qI89JqXEejhgiq6R9WLl5WO/mEyI7gdXCrpCicmlDh+WWnW9EPO0HaTFEPqNMTjG65FpAIQ9IFy68uLxPObsNUUEg== 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=uB8JxsTiF9rS8GVOnoXsC8O6XcScnXhYRzE64mek0nw=; b=uR72CqeEADcziYqdsu2vn65wPzXWVkKwhpB9QsY1yVdPLkj/e1ku4Qg12xu/RqxS0cEKoXHhdzNLanipBTWueRKa65WShRBUL6Ut696y7MJyE61AWE+Wbj4qJaqISdNJwFYR4FYfIdPXYpbOJ++8hI0jl3KC9KWKhY4qPHfxAJePEi8PSqUHMFf9wLsQSfeQzONTFBwuu4mfBq/0JnlxgTlKoKGztNG3IuRm3inK3G/IcdroMrk/EWcVBPqqh7OoEVOFggBIDprAiw11dTwgCJxVBafO/1sUhlMy2lca+V02JBDp45I16V4sBFIZ6M0j2ncrTeJ6+tVHz8Khwo1ihw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by BN9PR12MB5131.namprd12.prod.outlook.com (2603:10b6:408:118::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Tue, 6 Dec 2022 10:59:17 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a%3]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 10:59:17 +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 v2 6/9] bridge: mcast: Remove br_mdb_parse() Date: Tue, 6 Dec 2022 12:58:06 +0200 Message-Id: <20221206105809.363767-7-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221206105809.363767-1-idosch@nvidia.com> References: <20221206105809.363767-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR04CA0076.eurprd04.prod.outlook.com (2603:10a6:802:2::47) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5131:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d1fd7de-3d16-4a3f-878c-08dad778eb73 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nl9vRIEBmUu7jWun2e14cN1bweC3yEvh7zuZBg/oFk608f9dSMNgmDK7x769F8JgXjQNfCFVJQLalxaxtXeli9+YxZ7HkyL+GzLIm953qyI9ExRH+pISDN6ktoGHikMVN35GHzjnDdQJEnLfK3azX2uNyL0KQajaw6GOKf5IvB9Q5jA8D8ETnNQ+D5894JMs5y2i2NCpmBGNjJJPzazj+I3MgT7Oe9oW5HUMLJPIqP6IsfrwcKtF43hwcRWvOls4+3mtoFbsTIfKqeEpiDKfe7QsKv2v8fJELvXWEos/vX5Ub7bJ5pIHEacQr9gUK3Q0i9RE8ld9q2BOZ+Y8uDt/gA7VH60WJL6klL2MnUW0+p4dzMBEfq8ZPxMg5VbLGnBWY2AkVkFptaWfWRKNIekuWYMdet07EL72tNIDzjekOt4zQnrIw8j5DpsKzwd8vM0kALmIOu0caDRQabejMWEjUznUjANYc+wMof7tpXxvxn3hc+M1ugvgUlWwqZwkLv49xJPKvd8VVGsfpoSjl03HlwnsrP04WuLXAwgl16YrM160NpE9YUvHVZqJPVawgnCZcIqsLs2tHeAXSQr6GX5CIcR/qNXQRGIQnJkRGBH8GlQqHhe7QQSUXk/2jdOX88pVXN5n7INOE0VdlKmE1UKeZw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(396003)(39860400002)(136003)(376002)(346002)(451199015)(36756003)(86362001)(38100700002)(6486002)(478600001)(6506007)(6512007)(26005)(186003)(107886003)(8676002)(6666004)(5660300002)(4326008)(2906002)(316002)(66556008)(41300700001)(8936002)(66476007)(66946007)(1076003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: X8zzrrfGtF/hMZQk7/pcLlI73oOJN86L4hXMGjszT8jLUTL0BNH23BeR2uGO61HUaDDj9iJaX8O2dRIfEtjCJgq2g/RgRB8n7ugIOqS74DoDqWBaoJOuYaV+rCRw5eKj0Fcis3cVt1djRb1Md/uYvG/V+s/CdVOpg/JMMN7MOj4l1sL3TPNTJ3CBTRwFUv2PC7R3ahdE6g/DK0tmMK83VdRlIdgugFlhHX95S5kypAA6ZBUGyDsSNJEvMPCkQR5UfDORhd9LwXYBT+WquZik/4GrCzfhIUz1c7XtA+DOQfbeogfGdQ+g4yFTH/c88BYfPfBTZjoYA3wBNpN0Rz9aUFF9YkfabmpfTawwd0mFt68EKK43unjwD27eOjjqqN7/3q0JIuv/tiZNQCmGg5/He1ujpBZK0/UPZGt0tbMYNxpUumicxZq9/DM8U5/e8PY6DHetwWLkttcfVajqiK1iB4aW/mfiAtLnpyZ4YpUnsp1n2acA6oSA4QYwYjAwRj25j03i2UpKHFxVpWy/pAb6LL65/Vu2wKzD0u20lIhsx86ApBs8DugkDTf247xRr2HRPythZ1dPzhR/Uezrn8ubUUlBhulsdrCNp+XR64KYH9xFDUhAuFw664lQvXAUQdy+D3NNq/UFwsPUiWKuvN01XZhDc2ePekU2cxlu2DYVBHwj3iJx4iIIiHpcsWp6hjlAyb1SPS7nrgohrdxrZLDEgXNYx8w7TvXW5Gq7cVIHEV6NA7pvRFVYs3ZG/ki7HFQuhaNpdJPyF/kB+b7jtfFSEKfs71ivAw8yHVG+7tVhFMGETHWPEukIH36yLShoxrbvZu7TzjRVKz1nV9eR0KpVeTiCPChd+E+jwyHsXDzWD8SiJCAn+PhB+gdhS9IbKXyxd4jCNqGLMgkTXZg6L9yF1X2sRaDNhjsQVuhZvaDdzbh2e4uUwvHmeNhHkA+wLMqPeSyhKMPt93/1+Yercfc9GGD3HlEI0tmcBSifWHgjJzT8o0vbWEnmUiaZUPV2+yhdajNFjA6traa51DNdmwWuPajRFevrccuKl+8VX77d61yyel2l3I3yYqDDfpfW79TH1AAJ77H/b4m1l1FQIk8Kta/R3ZgdFUbMum6DJMozNOPHRvusfq7B9xSAfN7G5fE05nfMmae5+scweLHBYCxzOoIHPcT9LsBV9l0C169XlKMHa1V7z1eOhxQqzKDf5b/QMTCGvP9SWrCL7GbUhXRPu9xsjG5WMBrKwvtggE0EGjDAc0vTvJJTaYd8YsxLbONQEJYzv2fhoJilj/dpmjW/+1l62VjSAwFxnDOj6Bq6FpsLPBgFvf7qhePX3uuQKJsAew+qRgOPZM6xXXfdrEqEbiKiky4XL7QMsMgN7tQ+vC6utANaUSV915LQaOIyOejphUhbl2fKd0YQ6oHE+yK858I1MyTmnJaP84KbCes2cQ4qjbkGw8o46edJOyDIzQMXhtJ90psIDx6+7jX974ww1JFH9x8jOeVvyC4e/EW0yuv5yv4j1w9Wgcwz1+64mrQbEL/jm77I4YJkZ5WDYqPuVIpD+ImUQ0vVeGDhePk35Q9GuTCx6F+4tKvhPkT5OLb/ X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d1fd7de-3d16-4a3f-878c-08dad778eb73 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 10:59:17.3391 (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: pAHaHjOkd01WztSAGC9GkC8bvLKSmErkoi71Bb1WSAjKb4QvkDsVunnt08c8ebvxKE6qZtwfWzmJqmXHCriO5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5131 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 b459886af675..d0e018628f5d 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(const 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, const struct nlmsghdr *nlh, 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, 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(const struct br_mdb_config *cfg, - struct nlattr **mdb_attrs) +static int __br_mdb_del(const 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(const 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, 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 Tue Dec 6 10:58:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13065677 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 9818CC352A1 for ; Tue, 6 Dec 2022 11:00:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234536AbiLFLAr (ORCPT ); Tue, 6 Dec 2022 06:00:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234547AbiLFK7x (ORCPT ); Tue, 6 Dec 2022 05:59:53 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2060.outbound.protection.outlook.com [40.107.93.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E31A22B2D for ; Tue, 6 Dec 2022 02:59:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DqW3vd374m+2k3r3OMwwdPtaQDu6duMxfmcRDrkIXZ3pP5xpWccEGHU7wKaB1Ya2qbdTXVaRom9BSQeBGYNSnIqDDHVYxwYSP6KgskgRP/j28uo2GkOFfIDrzOENCOINeO5lRwx2/8v9NOrtbN7MIJcT4BwikwZOpNlqr0y+IV1NFSLYCs8YS0vK1vyZetMDcY+JWpWJQDYEM/4FlBFOtys83qsRvxrMFvHVdXD5MD09L4FehP4GS/u3jV1LEdD4+tnoLiu2/y5AwUX/W/40yiNJLpJHK9rcayFU4/BdHJnXrbCdWm2IyE+dLpO+0NPHOZkyJlURL/sBYOuCcKyhvg== 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=EdvVN5xzfy+1ZPDNmvOwrIBR5OfKCZgYHP84JMw8sEo=; b=Stbz0kjKPRuVi18dEhADHAoOoHZz/0EddrgSE6Cphu+8SfFQo46h6dCqfHyAOfJiz5I16V9BVwUPzNsxEaEnGhX46Hs335HE8rOlMY8dfF5PczLX+Q8XbDOmIZ6H7miwp+noI69aRYa+hHKziJqvLxb9HBWdEyNZK7eqpdOecfrEEvmUedyJ3SRxgRW/HJ11VdEihpiQzkrGK65XXQRUAYDq5n8u6yewI3G70JUyZHkqj6T6lsVj0vqkN9CtBgdVq6aHb5gZGToO1qqqbeGZH4E+ocmD8Zi54DABFL/IwWt9cs8B0cLqXAef/cJgykHIpstEaxjMtbDcaYWgHiwSww== 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=EdvVN5xzfy+1ZPDNmvOwrIBR5OfKCZgYHP84JMw8sEo=; b=fQNjHsRNrDkB4h5eyglESFSMBriw7V/dW40j/j2ezb1PKMgr1Z4P/wAWRbgXSGOSmwdyY0jqgwCVUe0+YCEQ9LE+bn80D5LpZKXT43azhg2gla+v2cVkk8pWFcxOeO4pD4w9rABE2ED6I3Ch/wbW2LLrukHo013tT++dAeDVZZ/TYmGmyLYnFyvpVLDrxbM5NqMSfIrR3DldUKMrUCBjqaWiiEm8Q5mURv1pZjCuU1gM97d3M9Uht2NQwdHAJC2SIfZrvEOlaXNvxlOtO9ZnJTsbPRJ43LBWHuChRrFrJaKF1GuDpYEiLEOEv1p426zTIakAXp5PcGDiQp2M57cglg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by BN9PR12MB5131.namprd12.prod.outlook.com (2603:10b6:408:118::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Tue, 6 Dec 2022 10:59:24 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a%3]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 10:59:24 +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 v2 7/9] bridge: mcast: Move checks out of critical section Date: Tue, 6 Dec 2022 12:58:07 +0200 Message-Id: <20221206105809.363767-8-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221206105809.363767-1-idosch@nvidia.com> References: <20221206105809.363767-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR0401CA0001.eurprd04.prod.outlook.com (2603:10a6:800:4a::11) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5131:EE_ X-MS-Office365-Filtering-Correlation-Id: ff843b07-8dcb-4460-cd71-08dad778ef9a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oTgt5cL6XvZznWT1piI3oHZn69F/MSPLvVcytvBMwepnE0OHRl3OXaTmZtcX0PJdMOzU6fe3U7fcIVcA8qzQVgB5O6tipcHpc6mEX3ckKedK6wWVnJLLq9ErZBxf4VkgFhXxWbpFMG9Ck3H60RxHAItJmPt4shkxyXRZ8iAUq/nduCiwlXzqFC4Z8QoMUBUHv4unu3bw1tDUJBsm7lc6LkkzB/v5LXoxLR9Gch/GuIoo5m9kYqoBaxCvwKWS/3N9RdUMfxZ+6PExnwDGxdZ/CnngR5lHs9dJWs5aPa1pppG5Y17TWDZsynzlbVAr9cagoQ2taKmzZcRg08doU6Kv4qq+uNMOGUqVzkCiK/CI0XCX4QjUcSJTVFkW/JdEb11fZxwzpcXfZrxF5QYCzXZ1ak57EOES2uFGxDvhKY4rTmfrw2s3gQDypJgsvSxTLyuAcZrM4eXwYMP3pFiUJ4Ocn5JNVv1m83dYBbKmVuNP7+5wtxG0McRyNVTgWLNEqvvcJ8P9dSz3T58bd73n4Jn7PzidGZIgHBkLXtQjnYnLa3iTFiRAF4wOIQdJd7HhO3dU9yZb7aOuKlGsmq5vh7Wmz9XFLR/52xv47vNHeGw829v5diQ3dwtDqqvPxmhDe/k+2fWPtcc6j2PIymcYnSfAlA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(396003)(39860400002)(136003)(376002)(346002)(451199015)(36756003)(86362001)(38100700002)(6486002)(478600001)(6506007)(6512007)(26005)(186003)(107886003)(8676002)(6666004)(5660300002)(4326008)(2906002)(316002)(66556008)(41300700001)(8936002)(66476007)(66946007)(1076003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pWBxizjTb2cUpFQQjJHWiFd6hRi9PF67pVKm+eZUpupngXJ5M3ZdKYRFXau2JXajXUAjM6ANzcpXUJPuJI+MJPQIOaxIJ1/UVdOLN3TWRx6ZtSz05dzjfdbxrUEU9C4IqaIakY/451ck5Bg2utMb37RTexwZ9anDo03R7KXLORkUqjMf2gb8uu1ydkB2lw7C3RhEmRdq6ru4N0/4jM0de4jGJ9E1ZFSlwhVCo8wmi6RakxZlkhiMd6GNFsrpVVKtj35OcpVQjr8cW/fIFtShgxZte8AGeD3lQZD+d+FSSXzyDmVT/5f82B+JSg+M9A3GqOLD93Q8Ft18QGVOCYL+cTsHId0Kyk7uk6qpeHvBUte1eNQeYi2ckoHtyV0XEQoh2jhd9wHdVaFPpV3e4Di2/yKorLD1hcQ16EMbri7RvYY7M7LHOHd9lZ37NWS28bGNl2HOKUo02jSjUJUamRWtMj46wqYAuFyhGGd7OMEnSV6ldZjTLoYylx/biu+wiuuyxHwb1DMHBaumC2gyz7GLKdKNgNYsMagu1LKOA3Krr7tuCOW/9cfdsI/uW6pKYLY2uN8GbyNOM4h833Yq0m2fd5D3qPpB+jBesmMz+qmt0oen361h3Eb2AtL2O3zSr/BbgqSxjVgc85IY8itn9ncPB8nZzy0r4hm2JkPnj2YqH3L16+3WN1zxHtUtsxB4mLdyUGUDet7Hij7TNlvAfbcq/X/8sFvPI0rgKcQnUewvbmDRTNAxgFIRvGvINwnn5XPgLiVlfoiHiIKvxVQ1u+VpJn/Xt50//ztk8OuYldiMOE+irZJp9XRcII5/uLsjDzJDgNICLR5dI4Vf1mDtfMm1tipSNNOocTVAbBO9i9ddOfN0AqOtFfE3O9Prt9XyqG6VugI7MkrD5ncZj1seCTwcp+zNyl6SoS/7rsXTzyw0c6QS78+qftS4mtszyjBrb5tibxuB6/gHRQBQ256yTtFdD4NeoenSI/RlvzxLEfmJnppPWHlIbkcQmpfZ/EeV2A1G25eT/xGWs/IN5FFVzXr9EWSeAFnVRcNbhNc2sxTfGnxJUTzTslqOvCzVXuvi5g3Ixqkl/AnJ8NFjxOnCse4uIYnmI4CrDC49ynUxhKoncDMpJ8XH4njFhm26u8zqwFATGAotZYxI8+GlulBM8CvmwW1W246iJXDEC5W7dcBO/vvZG/tf+IoeJ4Xx3+ry7WjeuH9efvu5Fjba9lLKTIfCKm5LbBvD06VJBoSsj+oX9koYHjRWIdc1ChtHFIq7es8Dq+F/QRj+xl7airrIyZdKShou51RCWHQNFvhorVcQQEBJO+Qfc5GMEk1IIh7rMTH4gEuAps8pAOUNr6voG9tqvs0FwUAAwJFwM3HHXpgzOXk2L1OBSoS2OcPlXCbuT0D54vcr60KcxMh9hWU54WJLYYKG92dwXn1xRFzJL2WzNOw6pBmX0m3wFS31CP84nHtffPDBR1X8EYt1VmT0eKhjWFsa6VZFx4wnbHzZfa/LrcW0YS+Q9PdZS7PyxMoBD/AngX7EeSi42eQUGgccIVse4fNeMObTpTxaYcoBRbWGpwxgR5mqv+f+dxJSUK+RSsSc X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff843b07-8dcb-4460-cd71-08dad778ef9a X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 10:59:24.3230 (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: o7f+Ay41etmmNINIPp9WnTph94tvrao1N0tleqli+v/1/iqjkEakFid0uZ5N0SObpeFCXnmFJBy3v8de/MnZ9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5131 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 d0e018628f5d..d954d8f7cb0a 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 Tue Dec 6 10:58:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13065678 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 9BFE5C4708C for ; Tue, 6 Dec 2022 11:01:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232748AbiLFLBD (ORCPT ); Tue, 6 Dec 2022 06:01:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234606AbiLFLAE (ORCPT ); Tue, 6 Dec 2022 06:00:04 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2060.outbound.protection.outlook.com [40.107.93.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 957BD24BD4 for ; Tue, 6 Dec 2022 02:59:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X/pyRoa5jlJzsEzQUl7eF3VN/5cOyyUiEAl6xYygcxrBRYht7/M2sekRHNmRxxKQIJvyJdy4Kf21c7xQPliKZEy1UluEWGH7nojm7FCbqPD2F0BTVrsngdLa3sU3cBYTrB1X2M8MADte6RE3Z4TlytddMC86G1qFd99MLf9C9c5OTtwZpaK2UasBq9CJn2NmVaWMls6K0gaRHuR1IMLCkd5Mc3Ag7RFAaHufZgyR2zF+aD5QtoQo/a5bJi80COOV/TTDntDHukkS2SlOuzCYEdSaIg1CXp5hR2gs7qOAFaCnIHD3ZxP5YezOK28gA+/RifFbytH/5IqGdhIRVa0NLw== 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=jxi5hqenPmGJZ3OiuNPNAdTZ04SsvqLcnKeAnCiatF0=; b=m/+KHykw/iXmgaQu/NI8bxkzS97Q7/qoAgqxD8UZvoGKNvNkT6Gj3H6UgTmfDGRZIHn0FgCqdPeGt/bAZDy8ZCL/X/F8xD0OaKDcyw42Iq5eBVSDS/+nGttARexylsjf+uMtRIgim5lXtnJWRyTi5NTp80stTIYsgi/OBNspVcKjMZEL+SNVi++RdZbJIlgWtxAFzI23xlpGVdV8HKDgRW/O1xyubjTrptjgoxBbLw+IO0GF/YNS/xt/ElIgZnyGokmOM3Hkd3Fi6TnNpbwyODAKWS2vYKfU+UE+yQ3LRonsOEyIENZ0TpTkVt7VViBrdrwgzpADAm/DObJuvHX3eQ== 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=jxi5hqenPmGJZ3OiuNPNAdTZ04SsvqLcnKeAnCiatF0=; b=EVNS6jGDBGmCgZi2DQzCSdEQB/+vzv3TTuGW1RazwoO3xNces5Z0WXjGXIvWFOfwTVztbLiB/+jvFlapbbN57kYIJGQat+RuDXkUdfvgBpCv9wx4ivrTBngMF7BsdhG6GHzBAVfpHl3+xCH5TnUdqgz9mEsKwEeHRk2NBVuVJRgxODmqwmgOpEr1prjSmMfR7BtoElo9NnV8lLT+/e6cEks1DCQyvhNhCqXIB/a2MmEb2gXIKl8lzZ6GftRAbheAr/DzmB1q+DIvYrSkf3Hk+lG1o+02HsQ03+oToFDFE0mi868NcP+zFGH8LZMVGspTifx4JNYWrLEMB8TZ6JohMg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by BN9PR12MB5131.namprd12.prod.outlook.com (2603:10b6:408:118::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Tue, 6 Dec 2022 10:59:30 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a%3]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 10:59:30 +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 v2 8/9] bridge: mcast: Remove redundant function arguments Date: Tue, 6 Dec 2022 12:58:08 +0200 Message-Id: <20221206105809.363767-9-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221206105809.363767-1-idosch@nvidia.com> References: <20221206105809.363767-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR08CA0131.eurprd08.prod.outlook.com (2603:10a6:800:d4::33) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5131:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ff7509e-116e-49b0-6bba-08dad778f341 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 79JyIDqREkeWxkbgXBYqLKagbOuhGgR+Rz9OTz/AMmcM2ZfYWC8q7EDFKr60Db+P66/hTMOuvy9/rtqX6BcncnOulSM+VbYdLb2RUfEGGg5g9uZky0QVQ6Uyxe1MYToc3uEQY6C6weLZrzUzaXQLYo33ud56pjkCNJQQtxiEeD7VaPNwPwrv969OjlunwVuzsfPlySqBAF74qghR1QZRRRW16nIft7P1tooNQ++FOqEsFtSyZufecIXtNUDN0DyDlz1kcTBUJyVaawCZ25QABwLb/0bsJHTJ/6UjPkFJTt7PXkkfU2S8TrBYmaskzXZTunbEUfzfAtnOu7At4efBeiUU5/dXS20L4LEMsJMxvnrbY3UzJ7KQnUYPPwfFIJ2SM7Irke/zZ7qqZN7nPfqxAWP6c5WHX4UzgJdMGPrsRygsvGQ2g7GmdnWD2DRur8DXw3WWw2BUxXahbx0fegSg5DNPDi+WiMq5oJh1I5mSeaF1+CSe+MET3nPVwzUM4qG7FCdkyRpauEpF4Mg1NvPYgh62qKY8H0bmn8zWOBe3tCG6v0/lEnw2PAMN3bOsAkw+89NpPEgSEFhlKzYc8mJmdViM+96GFGZV4+E1q2oZggqBoJnBZCjOFQbbDtIDqMJ1Tc/bt+PoE8YjfbpoSfgN9A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(396003)(39860400002)(136003)(376002)(346002)(451199015)(36756003)(86362001)(38100700002)(6486002)(478600001)(6506007)(6512007)(26005)(186003)(107886003)(8676002)(6666004)(5660300002)(4326008)(2906002)(316002)(66556008)(41300700001)(8936002)(66476007)(66946007)(1076003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BTBT6GXFkSmGlJRe6lRDVkVS3xc+LDMFB57eVj+bFi6iqVSuR7JEkKV2n06tWLlm7X973Tn1Ogvt7hOyUgdh3Sh1ofHazng6seD1EhJlEv8oKsynI/aniIQTR4yJKXUK/suLtiS+hrSurhqOYenonzjFKRxC00LcKWUqcVdtJd9AaxXH6HC+Pk6DBn15TynIpe1xGi+X38bxTs+fYk4lRpmbz5ndHG/QAAxI8LpaVyQJlePJR5eTBYKt5fqnaBEZvKPJtt7oNwseixPhpXYBAuq4F7zFMqQRbuHzOrSS+SUuFqoBtOMGN1eQ0+u6camSxBiY6bSSuqCzhNwf66k6FyLcv7v4q+O4NrIQgzlRxEXjAYmSUe/7sNGsBQZRGmBaD5guq1S1tgv6DWVDe5poxuwFW1QKEbA+1tq6FRjlMzLuHJ6fwKjZL2UhyVhWsn2KdBOKJAhv3cNUPkhMkApD5Rxkkk1YMZnqnJlcz6T+KXbrKrAihc5Czfqt/B6gXg24K2+yKbgbkWR9Ek7/7pS0ny5l8ZF3LAh0s6kyTX9V2gsAUkKXYyZnNZJk+b5rzllz0VP7bgVarR4xrWBDkjm2w28CfPLjBu0Gt8wFR5LklL/4KqOPzHB0RWDKEymWAR4r8lyzaT/76ZJrEwVp3X/u97ItXzrAnpAfB27Oue49PK+po8VlCQfFG7G0BfDJHPlIfULlHTMPyKmILtnkgE6exUhqYQP/eXCqv7fyD+E2i/y0lOVjXaDW4UdnXBQ3FoWDzdHVhVv6JeAmG+hAPFTJB2Cau9vHpijwd/1aZbEifi8SH683MgO3aLLG1zADPepq2ugTfpLLr/y4WWtUCAa++9NEjbYaz6dNW8w9xfJdc39En9p2HJyp+ikztcP8djt9dqdTcCVcj06yXRph+1ceaHpdNTsKVRF/oTUw+SQaAdW3XC0YZMkeg6FHGKkLo1u0xtKl6X7VaRaPhxNDekvo27tywIuJcfXTfNbLYjVrcc+43z22Tll3y/A/lN+kOHVZrIb7geQyLoP7FB3u44JBgNdcJuJbJ4e8hIipP1apZ7WynPCyqMmFCdqZcQTkJhMnKiAfNrTL98dkJIopRL6X7EcmQxZXw5gX/w7AlTAaDiuz5Ho0bPhZR1Pvn8yDah7V+7NEClG/k4siAThsD6yg1glcx27CuDBA2oRNBX1zIIyxejWx2/45o6TgSTl9eNGD4dE8wxEIoaL4Ju3T0s5UEeVDbvZwrvgIg25y5Z9QBIxhUVP5LxSuXfaXIF94NyeuSR5dyxwJqwgwAui9oa0BdHyQ4s/gKkV/AZ1dejkNgri/lVPC+SWePUSvYmDmCHGxqL3HBj2ZBEsq+IlLy8Y4oMgS5pSbSTpdhugHMJMvqxmQoOPeqZx5Q6rKCnNy3SLlaEM4mDF+8QM7oTcjMnowE3wzVJBgjAuKbiSj+YUb6qKV84tJ+OobEJ116xr8oEraC1yUjan75Br3SAHHYrB+vOItNz+rp8kSRd96+F6X+epLyJTiR+pboSeGyOn0hgXgSIOTDGqNhwNfyou6DgdOf28UKCIPvcyRaqRHq8ZVjgCEC787pzxkM14upLeaCHLE X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ff7509e-116e-49b0-6bba-08dad778f341 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 10:59:30.4325 (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: tAuMZu0ElI8u7qOOe6nbZt+zs7mDsv1Cy3l4vYjNBvWBrUwiM6A5CGYJ8zG41CySoCxogSQ00dO/zomQeMfvSg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5131 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 d954d8f7cb0a..ae7d93c08880 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, - const struct br_mdb_config *cfg, +static int br_mdb_add_group(const 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(const 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; From patchwork Tue Dec 6 10:58:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 13065679 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 11239C4708C for ; Tue, 6 Dec 2022 11:01:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234594AbiLFLBF (ORCPT ); Tue, 6 Dec 2022 06:01:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232198AbiLFLAR (ORCPT ); Tue, 6 Dec 2022 06:00:17 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2044.outbound.protection.outlook.com [40.107.93.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EDDC22B13 for ; Tue, 6 Dec 2022 02:59:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H3qFuLZC0BB/N7Azb99NzipDlXYP4+DeriT8nsz+0TY6VRdLxx00iaoPMXcKwLd8oD1MREh7gYiD9+c0H1FudDGfNn5mNkLbeGmav+TatVCJqSli3WPBZARGMRJZjwL5TU4LyFbbftA53ErTMpPP/y94vvJPbkwsoQ0QqN6qGLAFvCLWHHrJ4SGE3tiZg0AqeifbsMjCYCUSbR89sGGrhNT+D32x9VRtH7QFfJMK5qWMbYPioJMLDQxQhF2zQ9/jHirorc1fzQwWa4woWUjljLJ5yxGy7gLJPa+t8sJqpPCGaiEZq6VuufVFrMoo5f6llcaoziYvoR0KWB0AjZWjHQ== 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=mXyHyrMzVsh1denck4pjX6bxuHTnUid3ejMf09nWG38=; b=QvsnsDzzCiFEH79YF9AeCfYWoS2kJuFPCRWP/y0ND0/6rpL5M7Sx2xBg22v8Yalp218xqim14NOpjse4coumyh5EFyFfoQKm2WEwYZL8L/HvHP+ukcDpx8JpQ2HiFqsW5ICJHeevaIoK6tdI1RQG+atlkXSAT/p8Hz/471i3wuG/Tx77bz9bofmovn77Vz2fC8CZYL3lr6G7CTE1jRMFubv9RONBwWoYf2c9I584i2EXMB0puyQhpgluRkXkusNBLLRu0JixheLr9EMsCqAXKAF2pViTrIXyi0Pubf1Gtk27rjUwIqttmaXaochqmLrXIA/1c+bheaw1USbXHwIFbg== 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=mXyHyrMzVsh1denck4pjX6bxuHTnUid3ejMf09nWG38=; b=K4LsxDdyCWdlPYIcKmKVo7mjkGScr7asZIiqSa6ZpaBrGYLje8ElYdIwSdQWEKU9xLSf/mLtq/PCUzxoxIuMMXwMLMTiro2aeMo4LG+cAVaEnuL5i4NQHLlCVQEmqFuNvjgQr0/splfPuSiKWCGDTtfWhnlSXOM1poOpjlZdJwv6Y/I0ZE+Kxw9ly3CTOCKZBYKiSuk0RP6mA27C7PUQLEIMFkxuwPQDpq0LKFYq0UrYgcSL26aiXv5apOCLlsxS+FZyf/IlY//j23IWxymRXzTVBzhHgwMW7WKIPBc7XcFrXPmurGnPjsN6PhCfzWTxaJL/1wU5oWVt5cF9NiTScw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) by BN9PR12MB5131.namprd12.prod.outlook.com (2603:10b6:408:118::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.14; Tue, 6 Dec 2022 10:59:37 +0000 Received: from CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a]) by CY5PR12MB6179.namprd12.prod.outlook.com ([fe80::a600:9252:615:d31a%3]) with mapi id 15.20.5880.014; Tue, 6 Dec 2022 10:59:37 +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 v2 9/9] bridge: mcast: Constify 'group' argument in br_multicast_new_port_group() Date: Tue, 6 Dec 2022 12:58:09 +0200 Message-Id: <20221206105809.363767-10-idosch@nvidia.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221206105809.363767-1-idosch@nvidia.com> References: <20221206105809.363767-1-idosch@nvidia.com> X-ClientProxiedBy: VI1PR06CA0141.eurprd06.prod.outlook.com (2603:10a6:803:a0::34) To CY5PR12MB6179.namprd12.prod.outlook.com (2603:10b6:930:24::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR12MB6179:EE_|BN9PR12MB5131:EE_ X-MS-Office365-Filtering-Correlation-Id: 15e05406-f033-430d-726a-08dad778f740 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 47f9D9ICJmKJdgDHDG4IreLkPiaqf0Du5zlfYUSATgwwT1/3eLYm9RN313XXbmI8KciUsbkjrHrgEzjQGTjFDjQ7Y2QWN+uzA3/3MCMBZuHCJUtHIwLdsLpFDOPScGbJyCFNEfvpf6gdYwa5WAuitNChWyKzryTkMxfcjGv02tlasMrv7OUcZX7ChhwtBSg6QICn91AsS3b8A33jmn69nwwb7qpDho2ThS5CKBn0X/Z9Pdc7l1NV71bzgPfg2yA2IkwScVJAzjjWb/LGimOw3Lnrx/dgeRBVGHIkBO/RJ93Rh+Bf+/SJibkixa7ljVpUn5OM4BYTUAL+PLzxKTshP028EXrKgHALbojd8N8Uhjcln4FA2E2twYyJTqy9J0qjjX1XooEsy/HPWljaghZVr9G9T0l8ZnBW7ksd2ourResijBDzvKLq6kyK5EVgO76XG7aQAl4PvAqFlroRkmTCDPXWADEvSh5JZo+fIfa39GKQbTWQ60Zq4SxdA+Pzfl46VCVT4mFkt514Bpds3Q+PfHd1oEhBDe4HdOp6f8khfuxy2qXrB+jU1wVciMa5E22nY0S/XHmsxI/RRlWpqPltg/4GKxb5NsWHVJcZ0mPcmybLIKSOMcW3wVdrTeCW2UXf4Lz2/eDp/bjNHyy4UQTBrA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR12MB6179.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(396003)(39860400002)(136003)(376002)(346002)(451199015)(36756003)(86362001)(38100700002)(6486002)(478600001)(6506007)(6512007)(26005)(186003)(107886003)(8676002)(6666004)(5660300002)(4326008)(2906002)(316002)(66556008)(41300700001)(8936002)(66476007)(66946007)(1076003)(2616005)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WmD1qhxvkhJtHF7PCb1XHh2szeuIziwD7VnjMhYv5CUtmgSX14sLQEV5sAKvIB2iK1a7ErZ0UDKlBqopP+7/mb62ldeGGxVZ2AKoiyNBuuAo6lxMyCms1ETCx/qdv1u0zz/+q77/Md2ovsCQBDay8uw3v9Ge3QK+5/+OOVOHZt+TXkyM7Pr0BN0/DmimLffKa1gZ4NhxZTzS00v9z2XGDcBo+EFNRgsBN/kDaNrVOlS0EsGzkp8utJPtOhQD1+6Pi/YwQhWvXnZ3owR8zmpBPgdW/SQagsUdPoxJrpebt7C0ArOGTFMUZmgDdJwTa4dsXDhrLBsn97/hP/ZqAEEMmZnl72tTM5k8PRISnnt6bNTWIDfhWMLCTFHzk4JchlGRadxJSeAyBFwgOa8ivNhada4W6b6i/xiiNceGgRsP+fqamJIzMOPqExc/D63ZM/3aH5VEGmx0NevEjBmUFgyq3D8UASsaPimuhO7i78Z/z8EXlY9Rt99UubU6H518etie12V/NmD7PhX+6fq6QRaVr7euJl+xKYm8UvJxrKkBbyayjLYMi8d7kzJcJd43zzDzraTH+1r5UJDSe/BHkCjah38f4FMTv749KLuZUtLrxdklk0aIFk27gjz7y+LTxtYEus97wBVKQA7wYmOFOEPv7rziGzzykzipAdcELPBhSOfI+SaENNtSQkLfpE3zyGtm8BYK2Q1Ez949P9jsKp3MTLIjDLfeuw9zJTP1xFRLdxscJaBum9e85IebetHRBN32/+KeVunADoCl8LQt+0/74b3Y1PJAWZUObpocXQBN07uTRuySd69opcO7n8uWePFK7AobB9qxGE8x+RCv3ud6V0s9mYBXRjjMKyiQNjIJplk5cbsfcp6h5ZmwfEI6qTEUFE0kCjzKDXCEqCA/8TkaKbGf/ljkDStOHlY1jZuHXuHM9Q06ddwv6ATKeonryc4hWhjqoBNvU6jgWcxKEo/rOv9pP0Ex2UbEXy4X0SOjorTqEmvOUAMk6ytqwSrMPFAiuFvR9hjRXo2SEufygL0w4XvD0zw+dM5AGgsrmd9apiNwRAsaD6uqxyMeK7h/3NX3yovmGFHBYKTf3uydiH3ZTIhgtIO5yUZq7d/cO6l+ktsbtdeY3syEdEhsFsSOgtfh1jHOiHF0hjBQsV7lWwhRTNXVdg+0twfKmnkfcw9rou6fSAZAGgLJKZVDNftFhge2eeWYT7bGXOCShyF79m5xbTa83QI8foEImsznzrTM8ITTIWV5h1jyLqxbzO1zWMyzlupAQjEjG15iL7A76Ho9h3UnpshPF5cCTomo3VbUdlweSrRufDCHu47NEF0VJ2rfaz5xEmIl9iS5+I9m5EjvelbW9qwsCKTN6GJh1yR9KHCSU7OdWK/7+IEjJ0GxA4q1iTjXTrS3Zw/BrmEdZu3tqdtweYJ6Hnh3GRYSkkDDuaUnKl0EfnViooz5m/Od3roLtVmaKiDJi0cUPDOn6kMZXi6q1rdjg4EMsyMLDI0mSV86/UjP7Gkq6lV8c0UHZOCIDO1UHW2nA7knj47bBvGDIqj1rIun/WKDNi+2nY/i+unFK5fdg6O5eMiKPWYXOarI X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15e05406-f033-430d-726a-08dad778f740 X-MS-Exchange-CrossTenant-AuthSource: CY5PR12MB6179.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2022 10:59:37.2777 (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: KV26s3lEAysocFfl7tYoz9+RxND7yed9ChnV24ujdCjNdjXyNfDEpxbQDXescGKFeHIOVQRyJvKVr0xxTjOXQA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5131 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The 'group' argument is not modified, so mark it as 'const'. It will allow us to constify arguments of the callers of this function in future patches. Signed-off-by: Ido Schimmel Acked-by: Nikolay Aleksandrov --- Notes: v2: * New patch. net/bridge/br_multicast.c | 2 +- net/bridge/br_private.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 5e988f0ed2c0..db4c3900ae95 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -1273,7 +1273,7 @@ br_multicast_new_group_src(struct net_bridge_port_group *pg, struct br_ip *src_i struct net_bridge_port_group *br_multicast_new_port_group( struct net_bridge_port *port, - struct br_ip *group, + const struct br_ip *group, struct net_bridge_port_group __rcu *next, unsigned char flags, const unsigned char *src, diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 0a09f10966dc..3997e16c15fc 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -941,7 +941,8 @@ br_mdb_ip_get(struct net_bridge *br, struct br_ip *dst); struct net_bridge_mdb_entry * br_multicast_new_group(struct net_bridge *br, struct br_ip *group); struct net_bridge_port_group * -br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group, +br_multicast_new_port_group(struct net_bridge_port *port, + const struct br_ip *group, struct net_bridge_port_group __rcu *next, unsigned char flags, const unsigned char *src, u8 filter_mode, u8 rt_protocol);