๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23925

Re: [PATCH v3 2/3] net: atlantic: AQC113: Limit multicast filters to available slots

#23925
From: netdev-bot+sashiko
Date: Sat, 28 Nov 2026 15:39
109 lines
12235 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] The new helper hw_atl2_get_multicast_address_max() returns
  `min(priv->l2_filter_count - 1, AQ_HW_MULTICAST_ADDRESS_MAX)`.

--

net: atlantic: AQC113: Limit multicast filters to available slots

This adds a hw_get_multicast_address_max() hw op. With it,
aq_nic_set_multicast_list() can fall back to IFF_PROMISC or IFF_ALLMULTI
based on how many L2 filter slots the firmware really provides. hw_atl2
takes the value from the firmware-reported l2_filter_count, and the bounds
check in hw_atl2_hw_multicast_list_set() now uses l2_filter_count too.

> 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 25dd7150aaaf2..0b5a5bc420e92 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2.c
> @@ -777,7 +777,7 @@ static int hw_atl2_hw_multicast_list_set(struct aq_hw_s *self,
>  	struct aq_nic_cfg_s *cfg = self->aq_nic_cfg;
>  	int err = 0;
>  
> -	if (count > (HW_ATL2_MAC_MAX - HW_ATL2_MAC_MIN)) {
> +	if (count > (priv->l2_filter_count - 1)) {
>  		err = -EBADRQC;
>  		goto err_exit;
>  	}

[ ... ]

> @@ -1602,6 +1602,14 @@ static int hw_atl2_hw_vlan_ctrl(struct aq_hw_s *self, bool enable)
>  	return aq_hw_err_from_flags(self);
>  }
>  
> +static unsigned int hw_atl2_get_multicast_address_max(struct aq_hw_s *self)
> +{
> +	struct hw_atl2_priv *priv = self->priv;
> +
> +	return min_t(unsigned int, priv->l2_filter_count - 1,
> +		     AQ_HW_MULTICAST_ADDRESS_MAX);
> +}

[Severity: Medium]
Should this helper also account for the firmware base index?
hw_atl2_hw_multicast_list_set() writes slots starting at
l2_filters_base_index + 1. Neither this helper nor the new check above
limits the count to the part of the HW_ATL2_MAC_MAX (38) entry bank that
sits above that base.

hw_atl2_utils_get_filter_caps() checks the two firmware values separately:

    priv->l2_filters_base_index = filter_caps.l2_filters_base_index;
    if (priv->l2_filters_base_index >= HW_ATL2_MAC_MAX)
        priv->l2_filters_base_index = HW_ATL2_MAC_UC;
    priv->l2_filter_count = filter_caps.l2_filter_count;
    if (priv->l2_filter_count < 1 || priv->l2_filter_count > HW_ATL2_MAC_MAX)
        priv->l2_filter_count = HW_ATL2_MAC_MAX - priv->l2_filters_base_index;

This means firmware caps such as base=9 and count=38 are accepted. With
those values:

  - this helper returns 32
  - aq_nic_set_multicast_list() can pass 32 addresses
  - the count > 37 check in hw_atl2_hw_multicast_list_set() passes

The loop then writes the DA LSW/MSW, tag and enable registers at
base_location + i, which covers slots 10 to 41. Slots 38 to 41 are past the
L2 unicast filter bank that hw_atl2_hw_init() initialises.

HW_ATL_RPFL2UC_DAFLSW_ADR(f) is 0x5110 + f * 8. So slot 40 maps to 0x5250,
which is HW_ATL_RPFL2MC_ENF_ADR(0), and slot 41 maps to ENF_ADR(2) and
ENF_ADR(3).

Can this overwrite the L2 multicast filter registers? The Apple values
(9 + 29) add up to exactly 38, so this only happens with firmware that
reports base + count > 38.

The later patch in this series, "net: atlantic: AQC113: Fix
hw_atl2_hw_packet_filter_set for L2 filter base index > 0", sizes the same
slot range like this:

    min_t(unsigned int, HW_ATL2_MAC_MAX - base_location,
          priv->l2_filter_count - 1);

At the end of the series, three places therefore use different slot
counts:

  - this helper
  - the check in hw_atl2_hw_multicast_list_set()
  - the loop in hw_atl2_hw_packet_filter_set()

Could the helper and the check both use the same limit?

    min(HW_ATL2_MAC_MAX - (l2_filters_base_index + 1),
        l2_filter_count - 1, AQ_HW_MULTICAST_ADDRESS_MAX)

-- 
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: <179588034859.3135.5963966861559896048@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-373195-linux-kernel-netdev=dewy.ru
References: <20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-2-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-373195-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH v3 2/3] net: atlantic: AQC113: Limit multicast filters to
 available slots
Date: Sat, 28 Nov 2026 15:39:08 +0000
Organization: Usenet Network
Message-ID: <179588034859.3135.5963966861559896048@kernel.org>
References: <20261127-net-atlantic-aq113-apple-l2-filter-slots-v3-2-b5efbc124dcc@jannau.net>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="978306"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:oCLbho0NAbDlSCZ41+abCeRuRD4= sha256:OrLjb05KpBgIp9YLF2qnw7Cbo6zSVoB7mqKEW/oryCU=
	sha1:s639LY0gYml40IPuNqysngS9Qi4= sha256:eCrNPPGc55kc/XH8t5yN9ec7EJQQ+e+8pNpiEUzC+c0=
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 51EDA125F84; Sat, 28 Nov 2026 18:39:39 +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 Hpq0jW7JczmF;
	Sat, 28 Nov 2026 18:39:35 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373195-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 6147E125F83; Sat, 28 Nov 2026 18:39:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id B0C9728D52; Sat, 28 Nov 2026 15:39:20 +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=1795880355;
	b=d6CTRDg9w44o4uQ/LVNyojkA9Uz47H9Kpt8xBX5SrmmDckyMCDXsF0sqWSfzTXQfir8C
	 9USluApTa4IDrrX0qTVmCzf50rN4GSS8XEDI+aLt43h13G4dAIL/e1Z9UxGFXM9ndJVk8
	 MPGHI/6rxUGeSnoTaRHhymtQv/iM8SZo3kPS8lR8t6dZOGwR5obJzLXCdxmQfoBiD5ZMU
	 lXNeDWU8GqOGEdgSdUM1+kBbPo5Swv3Uc4vcdzdkLW94S2rdBRh18O2CArFwTr4Fu1WY1
	 W8NfyLVSARDa1xQhP9btsl7N1RUt3uvj3x4b+t7i1a0P3I5sDZVh+QUDzB6BI/XANlw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795880355;
	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=LShtitvz7DRRsTeVyGIjUpCoy6XLU9LzpKYb3S4c5x0=;
	b=JSSkD+EEvijSxmfo4U826oRhC1NlwzxWoPdY5+VykmmTK6mPKtHmfXkkJ6TDs2PSncUQ
	 fWo3pp6MxHiSep7Ky4bywPg5HwDikpTRHnUSUO3WZ0vFJGK+1NgnUdf5Wd9AjXIAg6xaC
	 DHx0psmSqou/0RJTzt7oCSiZ/2Kpekv/AeZIi0tNDVIdAMnJ3WcW06QLg4wbYm9tme8fq
	 jY5yy0kZwPtCMoHDNHD46WQDtAxcr6qwOZI+1fnkZi2R88HK13XjecHfj79rVdhlKN272
	 YKFtDtjBtftUvCqc49Jn5O9MeKK7zhXP4POCm8WEyuLrPNV2enWXYcHGvqoEnYQpWJA==
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=EGuT6NUG;
	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 9F8A3606A68D;
	Sat, 28 Nov 2026 15:39:15 +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=EGuT6NUG
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=1795880349;
	b=gUq4EZEgYKApTpOy2BS4+x6q/+I7QvfmEG7Mh1ZxL/iopdg/v/xXvRYO86YfJA4mN69B
	 /ZGJuteAkmseHrVMQcmoYB/bzAsMWQ3lfL+x+0Ux3k2sc/5ycvTnl60PFT/UEJuhL1z9S
	 AszHlxWBquG+ciLWj/fw4PzX/SlzURuSssEghFNenRp/pfKIR3RmAIdk6Zr944fIdea3/
	 xGXJnWseIVMLrDnFPkDlPyrsSt4EAd/Ec3xOg05BnkhEZZUCcL2wzLbYd3m4+mvskZ1lb
	 wIhAjHZthSLWx90bXR9BgUBx4ls5wwQsG4MNIGLskvxVo9zInYZHVr4/lQGNmhYdw2w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795880349;
	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=LShtitvz7DRRsTeVyGIjUpCoy6XLU9LzpKYb3S4c5x0=;
	b=IvY4+TvDMZnQ5RzmsiAT3LKGEr9qyYt1MykcGubzG2LRE8HNSzSVVH/BszUW+c7mqtx9
	 hosoS0fmWFRqx04i6nZhOm9N2jH8/Idv2XMcquW+yhOKoUSNUy6PvLxwI9USn8fq7hLVv
	 77z1L0lnNVXFHlK33zZ9ShU1saeUChQvLXdKlTwUPM7n711VM5MTlr2KdhPKK9cLe3x4a
	 x6xog1SbrgsYtUQQnY7jVm7CGCLdcpccazgzPUA637LfEka+mgvGTz0F0RoNoSbMi1AGE
	 RbwJeQtU8oZL7XujPTPyR1Zvz88YTl1hsmnzjWQQ3u6yRJ+tqTdwl+HGZhf4iBQp/ug==
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=EGuT6NUG;
	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 BEF0F606A32C;
	Sat, 28 Nov 2026 15:39:09 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01E1E1F00893;
	Sat, 28 Nov 2026 15:39:08 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795880349;
	bh=LShtitvz7DRRsTeVyGIjUpCoy6XLU9LzpKYb3S4c5x0=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=EGuT6NUGO5FCeAjYFWE5zDDrS46diaMjUQmPrYMgee1ztUNv7HzCH2/hu4MjIoPTi
	 /TvR5m7v5+97FyuTamoca18j8dQHZPRTgoACUxO0XeYCIKwOpdCZ/C7KDpRxt4g8aM
	 G1d68NM/jcvbCsCPgpSHaqrbvjQa1R1LppdxXAvO35hTg4kCOWtrpyJZ1gBCV2EFo7
	 J5nUEvIr1+1B8h4gTaa1ZpnB5Dcgoa1QL+KNYZqCg6px0D+ND1KAP3inxz3gsER0Wv
	 zLaCWevGfD5ZcqMlXbarweKW+d4w6BfNa4h6hp90dnU87yOEOYr53AQzoXoTGS7Qmq
	 zwsdGlM/AmodQ==
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-2-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