From: netdev-bot+sashiko@kernel.org
To: ovidiu.panait.rb@renesas.com
Cc: maxime.chevallier@bootlin.com, recv.jo@gmail.com,
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, shuah@kernel.org,
joabreu@synopsys.com, yi.fang.gan@intel.com,
jun.ann.lai@intel.com, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net v4 1/7] net: stmmac: Remove VLAN perfect matching dead code
Date: Thu, 10 Sep 2026 23:45:57 +0000 [thread overview]
Message-ID: <178908395746.219967.12509019591003417803@kernel.org> (raw)
In-Reply-To: <20260908164309.59282-2-ovidiu.panait.rb@renesas.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider:
Critical: 0 · High: 0 · Medium: 1 · Low: 1
- [Medium] Incomplete removal: the two in-tree self-tests whose only
purpose was to exercise the deleted VLAN "perfect matching" fallback…
- [Low] The commit carries `Fixes: c7ab0b8088d7 ("net: stmmac: Fallback
to VLAN Perfect filtering if HASH is not available")` while its own…
--
net: stmmac: Remove VLAN perfect matching dead code
This removes the "perfect matching" fallback that stmmac_vlan_update() used
when priv->dma_cap.vlhash was clear, along with the perfect_match argument
of the ->update_vlan_hash callback and the corresponding branches in
vlan_update_hash() and dwxgmac2_update_vlan_hash().
No Link: tags were present in the commit header.
> stmmac_vlan_update() falls back to "perfect matching" when the VLAN hash
> filter is unavailable (!priv->dma_cap.vlhash). This fallback has been
> unreachable in normal operation since its introduction in
> commit c7ab0b8088d7 ("net: stmmac: Fallback to VLAN Perfect filtering if
> HASH is not available") because the NETIF_F_HW_VLAN_{CTAG,STAG}_FILTER
> features are advertised only when priv->dma_cap.vlhash is true.
>
> Fixes: c7ab0b8088d7 ("net: stmmac: Fallback to VLAN Perfect filtering if HASH is not available")
[Severity: Low]
Is the Fixes: tag intended here, given the message states the removed code
"has been unreachable in normal operation since its introduction"?
The unreachability claim does check out: NETIF_F_HW_VLAN_CTAG_FILTER and
NETIF_F_HW_VLAN_STAG_FILTER are only set when priv->dma_cap.vlhash is true
in stmmac_hw_init():
if (priv->dma_cap.vlhash) {
ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
ndev->features |= NETIF_F_HW_VLAN_STAG_FILTER;
}
and the VLAN core only calls ndo_vlan_rx_add_vid/ndo_vlan_rx_kill_vid for
devices advertising hardware filtering (vlan_hw_filter_capable() in
net/8021q/vlan_core.c).
So no user-visible misbehaviour appears to be corrected, while the patch does
change the ->update_vlan_hash signature in hwif.h, stmmac_main.c and
stmmac_vlan.c. Would it be better to drop the Fixes: tag and target net-next,
or alternatively describe a concretely reachable failure in the message?
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 24656b35350b..24d64cce1d87 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -6816,29 +6816,18 @@ static u32 stmmac_vid_crc32_le(__le16 vid_le)
> static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double)
> {
> u32 crc, hash = 0;
> - u16 pmatch = 0;
> - int count = 0;
> u16 vid = 0;
>
> for_each_set_bit(vid, priv->active_vlans, VLAN_N_VID) {
> __le16 vid_le = cpu_to_le16(vid);
> crc = bitrev32(~stmmac_vid_crc32_le(vid_le)) >> 28;
> hash |= (1 << crc);
> - count++;
> - }
> -
> - if (!priv->dma_cap.vlhash) {
> - if (count > 2) /* VID = 0 always passes filter */
> - return -EOPNOTSUPP;
> -
> - pmatch = vid;
> - hash = 0;
> }
[Severity: Medium]
Should the two self-tests that exist only to exercise this fallback be
removed in the same patch?
After this hunk, stmmac_vlan_update() no longer reads priv->dma_cap.vlhash,
but stmmac_selftests.c still overrides the capability around the ordinary
test bodies:
stmmac_test_vlanfilt_perfect():
int ret, prev_cap = priv->dma_cap.vlhash;
if (!(priv->dev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
return -EOPNOTSUPP;
priv->dma_cap.vlhash = 0;
ret = __stmmac_test_vlanfilt(priv);
priv->dma_cap.vlhash = prev_cap;
stmmac_test_dvlanfilt_perfect() does the same around
__stmmac_test_dvlanfilt().
Since nothing under test inspects dma_cap.vlhash any more, do these two
wrappers now behave exactly like stmmac_test_vlanfilt() and
stmmac_test_dvlanfilt()?
That would make the "VLAN Filtering (perf)" and "Double VLAN Filter (perf)"
entries in stmmac_selftests[] report PASS from ethtool -t for a filtering
mode the driver no longer implements, and they could never fail for the
behaviour they name.
Verified that both wrappers are still unchanged at the end of the series
(bb70e68e6ebc), so this does not look like a later cleanup either.
> @@ -184,20 +184,6 @@ static void vlan_update_hash(struct mac_device_info *hw, u32 hash,
> }
>
> writel(value, ioaddr + VLAN_TAG);
> - } else if (perfect_match) {
> - u32 value = VLAN_ETV;
> -
> - if (is_double) {
> - value |= VLAN_EDVLP;
> - value |= VLAN_ESVL;
> - value |= VLAN_DOVLTC;
> - } else {
> - value &= ~VLAN_EDVLP;
> - value &= ~VLAN_ESVL;
> - value &= ~VLAN_DOVLTC;
> - }
> -
> - writel(value | perfect_match, ioaddr + VLAN_TAG);
> } else {
> value &= ~(VLAN_VTHM | VLAN_ETV);
> value &= ~(VLAN_EDVLP | VLAN_ESVL);
With only the hash and no-hash branches left in vlan_update_hash() and in
dwxgmac2_update_vlan_hash(), a nonzero hash always enables hash matching, so
the "perf" self-tests end up programming the plain hash filter. Would
dropping those two test functions and their stmmac_selftests[] entries (or
re-pointing them at the vlan_add_hw_rx_fltr() path) be the right follow-up
inside this patch?
[ ... remaining hunks snipped ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260908164309.59282-1-ovidiu.panait.rb%40renesas.com
next prev parent reply other threads:[~2026-09-10 23:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 16:43 [PATCH net v4 0/7] net: stmmac: Fix double VLAN 802.1ad tag handling Ovidiu Panait
2026-09-08 16:43 ` [PATCH net v4 1/7] net: stmmac: Remove VLAN perfect matching dead code Ovidiu Panait
2026-09-10 23:45 ` netdev-bot+sashiko [this message]
2026-09-08 16:43 ` [PATCH net v4 2/7] net: stmmac: Stop toggling the EDVLP bit Ovidiu Panait
2026-09-10 23:45 ` netdev-bot+sashiko
2026-09-08 16:43 ` [PATCH net v4 3/7] net: stmmac: Rework S-VLAN handling Ovidiu Panait
2026-09-10 23:46 ` netdev-bot+sashiko
2026-09-08 16:43 ` [PATCH net v4 4/7] net: stmmac: Do not advertise S-VLAN stripping when it is disabled Ovidiu Panait
2026-09-10 23:46 ` netdev-bot+sashiko
2026-09-08 16:43 ` [PATCH net v4 5/7] net: stmmac: Disable S-Tag processing on dwmac4 Ovidiu Panait
2026-09-09 12:19 ` Maxime Chevallier
2026-09-10 23:46 ` netdev-bot+sashiko
2026-09-08 16:43 ` [PATCH net v4 6/7] selftests: drv-net: Move _set_ethtool_feat() into lib Ovidiu Panait
2026-09-10 23:42 ` Jakub Kicinski
2026-09-08 16:43 ` [PATCH net v4 7/7] selftests: drv-net: Add VLAN test Ovidiu Panait
2026-09-10 23:46 ` netdev-bot+sashiko
2026-09-10 23:52 ` Jakub Kicinski
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=178908395746.219967.12509019591003417803@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=joabreu@synopsys.com \
--cc=jun.ann.lai@intel.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=ovidiu.panait.rb@renesas.com \
--cc=pabeni@redhat.com \
--cc=recv.jo@gmail.com \
--cc=shuah@kernel.org \
--cc=yi.fang.gan@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox