Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1215399pxb; Wed, 10 Feb 2021 03:06:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJz40WxlB6vBSO6jpvc5XenW8+09nCyvoSD4lqtNZH7Lr6PJbq/M/oIoAohYslzrLDOXZyW6 X-Received: by 2002:a05:6402:206f:: with SMTP id bd15mr2653966edb.342.1612955171557; Wed, 10 Feb 2021 03:06:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612955171; cv=none; d=google.com; s=arc-20160816; b=bFOGymhIVpUVJpTwAl+/dIydYwknG2IHFZD2iqRbtK9dFMVTfKLeqW9Hclk2pLf4Uq wqU4kjAYJ1subXGxPKeK9K8hBc0bRc3YuTveGDgUQN9PdnjAjaDU8S7OIGiAA9H1K1Os P/wx5iz2TqD+Te/PwBiipRuhxhIJFSUUBB0lhcNXqAMK8yMowxHAv3l5jNa00wcItK5w i+WI8uJ6Gjkjb0dOb1Wwk+MlhDoWMGXGNG1owd4HqbPH+BiTIYqUR9F47Cx4Q1EWa1iv 5hd1rMqfyLMmthMsPR273QjCmhtOygam8f3da7zv0Bl+4nJThPYfTpuq43rAb3wIsWni B9ew== 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:dkim-signature; bh=5fXHGYxrTC05uatkM7mitonKpiC7Bf6g34qbrlEBtbI=; b=cLITVNNaYyi8SM40/IBU+yVQ6DtcnRNvjs0jnu4s/+ujeseG87skKwtYwUKTrvKwgw DQYqr8Lr2p+fHnQ73UDgvB+lBKSC6VwJsot77obw+E0Bdx6A9eo5Caq4uuiqcWICKdmO sVRLkW6a+WzyI9zw/5bov6z18vpShhNpMhCEmCSAvzH0mid05xDGhuJ73onftyBiCir5 7Xq4sYZBLF/RVF9YUiYSjp5r6pgxwGYds6wF365qydOMQ7dNJRWAmDrmVtfD4jyRMWiY Pz8lbi7PLT2OdK6kKyQ+YQMgLuFPvtgtM/3bIhrVWVyXKM1/XvIEWDEHse2fMRi1chWM 7LRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=at1X+c2F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r13si1070299ejz.437.2021.02.10.03.05.48; Wed, 10 Feb 2021 03:06:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=at1X+c2F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231496AbhBJLDQ (ORCPT + 99 others); Wed, 10 Feb 2021 06:03:16 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:52755 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbhBJLAl (ORCPT ); Wed, 10 Feb 2021 06:00:41 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 328AC580324; Wed, 10 Feb 2021 05:59:55 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Wed, 10 Feb 2021 05:59:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=5fXHGY xrTC05uatkM7mitonKpiC7Bf6g34qbrlEBtbI=; b=at1X+c2FFqoR2jFLPaHr1d yGhAM34eDzIBMRNapWY8+VUEC/TmkZ084CKIrfWdRFIM1H/1b6dVxKh9nx0EIbfL rGA9VnThnFISRUKQx/2LTY054kmJuePF46eJjOzQ9MFRrcuTia2vklPuVkS236y1 SUqfO7qMtKDlnh7Z/5f1rZBpE/BkxB6WIH9IikGLn110LovjtAzosWbsLxJCTU74 e08In/xIwgktwJKaB/ZGPA4EcV5EWOA2cza8KiSINZYV0SDCaQdr+Tl7f2Al4yqq O0zda5STP5HavurJfYdnTP1W6iXPqU2ZdscLGGTrA9XAojBgQ8dKFoZswuv+YsqQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrheejgddvvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepkfguohcuufgt hhhimhhmvghluceoihguohhstghhsehiughoshgthhdrohhrgheqnecuggftrfgrthhtvg hrnheptdffkeekfeduffevgeeujeffjefhtefgueeugfevtdeiheduueeukefhudehleet necukfhppeekgedrvddvledrudehfedrgeegnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepihguohhstghhsehiughoshgthhdrohhrgh X-ME-Proxy: Received: from localhost (igld-84-229-153-44.inter.net.il [84.229.153.44]) by mail.messagingengine.com (Postfix) with ESMTPA id C464B24005D; Wed, 10 Feb 2021 05:59:52 -0500 (EST) Date: Wed, 10 Feb 2021 12:59:49 +0200 From: Ido Schimmel To: Vladimir Oltean Cc: Jakub Kicinski , "David S. Miller" , Andrew Lunn , Vivien Didelot , Florian Fainelli , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, Roopa Prabhu , Nikolay Aleksandrov , Jiri Pirko , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Vadym Kochan , Taras Chornyi , Grygorii Strashko , Ioana Ciornei , Ivan Vecera , linux-omap@vger.kernel.org Subject: Re: [PATCH v2 net-next 04/11] net: bridge: offload initial and final port flags through switchdev Message-ID: <20210210105949.GB287766@shredder.lan> References: <20210209151936.97382-1-olteanv@gmail.com> <20210209151936.97382-5-olteanv@gmail.com> <20210209185100.GA266253@shredder.lan> <20210209202045.obayorcud4fg2qqb@skbuf> <20210209220124.GA271860@shredder.lan> <20210209225153.j7u6zwnpdgskvr2v@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210209225153.j7u6zwnpdgskvr2v@skbuf> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 10, 2021 at 12:51:53AM +0200, Vladimir Oltean wrote: > On Wed, Feb 10, 2021 at 12:01:24AM +0200, Ido Schimmel wrote: > > On Tue, Feb 09, 2021 at 10:20:45PM +0200, Vladimir Oltean wrote: > > > On Tue, Feb 09, 2021 at 08:51:00PM +0200, Ido Schimmel wrote: > > > > On Tue, Feb 09, 2021 at 05:19:29PM +0200, Vladimir Oltean wrote: > > > > > So switchdev drivers operating in standalone mode should disable address > > > > > learning. As a matter of practicality, we can reduce code duplication in > > > > > drivers by having the bridge notify through switchdev of the initial and > > > > > final brport flags. Then, drivers can simply start up hardcoded for no > > > > > address learning (similar to how they already start up hardcoded for no > > > > > forwarding), then they only need to listen for > > > > > SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS and their job is basically done, no > > > > > need for special cases when the port joins or leaves the bridge etc. > > > > > > > > How are you handling the case where a port leaves a LAG that is linked > > > > to a bridge? In this case the port becomes a standalone port, but will > > > > not get this notification. > > > > > > Apparently the answer to that question is "I delete the code that makes > > > this use case work", how smart of me. Thanks. > > > > Not sure how you expect to interpret this. > > Next patch (05/11) deletes that explicit notification from dsa_port_bridge_leave, > function which is called from dsa_port_lag_leave too, apparently with good reason. > > > > Unless you have any idea how I could move the logic into the bridge, I > > > guess I'm stuck with DSA and all the other switchdev drivers having this > > > forest of corner cases to deal with. At least I can add a comment so I'm > > > not tempted to delete it next time. > > > > There are too many moving pieces with stacked devices. It is not only > > LAG/bridge. In L3 you have VRFs, SVIs, macvlans etc. It might be better > > to gracefully / explicitly not handle a case rather than pretending to > > handle it correctly with complex / buggy code. > > > > For example, you should refuse to be enslaved to a LAG that already has > > upper devices such as a bridge. You are probably not handling this > > correctly / at all. This is easy. Just a call to > > netdev_has_any_upper_dev(). > > Correct, good point, in particular this means that joining a bridged LAG > will not get me any notifications of that LAG's CHANGEUPPER because that > was consumed a long time ago. An equally valid approach seems to be to > check for netdev_master_upper_dev_get_rcu in dsa_port_lag_join, and call > dsa_port_bridge_join on the upper if that is present. The bridge might already have a state you are not familiar with (e.g., FDB entry pointing to the LAG), so best to just forbid this. I think it's fair to impose such limitations (assuming they are properly communicated to user space) given it results in a much less buggy/complex code to maintain. > > > The reverse, during unlinking, would be to refuse unlinking if the upper > > has uppers of its own. netdev_upper_dev_unlink() needs to learn to > > return an error and callers such as team/bond need to learn to handle > > it, but it seems patchable. > > Again, this was treated prior to my deletion in this series and not by > erroring out, I just really didn't think it through. > > So you're saying that if we impose that all switchdev drivers restrict > the house of cards to be constructed from the bottom up, and destructed > from the top down, then the notification of bridge port flags can stay > in the bridge layer? I actually don't think it's a good idea to have this in the bridge in any case. I understand that it makes sense for some devices where learning, flooding, etc are port attributes, but in other devices these can be {port,vlan} attributes and then you need to take care of them when a vlan is added / deleted and not only when a port is removed from the bridge. So for such devices this really won't save anything. I would thus leave it to the lower levels to decide.