> -----Original Message-----
> From: Intel-wired-lan <[email protected]> On Behalf
> Of [email protected]
> Sent: Sunday, June 14, 2026 6:12 PM
> To: [email protected]
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; Nguyen, Anthony L
> <[email protected]>; Kitszel, Przemyslaw
> <[email protected]>; [email protected]; Mohammad Heib
> <[email protected]>
> Subject: [Intel-wired-lan] [PATCH net-next] i40e: add devlink
> parameter for Flow Director ATR sample rate
> 
> From: Mohammad Heib <[email protected]>
> 
> The i40e driver uses Flow Director ATR to periodically update flow
> steering information for active TCP flows. The update frequency is
> currently controlled by I40E_DEFAULT_ATR_SAMPLE_RATE and is fixed at
> driver build time.
> 
> On systems with a large number of queues and high-rate TCP workloads,
> the default sampling interval can result in frequent Flow Director
> reprogramming for long-lived flows.
> 
> The amount of TCP packet reordering observed on some systems is
> sensitive to the ATR sampling interval. Increasing the interval
> reduces Flow Director programming activity and can significantly
> reduce the associated reordering.
> 
> Since the optimal sampling interval depends on the workload and system
> configuration, a single fixed value is not suitable for all
> deployments.
> 
> Add a devlink parameter to allow administrators to tune the ATR sample
> rate at runtime without rebuilding the driver or disabling ATR
> functionality entirely.
> 
> Signed-off-by: Mohammad Heib <[email protected]>
> ---
>  Documentation/networking/devlink/i40e.rst     | 19 ++++++
>  drivers/net/ethernet/intel/i40e/i40e.h        |  1 +
>  .../net/ethernet/intel/i40e/i40e_devlink.c    | 65
> +++++++++++++++++++
>  drivers/net/ethernet/intel/i40e/i40e_main.c   |  4 +-
>  drivers/net/ethernet/intel/i40e/i40e_txrx.h   |  4 +-
>  5 files changed, 90 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/networking/devlink/i40e.rst
> b/Documentation/networking/devlink/i40e.rst
> index 51c887f0dc83..704469aa9acf 100644
> --- a/Documentation/networking/devlink/i40e.rst
> +++ b/Documentation/networking/devlink/i40e.rst
> @@ -40,6 +40,25 @@ Parameters
> 
>          The default value is ``0`` (internal calculation is used).
> 

...

> +static int i40e_atr_sample_rate_set(struct devlink *devlink,
> +                                 u32 id,
> +                                 struct devlink_param_gset_ctx *ctx,
> +                                 struct netlink_ext_ack *extack) {
> +     struct i40e_pf *pf = devlink_priv(devlink);
> +     struct i40e_vsi *vsi;
> +     u32 sample_rate = ctx->val.vu32;
> +     int i;
> +
> +     pf->atr_sample_rate = sample_rate;
> +
> +     if (!test_bit(I40E_FLAG_FD_ATR_ENA, pf->flags))
> +             return 0;
> +
> +     vsi = i40e_pf_get_main_vsi(pf);
> +     if (!vsi)
> +             return 0;
> +
> +     for (i = 0; i < vsi->num_queue_pairs; i++) {
> +             if (!vsi->tx_rings[i])
> +                     continue;
I'm afraid devlink runtime callback holds NO rtnl_lock.
So if (!vsi->tx_rings[i]) can see not NULL while i40e_down() is running for 
example.

> +             vsi->tx_rings[i]->atr_sample_rate = sample_rate;
> +             vsi->tx_rings[i]->atr_count = 0;
So UB is possible NULL dereference or UAF.


> +     }
> +
> +     return 0;
> +}
> +

...

> 
>       bool ring_active;               /* is ring online or not */
>       bool arm_wb;            /* do something to arm write back */
> --
> 2.53.0

Reply via email to