Subject: Re: [PATCH net] xfrm: always flush state and policy upon NETDEV_DOWN/NETDEV_UNREGISTER events

From: Leon Romanovsky <[email-masked]>
Date: Wed, 28 Jan 2026 14:35:46 +0200

On Wed, Jan 28, 2026 at 07:44:02PM +0900, Tetsuo Handa wrote:
> On 2026/01/28 19:24, Leon Romanovsky wrote:
> > I think this can work, but IMHO the more robust approach is to ensure that all
> > states and policies are removed when the NETIF_F_HW_ESP feature bit is cleared.
> 
> The transaction will become complicated, for dev->features manipulation
> function can fail.

Line above returning NOTIFY_OK, check that NETIF_F_HW_ESP is cleared,
and remove everything.

> 
> > 
> > Would it be possible to handle this in NETDEV_FEAT_CHANGE?
> > 
> 
> Is there a guarantee that xfrm_dev_event(NETDEV_FEAT_CHANGE) is called
> regardless of other callback functions, for it can return NOTIFY_BAD ?

I don't know.

Thanks