Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6094023rwl; Mon, 9 Jan 2023 04:14:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXvTxbDA2x3wPVTl/NNRUKNtDTKmSd6lQ++tTeuMEHD7NkD9ehKI0fVf4oLbkDTbp9Awtved X-Received: by 2002:a05:6a20:4995:b0:aa:7eab:25a5 with SMTP id fs21-20020a056a20499500b000aa7eab25a5mr72339736pzb.34.1673266469264; Mon, 09 Jan 2023 04:14:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673266469; cv=none; d=google.com; s=arc-20160816; b=GTkEAcwc1p5iGPdL6sgIOOkONtbu6gC+tbxvll+wtsK/MjY6s1GaxG8rtGNvnGoUGS skrYrWWfbCp6B5ab0cokmFURn/E8ggQQ5JDPYJDqFqv/rB5hXup65gDtNoxzj8DVa3TH QDMjO4w/ZAy0VTKxDK5GE0tdV81T7WVJI8uO6E+8NZZzeRVeNsxC/qCiWXXhBqncm/fM 9wX0fZFf97eLuFi9/vJxgnUKuHm9CTRlkwz7Obz5Ww6AZj/pPMdH1hBuNOV1FL7MGKmt sVtT0BfefjC+f9g5H/niTqIJMcjlN2yU3z9OyaItp77AjsiAaTWLenNZOdKRGhhIDz8c I5iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Ozl2+3CNbOGcFgir3rEQ41Ac/ijTRZdlB8u+sHLq/PU=; b=Kob+MlOSihVuDPxlA/VzI/qdXxxLZ7acXPvgQLzeuS7P3BsZQQQaPUzbDptkRWC818 R3VKjja0zJ42EDPDL3Qq/hijmlcneZ+6TOnXtZjdIukWpY0otvvWVr/JVR6GvR3EvjZY aYkxXEgaim8bMkl1iGyTlBka688NgTRG5LzNTHWq2xEIPbLdIwSG0D33vBLz5xmYfiIU Q8zAHfJcksPMm9X3/bC+5morvy6tg0tNxB/W1o7sMTBxSNfXvyT1JUDCL80O+seaEhSL 0yDnjnEcmtu9veq12fRskjRjYu2k47D5FZF9gMhYlhtxKAwACipfe+lHzE1sF85tfBC7 Clsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@blackwall-org.20210112.gappssmtp.com header.s=20210112 header.b=q26NSJL3; 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 h64-20020a638343000000b00460dd0eed0csi9649452pge.176.2023.01.09.04.14.21; Mon, 09 Jan 2023 04:14:29 -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=@blackwall-org.20210112.gappssmtp.com header.s=20210112 header.b=q26NSJL3; 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 S234085AbjAILwL (ORCPT + 55 others); Mon, 9 Jan 2023 06:52:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236602AbjAILvq (ORCPT ); Mon, 9 Jan 2023 06:51:46 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A33B55BB for ; Mon, 9 Jan 2023 03:51:45 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id ud5so19417191ejc.4 for ; Mon, 09 Jan 2023 03:51:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Ozl2+3CNbOGcFgir3rEQ41Ac/ijTRZdlB8u+sHLq/PU=; b=q26NSJL3gz3bQkxp9t5GOIbI1B65qBaA4F8ov68W9DczLzoPzO9DY+3slzVvSPMCT/ nrqt8Go4OQ1zJE9Mv5eBhQLGs8/NRIqim0vDW/cZSkIlarBF8dHxwJ5aGHBjSP7s9Dik oTTQ1mrmPQoaFHgycujHEu/he05ymJraISQm5s+yR2koTXX6OCfnWNTipdrhuyBIB1IX U7xOtjuoL613xYIITDwipJGCFqnAC3hpJU3XICBkq308qnjSHnyOZ5q9IoERCu06kDu1 U8LZLFHLxVHBUP7wysgQJpR1Ykbzv5arkJyfI8RXKMIIfdvm/M4m6gi16ArzJUVQR0Tc jWVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ozl2+3CNbOGcFgir3rEQ41Ac/ijTRZdlB8u+sHLq/PU=; b=oQfuwFxZL4FwO2GM8K2tALrwdlnKrR8jCFj6kctLAagJmfEMyOVQ2OAxYPnsGXCDUu aExF2HMyaANeAsRp2+CEMV/pXI7t0UIlNcXS/C3rIKecMhE62pksW1UR9E0CnGJC2clk 0ZxuVfHP5OFytvR8UmfwpxyLb22psY4OFWfNCaA1EVCsNBGT1c4clBK84k2FrKI/FvmD Z7cqRm56yjirYOdr7PdXcpHiLKLQTzY0AmtbixKx24KWBdN6rsnwQA4mufRewxm5ev+K 4hRG/pnzd0pYDIni0+JxNoWehEZmfwhTenmPboHirjYxC5GW1Vp8FHqbAZYWZ0ZaUX2O /ozA== X-Gm-Message-State: AFqh2kpoJV0Ce6Ep2VOmTK8q5BLBGko6s2OLvjxB6cGWwNe4YO0R6k7s QOHkBIGriE29jG4GGaMqKvfeMw== X-Received: by 2002:a17:906:9e06:b0:84d:35e1:2781 with SMTP id fp6-20020a1709069e0600b0084d35e12781mr5356332ejc.46.1673265103679; Mon, 09 Jan 2023 03:51:43 -0800 (PST) Received: from [192.168.0.161] (79-100-144-200.ip.btc-net.bg. [79.100.144.200]) by smtp.gmail.com with ESMTPSA id y10-20020a170906070a00b0084ca4277a81sm3722993ejb.95.2023.01.09.03.51.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Jan 2023 03:51:43 -0800 (PST) Message-ID: <95f8b774-0b00-88dd-b890-2737d8a70592@blackwall.org> Date: Mon, 9 Jan 2023 13:51:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH v5 net-next 01/15] net: bridge: mst: Multiple Spanning Tree (MST) mode Content-Language: en-US To: Ido Schimmel , Vladimir Oltean Cc: Tobias Waldekranz , davem@davemloft.net, kuba@kernel.org, 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 References: <20220316150857.2442916-1-tobias@waldekranz.com> <20220316150857.2442916-2-tobias@waldekranz.com> <20230109100236.euq7iaaorqxrun7u@skbuf> From: Nikolay Aleksandrov In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 09/01/2023 13:43, Ido Schimmel wrote: > 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; > } Ack, good catch. This should've been _inc/_dec indeed. Thanks, Nik