From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 804781F0092B; Sat, 5 Dec 2026 22:29:03 +0000 (UTC) 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== Subject: Re: [PATCH net-next v2 1/2] i40e: move ATR sample rate from ring to PF level 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 Date: Sat, 05 Dec 2026 22:29:03 +0000 Message-ID: <179650974303.3148.5822901378203970251@kernel.org> In-Reply-To: <20261204213811.3397760-2-anthony.l.nguyen@intel.com> References: <20261204213811.3397760-2-anthony.l.nguyen@intel.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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