From patchwork Thu Aug 10 09:36:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 133833 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp305507vqi; Thu, 10 Aug 2023 03:00:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHq4/1vGORF6Z12C8ujtW0KSPtNPG4+YGyWqrz+lRpMdbo2u3aZ9javejg9fTwAfwjpJk1U X-Received: by 2002:a05:620a:1a04:b0:76d:2764:f3b3 with SMTP id bk4-20020a05620a1a0400b0076d2764f3b3mr2145506qkb.56.1691661614852; Thu, 10 Aug 2023 03:00:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691661614; cv=none; d=google.com; s=arc-20160816; b=UHyyK8JMMSEGxG+m+aNgIGqKaJmbBG/cqmUQeD7bSFHFbsHnEHE8CUEYk9+H77VkC1 yKJDZSCRoDXChCo+/dYtHgyB8JU3KYEOuGHRY/LwHGWN7lWAqKxSRRJmj8tjStVtbIAN hpJSGDw9jU7zbmHxeOT+Pn2lsM5vQ7qvmN9OlLZRMiWvmI+05r/OLNvClT7lWA/dhPGl L+d9+ZcDf0A6DWSyHxseqWQBmXSnQN++I13c7iA+dxv9eeQsPcLIday26KnoqjLbXsi9 TfZLo9UeEXIgUSK12nxyQfiSRDrhb+BCkIZUalbArHVaIiHJhOMc454ID3CrWwjP62md vZlA== 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=p3NrcZmj+FrNiMy+UF9UWgRSNLTLhtesLJKPB+kr/QU=; fh=3wDQbLmHlD4j9AXVGHEqnwDaZQTO6SBDvybG0Ocf1xQ=; b=Ep91MBX0lwSdQGCuoPY+zkVXq0pqsUkr3pGldAlkzV1f0iCiZbbGN2lPfJoKhvu18g oy54rGsl0UtDgtHV/mNj3rOvtxmqV7EYS2g2MDPS6YJpYH0DcuvRtOMzM5aVUok1urcz yRZb4wQQvMbFa6VNiaYhOmXlfqljuyuC3Ha/xjbEe6YDdJkRvLWJE/dzXyCe8lCOVanp CbO3oGy3gZYngMZ6lLAaKkEG8OsEZqdaopGBdWeBEskv7TsH+F/LQBladK6Q4k9XbVoy kLw08W4XelzU7ZkTs3Ig1RQP43PN6+g7D+Oy1gNRPLk1ueRX46LoRgk3t0/bVGuPr5eC Cy3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=JRtIGm8x; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k190-20020a6384c7000000b00564b8ae6081si1283891pgd.15.2023.08.10.03.00.00; Thu, 10 Aug 2023 03:00:14 -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=JRtIGm8x; 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 S234092AbjHJJgY (ORCPT + 99 others); Thu, 10 Aug 2023 05:36:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232569AbjHJJgT (ORCPT ); Thu, 10 Aug 2023 05:36:19 -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 7DD01D1; Thu, 10 Aug 2023 02:36:18 -0700 (PDT) Received: by mail.gandi.net (Postfix) with ESMTPSA id 04A59C000B; Thu, 10 Aug 2023 09:36:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691660177; 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=p3NrcZmj+FrNiMy+UF9UWgRSNLTLhtesLJKPB+kr/QU=; b=JRtIGm8xfvwQPZ7IemXHxgVhyqP2j/se21FuzMuMb2IzPhWYctUHiLcMpdNk7iRPHg5p6C l64xih4CmhP6chZYAbEd+DXrXChVEyZ5iXcRaRz62pyjo+sEWETcOsLSo1nk+cvoedYKq3 L7VyArBQCPt//BRkB/A7MAN43SK5OM+qqeiU9uNwjWlYQUaRoTnEM7vhUIP6i8HpCeQanI KIcvXEqNmDJdieUzWW82eoDwlA9X8R/yRaBjwjPzccav3JLQfuOfazhdudnOOfPX4R6EtF KGTI6+Uf16JXYCdeh8ONh+0Z+zPH4kGlgxEOTT06mJ1/c0eq9uiRdApXHVsk9w== From: alexis.lothore@bootlin.com To: =?utf-8?q?Cl=C3=A9ment_Leger?= , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Miquel Raynal , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , Thomas Petazzoni Subject: [PATCH net-next v5 1/3] net: dsa: rzn1-a5psw: use a5psw_reg_rmw() to modify flooding resolution Date: Thu, 10 Aug 2023 11:36:49 +0200 Message-ID: <20230810093651.102509-2-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230810093651.102509-1-alexis.lothore@bootlin.com> References: <20230810093651.102509-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: alexis.lothore@bootlin.com X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773835769400370134 X-GMAIL-MSGID: 1773835769400370134 From: Clément Léger .port_bridge_flags will be added and allows to modify the flood mask independently for each port. Keeping the existing bridged_ports write in a5psw_flooding_set_resolution() would potentially messed up this. Use a read-modify-write to set that value and move bridged_ports handling in bridge_port_join/leave. Signed-off-by: Clément Léger Reviewed-by: Florian Fainelli Signed-off-by: Alexis Lothoré --- drivers/net/dsa/rzn1_a5psw.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c index c37d2e537230..302529edb4e0 100644 --- a/drivers/net/dsa/rzn1_a5psw.c +++ b/drivers/net/dsa/rzn1_a5psw.c @@ -331,13 +331,9 @@ static void a5psw_flooding_set_resolution(struct a5psw *a5psw, int port, A5PSW_MCAST_DEF_MASK}; int i; - if (set) - a5psw->bridged_ports |= BIT(port); - else - a5psw->bridged_ports &= ~BIT(port); - for (i = 0; i < ARRAY_SIZE(offsets); i++) - a5psw_reg_writel(a5psw, offsets[i], a5psw->bridged_ports); + a5psw_reg_rmw(a5psw, offsets[i], BIT(port), + set ? BIT(port) : 0); } static void a5psw_port_set_standalone(struct a5psw *a5psw, int port, @@ -365,6 +361,8 @@ static int a5psw_port_bridge_join(struct dsa_switch *ds, int port, a5psw->br_dev = bridge.dev; a5psw_port_set_standalone(a5psw, port, false); + a5psw->bridged_ports |= BIT(port); + return 0; } @@ -373,6 +371,8 @@ static void a5psw_port_bridge_leave(struct dsa_switch *ds, int port, { struct a5psw *a5psw = ds->priv; + a5psw->bridged_ports &= ~BIT(port); + a5psw_port_set_standalone(a5psw, port, true); /* No more ports bridged */ @@ -992,6 +992,8 @@ static int a5psw_probe(struct platform_device *pdev) if (IS_ERR(a5psw->base)) return PTR_ERR(a5psw->base); + a5psw->bridged_ports = BIT(A5PSW_CPU_PORT); + ret = a5psw_pcs_get(a5psw); if (ret) return ret;