Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1807057rwl; Thu, 30 Mar 2023 01:35:48 -0700 (PDT) X-Google-Smtp-Source: AKy350a3GGDzWRthzKJreqZiuP92wjLM1/h6/8HCHGAsMXjsNAOXY4LrpGon5EWij6yJ4R2Q+Rd7 X-Received: by 2002:a17:906:208:b0:931:5145:c51d with SMTP id 8-20020a170906020800b009315145c51dmr1469325ejd.0.1680165348336; Thu, 30 Mar 2023 01:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680165348; cv=none; d=google.com; s=arc-20160816; b=x92Icr85+WGLP9ykVC47VS/SP5k1YT+O9QoUTgxKofSUZwmdlpwXcwqU7GbRpzwRsS XlhEKTJMCdkWSFQ4UdQ05Fy2wjtuDJc9MbTRJTwxJ5eNk3t3yI47k+VAMzQjubYCtf6P 6c493I8zkc2SKX/wm6LWn+IWfxSjCaheGu8bh/+dJs1BdLCyNiZLvNpHggQ5AURvv/K8 rkdCQsDAkiv+RCVjVthTc57nBgqKUS5b1hWIGdkSQFUtJxfFuRN+UNr04SJvbNMEiuYX OEkV6pOamno6NXA70+WF46pV8SQVG2a/icsZPtIscinCM1wuu4gTZSQm66VkcUfZwZmm L84Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WwAhyV1Sj5KBBfVDCAdRTQpNDnZo2GvHv0Rky3dXMiQ=; b=u2wMV6WdNcdIzIWmvvATTmJmHeMRlDh7VYfRi5Jm2bh8yD9/LNxa9+cjDNdPK6xZde J7a+dWMydO03gBPjx5TAjRqkm5yMxHaTAYuJhuvWLcuhctBtfWIXJ8cq5rliWToKgqBx fljpnwR4Er16tNGMv5Ta4urnkscOwvIu44Hyj93G1PAObxNYDhm3mt8JfD6zl3sLJ+Cm oG8sNHcsD6ltZp0RJM6bWTOuPw2TMRTK3OtvjsO74CAoW/mdno8/ITbFWdiFfB+V1pCx EtM3eWiqGJKL+M25Iy5KTDd65pfd6esn6rViuBEhuS/TqYQYCH5ZJn3OzUmdcddmLloY S2Xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=FvKfGfSZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a170906a28d00b00932dac6402csi30074844ejz.370.2023.03.30.01.35.23; Thu, 30 Mar 2023 01:35:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=FvKfGfSZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbjC3IeO (ORCPT + 99 others); Thu, 30 Mar 2023 04:34:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbjC3Idt (ORCPT ); Thu, 30 Mar 2023 04:33:49 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1120B3; Thu, 30 Mar 2023 01:33:46 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 42666C0009; Thu, 30 Mar 2023 08:33:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1680165225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WwAhyV1Sj5KBBfVDCAdRTQpNDnZo2GvHv0Rky3dXMiQ=; b=FvKfGfSZ6CE043eolJcSg7z6fIgqiQ5Fle3qnqfqGZ8Jy2NG2lvc0m9kRNOiabUtHmpz+I qVQO7iL5hQgf5eLue/mh36wbIRDyD5+fSG9qDLr6FOKTkd4jgcjVor+XbxH1M14b2sBo+Z E/nbVZ/vi64gxVcGvKXKRKBhyGeQEZNlmHZCvGvPVmwYlPVaCzPC7iFsvNIyOpPtu8LdWU T+HCrZiRdahsgfyHNtPy5oPLTNRfh3Eww2CsZFbai2IiqyYxVb3oZicR6Aa1+s6tvd9MXp UrwsWF/IP5nAcw14KGSqaa0MIOrxhdXdF9JALgijw/w2dTh8J5psh/VqiYpxWw== From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Petazzoni , Herve Codina , =?UTF-8?q?Miqu=C3=A8l=20Raynal?= , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , =?UTF-8?q?Alexis=20Lothor=C3=A9?= Subject: [PATCH net-next 2/2] net: dsa: rzn1-a5psw: disable learning for standalone ports Date: Thu, 30 Mar 2023 10:34:08 +0200 Message-Id: <20230330083408.63136-3-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230330083408.63136-1-clement.leger@bootlin.com> References: <20230330083408.63136-1-clement.leger@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When port are in standalone mode, they should have learning disabled to avoid adding new entries in the MAC lookup table which might be used by other bridge ports to forward packets. While adding that, also make sure learning is enabled for CPU port. Signed-off-by: Clément Léger --- drivers/net/dsa/rzn1_a5psw.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c index bbc1424ed416..3e5062ab0928 100644 --- a/drivers/net/dsa/rzn1_a5psw.c +++ b/drivers/net/dsa/rzn1_a5psw.c @@ -336,6 +336,14 @@ static void a5psw_flooding_set_resolution(struct a5psw *a5psw, int port, a5psw_reg_writel(a5psw, offsets[i], a5psw->bridged_ports); } +static void a5psw_port_set_standalone(struct a5psw *a5psw, int port, + bool standalone) +{ + a5psw_port_learning_set(a5psw, port, !standalone, false); + a5psw_flooding_set_resolution(a5psw, port, !standalone); + a5psw_port_mgmtfwd_set(a5psw, port, standalone); +} + static int a5psw_port_bridge_join(struct dsa_switch *ds, int port, struct dsa_bridge bridge, bool *tx_fwd_offload, @@ -351,8 +359,7 @@ static int a5psw_port_bridge_join(struct dsa_switch *ds, int port, } a5psw->br_dev = bridge.dev; - a5psw_flooding_set_resolution(a5psw, port, true); - a5psw_port_mgmtfwd_set(a5psw, port, false); + a5psw_port_set_standalone(a5psw, port, false); return 0; } @@ -362,8 +369,7 @@ static void a5psw_port_bridge_leave(struct dsa_switch *ds, int port, { struct a5psw *a5psw = ds->priv; - a5psw_flooding_set_resolution(a5psw, port, false); - a5psw_port_mgmtfwd_set(a5psw, port, true); + a5psw_port_set_standalone(a5psw, port, true); /* No more ports bridged */ if (a5psw->bridged_ports == BIT(A5PSW_CPU_PORT)) @@ -755,13 +761,15 @@ static int a5psw_setup(struct dsa_switch *ds) if (dsa_port_is_unused(dp)) continue; - /* Enable egress flooding for CPU port */ - if (dsa_port_is_cpu(dp)) + /* Enable egress flooding and learning for CPU port */ + if (dsa_port_is_cpu(dp)) { a5psw_flooding_set_resolution(a5psw, port, true); + a5psw_port_learning_set(a5psw, port, true, false); + } - /* Enable management forward only for user ports */ + /* Enable standalone mode for user ports */ if (dsa_port_is_user(dp)) - a5psw_port_mgmtfwd_set(a5psw, port, true); + a5psw_port_set_standalone(a5psw, port, true); } return 0; -- 2.39.2