Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2066767pxp; Mon, 7 Mar 2022 07:49:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzpvn0SVZQnTQUmdStAQ6LbIl6MnOofuMC8ftxfHwrV5M7hXVEQCAg010Yr7QNLnBHHd87H X-Received: by 2002:a17:90b:4a46:b0:1bf:7920:c7f7 with SMTP id lb6-20020a17090b4a4600b001bf7920c7f7mr2457801pjb.128.1646668145332; Mon, 07 Mar 2022 07:49:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646668145; cv=none; d=google.com; s=arc-20160816; b=fhKGA57VuwDXuhUkZ+E/vnBuVsQ6SVje3CuEoBFEZ6agD5LKqNHaqEd4vM6qdJZx8d cYYT2hCnPZ43wkSABcke+Vg/9fzLDkyUZYQMKDAUEYgz9l3Cg1oFG08qZxNR9Mw50IfL +E/tJszW2v1WWOM2zS3hPlWHnWdQtbeI/JAfB7IslQ9Ej/rcguaVcd9IG9qiBJnZmJi+ nnAe8rBsiASjhph55meJBnSxzUzxUlCAy+WRSbXsALXDLRQSU0VeBBvVGGp9ycGdYaT0 9+txOjA+crbjj/Qa8TOKnN8sDmhi5qClEGveGt2hpKxAhjGX0CPe4Xj3wvP+2VQVPBd2 7mgg== 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=1jGYNh9y1jCRU2Ce5sNN/KIt4KeyZCiwBUd3+H3/o08=; b=qcBIcf0h6AgXF5v2ICgFg+bg13sdyICqnR4hAb49JKQhZ/PamDlxpoHEUDHHdp0YUN wu38UCKttqqqCJhHjVvOToSuHugjV3bsZKR08dn3O803S/zuextD7ZyGd8n7FgnwB1nc Iy6jXtn4ELVZ2IGAshotU6rXh9GF1d3PTfFe1XtVfQ2i4Ovv/EIWM4EzddIOnE+jRcB0 67vEyvGPP3iGb0W2FOJHE0LkSjEn+mbgH5hYTpMesgH5uIrNts316CCl2EvTeXFt1tJf dHRie5xfvhMyUi7zHKEZ1d8uz8GWKzVBW9fhKyx8NYcD55fijBCOiwuKkEnpAZYDTuaX x5cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@blackwall-org.20210112.gappssmtp.com header.s=20210112 header.b=EPe6VKyT; 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 s14-20020a63f04e000000b00373ad996c9dsi13028437pgj.288.2022.03.07.07.48.48; Mon, 07 Mar 2022 07:49:05 -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=EPe6VKyT; 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 S237342AbiCGPEP (ORCPT + 99 others); Mon, 7 Mar 2022 10:04:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243629AbiCGPEK (ORCPT ); Mon, 7 Mar 2022 10:04:10 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A69AE1D0D0 for ; Mon, 7 Mar 2022 07:03:06 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id a8so32565378ejc.8 for ; Mon, 07 Mar 2022 07:03:06 -0800 (PST) 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=1jGYNh9y1jCRU2Ce5sNN/KIt4KeyZCiwBUd3+H3/o08=; b=EPe6VKyTN3nTIzc2Xu7I2TzJ81mO0rAjis5e8dPqpR3ke+IxwnOlBfNPx+2ws/yGE3 6N4/8USZpMXGOwMkBkqaPsVFdpV8/CL4M6KipioCaKru2ps8txN/LvRTjfo3odLRts6j fi+KihWJv3uBnoAWDW/kotNPPjMlBie/FtXtowgGvSNW5z1WUt6J+yYac/cEsP5deNzy MA/WWVTVHSo3WhWOdvDyX/xgxHTh5EllYSTqr1Fwj2IiAvONMN961PLJ9mcXqr8FOl2c GrZBmpYQfZ3YXMy3aolMw9hj5Rniup+pGJVxlRmHJbWomoHnT+ZUyYSJXJ315/KKHgwj vM0g== 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=1jGYNh9y1jCRU2Ce5sNN/KIt4KeyZCiwBUd3+H3/o08=; b=AiT9Jq+PDOzPqF1YYxvQWxvm+4o7iqPZfFQgC07QCZsj++iF4GlAsI4mkWTrUPNHO+ hDE6tNvz+efl70IU0ht7jNk98lr0QORgBLAFrlrll/m6Qr5HVKZym6IOXfMj3lMqaA2F QsMSPiTJ3fxeI9SVXlj3Q/EOwte7Der9dMHrUNFEwA9qYY0wMPQom4WHivqIH0t3z38v rFEygYiPKM83Hhw1zoScL2JH+BhfbbKL7W5ST95fw/ts26MlMTkITPuWyKQw36klvzGj XNrHYmElKxZKgZ7tllKkzq9F0Aysn3Pd/IkR9Hr7Ws5NIHr4mIx7kP1JOFUw08tPGJa/ +FgQ== X-Gm-Message-State: AOAM530dukJZvZxLJIrEJ95Hr7bm0ZjyiDoy5yT7aKC8MYcLrFGD7NG5 T2TE6A6VRmHelNTh/Li/gQO6nQ== X-Received: by 2002:a17:907:7f03:b0:6d9:acb2:33ac with SMTP id qf3-20020a1709077f0300b006d9acb233acmr9165596ejc.705.1646665384867; Mon, 07 Mar 2022 07:03:04 -0800 (PST) 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 jl2-20020a17090775c200b006dabe8887b8sm3535382ejc.21.2022.03.07.07.03.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Mar 2022 07:03:04 -0800 (PST) Message-ID: <4fc171ed-98dd-2574-6373-f58b4b9e036a@blackwall.org> Date: Mon, 7 Mar 2022 17:03:02 +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 v2 net-next 03/10] net: bridge: mst: Support setting and reporting MST port states 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 , Cooper Lees , Ido Schimmel , Matt Johnston , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bridge@lists.linux-foundation.org References: <20220301100321.951175-1-tobias@waldekranz.com> <20220301100321.951175-4-tobias@waldekranz.com> <53EED92D-FEAC-4CC6-AF2A-52E73F839AB5@blackwall.org> <874k49olix.fsf@waldekranz.com> From: Nikolay Aleksandrov In-Reply-To: <874k49olix.fsf@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 07/03/2022 17:00, Tobias Waldekranz wrote: > On Wed, Mar 02, 2022 at 00:19, Nikolay Aleksandrov wrote: >> On 1 March 2022 11:03:14 CET, Tobias Waldekranz wrote: >>> Make it possible to change the port state in a given MSTI. This is >>> done through a new netlink interface, since the MSTIs are objects in >>> their own right. The proposed iproute2 interface would be: >>> >>> bridge mst set dev msti state >>> >>> Current states in all applicable MSTIs can also be dumped. The >>> proposed iproute interface looks like this: >>> >>> $ bridge mst >>> port msti >>> vb1 0 >>> state forwarding >>> 100 >>> state disabled >>> vb2 0 >>> state forwarding >>> 100 >>> state forwarding >>> >>> The preexisting per-VLAN states are still valid in the MST >>> mode (although they are read-only), and can be queried as usual if one >>> is interested in knowing a particular VLAN's state without having to >>> care about the VID to MSTI mapping (in this example VLAN 20 and 30 are >>> bound to MSTI 100): >>> >>> $ bridge -d vlan >>> port vlan-id >>> vb1 10 >>> state forwarding mcast_router 1 >>> 20 >>> state disabled mcast_router 1 >>> 30 >>> state disabled mcast_router 1 >>> 40 >>> state forwarding mcast_router 1 >>> vb2 10 >>> state forwarding mcast_router 1 >>> 20 >>> state forwarding mcast_router 1 >>> 30 >>> state forwarding mcast_router 1 >>> 40 >>> state forwarding mcast_router 1 >>> >>> Signed-off-by: Tobias Waldekranz >>> --- >>> include/uapi/linux/if_bridge.h | 16 +++ >>> include/uapi/linux/rtnetlink.h | 5 + >>> net/bridge/br_mst.c | 244 +++++++++++++++++++++++++++++++++ >>> net/bridge/br_netlink.c | 3 + >>> net/bridge/br_private.h | 4 + >>> 5 files changed, 272 insertions(+) >>> >>> diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h >>> index b68016f625b7..784482527861 100644 >>> --- a/include/uapi/linux/if_bridge.h >>> +++ b/include/uapi/linux/if_bridge.h >>> @@ -785,4 +785,20 @@ enum { >>> __BRIDGE_QUERIER_MAX >>> }; >>> #define BRIDGE_QUERIER_MAX (__BRIDGE_QUERIER_MAX - 1) >>> + >>> +enum { >>> + BRIDGE_MST_UNSPEC, >>> + BRIDGE_MST_ENTRY, >>> + __BRIDGE_MST_MAX, >>> +}; >>> +#define BRIDGE_MST_MAX (__BRIDGE_MST_MAX - 1) >>> + >>> +enum { >>> + BRIDGE_MST_ENTRY_UNSPEC, >>> + BRIDGE_MST_ENTRY_MSTI, >>> + BRIDGE_MST_ENTRY_STATE, >>> + __BRIDGE_MST_ENTRY_MAX, >>> +}; >>> +#define BRIDGE_MST_ENTRY_MAX (__BRIDGE_MST_ENTRY_MAX - 1) >>> + >>> #endif /* _UAPI_LINUX_IF_BRIDGE_H */ >>> diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h >>> index 0970cb4b1b88..4a48f3ce862c 100644 >>> --- a/include/uapi/linux/rtnetlink.h >>> +++ b/include/uapi/linux/rtnetlink.h >>> @@ -192,6 +192,11 @@ enum { >>> RTM_GETTUNNEL, >>> #define RTM_GETTUNNEL RTM_GETTUNNEL >>> >>> + RTM_GETMST = 124 + 2, >>> +#define RTM_GETMST RTM_GETMST >>> + RTM_SETMST, >>> +#define RTM_SETMST RTM_SETMST >>> + >> >> I think you should also update selinux (see nlmsgtab.c) >> I'll think about this one, if there is some nice way to avoid the new rtm types. >> >>> __RTM_MAX, >>> #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) >>> }; >>> diff --git a/net/bridge/br_mst.c b/net/bridge/br_mst.c >>> index f3b8e279b85c..8dea8e7257fd 100644 >>> --- a/net/bridge/br_mst.c >>> +++ b/net/bridge/br_mst.c >>> @@ -120,3 +120,247 @@ int br_mst_set_enabled(struct net_bridge *br, unsigned long val) >>> br_opt_toggle(br, BROPT_MST_ENABLED, !!val); >>> return 0; >>> } >>> + >>> +static int br_mst_nl_get_one(struct net_bridge_port *p, struct sk_buff *skb, >>> + struct netlink_callback *cb) >>> +{ >>> + struct net_bridge_vlan_group *vg = nbp_vlan_group(p); >>> + int err = 0, idx = 0, s_idx = cb->args[1]; >>> + struct net_bridge_vlan *v; >>> + struct br_port_msg *bpm; >>> + struct nlmsghdr *nlh; >>> + struct nlattr *nest; >>> + unsigned long *seen; >>> + >> >> Reverse xmas tree > > Both of these lines end at the 28th column. Is there some other > tiebreaking mechanism that forces the reverse ordering of nest and seen? > > In a variable-width font, the nest declaration does appear shorter. I > remember that you did not have your laptop with you, could that be it? Ah yes, you're right. :) Sorry for the noise.