Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1231625pxp; Thu, 17 Mar 2022 05:47:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVTHzc1IuJIrQJayQOKkCh6cXyiJhR5YJZ0On8hGnx1RG7Sq68CCm3XjA5d9ySL6Kf4ZiF X-Received: by 2002:a17:906:4108:b0:6db:867c:f3ab with SMTP id j8-20020a170906410800b006db867cf3abmr4233124ejk.708.1647521265674; Thu, 17 Mar 2022 05:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647521265; cv=none; d=google.com; s=arc-20160816; b=tabuYmZRZIv14N9j+NplnZRy9f6erLFsY4MLhETywfPfRV9/H7IIB/DAEsSqDOUlvC k1q0xIIeB/meLc0BmT3XhygY+ps/zQ+g/nWVumFwrZVYLCQt53lknHsL5p0twHW4+3FM WD5DkErzBn+JsDPDihN1FycUR+4Qv1U/GycdQ0ICvk1W/qhRAnxBeIGniXAx4MA2211A QZp3sH+qFLY4sIioGg+KLO62dVgnwX4i+tHlcL4HufvYx7zTpT6AwYHCLG0tC1lWfGUl aK8j0qa2mbTjV3ajtWNFXnFEXQblbUuFlRW8ZluMgdOE3WrYoC2IBsxMrFzyFjo/vDgn Ombg== 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=ioWEXzquDWHeeiOk5WANDAY/UZxcw0vNdnj9B/3BeGo=; b=sTqg9MIxaCVTmRAma/UykmN6SJbGmaxbp4tRwKp52Ufd78ZUVnXQqAUxpT6sb9r1F1 r88MgKmMw+CjNjIRwPx79G8t71iCwyGk0rlVOZ8PZ8fOi9g3j0mH8RIMRE1C2Ul3+taF g6IoabtU+xley3Kn+kx7mWd6R5pzNl4bUCJvbEuCZffaqgIX2D3foP2JVZJo/GXtlTPg +mqj0NwYZ8otOcjMCsamUrzzWDFnNeZcgHBt7qI6zedzafyJLB08XLeISznTB2MJMkkK aSz3WKanNLE9GhJ2P/9rlUDHB9Mg3k3QDDfvmxTTmlJ33R/vQWTJ1gZiZP7FxUpeSYCP XIvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@blackwall-org.20210112.gappssmtp.com header.s=20210112 header.b=wr0i6WMs; 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 g1-20020a1709065d0100b006cf37fdb0cfsi4128214ejt.936.2022.03.17.05.47.18; Thu, 17 Mar 2022 05:47:45 -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=wr0i6WMs; 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 S231544AbiCQJCD (ORCPT + 99 others); Thu, 17 Mar 2022 05:02:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbiCQJB6 (ORCPT ); Thu, 17 Mar 2022 05:01:58 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CCF61D08D1 for ; Thu, 17 Mar 2022 02:00:41 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id m12so5667211edc.12 for ; Thu, 17 Mar 2022 02:00:41 -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=ioWEXzquDWHeeiOk5WANDAY/UZxcw0vNdnj9B/3BeGo=; b=wr0i6WMsc5NWB3lT4XIYdpN/T5oViy8jhC4Qq7OKe5yVPedC/bYw/k+uEswkOh9v0x pjvsaTnbVZ7pF/BvztJniNmJGMciCT4MRWLt1FvV8WjCig/o1tWuHfMuRLPtTy/1wqEK NXbfqGB1Jht6f7v5IVU+iEUY7qOhDreTXPJbk/nWq1RgVD6Gd2/WccraK1WiWAfNl/q/ BhBGxR51HX1fzFNOVGrsZ2Y2aB1vqMMnLyYmlBdr42LASGLxkddTIv6Fo5P78Svkxsr2 9a0PE2Fu9Ed2M/2FhWoUe/ElqJF4ZOY0xUdgpUWSuozSHjFATLQWHPpTzkgc/NL6MWaL tt4g== 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=ioWEXzquDWHeeiOk5WANDAY/UZxcw0vNdnj9B/3BeGo=; b=SKS8wDgAuV64WoATG809csVa89go1YYveEZSaQbKhdlv/12jfOBVy0WD4pdCuSqq29 c9e353WyPNM83Lj8gWezrVIOKR5woGmrCptmGdbk1NXabXSWJEhSUwMcgB4qsU/xO0aq wJMTvja/gMkdg1rj9bucNx9SlUgoHsy8WFSmGpWgd/HtY5U84mYK/6xQldThS5pFP8H2 gPLc8q04zy6LljZMMRybWBkW1dpYL0Hkh5DWUX2mVIzmP4dMXd/DQEuEoyP4LcQ7P8fv lEqaIMR5/iRS+y6kwMhN4Va/on8GFR5f/O21EW8bGa51LoigJ4xh+Az4qpTpUwPbEJZ1 ZTgQ== X-Gm-Message-State: AOAM530/rBydKkpveEUlQcALM2BpQMFcSvBiYCEMqdFxMlR2MxXe/9Xd v3obnCAZX6NF3V2qDT26oE4J4w== X-Received: by 2002:a05:6402:4390:b0:416:a29c:660c with SMTP id o16-20020a056402439000b00416a29c660cmr3241202edc.149.1647507639752; Thu, 17 Mar 2022 02:00:39 -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 g11-20020a170906538b00b006ae38eb0561sm2090779ejo.195.2022.03.17.02.00.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Mar 2022 02:00:39 -0700 (PDT) Message-ID: <610eb6cc-4df4-f0fc-462a-b33145334a12@blackwall.org> Date: Thu, 17 Mar 2022 11:00:37 +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 v5 net-next 00/15] net: bridge: Multiple Spanning Trees 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 , 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> From: Nikolay Aleksandrov In-Reply-To: <20220316150857.2442916-1-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=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 16/03/2022 17:08, Tobias Waldekranz wrote: > The bridge has had per-VLAN STP support for a while now, since: > > https://lore.kernel.org/netdev/20200124114022.10883-1-nikolay@cumulusnetworks.com/ > > The current implementation has some problems: > > - The mapping from VLAN to STP state is fixed as 1:1, i.e. each VLAN > is managed independently. This is awkward from an MSTP (802.1Q-2018, > Clause 13.5) point of view, where the model is that multiple VLANs > are grouped into MST instances. > > Because of the way that the standard is written, presumably, this is > also reflected in hardware implementations. It is not uncommon for a > switch to support the full 4k range of VIDs, but that the pool of > MST instances is much smaller. Some examples: > > Marvell LinkStreet (mv88e6xxx): 4k VLANs, but only 64 MSTIs > Marvell Prestera: 4k VLANs, but only 128 MSTIs > Microchip SparX-5i: 4k VLANs, but only 128 MSTIs > > - By default, the feature is enabled, and there is no way to disable > it. This makes it hard to add offloading in a backwards compatible > way, since any underlying switchdevs have no way to refuse the > function if the hardware does not support it > > - The port-global STP state has precedence over per-VLAN states. In > MSTP, as far as I understand it, all VLANs will use the common > spanning tree (CST) by default - through traffic engineering you can > then optimize your network to group subsets of VLANs to use > different trees (MSTI). To my understanding, the way this is > typically managed in silicon is roughly: > > Incoming packet: > .----.----.--------------.----.------------- > | DA | SA | 802.1Q VID=X | ET | Payload ... > '----'----'--------------'----'------------- > | > '->|\ .----------------------------. > | +--> | VID | Members | ... | MSTI | > PVID -->|/ |-----|---------|-----|------| > | 1 | 0001001 | ... | 0 | > | 2 | 0001010 | ... | 10 | > | 3 | 0001100 | ... | 10 | > '----------------------------' > | > .-----------------------------' > | .------------------------. > '->| MSTI | Fwding | Lrning | > |------|--------|--------| > | 0 | 111110 | 111110 | > | 10 | 110111 | 110111 | > '------------------------' > > What this is trying to show is that the STP state (whether MSTP is > used, or ye olde STP) is always accessed via the VLAN table. If STP > is running, all MSTI pointers in that table will reference the same > index in the STP stable - if MSTP is running, some VLANs may point > to other trees (like in this example). > > The fact that in the Linux bridge, the global state (think: index 0 > in most hardware implementations) is supposed to override the > per-VLAN state, is very awkward to offload. In effect, this means > that when the global state changes to blocking, drivers will have to > iterate over all MSTIs in use, and alter them all to match. This > also means that you have to cache whether the hardware state is > currently tracking the global state or the per-VLAN state. In the > first case, you also have to cache the per-VLAN state so that you > can restore it if the global state transitions back to forwarding. > > This series adds a new mst_enable bridge setting (as suggested by Nik) > that can only be changed when no VLANs are configured on the > bridge. Enabling this mode has the following effect: > > - The port-global STP state is used to represent the CST (Common > Spanning Tree) (1/15) > > - Ingress STP filtering is deferred until the frame's VLAN has been > resolved (1/15) > > - The preexisting per-VLAN states can no longer be controlled directly > (1/15). They are instead placed under the MST module's control, > which is managed using a new netlink interface (described in 3/15) > > - VLANs can br mapped to MSTIs in an arbitrary M:N fashion, using a > new global VLAN option (2/15) > > Switchdev notifications are added so that a driver can track: > - MST enabled state > - VID to MSTI mappings > - MST port states > > An offloading implementation is this provided for mv88e6xxx. > > A proposal for the corresponding iproute2 interface is available here: > > https://github.com/wkz/iproute2/tree/mst > Hi Tobias, One major missing thing is the selftests for this new feature. Do you have a plan to upstream them? Cheers, Nik