🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23926

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

#23926
From: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 15:39
111 lines
11806 bytes
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
Technical Details
Message-ID: <179588034965.3135.11135930842841069370@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373196-linux-kernel-netdev=dewy.ru
References: <20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-3-b5efbc124dcc@jannau.net>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373196-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179588034965.3135.11135930842841069370@kernel.org>
References: <20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-3-b5efbc124dcc@jannau.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="978354"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:kwYQRMZ1ZLl6M83zR8i8ICuyHgc= sha256:515zLNcyJBGLsHgRwfdlzzPcAXVGQNU7ak6jwQmxjgE=
	sha1:L3X4OXVsEDYKoK95VZa30Lm3Ue8= sha256:d4IRnIcKimIqhCEAlFHohxrStEkNXvuVjFnEYtPl4R8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 2759D125F83; Sat, 28 Nov 2026 18:39:40 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 2KyDE-UUsUqO;
	Sat, 28 Nov 2026 18:39:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-373196-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 57A5A125F82; Sat, 28 Nov 2026 18:39:21 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 5DCB8248E7; Sat, 28 Nov 2026 15:39:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795880352;
	b=qblU+Y/fK0vBHZD7RkOdOqI937qx/Mz93WZqHdDyHvnOQ55vAuyrspBVZOcill4pzMcN
	 mt8gZE7Dtzl5r/uDEXv2yaUsGQ3bwF+G4ZUNrgPlXH5J692UN3Lz8P+YMZZS1hhCAxJZH
	 CfX78kGKxQgvWvg7wpUK9yWh7wHKLCilqg9Le3kJggoP3kDPfeGogYEps/dB22EMJmFz7
	 RLsjR5gMHr8kJCmrMbSuSRtZlDTY38Nn+Se6NaeR2VCnTpctgV9yqcAEkY6h8ltKrojFy
	 qc4l4PAnEkMBbAMaBuxgvL/n5SHLF/YVUZfwFYtbuJwsVjooJkfeSdmuuHqgGQYs2Qg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795880352;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=LZkDUpW5lcBiMmS7XikDtOe8pmsL+bMP3t+U/T7flfw=;
	b=vfLX0rzKQFpRJZMhgbI9Yk/X9qFKBCrU0J6q9g8iYewRmWidBUjEhRwMSRuvQi/9QipZ
	 DjnZatDxzG78VeF7XWqkl1Hb3THdwolpgn/rxyrWelXsdosSq9wdxmftpQz+FSj5u3SWG
	 Oa/gL81Jl+MmgAXsaTqNKT3FkKbXSJ7tM/PMUolhrNNYws4FxM8JFWtaqf57RYYedIYI/
	 1RWeeACzQ0MYy6DdzGrr1IUo08bgZgGXQInO121uVB/eGou1QEM2iItZMFeTelnkQ4A8C
	 TytyJaZM3GQtPnEqVHL9gkSESfHmP9OObxUXacZqUcwLnvAmjjECTBYt46Qv7YoXuYQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Aou6cs1I;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B6A4F606A326;
	Sat, 28 Nov 2026 15:39:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Aou6cs1I
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795880351;
	b=kleWS49wV77RMMwfvefS7F73FhHW6pfr/qrwEgg4AYZ0tmbv/YM9f7d8qu10mBIEP2j1
	 RrXYESeRq95BspBZtukCfyzak6C80r/bnw2fPkPiDFd0uX5v2OjAq0f3/4YD7DmAL/lXP
	 FNvTLTX5QHm2FEOgPR+b8vDp3jb/L1viYKOkNv2Wh30/57ZLoGbs3ZumBF+/XW+t0Xs4B
	 nKJ7ziZCJzCd7/oqFl6jOaSwLq2LlgrmcpryUR96hcFW4mFiwxIgQtTzYXdnc9vXsXB0J
	 ftPxiweRNubfyXnOb7D+L820V2UKcMbMZNDBA3dRrK0s4aLsOj7kt8Ka+DxAo1g05yQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795880351;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=LZkDUpW5lcBiMmS7XikDtOe8pmsL+bMP3t+U/T7flfw=;
	b=KS7pT5/wqTG2zY5MX4InJvIoldVMJ2KckZiNchkHSonVwRvQfbmbsDz7UeCWfmf21a83
	 ng2leQEwxbwEUB1lWniJoTKNJ+yi+zfooTHGdXkUMJlJFOxRUoZ2PgdvH2j1ZI5ggO9Vq
	 JPCHhFvs8Sglni+OwUGmv4n2jpnAajZeBUsHBjD63d3J3s8ndmQY0367O+vpVi9BxlTL2
	 ymc3NfB5Kn4zbt1Y7VI3JVhvz5pqmyc0hIrO00H7K8Uq7wSPE/wzIB6E+JTng1/+m2nc8
	 CBjnuQTvhcnGgmhL1BSzEnINj2cOmxGKwoeKoDl1bNeMZjcXaaP089EBN2wthq4VmCw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Aou6cs1I;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id D59AB606A31F;
	Sat, 28 Nov 2026 15:39:11 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18C931F00893;
	Sat, 28 Nov 2026 15:39:10 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795880350;
	bh=LZkDUpW5lcBiMmS7XikDtOe8pmsL+bMP3t+U/T7flfw=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Aou6cs1Ib4ILaFtM8rok7LwIZ7Ry7XDFdvPbD+P4XTp9UkNaqeo+y6QIZfpZrTErr
	 wH+h52n0tz8h0dBpon1kJt9Q8j4JNR3MrKucnH1h9SMHj7ScD5etsaWeo3N8hphoEF
	 z0janFbdyckzDK46/sm1TDdX64pgAC9ayxf0+c7+dUySdDhHVwY6/EXJ0xcfELoCnh
	 1P8TYYUkKkkPvz8yrvQGzBn22hP4z0+hJxxtZc6JT3gS1rNSb+Ey9dalucwSPkLdir
	 u095DdOazykJoFSUzDqD2y2BCdmyYOzYYfcoJ0wqVtM+K8siEmKd4UE/LiE9NWQi98
	 wy7IHzi1WfmDg==
X-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
X-In-Reply-To: <20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-3-b5efbc124dcc@jannau.net>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list