From patchwork Wed Feb 8 16:04:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= X-Patchwork-Id: 54477 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3539239wrn; Wed, 8 Feb 2023 08:05:55 -0800 (PST) X-Google-Smtp-Source: AK7set++6lcUYH1MpoXqTdIumUxjYD7VOO8rQ9epo8RYZVxGD7486UVxFdRvbVGyM+tqLe6SFmaz X-Received: by 2002:a05:6402:278a:b0:4aa:b394:7b28 with SMTP id b10-20020a056402278a00b004aab3947b28mr9863093ede.3.1675872355512; Wed, 08 Feb 2023 08:05:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675872355; cv=none; d=google.com; s=arc-20160816; b=tL7n9huTd+DMaFL8D9SvtGEJk2f+ij8VJZBLzWhnT8I12GAmb6YZte0iDTqCR3K/mA usZvsppas7t7RH+pVQu5BhccyCTIHG9m2+TFL/ZZros6X+kidONpFsk1x7lE0Yw/37CR 2NfxG68vsnXYmEVP5d4cTDRIdAsQXY5IT1w02L7v4/hhn1/oQST+g0cyJyAll1o2/0wr brKv5IeeieahSnGNWzhpTyCmxhS1VYhIyd9o0LsuX2N9oDQjs2ia3jceKHxCqUaOmVhl aUrpJ6IcrXVe/oeANbTAxI7QMgKRdBzHm8p2exlT79VjA+hRymgvcu/Akh4EKr9Ee0RW NIuw== 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=yID+HSZHZsFysNyH5E4J8FFNrJg4SULKzIRkEIsJkjo=; b=GYqE03vrwdpZqBY74MYgdyfNuxgOWz8IeoB/Xos70rm/iVRP7cih5/2odNXbJTuFBe /OEXrxP72fYuNL8CzZ+vzXW8oIVopRtWGuOb22ABBkZKxSdD/iCeG8fnQ6fIgGPInhvo Q6atlx8k8vL2SNHvB3k7XwHcOkbErWKEAPaIPOLfvCtDb4Q9MirVczB6WdIi1OyNu4Mt QGukcN4CvuQqQx914hV1qJ3NJWYHuuzmC4mjQa4bF1e9tAVOg9MxFUJuFwRTfrm+tEFt zoCNGfkDg8zmPF6/uUVE0rG38xkjsAR7tDWS1+SbZ0SfTz9J1bjXzMTN3lS0Zuj/uFXx WrIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=IzAjIooj; 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 14-20020a170906008e00b00878621fb6e4si23327307ejc.73.2023.02.08.08.05.31; Wed, 08 Feb 2023 08:05:55 -0800 (PST) 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=IzAjIooj; 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 S230421AbjBHQC4 (ORCPT + 99 others); Wed, 8 Feb 2023 11:02:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230443AbjBHQCv (ORCPT ); Wed, 8 Feb 2023 11:02:51 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D92EF4B763; Wed, 8 Feb 2023 08:02:45 -0800 (PST) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id A80B4E0002; Wed, 8 Feb 2023 16:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675872164; 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=yID+HSZHZsFysNyH5E4J8FFNrJg4SULKzIRkEIsJkjo=; b=IzAjIoojZ8Kk65VKkK92EG1YmUuAoJMLiOF/V4dkjRD/g6rtOC6giExPvRH/gYD5NM9cCq moR5jkkl8yoG9waJK5IY8Pf+hEdN8ZiIMI9ufxQZdYZwS+dqdPDuFo3GqrXgewIlHe3PQ3 eO2IlXr3FVCyxYmtQk1Z3hsMILdkLodzVFHVobUlFF5P5kppKWy5jUjLIXtOybbKuAAyp4 dmVmbZurNyVXtrC0uh+69vvbnagV0UCCC/iStz6EXcAeUKY9/KLbc6VocCEuqKItosoQfm 3h28i+eKfnxkIsNFaM+/ltEpWwYqu/g7qyd4OdyB6YC0MW6VLpmc4DjvCceJCA== From: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Thomas Petazzoni , Herve Codina , =?utf-8?q?Miqu=C3=A8l_Raynal?= , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , Arun Ramadoss , linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] net: dsa: rzn1-a5psw: use a5psw_reg_rmw() to modify flooding resolution Date: Wed, 8 Feb 2023 17:04:51 +0100 Message-Id: <20230208160453.325783-2-clement.leger@bootlin.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230208160453.325783-1-clement.leger@bootlin.com> References: <20230208160453.325783-1-clement.leger@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757279531165557425?= X-GMAIL-MSGID: =?utf-8?q?1757279531165557425?= .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 --- drivers/net/dsa/rzn1_a5psw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c index 919027cf2012..8b7d4a371f8b 100644 --- a/drivers/net/dsa/rzn1_a5psw.c +++ b/drivers/net/dsa/rzn1_a5psw.c @@ -299,13 +299,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 int a5psw_port_bridge_join(struct dsa_switch *ds, int port, @@ -326,6 +322,8 @@ static int a5psw_port_bridge_join(struct dsa_switch *ds, int port, a5psw_flooding_set_resolution(a5psw, port, true); a5psw_port_mgmtfwd_set(a5psw, port, false); + a5psw->bridged_ports |= BIT(port); + return 0; } @@ -334,6 +332,8 @@ static void a5psw_port_bridge_leave(struct dsa_switch *ds, int port, { struct a5psw *a5psw = ds->priv; + a5psw->bridged_ports &= ~BIT(port); + a5psw_flooding_set_resolution(a5psw, port, false); a5psw_port_mgmtfwd_set(a5psw, port, true);