From: netdev-bot+sashiko@kernel.org
To: anthony.l.nguyen@intel.com
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
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 [thread overview]
Message-ID: <179650974303.3148.5822901378203970251@kernel.org> (raw)
In-Reply-To: <20261204213811.3397760-2-anthony.l.nguyen@intel.com>
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
next prev parent reply other threads:[~2026-12-05 22:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 21:38 [PATCH net-next v2 0/2][pull request] i40e: add runtime-tunable ATR sample rate Tony Nguyen
2026-12-04 21:38 ` [PATCH net-next v2 1/2] i40e: move ATR sample rate from ring to PF level Tony Nguyen
2026-12-05 22:29 ` netdev-bot+sashiko [this message]
2026-12-04 21:38 ` [PATCH net-next v2 2/2] i40e: add devlink parameter for Flow Director ATR sample rate Tony Nguyen
2026-12-05 22:29 ` netdev-bot+sashiko
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=179650974303.3148.5822901378203970251@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=mheib@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rdunlap@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=willemb@google.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