From patchwork Sat May 6 23:05:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1778091 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=dZkdBBaO; 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=R9t+4a+g; 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 4QDNXX1KJzz213r for ; Sun, 7 May 2023 09:08:58 +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=La8L/nXEKg5aESYTRFLXPxJXmRgXkaVsPpVwnDAbKTM=; b=dZkdBBaO1YHS2p b3fLAjGFp8y7pJdGyvnejfRYNTvbTpKtXfIIgObk9O7nqjh7bTMoih+NMJ/ta+gOHse4oOZ+Nw0xU VPDN5Iu7988NwG9l1a+Ui/M102yKIhFUcuMFVzL1VhF+iIeUDtM6b54mJr9nM7uJk1+MRZLIp5bIT KMtv2ktBqmFqUkVXESYYqh2FeCCB8fsebKu6+pDE0KW5asfQLIxm50HDbAU3xngug0HIbG19FyebB 7H10+8NTruegO6wBLffatmZJNsG0Fxq0BLVk3MGAlrtHI8b+6dvxY3uNUl8W+DUH0DJh9jsNj4y7V kzJt7o/M9YLjYif1fIMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pvQzR-00EXLH-0c; Sat, 06 May 2023 23:06:57 +0000 Received: from srv4.3e8.eu ([193.25.101.238]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pvQzN-00EXKk-2C for openwrt-devel@lists.openwrt.org; Sat, 06 May 2023 23:06:55 +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 srv4.3e8.eu (Postfix) with ESMTPSA id CBCE140C9C; Sun, 7 May 2023 01:06:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1683414369; 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=QQJVlIkL85iGWuVPQrv1YcbecsSuMmW08OYJtDjH3Wo=; b=R9t+4a+gazAypk1ed5aetYzP+YLuKp/URpp/eIOrJs0QCQ58+fZqa27oVUOb0+WX+zhQCG a4FV7f0F+BoHj1iWhhkSZba0ZBBfX89gv20AF5ORYU5khFL8NxBguavlEt4UENzCZPkNmc DlpfnZ/1MVAHJRCvs0lm4mOTXn//LrOI2Cmt0I6g9+xmAzAwaCZ/FmHhZFfJ3TtVMfLrO8 5W5GgRbnU9AzRh92MK7WjchCl/35O7RkpV/pSKF2HARlTGqiJ1LOaJKG347OD4NZmPBXE6 5TTRwwyytH+hA0CN6kALQdl3txTks62mBh5sOvrhO9fzgOqdusiFuUJ3is4TrQ== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org, Sander Vanheule Cc: Jan Hoffmann Subject: [PATCH v2 2/6] realtek: don't treat first multicast portmask entry as reserved Date: Sun, 7 May 2023 01:05:31 +0200 Message-Id: <20230506230535.1150881-3-jan@3e8.eu> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230506230535.1150881-1-jan@3e8.eu> References: <20230506230535.1150881-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_160653_867799_AFA82C79 X-CRM114-Status: GOOD ( 12.00 ) 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: There doesn't appear to be a reason to do this, as only the last entry is actually reserved for unknown multicast. This also fixes two issues: - As the increment happened after the bounds check, the value of the actually reserved last entry could be overwritten. - On deletion of entries, a corresponding decrement [...] 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 There doesn't appear to be a reason to do this, as only the last entry is actually reserved for unknown multicast. This also fixes two issues: - As the increment happened after the bounds check, the value of the actually reserved last entry could be overwritten. - On deletion of entries, a corresponding decrement was missing, causing the wrong entry to be marked as free. Fixes: cde31976e375 ("realtek: Add support for Layer 2 Multicast") Signed-off-by: Jan Hoffmann --- target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 1 - target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 1 - 2 files changed, 2 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 fee63c36faa1..a9de70531237 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 @@ -987,7 +987,6 @@ static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port) } set_bit(mc_group, priv->mc_group_bm); - mc_group++; // We cannot use group 0, as this is used for lookup miss flooding portmask = BIT_ULL(port) | BIT_ULL(priv->cpu_port); priv->r->write_mcast_pmask(mc_group, portmask); 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 f9980ccacee1..90a6d6766051 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 @@ -974,7 +974,6 @@ static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port) } set_bit(mc_group, priv->mc_group_bm); - mc_group++; /* We cannot use group 0, as this is used for lookup miss flooding */ portmask = BIT_ULL(port) | BIT_ULL(priv->cpu_port); priv->r->write_mcast_pmask(mc_group, portmask);