Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp939263pxb; Tue, 9 Feb 2021 17:21:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyFH+2nlxXdJGvicIqpo4hyD2F6FXoEis6VU/c2f8AhXOMKJpQ/BsAIqhwuANJcNSVMZiko X-Received: by 2002:a17:907:1629:: with SMTP id hb41mr446725ejc.197.1612920114826; Tue, 09 Feb 2021 17:21:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612920114; cv=none; d=google.com; s=arc-20160816; b=Vxvs8qC1Pep5Knj+xzotzGV95KsHHrMXbzATnlrHimGF3U3igqpRrKk8O33VO2J9FB OX+5IvIvaft6zs/XVXRMg3u+m4KE+xA/xpzcYGtt92pziywZQnEdPXVLkcmrBv2n7zKu 6qJR1K4d53q3vmVWiR1saq3pzaR8MvEsLlKhXn4RauejwiupAdcUgJZ76U2VTDco13OA obpItiCl2dgv8Mp3ZRZJ2C6Apdby6vtnXxiBY1QPsKt7QTYo1Z6vE1oRKbRoEuKJ7zvo /QmKbdHNBBloc2jRrbOHW5agWrBDuCSnTBXmyARKR9VblmeNDzUDhjjnl1YDdEBtyhb3 cV5Q== 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=If0a9DG+vl8Jyo4MLhR7mY6t7WMqf7KoKRp8rDPToCk=; b=lr/IUZ90spXNnZ8Ve+Atjlc2u3aq9Ntq7wyXssYsg8Tt9zsXASsz2bR9NYYUhNFF4e C8v1lw/XUNwnAVKy34+Dc4bz9QTnOI7CfUmKqk+8nRXTM306I7j61miZ/O0le4idSPQf ZDJddxLUPNrgHe7EEIs5v4t427l4/c2szc43k6xgaqoPMikaxsZ/8p+D7aDrcK+F/Ij9 9Lyfc1q5f44akNkzXBslMWKpzlfKmZSWJo4xTy8ByVsEKBF77o77wPLkLxdHAxI4+lnD Y/l682CPOzSXY+eDniauIbEtkPCuTSbkfJUoryTM/6oyUMs60WagddgDY+wEI1i+0zyW DF6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=Eijxwlpj; 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 fy13si248463ejb.62.2021.02.09.17.21.32; Tue, 09 Feb 2021 17:21:54 -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=Eijxwlpj; 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 S234263AbhBJBSo (ORCPT + 99 others); Tue, 9 Feb 2021 20:18:44 -0500 Received: from new4-smtp.messagingengine.com ([66.111.4.230]:35351 "EHLO new4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233935AbhBIWR2 (ORCPT ); Tue, 9 Feb 2021 17:17:28 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id D256F58010D; Tue, 9 Feb 2021 17:01:29 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 09 Feb 2021 17:01:29 -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=If0a9D G+vl8Jyo4MLhR7mY6t7WMqf7KoKRp8rDPToCk=; b=EijxwlpjAizDL0+dXE/wNW Muaw7NUG6HGq3B61vSEu12cmEUsUFET0BKJS3avziOX677RJdzJAlZmE6S/WX9wJ +MHJWCwuoIfyVT+Y9EpxZ35zAUtl0Dqw27zw44fJOq9wJunYvfOwUOGc6Mo7YDYj 5BZbRNqXkjWCTfdA7KB0fFJmTN9CtkFHJzjO7hRYvpU2x75ExIpP1+9r3PKLTJer gFAHezuHUsK/j8aJuGan8NZ5pJhj9hjWx/LtlVx+rEDnuVRrHSj8w+RtmFfjnC5x U7pLm8EmM6ZDLhCngCR7PH9D0wfzX/+uEsC/9kPD9LuTjWhcn3zl8wmYGCapxF1w == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrheehgdduheejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefkughoucfu tghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucggtffrrghtth gvrhhnpedtffekkeefudffveegueejffejhfetgfeuuefgvedtieehudeuueekhfduheel teenucfkphepkeegrddvvdelrdduheefrdeggeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhg 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 0E0C1240066; Tue, 9 Feb 2021 17:01:27 -0500 (EST) Date: Wed, 10 Feb 2021 00:01:24 +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: <20210209220124.GA271860@shredder.lan> References: <20210209151936.97382-1-olteanv@gmail.com> <20210209151936.97382-5-olteanv@gmail.com> <20210209185100.GA266253@shredder.lan> <20210209202045.obayorcud4fg2qqb@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210209202045.obayorcud4fg2qqb@skbuf> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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(). 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.