Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp802556lqj; Mon, 3 Jun 2024 00:40:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU1hDSujeZQeeBdQFKPXHnq7EtJi6XG+oTr6mbRVp+j0m3Jok8jXl9/TeTqY8o5B0wkS/Xkou7PiSm826h4p9HRLZrkD4kk0uu1yuur6g== X-Google-Smtp-Source: AGHT+IGYpyIUx5bHWy6Z5y40MHE5xfbJCzQ6XAhkGw0uWeZ5B8zcfe1HIEG5IQXpUXcPGlO97rYL X-Received: by 2002:a05:6214:3d0a:b0:6ab:9973:4a5a with SMTP id 6a1803df08f44-6aecd5a3383mr112314836d6.19.1717400437932; Mon, 03 Jun 2024 00:40:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717400437; cv=pass; d=google.com; s=arc-20160816; b=PBLqBJMEigAERhsQBK4DCGUK9uNpbnL/rxN3SJzhPcQ3p8w0gdCXJIIq3Vbo3TwnlO iT3hCnOr6H2FJ0CQd5Us5eNlKzk3xcWkq2tb0/4ynTMqnJy9UaaMveX4p6ILIwbu3n/D Q23vnryzUVxQZMAnrO+DLfVrNgYXDFM4Z8liaCJrwohkV1sudEwILfrwwg5uBA3ii3I5 nYxchBqOxYHv2XFti8F8lCfijfm7t4oPAGvEw4oRp/RaIyHa79ZRfWgCaLdZ0iAq1pHo gTjkCVoYe4oiuRr5xvUZKxYT3Oo1m7jC2ek0iWAClBkHD0LqCA+THLF/ZDw65MktGfom OF2g== 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=h10BSaPSq3Cn1O+lBIe039/fMIoaSI34emmJ/z3bTNg=; fh=S4YphEccifsVCiS2QMhurOHj4UxQzEfRUumUR6NPxJQ=; b=f4ktxlkZnZBEuk/6ltsp1n2U7JdY3V1WQUDovS6JeSxw7d6p8oX3s1O4S0txiZ6dwG Mx34DiTrzoxFhS3ZNcKhRRqNExlpClA+WAvAxB5nJqaiMZg9MrY2axJiLciSpJM5TpGi 4GmeJAibO3QbfYlQeI9wsZuALc35QPfaN3dTeIVogSxGvnn631zu57JoJYGGyj5/5PpT P0jL8/6Wn8yPba9aNzG47NN//jzHnsntigK8miUQVszs19tMaCIteQx6vsM36/cwcues KzyUtQPIoyAsZ793sb0wHLSTPAnrxEeshDlEZlL7gGRs21hrTFyT+GpI08LUUXptMqwc QEdg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UXfBP6n5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-198728-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198728-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b43918fsi87031386d6.545.2024.06.03.00.40.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 00:40:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198728-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UXfBP6n5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-198728-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198728-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9F4D41C21925 for ; Mon, 3 Jun 2024 07:40:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B8064AEF4; Mon, 3 Jun 2024 07:40:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UXfBP6n5" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2F5B347A4C; Mon, 3 Jun 2024 07:40:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717400427; cv=none; b=aKOBQLUZNbExBGutYADJuDK8GAUJEu5e87lUkHSWw1iFo9Wg3OjR4nDHJExNO05nJBcQ5+HyyabH137B4U0YXy9CL2Q0fhvgFXU+tWl5GLqUyEczQ1F3o0iehXyP8VwNkfXufK/lgdY7edI2lJeci3bAJQTjU1XJdVsA3z4wuIk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717400427; c=relaxed/simple; bh=9rBCxnNOqL19PhtN8Ev8Pt2LG9neDHVmcXIvCefgzec=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=dIQCJGspaGmERF6neT83kJFfPTuCsnPQy0EkeP+KRF0wYkCJ8ukopmOO2CTNr/yTOPENbfG3/raLH6dOeNWUOYimRbT+JM6Xj+5LalwvxWFepnUdgu7kRqa142vBlVrkTZOd8I5fUrcrbcSfqJR5ni/EF9tV5mLnPHbJPZWH9l4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UXfBP6n5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C910BC2BD10; Mon, 3 Jun 2024 07:40:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717400426; bh=9rBCxnNOqL19PhtN8Ev8Pt2LG9neDHVmcXIvCefgzec=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UXfBP6n5YKpnpIqXq39RpLHYgCW8Niq2bWdBki6s5CTiKVZD1bPk6+fey8Yt4aMHQ lZDmH78vbZcqpbais3P2jbWcihAnjRHR4eaqY29qdxyOP15U9NDtRRz98zhjKRQiaU SNDgP44uoxEtngXnnT88fTiJECnUTJewvTc8Y/sYlSUhu0FCXUlDHXCTCWuO34DfFQ p8nZctkihrFLHTOtXdYd7w7FGAyRoaq7DnkNL32j53mTpFemI45EsUtRgMPWa+5RCM HGeeTJSaKewpr+NfxU+Q7Zxo9t/hN0keqQVn9+Ue6N4pE4lwufaiX5mrf5c/eNGlQo xeVDNkLrn6fNQ== Date: Mon, 3 Jun 2024 08:40:21 +0100 From: Simon Horman To: Vladimir Oltean Cc: Tristram.Ha@microchip.com, Woojung.Huh@microchip.com, andrew@lunn.ch, vivien.didelot@gmail.com, f.fainelli@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, UNGLinuxDriver@microchip.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: dsa: microchip: fix initial port flush problem Message-ID: <20240603074021.GV491852@kernel.org> References: <1716932145-3486-1-git-send-email-Tristram.Ha@microchip.com> <20240531190234.GT491852@kernel.org> <20240601120545.GG491852@kernel.org> <20240602140118.nnlvydm4dp6wr4c3@skbuf> 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: <20240602140118.nnlvydm4dp6wr4c3@skbuf> On Sun, Jun 02, 2024 at 05:01:18PM +0300, Vladimir Oltean wrote: > On Sat, Jun 01, 2024 at 01:05:45PM +0100, Simon Horman wrote: > > On Fri, May 31, 2024 at 07:19:54PM +0000, Tristram.Ha@microchip.com wrote: > > > > Subject: Re: [PATCH net] net: dsa: microchip: fix initial port flush problem > > > > > > > > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content > > > > is safe > > > > > > > > On Tue, May 28, 2024 at 02:35:45PM -0700, Tristram.Ha@microchip.com wrote: > > > > > From: Tristram Ha > > > > > > > > > > The very first flush in any port will flush all learned addresses in all > > > > > ports. This can be observed by unplugging a cable from one port while > > > > > additional ports are connected and dumping the fdb entries. > > > > > > > > > > This problem is caused by the initially wrong value programmed to the > > > > > register. After the first flush the value is reset back to the normal so > > > > > the next port flush will not cause such problem again. > > > > > > > > Hi Tristram, > > > > > > > > I think it would be worth spelling out why it is correct to: > > > > 1. Not set SW_FLUSH_STP_TABLE or SW_FLUSH_MSTP_TABLE; and > > > > 2. Preserve the value of the other bits of REG_SW_LUE_CTRL_1 > > > > > > Setting SW_FLUSH_STP_TABLE and SW_FLUSH_MSTP_TABLE bits are wrong as they > > > are action bits. The bit should be set only when doing an action like > > > flushing. > > > > Understood, thanks. And I guess that only bits that are being configured > > should be changed, thus the values other bits are preserved with this > > change. > > > > FWIIW, I do think it would be worth adding something about this to the > > patch description. > > I agree the description is confusing and I had to look it up in the > datasheet to understand. > > I would suggest something along the lines of: > > Setting the SW_FLUSH_STP_TABLE | SW_FLUSH_MSTP_TABLE bits of > REG_SW_LUE_CTRL_1 does not do anything right away. They are > just one-shot modifiers of the upcoming flush action executed by > ksz9477_flush_dyn_mac_table(). > > It is wrong to set these bits at ksz9477_reset_switch() time, because > it makes ksz9477_flush_dyn_mac_table() have an unexpected and incorrect > behavior during its first run. When DSA calls ksz_port_fast_age() on a > single port for the first time, due to this modifier being set, the > entire FDB will be flushed of dynamically learned entries, across all > ports. > > Additionally, there is another mistake in the original code, which is > that the value read from the REG_SW_LUE_CTRL_1 is immediately discarded, > rather than preserved. The relevant bit which is set by default in this > register (but we are mistakenly clearing) is: > > Bit 3: Multicast Source Address Filtering > 1 = Forward packets with a multicast source address > 0 = Drop packets with a multicast source address Thanks, that makes things a lot clearer to me. > Tristram, now a question to you: why would we want to forward packets > with a multicast source address? It looks like clearing that field is > one of those things which were accidentally correct. > > The cleanest way to not make a functional change where none is intended > is to simply delete the read. FWIIW, I thought about that too. But I was concerned that perhaps the read has a side effect, because I don't know the hw well enough to say otherwise.