On Wed, Oct 21, 2026 at 03:25:46PM +0100, Anatoly Burakov wrote:
> Flow engines currently distribute rule allocation and cleanup between the
> parser, engine create and destroy callbacks, and generic flow code. This
> leads to a lot of potential for memory leaks and bugs. In particular, one
> of the issues currently present is that when PF initiates reset, we are
> meant to just drop all flows without sending any virtchnl commands, but
> because not all engines implement the `free` callback, some flows will be
> leaked.
> 
> To address that specific leak as well as all other potential leaks due to
> misuse of memory by engines, use parser-allocated rule objects as the
> persistent rules and centralize their lifetime in the generic flow layer.
> This requires fixing all engines to not manage their own memory:
> 
> - Allocate the final FDIR rule in the parser, use it for action checks,
>   and remove the per-VF scratch configuration.
> - Have FSUB create adopt its parser-produced rule instead of allocating
>   and copying a second object.
> - Build the final RSS configuration in the parser and remove the
>   intermediate RSS metadata, including its unused raw-pattern flag.
> - Let generic flow code free rules on validate, create failure,
>   successful destroy, and uninit; remove engine-specific free callbacks
>   and rule frees from destroy callbacks.
> 
> Fixes: 4dad1a6815d6 ("net/iavf: skip flow flush during PF-initiated reset")
> Fixes: ff2d0c345c3b ("net/iavf: support generic flow API")
> Cc: [email protected]
> 
> Signed-off-by: Anurag Mandal <[email protected]>
> Signed-off-by: Anatoly Burakov <[email protected]>
> ---
>  drivers/net/intel/iavf/iavf.h              |  5 --
>  drivers/net/intel/iavf/iavf_fdir.c         | 68 +++++++--------
>  drivers/net/intel/iavf/iavf_fsub.c         | 23 +----
>  drivers/net/intel/iavf/iavf_generic_flow.c | 36 ++++++--
>  drivers/net/intel/iavf/iavf_generic_flow.h |  2 -
>  drivers/net/intel/iavf/iavf_hash.c         | 99 +++++++---------------
>  drivers/net/intel/iavf/iavf_ipsec_crypto.c |  1 -
>  7 files changed, 97 insertions(+), 137 deletions(-)
> 
Acked-by: Bruce Richardson <[email protected]>

Reply via email to