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/aczUiA09bD4D7uddSe0eeQgYsWvJxG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/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;