From: Yanteng Si <si.yanteng@linux.dev>
To: Nikunj Kela <nikunj.kela@sima.ai>,
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
Subject: Re: [PATCH] net: stmmac: set multicast filter to zero if feature is unsupported
Date: Mon, 26 May 2025 10:09:57 +0800 [thread overview]
Message-ID: <e0552940-9fbe-4375-a9a9-e26cd425591a@linux.dev> (raw)
In-Reply-To: <20250523221938.2980773-1-nikunj.kela@sima.ai>
在 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 <nikunj.kela@sima.ai>
> ---
> 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
next prev parent reply other threads:[~2025-05-26 2:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-23 22:19 [PATCH] net: stmmac: set multicast filter to zero if feature is unsupported Nikunj Kela
2025-05-26 2:09 ` Yanteng Si [this message]
2025-05-26 16:17 ` Nikunj Kela
2025-05-27 9:46 ` Yanteng Si
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e0552940-9fbe-4375-a9a9-e26cd425591a@linux.dev \
--to=si.yanteng@linux.dev \
--cc=0x1207@gmail.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nikunj.kela@sima.ai \
--cc=pabeni@redhat.com \
--cc=rmk+kernel@armlinux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.