From patchwork Fri Mar 3 21:48:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1751653 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=wYYxQIfi; 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=eV992fZw; 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 4PT22f72T8z246Y for ; Sat, 4 Mar 2023 09:00:09 +1100 (AEDT) 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=q2QXt+sQdT/PxphXF5Zl8DwNeFV1JLOLN7IohpXPjEI=; b=wYYxQIfikAK1QR 4dRLHnLgT75oXMSAPbcP6Q4MrVb67Xnavo0vWnhJ1QKxBV77MmnlBuS3W17SNOyVWi8JmGLFc1Ht/ r+l13u/jV0iivwfYzbe09nv3kL/uNz89dShFpvZZnIepPo7AoepHMNSlQP/rAlsoYAaSKjFNhWFiK MaciCW4+W4W1nS6+gc8mFxhW2sIUNEAqhOd7ZWWEh5FrAb/vG6ypkejdM1BwDNYl68X08isXHcgRb eRTgzlu05o7a92v4IK939rNXw1I8I/0QqSVx/pFZbrQzbDX/Ykmuok+NzeosnKXHXDRuxRz/lrq2K 4QrnoYX2lX9uZFuZj2Fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDKQ-007bHL-U0; Fri, 03 Mar 2023 21:52:39 +0000 Received: from srv5.3e8.eu ([2a03:4000:28:8d0::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDJ4-007aMF-V5 for openwrt-devel@lists.openwrt.org; Fri, 03 Mar 2023 21:51:18 +0000 Received: from localhost.localdomain (p200300c6cf0202a073867d2e443a1890.dip0.t-ipconnect.de [IPv6:2003:c6:cf02:2a0:7386:7d2e:443a:1890]) (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 60C93120CEE; Fri, 3 Mar 2023 22:51:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1677880260; 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=3vp827HN5JsYYuviISAVp+ir1MMMi+HmJnbG9irrVf4=; b=eV992fZwZrfVgKKN7a6I2FnO0i1WcBZ5cC1k3OhDgfQ96HAlfboE5EZjnemXU/cuPZtMXn U1ih81yqPW4XzeIWllu4KvJAUrG6LYvVvzNWTPZVw8ca4oUNmaoBbGgEGPB8DRNbsbDNXN EpCFMzRQOnsZYjNLhgy40qWPktt89e2siepabISyr+5cxgkKz97Yp9uBJAPC0KRM9GamZ0 18dkv5WE2aexk6AmD3Mi0yVElSD0opdjT+iISETp3i5X/zMDogGn4IBeTvT45zrwVfjWnr 7DWRS2dYfeS4qkp9l1JvwE0+FLYTIhC7zpgnkqw7w55ywhGjherhyF/tmnJp4Q== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule , Jan Hoffmann Subject: [PATCH 1/6] realtek: fix writing/deletion of CAM entries Date: Fri, 3 Mar 2023 22:48:41 +0100 Message-Id: <20230303214846.410414-2-jan@3e8.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230303214846.410414-1-jan@3e8.eu> References: <20230303214846.410414-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230303_135115_794648_3525FDDE X-CRM114-Status: GOOD ( 11.49 ) 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: Actually use the index returned by rtl83xx_find_l2_cam_entry. Fixes: cde31976e375 ("realtek: Add support for Layer 2 Multicast") Signed-off-by: Jan Hoffmann --- .../realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 8 ++++---- .../realtek/files-5.15 [...] 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 Actually use the index returned by rtl83xx_find_l2_cam_entry. Fixes: cde31976e375 ("realtek: Add support for Layer 2 Multicast") Signed-off-by: Jan Hoffmann --- .../realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 8 ++++---- .../realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 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..fee63c36faa1 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 @@ -1662,7 +1662,7 @@ static int rtl83xx_port_fdb_add(struct dsa_switch *ds, int port, } // Hash buckets full, try CAM - rtl83xx_find_l2_cam_entry(priv, seed, false, &e); + idx = rtl83xx_find_l2_cam_entry(priv, seed, false, &e); if (idx >= 0) { rtl83xx_setup_l2_uc_entry(&e, port, vid, mac); @@ -1698,7 +1698,7 @@ static int rtl83xx_port_fdb_del(struct dsa_switch *ds, int port, } /* Check CAM for spillover from hash buckets */ - rtl83xx_find_l2_cam_entry(priv, seed, true, &e); + idx = rtl83xx_find_l2_cam_entry(priv, seed, true, &e); if (idx >= 0) { e.valid = false; @@ -1800,7 +1800,7 @@ static void rtl83xx_port_mdb_add(struct dsa_switch *ds, int port, } // Hash buckets full, try CAM - rtl83xx_find_l2_cam_entry(priv, seed, false, &e); + idx = rtl83xx_find_l2_cam_entry(priv, seed, false, &e); if (idx >= 0) { if (e.valid) { @@ -1860,7 +1860,7 @@ int rtl83xx_port_mdb_del(struct dsa_switch *ds, int port, } /* Check CAM for spillover from hash buckets */ - rtl83xx_find_l2_cam_entry(priv, seed, true, &e); + idx = rtl83xx_find_l2_cam_entry(priv, seed, true, &e); if (idx >= 0) { portmask = rtl83xx_mc_group_del_port(priv, e.mc_portmask_index, port); 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..f9980ccacee1 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 @@ -1642,7 +1642,7 @@ static int rtl83xx_port_fdb_add(struct dsa_switch *ds, int port, } /* Hash buckets full, try CAM */ - rtl83xx_find_l2_cam_entry(priv, seed, false, &e); + idx = rtl83xx_find_l2_cam_entry(priv, seed, false, &e); if (idx >= 0) { rtl83xx_setup_l2_uc_entry(&e, port, vid, mac); @@ -1680,7 +1680,7 @@ static int rtl83xx_port_fdb_del(struct dsa_switch *ds, int port, } /* Check CAM for spillover from hash buckets */ - rtl83xx_find_l2_cam_entry(priv, seed, true, &e); + idx = rtl83xx_find_l2_cam_entry(priv, seed, true, &e); if (idx >= 0) { e.valid = false; @@ -1776,7 +1776,7 @@ static int rtl83xx_port_mdb_add(struct dsa_switch *ds, int port, } /* Hash buckets full, try CAM */ - rtl83xx_find_l2_cam_entry(priv, seed, false, &e); + idx = rtl83xx_find_l2_cam_entry(priv, seed, false, &e); if (idx >= 0) { if (e.valid) { @@ -1839,7 +1839,7 @@ int rtl83xx_port_mdb_del(struct dsa_switch *ds, int port, } /* Check CAM for spillover from hash buckets */ - rtl83xx_find_l2_cam_entry(priv, seed, true, &e); + idx = rtl83xx_find_l2_cam_entry(priv, seed, true, &e); if (idx >= 0) { portmask = rtl83xx_mc_group_del_port(priv, e.mc_portmask_index, port); From patchwork Fri Mar 3 21:48:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1751655 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=QijH2iGV; 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=ViZ5AyDd; 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 4PT24r4PjGz246Y for ; Sat, 4 Mar 2023 09:02:04 +1100 (AEDT) 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=6318LIRWzR2UD9LfJKWy73Xzmku0xWFIr3WR5ig4JOM=; b=QijH2iGV3ZZzNe 8NA6nrcjy7KOxsfGLcmRp0rL6G5Sz/hTvJBQ9APuNzhH6yrL8ITgU/EEVKlYBTLepStKd08CwT9I2 XaWI4HNJuVqSrCG57XgUNl859jr27ZlnIjuGwRoBvTlnpkFtuS5Ka6y17DGo4+7h70hlDdaulPReq D85DANuFrZ1oarHIGY/BNihJSprhqBdETeOaXzuviGzCitHyTauHGrSRlkeNEUKuaGNqc+aCkReRt n5u6p9KyZkPzxh0h8RQE9xGTD93VQvVJLxu7b9vLScvJwSWRnVFagHL/+yeWWOAsUAgf/HJyJ3sB4 fKkpeDqB1oA631Q//deg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDNd-007cgc-4Z; Fri, 03 Mar 2023 21:55:58 +0000 Received: from srv5.3e8.eu ([2a03:4000:28:8d0::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDJ5-007aMG-2O for openwrt-devel@lists.openwrt.org; Fri, 03 Mar 2023 21:51:19 +0000 Received: from localhost.localdomain (p200300c6cf0202a073867d2e443a1890.dip0.t-ipconnect.de [IPv6:2003:c6:cf02:2a0:7386:7d2e:443a:1890]) (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 780C1120D07; Fri, 3 Mar 2023 22:51:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1677880261; 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=fpRPF0XLcU7SreNnS1XjAK1Niyg0mU6DVM48bq72Plo=; b=ViZ5AyDd2kx44xk4zhfQoNx64qQv/e4izQ8BtbNwI4OoRlzsuGBGblgTN24ywZd6xx/ATg WAH1WKYHBOmnQVO61B9wMJUhWv4/UxZfexFQT166aNAWYjoKr/mt6yVzKU9TUifbd8M2vB QhymzhV1K38OULl+GSFtlHSJ+nFSWSSFZNglhzhR0XkqnLb2ObpIksDyILiFB1iv+6JkZv WUKN6zBa5ar6FzbRfwg45B43pmtzlueAbcOhuqucWgN7MUjG0TYHEQ6ZuPmASYivKrKvut 7RTrLhgeLGDpkwzRw64wYEi8g86uQczEuB4eaFPpoI4H+6773V2SvM7Pbjz6jQ== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule , Jan Hoffmann Subject: [PATCH 2/6] realtek: don't return 0 from rtl83xx_mc_group_alloc on failure Date: Fri, 3 Mar 2023 22:48:42 +0100 Message-Id: <20230303214846.410414-3-jan@3e8.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230303214846.410414-1-jan@3e8.eu> References: <20230303214846.410414-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230303_135115_863650_529071F8 X-CRM114-Status: GOOD ( 15.08 ) 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: This function returns the index of the allocated multicast group entry, so the return value should be negative when no entry was allocated. Fixes: cde31976e375 ("realtek: Add support for Layer 2 Multicast") Signed-off-by: Jan Hoffmann --- 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 This function returns the index of the allocated multicast group entry, so the return value should be negative when no entry was allocated. Fixes: cde31976e375 ("realtek: Add support for Layer 2 Multicast") Signed-off-by: Jan Hoffmann --- I'm not entirely sure about this patch. Seen individually, changing the return code is obviously the right thing to do. However, this entire branch is effectively dead code at the moment, as the only caller already performs the same check before. That check should probably be removed everywhere, as it doesn't really make sense to ignore mdb entries for LAG members. But I haven't tested that yet, because link aggregation is totally broken right now. So a proper cleanup will have to wait until link aggregation itself is fixed (which I'm currently working on). target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 2 +- target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 2 +- 2 files changed, 2 insertions(+), 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..695453a75862 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 @@ -983,7 +983,7 @@ static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port) if (priv->is_lagmember[port]) { pr_info("%s: %d is lag slave. ignore\n", __func__, port); - return 0; + return -1; } set_bit(mc_group, priv->mc_group_bm); 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..09fdc38b55e7 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 @@ -970,7 +970,7 @@ static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port) if (priv->is_lagmember[port]) { pr_info("%s: %d is lag slave. ignore\n", __func__, port); - return 0; + return -1; } set_bit(mc_group, priv->mc_group_bm); From patchwork Fri Mar 3 21:48:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1751658 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=frulFAFX; 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=LorqyIKV; 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 4PT29149dzz23j7 for ; Sat, 4 Mar 2023 09:05:41 +1100 (AEDT) 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=J/p5FJP1KKgZUJKNppPgXjXUHsu0kXjxGC7dSHFlHpU=; b=frulFAFX1D8Cob C3PO8glRKIDn+zz/1jbE4LOnNaUGK2WlFq1NIW2u+BxYV5OCK0lGaaVuOGhDkRG49q9RyJYDwXOqc UEY8d7LvBTYD+We2Rn/0nYQfdfG6PCA+/i0L+uKpcInFwrYgDT8VXzNTKYi4MPMtBSRoNV1MuutfP ZJCKJXfiCZlToe/47BvNlKpLafWOA4OxfW42VMgtNukyucgV4ChckhvIvNfS/jXd3Q11iQRADA/GH gRDTcrwGN2AN4BOVFvahBsfC+8X9FKJBSvlRTk/QnlsM2cV2RRAHJTSWG1hKW6oWAN5/oUfiHqnfQ EODztI35kmfHKbxC0dcQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDPd-007daI-2b; Fri, 03 Mar 2023 21:58:02 +0000 Received: from srv5.3e8.eu ([94.16.113.219]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDJ8-007aMI-RJ for openwrt-devel@lists.openwrt.org; Fri, 03 Mar 2023 21:51:20 +0000 Received: from localhost.localdomain (p200300c6cf0202a073867d2e443a1890.dip0.t-ipconnect.de [IPv6:2003:c6:cf02:2a0:7386:7d2e:443a:1890]) (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 9861C120D10; Fri, 3 Mar 2023 22:51:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1677880261; 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=9TctON+tK2mnxHxfWoBhEz0KCK5lsPewtshKcftVLwc=; b=LorqyIKVO3lMii1QZgwFw+RSDd4H+syduUJCya7Y8glI+VGE2IxHmaJMIDODk5+rFmC9wx tthm1v700McsLguf/YY2WFhSwKQ1gejp5UqFrok+xOyk1A5zYNELndPNf5fMQo+ssOZboy vAWUb5HAYiMg80PlsosOZiiOE0Pb6pPHKHSZyfyFG5gJcbKeTpLYzUNm9aAUH0I/1lxqZ0 5KIG7nLj/b393zLSS8AsJL8ObeSx8jblOgc0B67ciRoHc1NKHK4aGcaPDlXfSzl+Csk6qf C4oAgyQyI1v8pjj07QHoXax+UnzYJ3lLOO5wprZTPNg5yZchKybBBGKn6WYc9w== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule , Jan Hoffmann Subject: [PATCH 3/6] realtek: don't treat first multicast portmask entry as reserved Date: Fri, 3 Mar 2023 22:48:43 +0100 Message-Id: <20230303214846.410414-4-jan@3e8.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230303214846.410414-1-jan@3e8.eu> References: <20230303214846.410414-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230303_135119_083331_4F4EBCA8 X-CRM114-Status: GOOD ( 13.02 ) 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 695453a75862..b68b39773410 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 09fdc38b55e7..1ff2710353d8 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); From patchwork Fri Mar 3 21:48:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1751654 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=q+AZtW6t; 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=qKPnkhTl; 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 4PT22g00zBz246b for ; Sat, 4 Mar 2023 09:00:09 +1100 (AEDT) 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=DgTzTVyDAAGcB5I53xiyaPQcBiaQG5J9DpLxuHBfwK8=; b=q+AZtW6tUGsoCa 4HBCpQ4GCpnp+Ku7JUoccrytUFEiTGUsj6xdTzflS3v76eXqh7VWY35zHRoiz9o9hkxK1dR2dmU29 BAdoiuoyRX/6dlveh21OTs9PSUScXF6uuv3A/NvYwvzdbvyZFEskW4fecNXJYsSOpkiWwdm5ZKP+0 FNMxEN7KZAw+g6VQOYyguBwrbS2A4Kc9OF+cs88NFVu3AdFsezyGxaimInHYE8KjiSbTSjKmFmqCS S3R1/VndIdUDNtU8Vh/u0iDT8+7tjHV62zfPl6qZmZkslkk5wpk9J8YC1q/kBhLr6KFx1sZC09mMH zILECtZZeEHa8F/0zLVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDMY-007cI8-6d; Fri, 03 Mar 2023 21:54:50 +0000 Received: from srv5.3e8.eu ([94.16.113.219]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDJ5-007aMM-Hw for openwrt-devel@lists.openwrt.org; Fri, 03 Mar 2023 21:51:19 +0000 Received: from localhost.localdomain (p200300c6cf0202a073867d2e443a1890.dip0.t-ipconnect.de [IPv6:2003:c6:cf02:2a0:7386:7d2e:443a:1890]) (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 B7841120D23; Fri, 3 Mar 2023 22:51:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1677880261; 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=cM2s1XeMuUXLhGWjtAaDPEyzFeyHSDSTSdYSMHYGoPo=; b=qKPnkhTl9GrhY2wk4Ttb8GfChxP+9nj8Es4GohqB0mz8YtGDrxp1RPAgChThBJOopO4kL8 uWZ98OTigW0qplXInKsvix9ul8PlfQ5ow2jDjevI9m6KNX6dStaO8+W4qpfUPNoj86jrq3 8yhC187/jO9XEQLKgIfcnE55Ek9Y9pQJ352Ff+jhwA7YD9GkbKnQt5IqE1OvmVEOJxnZzg KVgV7Brhc0mdDvSPw7+gC6JAiw9X4OVY13UCUyZFSPaRRt8D5qTdY2/ILm8ZixZ42yTtUp MJiAJMIz9ynmBfVIWArJX3lCMoDl8b3Aq7uzxQ7PbEHZyF0zOMjgNrcx4pYx4w== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule , Jan Hoffmann Subject: [PATCH 4/6] realtek: actually remove port from multicast portmask Date: Fri, 3 Mar 2023 22:48:44 +0100 Message-Id: <20230303214846.410414-5-jan@3e8.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230303214846.410414-1-jan@3e8.eu> References: <20230303214846.410414-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230303_135115_850496_451F9D32 X-CRM114-Status: UNSURE ( 8.12 ) X-CRM114-Notice: Please train this message. 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: Fixes: 724e4af530cd ("realtek: Store and Restore MC memberships for port enable/disable") Signed-off-by: Jan Hoffmann --- target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 1 [...] 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 Fixes: 724e4af530cd ("realtek: Store and Restore MC memberships for port enable/disable") 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 insertions(+) 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 b68b39773410..e0c43ca743d1 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 @@ -1017,6 +1017,7 @@ static u64 rtl83xx_mc_group_del_port(struct rtl838x_switch_priv *priv, int mc_gr pr_info("%s: %d is lag slave. ignore\n", __func__, port); return portmask; } + portmask &= ~BIT_ULL(port); priv->r->write_mcast_pmask(mc_group, portmask); if (portmask == BIT_ULL(priv->cpu_port)) { portmask &= ~BIT_ULL(priv->cpu_port); 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 1ff2710353d8..dd29dc0ce400 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 @@ -1004,6 +1004,7 @@ static u64 rtl83xx_mc_group_del_port(struct rtl838x_switch_priv *priv, int mc_gr pr_info("%s: %d is lag slave. ignore\n", __func__, port); return portmask; } + portmask &= ~BIT_ULL(port); priv->r->write_mcast_pmask(mc_group, portmask); if (portmask == BIT_ULL(priv->cpu_port)) { portmask &= ~BIT_ULL(priv->cpu_port); From patchwork Fri Mar 3 21:48:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1751656 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=gqhnAHPg; 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=BJqwQ/KR; 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 4PT2652c0mz1yWx for ; Sat, 4 Mar 2023 09:03:09 +1100 (AEDT) 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=QXTJWsTBf56+g9XsN3fug82TWgyOXUPtoYfm84gUFHQ=; b=gqhnAHPgczddHV nVkMg9oA+CI/0coJbiNG7q4LNTAxsEW6xJXTQXo5JaCoZFGKcKq6pP3eT6Akb+Q8uhCiihpI98o5C KiuNGr9J51oQWhNYBCiIACHasdBWo5q6FWBv1Ht1+vjqBfyhCeZrGAM9lYMLM+kNJWxOqqus2k58f t1NH5wmjrL2xQa10n7x+FbrspkgDgaZ8dGUURdyRJLg0W4MNaVlrWQJ3jqn5BqWIYCdHGZjlTEV7A GB7t7KQl0w6NBSTnlRTqSGC36G8UN5uOe0YYJDsLlXKCwObI38g8iJh6vAMJcbiyXOtBWJDzKUAOi hk66DWAf8a7acq2r4NsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDOd-007dBm-L7; Fri, 03 Mar 2023 21:57:00 +0000 Received: from srv5.3e8.eu ([94.16.113.219]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDJ9-007aVe-Fs for openwrt-devel@lists.openwrt.org; Fri, 03 Mar 2023 21:51:21 +0000 Received: from localhost.localdomain (p200300c6cf0202a073867d2e443a1890.dip0.t-ipconnect.de [IPv6:2003:c6:cf02:2a0:7386:7d2e:443a:1890]) (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 D74AD120D3A; Fri, 3 Mar 2023 22:51:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1677880261; 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=LnGL0XGWkFhgVcv0wUHsLyhZjDu5L0gzGHeLocjAlO8=; b=BJqwQ/KROqQTCJ813Sv2WLxMNowc/orVb2rPxqHL2ytIfyqdkuIuggkV+TEGELJWsEcw8L 9Bb4bnLaqxOrr8ByBHuVxIoZbn4wS/Vi8L9n4bHXD76/2zPz9ik2imaBFe+OhBgia8Kptn DnSSlldunI0Sp36CqNLOtCWRLbkOAF9z2jWtBo5dc81yQVhdqj+WmR4IULlah6FIldng2s Zs6pTuDbLtad+6knKD060OTvsys/tvmWvYssxcxVYzIYSYLleCLK5UU/qYLHqFd3MjPtB6 D0UHl/Kmnncky24cG8wGobsQVIUuIgnWSmvbh4Jp7gyJ3/mYLb1DlZwvKQLp7A== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule , Jan Hoffmann Subject: [PATCH 5/6] realtek: don't add CPU port to multicast portmasks Date: Fri, 3 Mar 2023 22:48:45 +0100 Message-Id: <20230303214846.410414-6-jan@3e8.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230303214846.410414-1-jan@3e8.eu> References: <20230303214846.410414-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230303_135119_802471_753C0900 X-CRM114-Status: GOOD ( 10.73 ) 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 shouldn't be any reason to forward all multicast to the CPU. The original commit message also doesn't provide a reason for this seemingly unrelated change. The current implementation of the delete method is also broken, as it entirely removes any entry when the portmask contains only the CPU port, even if it was explicitly created. 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 shouldn't be any reason to forward all multicast to the CPU. The original commit message also doesn't provide a reason for this seemingly unrelated change. The current implementation of the delete method is also broken, as it entirely removes any entry when the portmask contains only the CPU port, even if it was explicitly created. Fixes: 724e4af530cd ("realtek: Store and Restore MC memberships for port enable/disable") Signed-off-by: Jan Hoffmann --- .../linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 7 ++----- .../linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 7 ++----- 2 files changed, 4 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 e0c43ca743d1..781195533c65 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,7 @@ static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port) } set_bit(mc_group, priv->mc_group_bm); - portmask = BIT_ULL(port) | BIT_ULL(priv->cpu_port); + portmask = BIT_ULL(port); priv->r->write_mcast_pmask(mc_group, portmask); return mc_group; @@ -1019,11 +1019,8 @@ static u64 rtl83xx_mc_group_del_port(struct rtl838x_switch_priv *priv, int mc_gr } portmask &= ~BIT_ULL(port); priv->r->write_mcast_pmask(mc_group, portmask); - if (portmask == BIT_ULL(priv->cpu_port)) { - portmask &= ~BIT_ULL(priv->cpu_port); - priv->r->write_mcast_pmask(mc_group, portmask); + if (!portmask) clear_bit(mc_group, priv->mc_group_bm); - } return 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 dd29dc0ce400..65713107976d 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,7 @@ static int rtl83xx_mc_group_alloc(struct rtl838x_switch_priv *priv, int port) } set_bit(mc_group, priv->mc_group_bm); - portmask = BIT_ULL(port) | BIT_ULL(priv->cpu_port); + portmask = BIT_ULL(port); priv->r->write_mcast_pmask(mc_group, portmask); return mc_group; @@ -1006,11 +1006,8 @@ static u64 rtl83xx_mc_group_del_port(struct rtl838x_switch_priv *priv, int mc_gr } portmask &= ~BIT_ULL(port); priv->r->write_mcast_pmask(mc_group, portmask); - if (portmask == BIT_ULL(priv->cpu_port)) { - portmask &= ~BIT_ULL(priv->cpu_port); - priv->r->write_mcast_pmask(mc_group, portmask); + if (!portmask) clear_bit(mc_group, priv->mc_group_bm); - } return portmask; } From patchwork Fri Mar 3 21:48:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hoffmann X-Patchwork-Id: 1751657 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=gdmxQgZt; 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=kklSgsOk; 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 4PT27g2HVsz1yWx for ; Sat, 4 Mar 2023 09:04:31 +1100 (AEDT) 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=Rz6gJZP+RMnke+sq/SM7MOuMPUOqVKguIJNoqxTHjUg=; b=gdmxQgZtPhCaAu RngZhitOgK0aTOkbXjf+ycmatzpnbP6Vr44LiIoqFi2Eqhc9CfQR4m1ZpihAlHSh9ON4baiu9ZZTK x6KGaljQQtmnWW4hFZV8txFOkc4TicKUE4Fo25ML4WA+GIAi3NCLY02QWUptAP/VVfrqx/h125pbJ 7Gb5DeMhTOHCFL0B35SaSv50+ugBr6QhuHJQqp67DIJdvo2KbWMmRVl0+EHlDPJTUszDX1F3kRCbD CDkChigvgSxBwGi/AylQwxqF7fx4L3L2NQE/To3It+vGWg8CXEu29+F7d3L53mj721d+nrQ3kI3ph uEK85GaIryij3Ocd2epw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDQm-007e5r-MO; Fri, 03 Mar 2023 21:59:13 +0000 Received: from srv5.3e8.eu ([2a03:4000:28:8d0::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDJ9-007aVg-FW for openwrt-devel@lists.openwrt.org; Fri, 03 Mar 2023 21:51:21 +0000 Received: from localhost.localdomain (p200300c6cf0202a073867d2e443a1890.dip0.t-ipconnect.de [IPv6:2003:c6:cf02:2a0:7386:7d2e:443a:1890]) (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 042C1120D5B; Fri, 3 Mar 2023 22:51:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu; s=mail20211217; t=1677880262; 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=FvHnH+862XpxSneUCD8lC6yNPjeo9IggQnXCH8AYRh8=; b=kklSgsOkpzDacla/92R0sZWurzx4ii1AU67h4sgzbLvNjUqo1t06GoKMRBeR4HqjFoA3Hh dyibEowPCIBTa2WK+lEKMC/pLue7Oxuh79+oyhtr008q4KdugYzFxEP6mNnC1VTlZh9Z/y pHqrVj3TZs9Eh94QxQ+US1uVVFsCgToAyUukCKFizEZvf3M+XYWf1oPTZnQk9ztqelq4nE 46EQjvuVhFYE0NffQNU60jxSS//wUGpv76byUm/moJ6ASWK8Q6YbY7CxmHUV4FN7S/vSy6 5VCB125/5OUqoyNhzkHyuxVU0nawMAQ/a6+jQDna/t19RXDXDUtYGglNn1QA5Q== From: Jan Hoffmann To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule , Jan Hoffmann Subject: [PATCH 6/6] realtek: remove store_mcgroups/load_mcgroups Date: Fri, 3 Mar 2023 22:48:46 +0100 Message-Id: <20230303214846.410414-7-jan@3e8.eu> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230303214846.410414-1-jan@3e8.eu> References: <20230303214846.410414-1-jan@3e8.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230303_135119_837081_D2A120BD X-CRM114-Status: GOOD ( 15.10 ) 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: The current implementation only works when store and load are called for the same port without any other calls in between. This is because the store function only saves a single port number instead of [...] 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 The current implementation only works when store and load are called for the same port without any other calls in between. This is because the store function only saves a single port number instead of a portmask for each group. It also doesn't take into account that the allocation of multicast group entries might change between store/load calls. As a result, the multicast port mask table gets corrupted. This also includes the reserved entry for unknown multicast, which gets corrupted even when no other mdb entries have been added. Remove the code for storing/loading multicast groups entirely, as the original commit message doesn't offer a convincing reason why this would be necessary in the first place. Fixes: 724e4af530cd ("realtek: Store and Restore MC memberships for port enable/disable") Signed-off-by: Jan Hoffmann --- .../files-5.10/drivers/net/dsa/rtl83xx/dsa.c | 30 ------------------- .../drivers/net/dsa/rtl83xx/rtl838x.h | 1 - .../files-5.15/drivers/net/dsa/rtl83xx/dsa.c | 26 ---------------- .../drivers/net/dsa/rtl83xx/rtl838x.h | 1 - 4 files changed, 58 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 781195533c65..ad7b1c529e4a 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 @@ -1025,31 +1025,6 @@ static u64 rtl83xx_mc_group_del_port(struct rtl838x_switch_priv *priv, int mc_gr return portmask; } -static void store_mcgroups(struct rtl838x_switch_priv *priv, int port) -{ - int mc_group; - - for (mc_group = 0; mc_group < MAX_MC_GROUPS; mc_group++) { - u64 portmask = priv->r->read_mcast_pmask(mc_group); - if (portmask & BIT_ULL(port)) { - priv->mc_group_saves[mc_group] = port; - rtl83xx_mc_group_del_port(priv, mc_group, port); - } - } -} - -static void load_mcgroups(struct rtl838x_switch_priv *priv, int port) -{ - int mc_group; - - for (mc_group = 0; mc_group < MAX_MC_GROUPS; mc_group++) { - if (priv->mc_group_saves[mc_group] == port) { - rtl83xx_mc_group_add_port(priv, mc_group, port); - priv->mc_group_saves[mc_group] = -1; - } - } -} - static int rtl83xx_port_enable(struct dsa_switch *ds, int port, struct phy_device *phydev) { @@ -1068,8 +1043,6 @@ static int rtl83xx_port_enable(struct dsa_switch *ds, int port, /* add port to switch mask of CPU_PORT */ priv->r->traffic_enable(priv->cpu_port, port); - load_mcgroups(priv, port); - if (priv->is_lagmember[port]) { pr_debug("%s: %d is lag slave. ignore\n", __func__, port); return 0; @@ -1105,7 +1078,6 @@ static void rtl83xx_port_disable(struct dsa_switch *ds, int port) // BUG: This does not work on RTL931X /* remove port from switch mask of CPU_PORT */ priv->r->traffic_disable(priv->cpu_port, port); - store_mcgroups(priv, port); /* remove all other ports in the same bridge from switch mask of port */ v = priv->r->traffic_get(port); @@ -1205,7 +1177,6 @@ static int rtl83xx_port_bridge_join(struct dsa_switch *ds, int port, port_bitmap |= BIT_ULL(i); } } - load_mcgroups(priv, port); /* Add all other ports to this port matrix. */ if (priv->ports[port].enable) { @@ -1246,7 +1217,6 @@ static void rtl83xx_port_bridge_leave(struct dsa_switch *ds, int port, port_bitmap &= ~BIT_ULL(i); } } - store_mcgroups(priv, port); /* Add all other ports to this port matrix. */ if (priv->ports[port].enable) { diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl838x.h b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl838x.h index 19049e4c957a..fc3d3f7b9777 100644 --- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl838x.h +++ b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/rtl838x.h @@ -1072,7 +1072,6 @@ struct rtl838x_switch_priv { struct notifier_block fib_nb; bool eee_enabled; unsigned long int mc_group_bm[MAX_MC_GROUPS >> 5]; - int mc_group_saves[MAX_MC_GROUPS]; int n_pie_blocks; struct rhashtable tc_ht; unsigned long int pie_use_bm[MAX_PIE_ENTRIES >> 5]; 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 65713107976d..0fdae7bc53cf 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 @@ -1012,27 +1012,6 @@ static u64 rtl83xx_mc_group_del_port(struct rtl838x_switch_priv *priv, int mc_gr return portmask; } -static void store_mcgroups(struct rtl838x_switch_priv *priv, int port) -{ - for (int mc_group = 0; mc_group < MAX_MC_GROUPS; mc_group++) { - u64 portmask = priv->r->read_mcast_pmask(mc_group); - if (portmask & BIT_ULL(port)) { - priv->mc_group_saves[mc_group] = port; - rtl83xx_mc_group_del_port(priv, mc_group, port); - } - } -} - -static void load_mcgroups(struct rtl838x_switch_priv *priv, int port) -{ - for (int mc_group = 0; mc_group < MAX_MC_GROUPS; mc_group++) { - if (priv->mc_group_saves[mc_group] == port) { - rtl83xx_mc_group_add_port(priv, mc_group, port); - priv->mc_group_saves[mc_group] = -1; - } - } -} - static int rtl83xx_port_enable(struct dsa_switch *ds, int port, struct phy_device *phydev) { @@ -1051,8 +1030,6 @@ static int rtl83xx_port_enable(struct dsa_switch *ds, int port, /* add port to switch mask of CPU_PORT */ priv->r->traffic_enable(priv->cpu_port, port); - load_mcgroups(priv, port); - if (priv->is_lagmember[port]) { pr_debug("%s: %d is lag slave. ignore\n", __func__, port); return 0; @@ -1088,7 +1065,6 @@ static void rtl83xx_port_disable(struct dsa_switch *ds, int port) /* BUG: This does not work on RTL931X */ /* remove port from switch mask of CPU_PORT */ priv->r->traffic_disable(priv->cpu_port, port); - store_mcgroups(priv, port); /* remove all other ports in the same bridge from switch mask of port */ v = priv->r->traffic_get(port); @@ -1190,7 +1166,6 @@ static int rtl83xx_port_bridge_join(struct dsa_switch *ds, int port, port_bitmap |= BIT_ULL(i); } } - load_mcgroups(priv, port); /* Add all other ports to this port matrix. */ if (priv->ports[port].enable) { @@ -1230,7 +1205,6 @@ static void rtl83xx_port_bridge_leave(struct dsa_switch *ds, int port, port_bitmap &= ~BIT_ULL(i); } } - store_mcgroups(priv, port); /* Add all other ports to this port matrix. */ if (priv->ports[port].enable) { diff --git a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.h b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.h index a4bfc285a60c..7053697bd882 100644 --- a/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.h +++ b/target/linux/realtek/files-5.15/drivers/net/dsa/rtl83xx/rtl838x.h @@ -1068,7 +1068,6 @@ struct rtl838x_switch_priv { struct notifier_block fib_nb; bool eee_enabled; unsigned long int mc_group_bm[MAX_MC_GROUPS >> 5]; - int mc_group_saves[MAX_MC_GROUPS]; int n_pie_blocks; struct rhashtable tc_ht; unsigned long int pie_use_bm[MAX_PIE_ENTRIES >> 5];