Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2022702pxu; Sun, 13 Dec 2020 10:53:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwj4FLrGPSE86mcoK3gRU+E7xAf1y+rupv70Siq0rwffzlNms/+45ygiO22xxYZQYMGEnXN X-Received: by 2002:a17:906:c408:: with SMTP id u8mr19577165ejz.364.1607885618241; Sun, 13 Dec 2020 10:53:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607885618; cv=none; d=google.com; s=arc-20160816; b=g9tboRWliiwONsZ0vMWyh1hMAKTz09ikYiV9ozIo1KbJxG+Ym3yKDwEDHC5Q+7htj+ PPxqhPSKYhVmkAaJXar7tBTt6piLYfvVm0ME+z8bEngRzdPD5EVKAlCxJ5oWEBVidRPv J91QMPh6HOYAVxErnMMi/7O4uUPdnKf/1kpqOeIKcnKjNRWhth0my2gZAmi/rgdpZ+7s td4RHgKGsmWWz8sM7lF79S4NjsbgKdFGRp2WaFRsiG2K0BNMs3bRqY3D09b3S2R3Qd3M 0IKuYr7m3Aqwn0QiEtKN0YqmPP/YCSPUfpPRlrDa65+BJ2Pq+pNzLZpoxV/4KMNDwEF8 Oorg== 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=dpcwTTz/sesD3B1rZoBYSQwgGPQNjssdt5XLEtahVEc=; b=SILv5Ad2v4c4UQBkV+frIrlUSxIn4hFZSyBjX/DerWC+o2JQjNLzx7vgDCW4IBjUFJ pUZfKkfzNgNYr+BVxipCSzd6MxPzO9eeFvVQvaysyIQslijrBKff1ttJ7lMJmoLZV3WO Aw+DXYIJkMyjCuKPoHDLEtJp1bFmciRcFerR6QMmVcQ8Tn86bkMeQ2QUwrnllDOh0HJ0 gjeZBLnECiH/arfCvgCvw6ph9Ml4ScLPB9IhbFcnMkK+UX4qHxqB9L6V+FTjjQnnPsVo VP6CIHBaw8gBbgBOAxDs/rwSfMwjD98byUb2s84fYBl9YumczP0whlquVmiVYg49+3sp wEYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=HosWXGNI; 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 i1si8779591eds.174.2020.12.13.10.53.15; Sun, 13 Dec 2020 10:53:38 -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=fm1 header.b=HosWXGNI; 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 S1728853AbgLMO5G (ORCPT + 99 others); Sun, 13 Dec 2020 09:57:06 -0500 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:42007 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405496AbgLMO4z (ORCPT ); Sun, 13 Dec 2020 09:56:55 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id D158758032E; Sun, 13 Dec 2020 09:55:48 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 13 Dec 2020 09:55:48 -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=fm1; bh=dpcwTT z/sesD3B1rZoBYSQwgGPQNjssdt5XLEtahVEc=; b=HosWXGNIaVwtkVUadRZphf vpGtRomJMH/cvw37j0NuQLej2sw8tqNCj9GFX9+Mg03v+Bk34NG37Po68y14S1s9 gtje7ny4yNPNulCrcApDMja4srFBDpTzz9q5+/A8KKThMczApn5Y8qoWp/XdF+ay oE4safZdDFaCtLrv7kgXZLTEWtyP2IZ6KcSfgsx5T9L6dumu83jXTNVrb4gJWpIe wlk7BCyyM5Mdz2+6E6vWvmA6GEK2G0b7G6tQbgSxB9KaEglCrNl2eFOnORiMpO1g nqAEskOoS8nvrY63A8yj78ZefU02Qq4fg/4Xx4rnJmAGdIiBwQzwBdVJohAApAiQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudekiedgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefkughoucfu tghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucggtffrrghtth gvrhhnpedtffekkeefudffveegueejffejhfetgfeuuefgvedtieehudeuueekhfduheel teenucfkphepkeegrddvvdelrdduhedvrddvjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehiughoshgthhesihguohhstghhrdhorhhg X-ME-Proxy: Received: from localhost (igld-84-229-152-27.inter.net.il [84.229.152.27]) by mail.messagingengine.com (Postfix) with ESMTPA id BC8C2108005C; Sun, 13 Dec 2020 09:55:45 -0500 (EST) Date: Sun, 13 Dec 2020 16:55:43 +0200 From: Ido Schimmel To: Vladimir Oltean Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Jakub Kicinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, Roopa Prabhu , Nikolay Aleksandrov , "David S. Miller" , DENG Qingfang , Tobias Waldekranz , Marek Behun , Russell King - ARM Linux admin , Alexandra Winter , Jiri Pirko , Claudiu Manoil , UNGLinuxDriver@microchip.com Subject: Re: [PATCH v3 net-next 1/7] net: bridge: notify switchdev of disappearance of old FDB entry upon migration Message-ID: <20201213145543.GA2539586@shredder.lan> References: <20201213140710.1198050-1-vladimir.oltean@nxp.com> <20201213140710.1198050-2-vladimir.oltean@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201213140710.1198050-2-vladimir.oltean@nxp.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 13, 2020 at 04:07:04PM +0200, Vladimir Oltean wrote: > Currently the bridge emits atomic switchdev notifications for > dynamically learnt FDB entries. Monitoring these notifications works > wonders for switchdev drivers that want to keep their hardware FDB in > sync with the bridge's FDB. > > For example station A wants to talk to station B in the diagram below, > and we are concerned with the behavior of the bridge on the DUT device: > > DUT > +-------------------------------------+ > | br0 | > | +------+ +------+ +------+ +------+ | > | | | | | | | | | | > | | swp0 | | swp1 | | swp2 | | eth0 | | > +-------------------------------------+ > | | | > Station A | | > | | > +--+------+--+ +--+------+--+ > | | | | | | | | > | | swp0 | | | | swp0 | | > Another | +------+ | | +------+ | Another > switch | br0 | | br0 | switch > | +------+ | | +------+ | > | | | | | | | | > | | swp1 | | | | swp1 | | > +--+------+--+ +--+------+--+ > | > Station B > > Interfaces swp0, swp1, swp2 are handled by a switchdev driver that has > the following property: frames injected from its control interface bypass > the internal address analyzer logic, and therefore, this hardware does > not learn from the source address of packets transmitted by the network > stack through it. So, since bridging between eth0 (where Station B is > attached) and swp0 (where Station A is attached) is done in software, > the switchdev hardware will never learn the source address of Station B. > So the traffic towards that destination will be treated as unknown, i.e. > flooded. > > This is where the bridge notifications come in handy. When br0 on the > DUT sees frames with Station B's MAC address on eth0, the switchdev > driver gets these notifications and can install a rule to send frames > towards Station B's address that are incoming from swp0, swp1, swp2, > only towards the control interface. This is all switchdev driver private > business, which the notification makes possible. > > All is fine until someone unplugs Station B's cable and moves it to the > other switch: > > DUT > +-------------------------------------+ > | br0 | > | +------+ +------+ +------+ +------+ | > | | | | | | | | | | > | | swp0 | | swp1 | | swp2 | | eth0 | | > +-------------------------------------+ > | | | > Station A | | > | | > +--+------+--+ +--+------+--+ > | | | | | | | | > | | swp0 | | | | swp0 | | > Another | +------+ | | +------+ | Another > switch | br0 | | br0 | switch > | +------+ | | +------+ | > | | | | | | | | > | | swp1 | | | | swp1 | | > +--+------+--+ +--+------+--+ > | > Station B > > Luckily for the use cases we care about, Station B is noisy enough that > the DUT hears it (on swp1 this time). swp1 receives the frames and > delivers them to the bridge, who enters the unlikely path in br_fdb_update > of updating an existing entry. It moves the entry in the software bridge > to swp1 and emits an addition notification towards that. > > As far as the switchdev driver is concerned, all that it needs to ensure > is that traffic between Station A and Station B is not forever broken. > If it does nothing, then the stale rule to send frames for Station B > towards the control interface remains in place. But Station B is no > longer reachable via the control interface, but via a port that can > offload the bridge port learning attribute. It's just that the port is > prevented from learning this address, since the rule overrides FDB > updates. So the rule needs to go. The question is via what mechanism. Can you please clarify why the FDB replacement notification is not enough? Is it because the hardware you are working with manages MACs to CPU in a separate table from its FDB table? I assume that's why you refer to it as a "rule" instead of FDB entry? How common is this with DSA switches? Asking because it is not clear to me from the commit message. The patch looks fine. > > It sure would be possible for this switchdev driver to keep track of all > addresses which are sent to the control interface, and then also listen > for bridge notifier events on its own ports, searching for the ones that > have a MAC address which was previously sent to the control interface. > But this is cumbersome and inefficient. Instead, with one small change, > the bridge could notify of the address deletion from the old port, in a > symmetrical manner with how it did for the insertion. Then the switchdev > driver would not be required to monitor learn/forget events for its own > ports. It could just delete the rule towards the control interface upon > bridge entry migration. This would make hardware address learning be > possible again. Then it would take a few more packets until the hardware > and software FDB would be in sync again. > > Signed-off-by: Vladimir Oltean > Acked-by: Nikolay Aleksandrov Reviewed-by: Ido Schimmel