Re: [PATCH v3 3/3] net: atlantic: AQC113: Fix hw_atl2_hw_packet_filter_set for L2 filter base index > 0

From: netdev-bot+sashiko

Date: Sat Nov 28 2026 - 10:39:26 EST


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