From patchwork Sat May 6 17:28:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1778036 X-Patchwork-Delegate: sander@svanheule.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=x9dcmsXB; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=3e8.eu header.i=@3e8.eu header.a=rsa-sha256 header.s=mail20211217 header.b=moWCGvdF; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QDF4F3Rbkz214Q for ; Sun, 7 May 2023 03:32:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FDwHN1faDRpNUlBY0XaUTMe34GW5qj878vosKztlUc4=; b=x9dcmsXB9R017J FDHPEOWo1qu3V69MOMRnQ3LS30SEngDK43xJACtmW0J54TVyA5O3UEIeHcqLZ7Orlhr81IJFLnoeK tNGQV/GhST9tAlZBwAK+rcUZ4KwskY0HPuDRxoSP5nyQM4IW+KqUlQHiivnWB6gd6bA+Y6ZfAdru/ k+A4sxMvZZ/bZ64slXp8kKnH1gdQSXfp+1MnilvkGT7IbPPTH4iFh+XrwtGtqfy6DVUW0jLsCmguG OZl1XyAPJhWRBsX+N/T3pFG5ntKbnQ+fgYgz0QT3KAqgevvnRGHXxcOt9MZ6u6CuU6ifavbC938LK k5NcYpyLzHavp5IWnSNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pvLjK-00E6Tv-26; Sat, 06 May 2023 17:29:58 +0000 Received: from srv5.3e8.eu ([94.16.113.219]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pvLjH-00E6TS-2C for openwrt-devel@lists.openwrt.org; Sat, 06 May 2023 17:29:57 +0000 Received: from localhost.localdomain (p200300c6cf1962a00858ededb4df0c9f.dip0.t-ipconnect.de [IPv6:2003:c6:cf19:62a0:858:eded:b4df:c9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by srv5.3e8.eu (Postfix) with ESMTPSA id 076CE120CDF; Sat, 6 May 2023 19:29:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1683394173; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VEhmvnty661NmA6IiYceQ5aGpNru0hBi7HL7w4FXcW4=; b=moWCGvdFrnWHdVFXVnp5AQhcUwkeUtF9KmkdLwSOC7wclALUBy6256ge17UOERwuWUPMI8 Ylgm866Em0W1gJA3CLhGec04NnAdHxpe9z6BuEpO09m6HhhJM3Ap0Oo5b0ehHhgYF0K6yb wW4itjkx+xWGSFyHn+eboa9hOga6oUAc8Z58etc3fEOhHRC5up1aOWuZP2lLxVYU7SWo1M 9ksN8bd7CVau6+4Ft6MjHf7iUMY2E9DrEdfKuv3IjnZqDncp2t82rVFd+GWu/VX6ZbC3us /KZTFP8CAhyBUzHoU3I8iAivysbrbzt9dapxLLc8RqIwWCV/3ClSPhBQet+PFg== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org, Sander Vanheule Cc: Jan Hoffmann Subject: [PATCH v2 1/4] realtek: properly update port masks when port leaves bridge Date: Sat, 6 May 2023 19:28:52 +0200 Message-Id: <20230506172855.1138748-2-jan@3e8.eu> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230506172855.1138748-1-jan@3e8.eu> References: <20230506172855.1138748-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230506_102955_863647_8EB8ADA8 X-CRM114-Status: GOOD ( 12.40 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Correctly update the isolation mask of the port being configured. The port_bitmap variable should contain all other bridge members and needs to be actually removed from the isolation mask instead of a [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Correctly update the isolation mask of the port being configured. The port_bitmap variable should contain all other bridge members and needs to be actually removed from the isolation mask instead of added to it. Also actually remove the port being configured from the pm field of the other ports, so that any other ports that are currently disabled will be configured correctly when they are enabled. Fixes: df8e6be59a1f ("rtl838x: add new architecture") [fixed updating pm field of other ports] Fixes: 2b88563ee5aa ("realtek: update the tree to the latest refactored version") [reintroduced incorrect pm field update] Fixes: 27029277f98d ("realtek: add switch driver support for the RTL93XX based switches") Signed-off-by: Jan Hoffmann --- .../realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 10 +++++----- .../realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c index 63461ff57348..220f1d5d281d 100644 --- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c @@ -1227,7 +1227,7 @@ static void rtl83xx_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *bridge) { struct rtl838x_switch_priv *priv = ds->priv; - u64 port_bitmap = BIT_ULL(priv->cpu_port), v; + u64 port_bitmap = 0, v; int i; pr_debug("%s %x: %d", __func__, (u32)priv, port); @@ -1245,16 +1245,16 @@ static void rtl83xx_port_bridge_leave(struct dsa_switch *ds, int port, if (priv->ports[i].enable) priv->r->traffic_disable(i, port); - priv->ports[i].pm |= BIT_ULL(port); - port_bitmap &= ~BIT_ULL(i); + priv->ports[i].pm &= ~BIT_ULL(port); + port_bitmap |= BIT_ULL(i); } } store_mcgroups(priv, port); - /* Add all other ports to this port matrix. */ + /* Remove all other ports from this port matrix. */ if (priv->ports[port].enable) { v = priv->r->traffic_get(port); - v |= port_bitmap; + v &= ~port_bitmap; priv->r->traffic_set(port, v); } priv->ports[port].pm &= ~port_bitmap; diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c index 83a0441ce27c..7eebb2107f84 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c @@ -1212,7 +1212,7 @@ static void rtl83xx_port_bridge_leave(struct dsa_switch *ds, int port, struct net_device *bridge) { struct rtl838x_switch_priv *priv = ds->priv; - u64 port_bitmap = BIT_ULL(priv->cpu_port), v; + u64 port_bitmap = 0, v; pr_debug("%s %x: %d", __func__, (u32)priv, port); mutex_lock(&priv->reg_mutex); @@ -1229,16 +1229,16 @@ static void rtl83xx_port_bridge_leave(struct dsa_switch *ds, int port, if (priv->ports[i].enable) priv->r->traffic_disable(i, port); - priv->ports[i].pm |= BIT_ULL(port); - port_bitmap &= ~BIT_ULL(i); + priv->ports[i].pm &= ~BIT_ULL(port); + port_bitmap |= BIT_ULL(i); } } store_mcgroups(priv, port); - /* Add all other ports to this port matrix. */ + /* Remove all other ports from this port matrix. */ if (priv->ports[port].enable) { v = priv->r->traffic_get(port); - v |= port_bitmap; + v &= ~port_bitmap; priv->r->traffic_set(port, v); } priv->ports[port].pm &= ~port_bitmap;