🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27534

Re: [PATCH net-next v2 1/2] i40e: move ATR sample rate from ring to PF level

#27534
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 22:29
224 lines
16655 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 2

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 'reset_needed |= BIT(__I40E_PF_RESET_REQUESTED)' for
  ATR re-enable can be combined with I40E_PF_RESET_AND_REBUILD_FLAG,…
- [Medium] The patch removes the per-ring gate that kept ATR descriptors
  off TX queues whose HMC context had fd_ena=0.
- [Low] The patch changes the LLDP EEXIST branch of i40e_set_priv_flags()
  from 'reset_needed = 0' to 'reset_needed &=…
- [Low] Missing Fixes: tag (baseline decision: not a valid finding).

--

i40e: move ATR sample rate from ring to PF level

This moves atr_sample_rate from struct i40e_ring to struct i40e_pf. The
rate is initialized once in i40e_sw_init(), and i40e_atr() now reads the
PF-level value. It also requests a PF reset in i40e_set_priv_flags() when
ATR is re-enabled, so that fd_ena is reprogrammed in the TX queue context.

> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> index 58d842d676422..93dd9560af7ef 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> @@ -5300,6 +5300,16 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
>  	    test_bit(I40E_FLAG_SOURCE_PRUNING_DIS, changed_flags))
>  		reset_needed = BIT(__I40E_PF_RESET_REQUESTED);
>  
> +	/* Re-enabling ATR requires a reset to reprogram fd_ena in the
> +	 * TX queue HW context. Skip when FD_SB (ntuple) is already
> +	 * enabled, since i40e_configure_tx_ring() sets fd_ena when
> +	 * either FD flag is active.
> +	 */
> +	if (test_bit(I40E_FLAG_FD_ATR_ENA, changed_flags) &&
> +	    test_bit(I40E_FLAG_FD_ATR_ENA, new_flags) &&
> +	    !test_bit(I40E_FLAG_FD_SB_ENA, new_flags))
> +		reset_needed |= BIT(__I40E_PF_RESET_REQUESTED);

[Severity: Medium]

Can this bit end up next to the I40E_PF_RESET_AND_REBUILD_FLAG that
i40e_set_priv_flags() sets earlier when the LLDP flag changes?

	if (test_bit(I40E_FLAG_FW_LLDP_DIS, changed_flags))
		reset_needed = I40E_PF_RESET_AND_REBUILD_FLAG;

i40e_do_reset() is an if/else-if chain, and it tests the PF reset bit
before the rebuild bit:

	} else if (reset_flags & I40E_PF_RESET_FLAG) {
		...
		i40e_handle_reset_warning(pf, lock_acquired);

	} else if (reset_flags & I40E_PF_RESET_AND_REBUILD_FLAG) {
		...
		i40e_prep_for_reset(pf);
		i40e_reset_and_rebuild(pf, true, lock_acquired);

If both bits are set, only i40e_handle_reset_warning() runs. That calls
i40e_reset_and_rebuild(pf, false, ...), so i40e_setup_pf_switch() never
calls i40e_vsi_reinit_setup().

The reinit=true path was added by commit 28b1208e7a7f ("i40e: Fix addition
of RX filters after enabling FW LLDP agent"). It is needed because the FW
re-initializes from NVM settings when the LLDP agent state changes.

Without that reinit, would the PF add MAC/VLAN filters while the default
switch filter is still present? That would bring back the AQ errors and
forced promiscuous mode that commit fixed.

One way to hit this, with ntuple off and ATR off:

  ethtool --set-priv-flags ethX disable-fw-lldp off flow-director-atr on

The EEXIST change below implies that both bits are expected to be set
together, but i40e_do_reset() acts on only one of them. Something similar
already happens with veb-stats, legacy-rx and disable-source-pruning, but
the ATR combination is new.

> +
>  	/* Before we finalize any flag changes, we need to perform some
>  	 * checks to ensure that the changes are supported and safe.
>  	 */
> @@ -5431,7 +5441,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
>  				case LIBIE_AQ_RC_EEXIST:
>  					dev_warn(&pf->pdev->dev,
>  						 "FW LLDP agent is already running\n");
> -					reset_needed = 0;
> +					reset_needed &= ~I40E_PF_RESET_AND_REBUILD_FLAG;

[Severity: Low]

This isn't a bug, but this hunk changes behavior beyond ATR, and the commit
message doesn't mention it.

Before this patch, if veb-stats, legacy-rx or disable-source-pruning changed
in the same command that re-enabled the FW LLDP agent, reset_needed held
BIT(__I40E_PF_RESET_REQUESTED). If i40e_aq_start_lldp() then returned
LIBIE_AQ_RC_EEXIST, reset_needed = 0 dropped that PF reset. With this
change the PF reset is kept.

Could the commit message mention this fix and the user-visible change?

>  					break;
>  				case LIBIE_AQ_RC_EPERM:
>  					dev_warn(&pf->pdev->dev,
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
> index abbc71e815ae3..0a4272e1ab070 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
> @@ -3458,12 +3458,7 @@ static int i40e_configure_tx_ring(struct i40e_ring *ring)
>  		ring->xsk_pool = i40e_xsk_pool(ring);
>  
>  	/* some ATR related tx ring init */
> -	if (test_bit(I40E_FLAG_FD_ATR_ENA, vsi->back->flags)) {
> -		ring->atr_sample_rate = I40E_DEFAULT_ATR_SAMPLE_RATE;
> -		ring->atr_count = 0;
> -	} else {
> -		ring->atr_sample_rate = 0;
> -	}
> +	ring->atr_count = 0;

[Severity: Low]

This isn't a bug, but the commit message describes a user-visible behavior
change and has no Fixes: tag:

  previously, re-enabling ATR via
  "ethtool --set-priv-flags ethX flow-director-atr on" did not resume
  sampling until an ifdown/ifup or PF reset

This patch is presented as a refactor in a feature series, and the next
patch, "i40e: add devlink parameter for Flow Director ATR sample rate", adds
a new devlink parameter. The old per-ring latch matched how fd_ena was
programmed, so it reads as a design limitation rather than a defect.

A Fixes: tag probably isn't needed. I'm only noting it in case one was
intended.

>  
>  	/* configure XPS */
>  	i40e_config_xps_tx_ring(ring);

[ ... ]

> diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> index 7f68adb5109b0..e045f9c71c944 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c

[ ... ]

> @@ -2882,7 +2883,8 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
>  		return;
>  
>  	/* if sampling is disabled do nothing */
> -	if (!tx_ring->atr_sample_rate)
> +	sample_rate = READ_ONCE(pf->atr_sample_rate);
> +	if (!sample_rate)
>  		return;

[Severity: Medium]

With the per-ring latch gone from i40e_configure_tx_ring(), does anything
still stop i40e_atr() from posting filter programming descriptors on TX
queues whose HW context has fd_ena=0?

Before, ring->atr_sample_rate was non-zero only on rings that were
configured while I40E_FLAG_FD_ATR_ENA was set. That was the same step that
programmed tx_ctx.fd_ena.

Now the only gates are I40E_FLAG_FD_ATR_ENA, __I40E_FD_ATR_AUTO_DISABLED
and pf->atr_sample_rate, and pf->atr_sample_rate is non-zero by default.

i40e_set_priv_flags() publishes the new flags before it requests the reset:

	bitmap_copy(pf->flags, new_flags, I40E_PF_FLAGS_NBITS);
	...
	if (reset_needed)
		i40e_do_reset(pf, reset_needed, true);

The queues are stopped later, and fd_ena is reprogrammed only on rebuild:

  i40e_do_reset()
    i40e_handle_reset_warning()
      i40e_prep_for_reset()
        i40e_pf_quiesce_all_vsi()

__I40E_FD_ATR_AUTO_DISABLED may already be clear at that point. After the
earlier ATR disable, i40e_fdir_flush_and_replay() clears it when
fd_tcp4_filter_cnt is 0. i40e_set_ntuple() also clears it when ntuple is
turned off.

Consider this sequence while TCP traffic is flowing:

  ethtool --set-priv-flags ethX flow-director-atr off
  ethtool -K ethX ntuple off
  ethtool --set-priv-flags ethX flow-director-atr on

During that window, could i40e_xmit_frame_ring()->i40e_atr() on other CPUs
post I40E_TX_DESC_DTYPE_FILTER_PROG descriptors on queues that still have
fd_ena=0? That would happen on every SYN/FIN/RST and every sample_rate
packets.

The commit message itself says the reset is needed to reprogram fd_ena. The
code doesn't show how the hardware handles these descriptors on such
queues.

>  
>  	/* Currently only IPv4/IPv6 with TCP is supported */

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204213811.3397760-1-anthony.l.nguyen%40intel.com
Technical Details
Message-ID: <179650974303.3148.5822901378203970251@kernel.org>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378163-linux-kernel-netdev=dewy.ru
References: <20261204213811.3397760-2-anthony.l.nguyen@intel.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378163-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 1/2] i40e: move ATR sample rate from ring to PF level
Date: Sat, 05 Dec 2026 22:29:03 +0000
Organization: Usenet Network
Message-ID: <179650974303.3148.5822901378203970251@kernel.org>
References: <20261204213811.3397760-2-anthony.l.nguyen@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="3133446"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gaophjIWXYshzzJkNSZfsrrnU1c= sha256:hYMevkuLSzYN8riO9aIbI7gV+er6dWtAsTGwMKw6n5U= sha1:fU56LkOSkPrz5zeRvDT9GoBrl+Q= sha256:jc3faTvqeyChI7r8RGra+BV9Bgrthp2jSsUpMWboFvs=
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 9DDC6117EDD; Sun,  6 Dec 2026 01:29:26 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.639
X-Spam-Status: No, score=-3.639 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.14, 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 RzaKD6o-f63S; Sun,  6 Dec 2026 01:29:23 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-378163-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 1095E117ED8; Sun,  6 Dec 2026 01:29:14 +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 E169429283; Sat,  5 Dec 2026 22:29:12 +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=1796509750; b=E1WbiXOvBUaiX/UdJpdtJZwzWHt/1HYH3HmJAx2GQI1YFXU2qXWIHduWFyD2inew5Ea3 ciFHvxJdiLZZTgQx6xbn2Cq5Krnwyq2NyxWA/0w7drqsAvDD4jHcAdXrH/LJab9U8S3Jp 2TFl4kp2DAa9E6GXepHc7UmHrYUEreeSrEg5qdxaBCTcLLSYxukNogBVXKCcKEDYFVKXY grINmX0CTDlz5sUp45zkhv7zgiLWcrvlnER/GWPgTlq4kY9YPicvscLtscarCEgjcnNug KDOcJLuCRseOtif3UOx+cMT7+Sfjk2IewB6vPngbv1yGMTb9F24tY+xSb0s/yFZWV3Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796509750; 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=1ILfPqV61GOz4D/cMSRJhLXj1pA7ZziJkk4DP/S9H8Q=; b=3g5VjB4i2cNWhWfVttYQJ/1TuPq7QGU5m8MaZwPpDFJN83/OuXIogtuB1dTgKTVR9wk7 uawmMOCC1r/qw1aNqpb5QhrWMcWk8WpQB53Ny0IRJr2MCKAeW59xk7HNQWRYuKuAzX41T lyXqRGRHeTjljMerbPpT2UDXHAWYym4I0Pr8JziL9cL871QKd5LAU3sI/XyEJRMtYfL3n HirAgiZ30DCUR+rOxd7CX/kB4PIbYfStCYsTJgFPqieJrwvRbHgvcvNehCipdgiS++r6Z vdpY5+odGXhFNoAFhpfyNWOGEB4EaZRAND/N6qW/uycFbhjl+tHomyuZPMsGcLi38Uw==
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=VOg6LO60; 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 910C5606A335; Sat,  5 Dec 2026 22:29:10 +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=VOg6LO60
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=1796509744; b=E7zcha44k/uKkin8U9txW8MLYrBol61X9i+53BgIqb5CddCy1iT/JgZOiu9/KOArTb0v 6ZImPxg7JIzFTM78Gg1/GdVUs70wbQs56TizPL5u2T/ripqkKhnzPISKX3LEV13sgd/ss xUqLI4ffwTEpEpwkySfzotr8zOW0nZXT7HxLrUTEyEKmTI13nn/VL9PE4pPYE10TnHZrj Ccul8Gvebyb+T0A3PIaU2lZFfd/5hJFLc2sRX97HuVkrtRfdTZ0U9eGS8eXb/U2P4T33u Ap3JPaGmUQf0Q/XxWBHysQowW1i9wea+VRpoNv0zhuK8D0Cz80ou8XT3egTau+HOqEQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796509744; 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=1ILfPqV61GOz4D/cMSRJhLXj1pA7ZziJkk4DP/S9H8Q=; b=a3yQoo8kgRT/ZhfFR3FQtjy0qB+3zRC3Cw2J2SswyZx1UrhRYmEb0sjXcBPAvfH5av0o Epiu7vaRooRfi165eJx73EP8ROSBQ4M6qiohAqP/XtNWn9EBg2DyDmhBkuK4LaLtE0+FX S42AwV8e2f+pfp0r9FltbVCWFjRX5cUhylyKWuBvW/h5jtJzc+vZ6BL/8LS7480v4LlKJ 0D8iQJ6T5m4+vWpGjc8I+3bm3ctfEQUuhbKACHUd0dQumPWZuWK0ozLIpJ1AHbJKa3jtR FTAMC5zHiere4bZRPEXJfnnuAqHpJSZIVo4eYz/TmbeL0cLTC0b/cHGP/tqL+2Vlqmw==
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=VOg6LO60; 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 AB013606A31F; Sat,  5 Dec 2026 22:29:04 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 804781F0092B; Sat,  5 Dec 2026 22:29:03 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796509744; bh=1ILfPqV61GOz4D/cMSRJhLXj1pA7ZziJkk4DP/S9H8Q=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=VOg6LO60XG9qglBoFk0U6QCHIwKiOWbjOq4vOr3i6dKxYstEGwZ00kSbi5aThqw+H 3Yarkip4tAJePkcHfKaTpeW/3aNV9QWLGf00xcKmXmHa9DNGphjjXAe2MADd/VuDtn qgjAAydkKkD3NqxXFFUTqVpkVKxO6pK1Fq5Su3ZvKQb/50sQFE1G20poS+V68s7g6u 8snL85aIu0aDM2g4ahbLTJv/kvg5t6cax4bhF/co3IbzpBCKT3AMY/OPHxrvo78EvY cYbrUCFst9v8XjYBFuwK47E5GgYqDo00iWzSiuRQNfkWQs3KgU/VoVchlIKYHup48p r0qeRYPar5/fQ==
X-Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@kernel.org, andrew+netdev@lunn.ch, willemb@google.com, netdev@vger.kernel.org, mheib@redhat.com, przemyslaw.kitszel@intel.com, jiri@resnulli.us, horms@kernel.org, corbet@lwn.net, skhan@linuxfoundation.org, rdunlap@infradead.org, linux-doc@vger.kernel.org
X-In-Reply-To: <20261204213811.3397760-2-anthony.l.nguyen@intel.com>
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
X-Received-Bytes: 16458