Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp343840lqp; Thu, 4 Apr 2024 15:18:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXUJXz4ZABI8bN38GYEWqGWpqDmDI/hGkBRZRvfOFy57918YCI4HoTozJSKUCsXM4WdpI5bn3f62MVJ4/l3My9h771DnLH8sRA6b15FoA== X-Google-Smtp-Source: AGHT+IE+26Llw2u1J7driWBteotm4IvQ5FiwoIhOTVH5PevfOfCUXa+euCFyjYxF0BaBj8mOI0tt X-Received: by 2002:a05:6a21:3285:b0:1a7:2463:ae3b with SMTP id yt5-20020a056a21328500b001a72463ae3bmr1531234pzb.7.1712269136317; Thu, 04 Apr 2024 15:18:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712269136; cv=pass; d=google.com; s=arc-20160816; b=clz7jjYEIR+FiIJXRd1RTdwXowjmdvehsmuSJKFy/d+MQqnqjSw2dkg98DpDZMe2iV G5fjgQ+C6Rl6bZDykAlqHCtztJAPpREAbcuq/9g+KHh8Bbvfr12EpSVFf5b8b6QlOSGN RtLc1X12XoUr5mUd37R9amAlO7JdlUB+x0gpebFX+JWfN5kGMXHDG+rQkjjhIXOc44c9 t+tVu/sY3gMC19w7k9jKaEIf4aeNhxVmaCuFpYR1bbnKXd73xpYDoKUxpPzmXolOdTdm NGooTplbn096/k7kymNErfD98lnPovpkBXk4UioFL0NIsns/crpmd4+pLcocfgh4pvt8 lNFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wF0piU5Bum94a3TqN990DQ0BqoHBjzdesA2kdLohbls=; fh=2ZlLMgcvjyWNbD0DhjG+/8+ZFhHheTev/5xWEfrT9Yk=; b=E5ez08KdEHxM9cZ1WXMC2QRKVCxbsrirW5anw5r3/xLWD5Z2zWnQy0RJkh9kf8Hn0M dFqvpfaMFaR2KyM9WaRNGKpsNinU01dCdrSt8J+vfOW3xuJ5NdvSZ6wk+kkiicJ3yFaH LnTc1FQEXqs0bA4oDFWe0PF9ciUTSH/pQzJm3P/M90hhoBUH1l9f2SWDcjIeXz/AU0vF 713auK9jFXdigVt3LBuf9M9+Yo6D+Im4LOWvh2/pbNaV4ulR+USmxoOs4O1lwC8RLjng IgbW16o7vXqyXMkHtR0aqvUZcp9CkTCxD6yOhi39hgGuYuY6zLynB/39/ytDW6qAoFvQ hyug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=bkoPPZ18; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-132184-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132184-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id m13-20020a170902f64d00b001e0e85b2950si180036plg.542.2024.04.04.15.18.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 15:18:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132184-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=bkoPPZ18; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-132184-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132184-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 70A55B2346E for ; Thu, 4 Apr 2024 22:12:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 198B513C3F6; Thu, 4 Apr 2024 22:12:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="bkoPPZ18" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B6A113C3DF; Thu, 4 Apr 2024 22:12:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712268724; cv=none; b=pFTeAewWbJLvQFFbRfW1zZjZU2kfvDsLvDby5n7tkswcQ3c1ouCzLg8oLJpB3yOPHKC9E6b2KLdZ/bAfZn7WoyRPRPCmCXZwMNaV4Oigy/BviPqeudZpBgKf1085RwnWOe1qnGjlEnGQTZ2LoVw+vXxfYI8EJ14m0upoGa9WgxY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712268724; c=relaxed/simple; bh=ZnX7DwugUfNwNH8YtGd8Qbbpcv7XYT2KMkbjx+Yt7A8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tx+O+C3TEZNEzw6NLLf7YFu37iyDGDW6rlzQCgPWEZP7lBCCm5kveM9rvqLZ9u+/KZb3yzCzuGXXzlUHMHs7i6jfwOlFUOmhOhplOhwiw8+Lcsgg0UEw9z62xwuO+PsQa61WUb5io47trEs1RazoNaxQBFYuplPaXhjZ3umgnJ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=bkoPPZ18; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=wF0piU5Bum94a3TqN990DQ0BqoHBjzdesA2kdLohbls=; b=bkoPPZ18rFow9S+p4VD+hwtV2c YVv56WUHqp6UcY66ae4Dn6BK5G9irkN6ghn1J6HIqLwS3LnBQqgPffUdTBq/WKN1+7jCYATloR0sN nVN6msTrATYeYkkIIwA0RksBq4AGmKC6LjfhH2lDj3VBNzech5rpNWHrbYAZL44x+yqw=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1rsVJ0-00CDmV-A9; Fri, 05 Apr 2024 00:11:34 +0200 Date: Fri, 5 Apr 2024 00:11:34 +0200 From: Andrew Lunn To: Joseph Huang Cc: Joseph Huang , netdev@vger.kernel.org, Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Roopa Prabhu , Nikolay Aleksandrov , Linus =?iso-8859-1?Q?L=FCssing?= , linux-kernel@vger.kernel.org, bridge@lists.linux.dev Subject: Re: [PATCH RFC net-next 00/10] MC Flood disable and snooping Message-ID: <630c37d6-b1c6-466b-8d00-fdc84585d5e7@lunn.ch> References: <20240402001137.2980589-1-Joseph.Huang@garmin.com> <4c28d59e-0c4f-462c-8a1c-d4bd72e25115@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4c28d59e-0c4f-462c-8a1c-d4bd72e25115@gmail.com> On Thu, Apr 04, 2024 at 05:35:41PM -0400, Joseph Huang wrote: > Hi Andrew, > > On 4/2/2024 8:43 AM, Andrew Lunn wrote: > > On Mon, Apr 01, 2024 at 08:10:59PM -0400, Joseph Huang wrote: > > > There is a use case where one would like to enable multicast snooping > > > on a bridge but disable multicast flooding on all bridge ports so that > > > registered multicast traffic will only reach the intended recipients and > > > unregistered multicast traffic will be dropped. However, with existing > > > bridge ports' mcast_flood flag implementation, it doesn't work as desired. > > > > > > This patchset aims to make multicast snooping work even when multicast > > > flooding is disabled on the bridge ports, without changing the semantic of > > > the mcast_flood flag too much. Patches 1 to 4 attempt to address this issue. > > > > > > Also, in a network where more than one multicast snooping capable bridges > > > are interconnected without multicast routers being present, multicast > > > snooping fails if: > > > > > > 1. The source is not directly attached to the Querier > > > 2. The listener is beyond the mrouter port of the bridge where the > > > source is directly attached > > > 3. A hardware offloading switch is involved > > > > I've not studied the details here, but that last point makes me think > > the offload driver is broken. There should not be any difference > > between software bridging and hardware bridging. The whole idea is > > that you take what Linux can do in software and accelerate it by > > offloading to hardware. Doing acceleration should not change the > > behaviour. > > > > In patch 10 I gave a little more detail about the fix, but basically this is > what happened. > > Assuming we have a soft bridge like the following: > > bp1 +------------+ > Querier <---- | bridge | > +------------+ > bp2 | | bp3 > | | > v v > MC Source MC Listener > > Here bp1 is the mrouter port, bp2 is connected to the multicast source, and > bp3 is connected to the multicast listener who wishes to receive multicast > traffic for that group. > > After some Query/Report exchange, the snooping code in the bridge is going > to learn about the Listener from bp3, and is going to create an MDB group > which includes bp3 as the sole member. When the bridge receives a multicast > packet for that group from bp2, the bridge will do a look up to find the > members of that group (in this case, bp3) and forward the packet to every > single member in that group. At the same time, the bridge will also forward > the packet to every mrouter port so that listeners beyond mrouter ports can > receive that multicast packet as well. > > Now consider the same scenario, but with a hardware-offloaded switch: > > +------------+ > | bridge | > +------------+ > ^ > | > | p6 (Host CPU port) > p1/bp1 +------------+ > Querier <---- | sw | > +------------+ > p2/bp2 | | p3/bp3 > | | > v v > MC Source MC Listener > > Same Query/Report exchange, same MDB group, except that this time around the > MDB group will be offloaded to the switch as well. So in the switch's ATU we > will now have an entry for the multicast group and with p3 being the only > member of that ATU. When the multicast packet arrives at the switch from p2, > the switch will do an ATU lookup, and forward the packet to p3 only. This > means that the Host CPU (p6) will not get a copy of the packet, and so the > soft bridge will not have the opportunity to forward that packet to the > mrouter port. This is what patch 10 attempts to address. > > One possible solution of course is to add p6 to every MDB group, however > that's probably not very desirable. Besides, it will be more efficient if > the packet is forwarded to the mrouter port by the switch in hardware (i.e., > offload mrouter forwarding), vs. being forwarded in the bridge by software. Thanks for the explanation. So i think the key part which you said above is: At the same time, the bridge will also forward the packet to every mrouter port so that listeners beyond mrouter ports can receive that multicast packet as well. How does the bridge know about the mrouter port? It seems like the bridge needs to pass that information down to the switch. Is the mrouter itself performing a join on the group when it has members of the group on the other side of it? Andrew