From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2163FC5AE59 for ; Mon, 26 May 2025 02:12:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BfaAdI9zTMYbkWR9hpAtSFrILp9opsBXSmOMXnFJNzA=; b=2uovr/D4y1QqnIARUW5DEsS820 oixeFbKT73bDICWyqxl+SN/ZjnPNem8VweqqF6ZVA7r0R6r4oOgAFKAMVYvZ8/EHHEhoyDtdEBEGr 9hhVquOwabjcWJQP2tEB6ZKFrcpeDGygurBImnVFRvMVVEfONZtdP6jLviRrm9nuyauqHYhf81/GI Pl9yK7Vuuu9SBGJUDOqMQw5Nk7HwwlN57CPGYjsuUpIAySVJg/nL0SHojA2zpdQjPnR7u5yGAfsAQ GcuQUgBwjx7AGRryhrWo+eiOtyQs6FBsQ6PrGqieuoYbPK5O17fQP8LiYPB8Z0J836tQRXSL1bkhe AJCngu4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uJNK9-00000007woR-2O8A; Mon, 26 May 2025 02:12:21 +0000 Received: from out-186.mta0.migadu.com ([2001:41d0:1004:224b::ba]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uJNHz-00000007wf7-3s2L for linux-arm-kernel@lists.infradead.org; Mon, 26 May 2025 02:10:12 +0000 Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1748225404; 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=BfaAdI9zTMYbkWR9hpAtSFrILp9opsBXSmOMXnFJNzA=; b=FYEmr/E+GLbI9k1DJULJpVLB+Vkmmpn2kp2zpWL1xiEx/Zee+na0++FAge+A7Sqjn5E3b8 xRd8x1rwcJuz7bbrZ42XKFEOpgoIT0c2RKhftzUIltvk57uLHsZrox6zt70c6sx49nlVl8 s4hM5DkxEXnAewg+j0E/pOjofmFWSXw= Date: Mon, 26 May 2025 10:09:57 +0800 MIME-Version: 1.0 Subject: Re: [PATCH] net: stmmac: set multicast filter to zero if feature is unsupported To: Nikunj Kela , andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com Cc: rmk+kernel@armlinux.org.uk, 0x1207@gmail.com, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20250523221938.2980773-1-nikunj.kela@sima.ai> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yanteng Si In-Reply-To: <20250523221938.2980773-1-nikunj.kela@sima.ai> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250525_191008_326976_09A5DDD1 X-CRM114-Status: GOOD ( 17.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 在 5/24/25 6:19 AM, Nikunj Kela 写道: > Hash based multicast filtering is an optional feature. Currently, > driver overrides the value of multicast_filter_bins based on the hash > table size. If the feature is not supported, hash table size reads 0 > however the value of multicast_filter_bins remains set to default > HASH_TABLE_SIZE which is incorrect. Let's override it to 0 if the > feature is unsupported. > > Signed-off-by: Nikunj Kela > --- > drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index 085c09039af4..ccea9f811a05 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -7241,6 +7241,9 @@ static int stmmac_hw_init(struct stmmac_priv *priv) > (BIT(priv->dma_cap.hash_tb_sz) << 5); > priv->hw->mcast_bits_log2 = > ilog2(priv->hw->multicast_filter_bins); > + } else { > + priv->hw->multicast_filter_bins = 0; > + priv->hw->mcast_bits_log2 = 0; > } I didn't read the code carefully, just did a simple search: ❯ grep -rn multicast_filter_bins drivers/net/ drivers/net/ethernet/stmicro/stmmac/common.h:611: unsigned int multicast_filter_bins; drivers/net/ethernet/stmicro/stmmac/dwmac-sophgo.c:26: plat_dat->multicast_filter_bins = 0; *** drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:512: plat->multicast_filter_bins = HASH_TABLE_SIZE; *** drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:536: &plat->multicast_filter_bins); drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:541: plat->multicast_filter_bins = dwmac1000_validate_mcast_bins( drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:542: &pdev->dev, plat->multicast_filter_bins); drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c:523: mac->multicast_filter_bins = priv->plat->multicast_filter_bins; drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c:527: if (mac->multicast_filter_bins) drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c:528: mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins); drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:516: (netdev_mc_count(dev) > hw->multicast_filter_bins)) { drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:1527: mac->multicast_filter_bins = priv->plat->multicast_filter_bins; drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:1531: if (mac->multicast_filter_bins) drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:1532: mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins); drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:1568: mac->multicast_filter_bins = priv->plat->multicast_filter_bins; drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:1572: if (mac->multicast_filter_bins) drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:1573: mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins); drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:543: if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins) drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:633: if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins) drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c:679: if (netdev_mc_count(priv->dev) >= priv->hw->multicast_filter_bins) drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c:31: plat->multicast_filter_bins = HASH_TABLE_SIZE; drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c:84: plat->multicast_filter_bins = HASH_TABLE_SIZE; drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:98: plat->multicast_filter_bins = 256; drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:365: mac->multicast_filter_bins = priv->plat->multicast_filter_bins; drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:369: if (mac->multicast_filter_bins) drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c:370: mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins); drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:7240: priv->hw->multicast_filter_bins = drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:7243: ilog2(priv->hw->multicast_filter_bins); drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c:570: plat->multicast_filter_bins = HASH_TABLE_SIZE; drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c:707: plat->multicast_filter_bins = HASH_TABLE_SIZE; drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c:479: plat_dat->multicast_filter_bins = 0; drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:456: int numhashregs = (hw->multicast_filter_bins >> 5); drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:485: (netdev_mc_count(dev) > hw->multicast_filter_bins)) { drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:1057: mac->multicast_filter_bins = priv->plat->multicast_filter_bins; drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:1061: if (mac->multicast_filter_bins) drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:1062: mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins); drivers/net/ethernet/stmicro/stmmac/dwmac-generic.c:43: plat_dat->multicast_filter_bins = HASH_TABLE_SIZE; and drivers/net/ethernet/stmicro/stmmac/common.h:265:#define HASH_TABLE_SIZE 64 From the search results, the default value of multicast_filter_bins may be meaningful. And I think that even if some hardware does not support this feature, it should still be overridden in its own directory. Thanks, Yanteng