Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: j@jannau.net
Cc: sukhdeeps@marvell.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3 3/3] net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0
Date: Sat, 28 Nov 2026 15:39:09 +0000	[thread overview]
Message-ID: <179588034965.3135.11135930842841069370@kernel.org> (raw)
In-Reply-To: <20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-3-b5efbc124dcc@jannau.net>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] This patch adds an off-by-one in
  hw_atl2_hw_packet_filter_set()…

--

net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0

hw_atl2_hw_packet_filter_set() used to wrap hw_atl_b0_hw_packet_filter_set().
That function enables or disables L2 filters 1..32 without taking
l2_filters_base_index into account. With l2_filters_base_index = 9 on Apple
silicon systems, this could disable the MAC address filter.

This patch copies the b0 function into hw_atl2.c and changes the unicast
filter enable loop to start at base_location.

> diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
> index 0b5a5bc420e92..89841612be168 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
> @@ -759,9 +759,43 @@ static int hw_atl2_hw_ring_tx_init(struct aq_hw_s *self,
>  static int hw_atl2_hw_packet_filter_set(struct aq_hw_s *self,
>  					unsigned int packet_filter)
>  {
> +	struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;
> +	struct hw_atl2_priv *priv = self->priv;
> +	u32 base_location = priv->l2_filters_base_index + 1;

[ ... ]

> +	hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST));
> +
> +	for (i = 0; i < num_l2_filters; ++i)
> +		hw_atl_rpfl2_uc_flr_en_set(self,
> +					   (cfg->is_mc_list_enabled &&
> +					    (i <= cfg->mc_list_count)) ?
> +					   1U : 0U, base_location + i);

[Severity: Medium]
Does this enable one more L2 unicast filter slot than the driver
programmed?

The old b0 loop started at HW_ATL_B0_MAC_MIN (1) and used the absolute
slot number:

hw_atl_b0_hw_packet_filter_set() {
    ...
	for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i)
		hw_atl_rpfl2_uc_flr_en_set(self,
					   (cfg->is_mc_list_enabled &&
					    (i <= cfg->mc_list_count)) ?
					   1U : 0U, i);
    ...
}

The inclusive "i <= cfg->mc_list_count" test was correct there. Here the
loop is 0-based and offset by base_location, so the same test enables
mc_list_count + 1 slots: base_location + 0 through
base_location + mc_list_count.

hw_atl2_hw_multicast_list_set() only programs count slots:

hw_atl2_hw_multicast_list_set() {
    ...
	for (cfg->mc_list_count = 0U;
			cfg->mc_list_count < count;
			++cfg->mc_list_count) {
		u32 i = cfg->mc_list_count;
		...
		hw_atl2_rpfl2_uc_flr_tag_set(self, 1, base_location + i);

		hw_atl_rpfl2_uc_flr_en_set(self, (cfg->is_mc_list_enabled),
					   base_location + i);
	}
    ...
}

So slot base_location + mc_list_count is enabled but never written in this
pass. Take this sequence:

- add a secondary MAC so the list has N + 1 entries
- remove it so the list has N entries
- hw_atl2_hw_multicast_list_set() rewrites slots 0..N-1 only
- hw_atl2_hw_packet_filter_set() turns base_location + N back on

The hardware would then keep accepting frames for the removed address.
With mc_list_count == 0 and IFF_MULTICAST set, slot base_location is enabled
even though it was never programmed.

This affects every AQC113, including l2_filters_base_index == 0. Should the
test be "i < cfg->mc_list_count" in the new 0-based loop?

> +
> +	return aq_hw_err_from_flags(self);
>  }
>  
>  #undef IS_FILTER_ENABLED

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-0-b5efbc124dcc%40jannau.net

      reply	other threads:[~2026-11-28 15:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 14:54 [PATCH v3 0/3] net: atlantic: AQC113: Fix regression on Apple silicon systems Janne Grunau
2026-11-27 14:54 ` [PATCH v3 1/3] net: atlantic: AQC113: Ensure L2 filter count is valid Janne Grunau
2026-11-28 15:39   ` netdev-bot+sashiko
2026-11-27 14:54 ` [PATCH v3 2/3] net: atlantic: AQC113: Limit multicast filters to available slots Janne Grunau
2026-11-28 15:39   ` netdev-bot+sashiko
2026-11-27 14:54 ` [PATCH v3 3/3] net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0 Janne Grunau
2026-11-28 15:39   ` netdev-bot+sashiko [this message]

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=179588034965.3135.11135930842841069370@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=j@jannau.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=sukhdeeps@marvell.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