Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3610143pxp; Tue, 15 Mar 2022 02:24:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrV4lhx0UaWR5m7SV2KM683kdtMsafDiB2GI7xVBPRqnXRvTHjdB5w42mzUV17n87VHTjX X-Received: by 2002:a05:6402:40d0:b0:418:78a3:883b with SMTP id z16-20020a05640240d000b0041878a3883bmr9941383edb.52.1647336293086; Tue, 15 Mar 2022 02:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647336293; cv=none; d=google.com; s=arc-20160816; b=QhG87McFVSqj1cYaDGaFIbMxNfkTS40ULSVW/BbWoBtXJ9Q8QfEe+1DuH6+DbJW4DN PES/PVv8+5jXsVFzHLJnbTFm5XXnwdOuCpXsodF9xnknXCCMUhGfL7j1/1P15KBgESvu JAkfeZk36kwHC2klqNMWs5B1KOIJea7AVntciSLrW9eu+YL67hs4OjEQ1WOfloFTjIEw Nnrpy9KQzCYVJYdOAIDUOT8NXmbAkDrPRGCro8Z+/o5jKQwoVdMs5/4EM/XA+Ur0tq2W ypm1Rd/Za5rXuGMCFRN3H8miJPKVDQapr7QXJdp7GMSaunGwTTV9csBsKfbKmoNwDUal AgJg== 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=A7EqDn+Rvpx8UXeNB7ju/W8rAWMhJLZzf0YL/c7EbsM=; b=Da7DQzAFAt4MrOU5r9aXtCvdQ667KIvcAAlsvaYlicuoPlALRiXONzSN+JZ5sQu3cb ITb3jAfXeW6FY0pwxfCIcXQ+FfII9NdD1o6XoWx8HB8iIh4qk0Gc7WO5rKyZzlRKu3DG zJ3GLm7oZt2FM53iEIsSydjDEZTrDp0e+hBoHg/BQLV26hRyBX3eFEVULKn5HWySK9XF fGqp3qpvVv/bsKh/Q7BpWtWN718aGHIMaKDJrTh+lV+PeRl45HGlnQKar0ZF8Jq1IDus XIBnoTixbEA4dIwMwwR4wr3CbuGKNf+1+osp7AlRh+/OZkNDh3RPcgGoeEpZMSgUY/+L pQVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@blackwall-org.20210112.gappssmtp.com header.s=20210112 header.b=R9FlibjV; 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 p20-20020a170906785400b006cd430acba6si10310519ejm.61.2022.03.15.02.24.20; Tue, 15 Mar 2022 02:24:52 -0700 (PDT) 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=R9FlibjV; 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 S232207AbiCNKo0 (ORCPT + 99 others); Mon, 14 Mar 2022 06:44:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236179AbiCNKoY (ORCPT ); Mon, 14 Mar 2022 06:44:24 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A38AB841 for ; Mon, 14 Mar 2022 03:43:14 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id kt27so32966028ejb.0 for ; Mon, 14 Mar 2022 03:43:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=A7EqDn+Rvpx8UXeNB7ju/W8rAWMhJLZzf0YL/c7EbsM=; b=R9FlibjV7YbRYHtNtmZ8gtRoaI/OqgLDDsvIOf3Nna/kMrJKoO2Diw1xJYXOdFMzNe eVfypM8Up5u0iHhizU6sIocI0SNbPJbzdQv8Ij8W7wpXkCKeh84v4GmDoVgvHii5FWT3 GdN6qq+nsKIYd0xgNHR41sr8NQUoSMz6Tofd9TsZXuGYp/bqCEt20UZK70YOM0qaL3lu Woy8tXCsY4dC5ScaFoePtavo0uiax78Jfoat3ahD9sOSepgUJZvvsZbvxT7XDlZ8xAwI kWe/+9uPXcsL9avWiyXaxxwl40n29bgAFDocnLoaPo5x2IvO5vKoO9+6CMwmWW3l+ouS ozMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=A7EqDn+Rvpx8UXeNB7ju/W8rAWMhJLZzf0YL/c7EbsM=; b=eFrPFo9y2d5jA6WmnF6qK7LDlUH6tm3KxSGUk8pVucEzsNHM/mKqh8MUJKsc1eQZPB AHkTRx0eNHvHnzbqBy03zwkNS99fb1aicJmDP3bGCbijCsLOuAmRWOqFTFLVKWQwCtdD C3JI/7+3Xnomcuo/B8/8LP2TlXZFkMQvDaydVQTuLTy5N6VIfY0pp4+N0xqv8XTez2Ak IUT4yoYaGiw0SWvbBmde8RGFD0CLjenDVo0IiOo5FMvgNq+L0/aigU02elN0vSA3AKf4 o+Ry/igcwXfdxy4m9p0KDv82ddsgjEyX2lXuPBXH2V3hgXBituZrrwI7G1/RK4V9RhXD Bf3Q== X-Gm-Message-State: AOAM533Z6gJT7vtsDt+uHqGxfx1nHRbgPNRWfS56OJ4s+tDjk2HOYezA UrUG03kVd1nPsa86FLdkkmMqBQ== X-Received: by 2002:a17:906:1613:b0:6cf:1161:eab6 with SMTP id m19-20020a170906161300b006cf1161eab6mr17257995ejd.315.1647254593012; Mon, 14 Mar 2022 03:43:13 -0700 (PDT) Received: from [192.168.0.111] (87-243-81-1.ip.btc-net.bg. [87.243.81.1]) by smtp.gmail.com with ESMTPSA id f15-20020a50e08f000000b004134a121ed2sm8023894edl.82.2022.03.14.03.43.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Mar 2022 03:43:12 -0700 (PDT) Message-ID: Date: Mon, 14 Mar 2022 12:43:10 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v3 net-next 08/14] net: bridge: mst: Add helper to check if MST is enabled Content-Language: en-US To: Tobias Waldekranz , davem@davemloft.net, kuba@kernel.org Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Russell King , Ido Schimmel , Petr Machata , Cooper Lees , Matt Johnston , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bridge@lists.linux-foundation.org References: <20220314095231.3486931-1-tobias@waldekranz.com> <20220314095231.3486931-9-tobias@waldekranz.com> From: Nikolay Aleksandrov In-Reply-To: <20220314095231.3486931-9-tobias@waldekranz.com> 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, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 14/03/2022 11:52, Tobias Waldekranz wrote: > This is useful for switchdev drivers that might want to refuse to join > a bridge where MST is enabled, if the hardware can't support it. > > Signed-off-by: Tobias Waldekranz > --- > include/linux/if_bridge.h | 5 +++++ > net/bridge/br_mst.c | 9 +++++++++ > 2 files changed, 14 insertions(+) > > diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h > index 46e6327fef06..5dbab0a280a6 100644 > --- a/include/linux/if_bridge.h > +++ b/include/linux/if_bridge.h > @@ -119,6 +119,7 @@ int br_vlan_get_info(const struct net_device *dev, u16 vid, > struct bridge_vlan_info *p_vinfo); > int br_vlan_get_info_rcu(const struct net_device *dev, u16 vid, > struct bridge_vlan_info *p_vinfo); > +bool br_mst_enabled(struct net_device *dev); > int br_mst_get_info(struct net_device *dev, u16 msti, unsigned long *vids); > #else > static inline bool br_vlan_enabled(const struct net_device *dev) > @@ -152,6 +153,10 @@ static inline int br_vlan_get_info_rcu(const struct net_device *dev, u16 vid, > { > return -EINVAL; > } > +static inline bool br_mst_enabled(struct net_device *dev) > +{ > + return false; > +} > static inline int br_mst_get_info(struct net_device *dev, u16 msti, > unsigned long *vids) > { > diff --git a/net/bridge/br_mst.c b/net/bridge/br_mst.c > index eb18dbd5838f..e5ab2ce451c2 100644 > --- a/net/bridge/br_mst.c > +++ b/net/bridge/br_mst.c > @@ -13,6 +13,15 @@ > > DEFINE_STATIC_KEY_FALSE(br_mst_used); > > +bool br_mst_enabled(struct net_device *dev) const dev > +{ > + if (!netif_is_bridge_master(dev)) > + return false; > + > + return br_opt_get(netdev_priv(dev), BROPT_MST_ENABLED); > +} > +EXPORT_SYMBOL(br_mst_enabled); EXPORT_SYMBOL_GPL > + > int br_mst_get_info(struct net_device *dev, u16 msti, unsigned long *vids) > { > struct net_bridge_vlan_group *vg;