From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_NEOMUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9CE5C43381 for ; Wed, 20 Feb 2019 00:07:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9630921738 for ; Wed, 20 Feb 2019 00:07:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="1iWloUdk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730141AbfBTAHz (ORCPT ); Tue, 19 Feb 2019 19:07:55 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:50364 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728652AbfBTAHz (ORCPT ); Tue, 19 Feb 2019 19:07:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dCO4KZb2yzlN2qOFvxkger1GMOyH1khdboQoKf61/I8=; b=1iWloUdkgFDIeO84x5+tnGAXI Bs+/MDrPyki6u0CI2LlbAXrbDsegHyaPbCYgubYq1IGlcrzO4htEhiO262fmBS4aN1EWMEVclJgv8 7POo18PeOMhzfOV9ycLUGlaTrCYZidxmRFhjihcQkS3/iy7/NQ0g1nflTtxb7/5yHGf34OJfvxg7y ytbG3S94Xgiin5v4hwbX0Js8CfTSYdu5iGeNGV+n3GXXo9t0Y6E4ZFWPz7FZC0NRlEhE5cej/7AfN EfZCZnmonj7QjjIrxGrsPsyIM0W8ZOigSdC2n6ohJSw+uXumqcgv42nIu9dWX0xHHeUo8/82T0zSF gfGcVP9kA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:51252) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gwFQT-0000OW-DY; Wed, 20 Feb 2019 00:07:49 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.89) (envelope-from ) id 1gwFQR-0008P5-L7; Wed, 20 Feb 2019 00:07:47 +0000 Date: Wed, 20 Feb 2019 00:07:47 +0000 From: Russell King - ARM Linux admin To: Florian Fainelli Cc: Vivien Didelot , Andrew Lunn , Heiner Kallweit , "David S. Miller" , netdev@vger.kernel.org Subject: Re: [PATCH net-next v2 2/3] net: dsa: mv88e6xxx: add support for bridge flags Message-ID: <20190220000747.j5yfbp45iqfcuc2j@shell.armlinux.org.uk> References: <20190217163114.yomawlljyxlqy3ob@shell.armlinux.org.uk> <20190219111612.GF27578@t480s.localdomain> <20190219170059.h5j552kuplvdaqol@shell.armlinux.org.uk> <20190219233408.th2wukhmtxdmeivj@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Feb 19, 2019 at 03:53:50PM -0800, Florian Fainelli wrote: > On 2/19/19 3:34 PM, Russell King - ARM Linux admin wrote: > > On Tue, Feb 19, 2019 at 05:00:59PM +0000, Russell King - ARM Linux admin wrote: > >> I've just changed my last patch to set these modes from > >> dsa_port_bridge_join() and dsa_port_bridge_leave(), and while testing, > >> I notice this on the ZII rev B board: > >> > >> At boot (without anything connected to any of the switch ports): > >> > >> br0: port 1(lan0) entered blocking state > >> br0: port 1(lan0) entered disabled state > >> device lan0 entered promiscuous mode > >> device eth1 entered promiscuous mode > >> br0: port 2(lan1) entered blocking state > >> br0: port 2(lan1) entered disabled state > >> device lan1 entered promiscuous mode > >> ... > >> > >> I then removed lan0 from the bridge: > >> > >> device lan0 left promiscuous mode > >> br0: port 1(lan0) entered disabled state > >> > >> and then added it back: > >> > >> br0: port 1(lan0) entered blocking state > >> br0: port 1(lan0) entered disabled state > >> device lan0 entered promiscuous mode > >> > >> Now, you'd expect lan0 and lan1 to be configured the same at this > >> point, and the same as it was before lan0 was removed from the bridge? > >> lan0 is port 0, lan1 is port 1 on this switch - and the register debug > >> says: > >> > >> GLOBAL GLOBAL2 SERDES 0 1 2 3 4 5 6 > >> 0: c800 0 1140 500f 500f 500f 500f 500f 4e07 4d04 > >> ... > >> 4: 40a8 258 1e0 43c 43d 43d 7c 430 53f 373f > >> > >> Note that port 0 is in disabled state, but port 1 and 2 are in > >> blocking state... but wait, the kernel printed a message saying it was > >> in disabled state! > >> > >> If I do the same for lan1, port 1 above changed from 0x43d to 0x433 as > >> expected, and then returns to 0x43c. > >> > >> It looks like DSA isn't always in sync with bridge as per port state. > > > > Okay, the problem is what we do when we up the port. > > > > When the port is added to the bridge device, and it's down, the bridge > > code sets the STP state to "disabled". > > > > Then when we up the interface, dsa_slave_open() calls dsa_port_enable(), > > which then decides to change the STP state on its own without reference > > to the state assigned by net/bridge: > > > > int dsa_port_enable(struct dsa_port *dp, struct phy_device *phy) > > { > > u8 stp_state = dp->bridge_dev ? BR_STATE_BLOCKING : BR_STATE_FORWARDING; > > ... > > dsa_port_set_state_now(dp, stp_state); > > ... > > } > > > > I can understand setting the state to BR_STATE_FORWARDING for > > stand-alone ports, but why for bridged ports when the bridge code has > > already taken care of configuring the STP state of the port? > > There was no reason for doing that in commit > b73adef67765b72f2a0d01ef15aff9d784dc85da ("net: dsa: integrate with > SWITCHDEV for HW bridging") other than copying what rocker had done > (which served as model back then), and which got changed the next day in > rocker with: e47172ab7e4176883077b454286bbd5b87b5f488 ("rocker: put port > in FORWADING state after leaving bridge") > > Good catch! As mentioned on IRC, I'll send a patch for this tomorrow for the net tree once I've untangled it from the floods work. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up