Subject: Re: [PATCHv3 net-next] rtnetlink: Honour NLM_F_ECHO flag in rtnl_{new, set, del}link

From: Jakub Kicinski <[email-masked]>
Date: Thu, 29 Sep 2022 06:40:48 -0700

On Thu, 29 Sep 2022 11:10:36 +0800 Hangbin Liu wrote:
> > Now for device modification, I'm not sure there's a use case for
> > unicast notifications. The caller already knows which values it asked
> > to modify, so ECHO doesn't bring much value compared to a simple ACK.  
> 
> And the __dev_notify_flags() is only used when the dev flag changed.
> 
> It looks no much change if we call it when create new link:
> rtnl_newlink_create() -> rtnl_configure_link() -> __dev_notify_flags()
> 
> But when set link, it is only called when flag changed
> do_setlink() -> dev_change_flags() -> __dev_notify_flags().
> 
> Unless you want to omit the ECHO message when setting link.
> 
> At latest, when call rtnl_delete_link(), there is no way to call
> __dev_notify_flags(). So we still need to use the current way.
> 
> As a summarize, we need to change a lot of code if we use __dev_notify_flags()
> to notify user, while we can only use it in one place. This looks not worth.
> 
> WDYT?

There needs to be a clear use case if you want to add notifications.
Plumbing ECHO to existing notifications is just good hygiene, if you
want to add new notifications you'd need to provide a real use case.

I don't buy the "a lot code changed" BTW, you can make
dev_change_flags() a wrapper and add dev_change_flags_nlh() or whatnot
which will take the extra argument.