Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6097827rwl; Mon, 9 Jan 2023 04:17:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXual4cgBTHa8HOmb96SP0bCfttOmNAzoRJ01AdSKexggyKGDqgEmpjzHYKgxovWUji7GBZf X-Received: by 2002:a17:902:d2ce:b0:192:a4d5:55b8 with SMTP id n14-20020a170902d2ce00b00192a4d555b8mr59855312plc.52.1673266654891; Mon, 09 Jan 2023 04:17:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673266654; cv=none; d=google.com; s=arc-20160816; b=hUG7p6qv50DytOvHZdGQcvmDWIj4pFo08tcwJhNMm9i72l3QK3038khEOXI/hUhhzd RSXCu8rLy24qDfnaoKSRBuJBCoG+DqlayMUX+EZ5CS0OMKCc+AARa3PrfZDMle0GxQk7 cEC4HWmN5uIXfHxSHDfOwlInwnpBSUF+KzP0ln89EVFPCOHGfHYdQ7YZRNg1EEUwCPEy XUX9HAf+g8y9IixNdM3dzCn2EChHaZNz1MUe6WRvDjSgZlFeiRFcrY6LhHBak/t2DfeG Cvx8onvjYOnWLgwmwOEdb3qS6TXvFfqGecvymD4sY730XvbBbWsK2RSimjkoDw0NGpd2 RdTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature; bh=bboapEA3vdgSLWm56a8XSVtdTYNt0MFJHdjnyOsqZws=; b=JBRpUnlPEbXs9TK+lW0LnC9/lGRoJQ/kQXurQYrGxfseBOEmxLuHO1BmSbIPe+A76S AFvMQQWF5ZNF8qDA9P8SzOX0Z8pZiYj80u++25CC9JXD/I3NIpYpq/MZLo6b+RDJJDwJ 5ztpXHWQJW58tv8fODRxMDbtOb8qOV5nkaYv4cOiGFZUw0CmEMgHz3TezEPqCCMykwLU HONt7KKzwMLydEG7LUIeyuSPYFdRBc8w8gzhsuwINwv8sgHYaoRif9deGpjhZxMiNCCJ VSu99nezASNgQjaWRMHamD4Lldsf1OLEMsY+XHX04lvI/IGRZJFxf6iF5aPIxZGQ7sja dzfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Wx0NqN6y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n3-20020a170902e54300b001733a212ccfsi9508043plf.330.2023.01.09.04.17.28; Mon, 09 Jan 2023 04:17:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Wx0NqN6y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbjAILoh (ORCPT + 53 others); Mon, 9 Jan 2023 06:44:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237239AbjAILny (ORCPT ); Mon, 9 Jan 2023 06:43:54 -0500 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 686982DFC; Mon, 9 Jan 2023 03:43:53 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id A5BC23200564; Mon, 9 Jan 2023 06:43:50 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 09 Jan 2023 06:43:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1673264630; x=1673351030; bh=bboapEA3vdgSLWm56a8XSVtdTYNt 0MFJHdjnyOsqZws=; b=Wx0NqN6ygqqa2SxoxoROtpr3/Hkbs+nwqruUtIS5aAHG 16wXZLBSnARXMXgHHSxdbG2ij4c9Yya9lLt1jOBREFxoQh+M3NJgjcj27pGEzhcn YIJcw3o8XqWiGakmWB90s0YiZI0zZ4T9wPRsSy0A1niEpuI+uuIyViMCFnYfZ6/x BYDqMF4Up7zindbrNkHZcZqD1Y+38daStRBtr7/c0VBgcoo3PEfHqcC/rXda5Fov wom76CULKqAEh5HbBGGHmMuhxiEZYKaKz8kDKDE1osJPHqDf5tqP5/fgHj4K7ddA AmEbhnuCFUHqqcH6a0HTR7Hk+6HvVQ3n1TezoqHh6A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrkeeigddviecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefkughoucfu tghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucggtffrrghtth gvrhhnpedvudefveekheeugeeftddvveefgfduieefudeifefgleekheegleegjeejgeeg hfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehiug hoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Feedback-ID: i494840e7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 9 Jan 2023 06:43:48 -0500 (EST) Date: Mon, 9 Jan 2023 13:43:46 +0200 From: Ido Schimmel To: Vladimir Oltean Cc: Tobias Waldekranz , davem@davemloft.net, kuba@kernel.org, Nikolay Aleksandrov , Andrew Lunn , Vivien Didelot , Florian Fainelli , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Russell King , Petr Machata , Ido Schimmel , Matt Johnston , Cooper Lees , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bridge@lists.linux-foundation.org Subject: Re: [PATCH v5 net-next 01/15] net: bridge: mst: Multiple Spanning Tree (MST) mode Message-ID: References: <20220316150857.2442916-1-tobias@waldekranz.com> <20220316150857.2442916-2-tobias@waldekranz.com> <20230109100236.euq7iaaorqxrun7u@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230109100236.euq7iaaorqxrun7u@skbuf> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 09, 2023 at 12:02:36PM +0200, Vladimir Oltean wrote: > On Mon, Jan 09, 2023 at 10:05:53AM +0200, Ido Schimmel wrote: > > > + if (on) > > > + static_branch_enable(&br_mst_used); > > > + else > > > + static_branch_disable(&br_mst_used); > > > > Hi, > > > > I'm not actually using MST, but I ran into this code and was wondering > > if the static key usage is correct. The static key is global (not > > per-bridge), so what happens when two bridges have MST enabled and then > > it is disabled on one? I believe it would be disabled for both. If so, > > maybe use static_branch_inc() / static_branch_dec() instead? > > Sounds about right. FWIW, br_switchdev_tx_fwd_offload does use > static_branch_inc() / static_branch_dec(). OK, thanks for confirming. Will send a patch later this week if Tobias won't take care of it by then. First patch will probably be [1] to make sure we dump the correct MST state to user space. It will also make it easier to show the problem and validate the fix. [1] diff --git a/net/bridge/br.c b/net/bridge/br.c index 4f5098d33a46..f02a1ad589de 100644 --- a/net/bridge/br.c +++ b/net/bridge/br.c @@ -286,7 +286,7 @@ int br_boolopt_get(const struct net_bridge *br, enum br_boolopt_id opt) case BR_BOOLOPT_MCAST_VLAN_SNOOPING: return br_opt_get(br, BROPT_MCAST_VLAN_SNOOPING_ENABLED); case BR_BOOLOPT_MST_ENABLE: - return br_opt_get(br, BROPT_MST_ENABLED); + return br_mst_is_enabled(br); default: /* shouldn't be called with unsupported options */ WARN_ON(1); diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 75aff9bbf17e..7f0475f62d45 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -1827,7 +1827,7 @@ static inline bool br_vlan_state_allowed(u8 state, bool learn_allow) /* br_mst.c */ #ifdef CONFIG_BRIDGE_VLAN_FILTERING DECLARE_STATIC_KEY_FALSE(br_mst_used); -static inline bool br_mst_is_enabled(struct net_bridge *br) +static inline bool br_mst_is_enabled(const struct net_bridge *br) { return static_branch_unlikely(&br_mst_used) && br_opt_get(br, BROPT_MST_ENABLED); @@ -1845,7 +1845,7 @@ int br_mst_fill_info(struct sk_buff *skb, int br_mst_process(struct net_bridge_port *p, const struct nlattr *mst_attr, struct netlink_ext_ack *extack); #else -static inline bool br_mst_is_enabled(struct net_bridge *br) +static inline bool br_mst_is_enabled(const struct net_bridge *br) { return false; }