Subject: Re: [PATCH net-next v2 0/8] net: Shift responsibility for FDB notifications to drivers

From: Petr Machata <[email-masked]>
Date: Mon, 4 Nov 2024 12:43:11 +0100

Jakub Kicinski <[email-masked]> writes:

> On Thu, 24 Oct 2024 18:57:35 +0200 Petr Machata wrote:
>> Besides this approach, we considered just passing a boolean back from the
>> driver, which would indicate whether the notification was done. But the
>> approach presented here seems cleaner.
>
> Oops, I missed the v2, same question:
>
>   What about adding a bit to the ops struct to indicate that 
>   the driver will generate the notification? Seems smaller in 
>   terms of LoC and shifts the responsibility of doing extra
>   work towards more complex users.
>
> https://lore.kernel.org/all/[email-masked]/

Sorry for only responding now, I was out of office last week.

The reason I went with outright responsibility shift is that the
alternatives are more complex.

For the flag in particular, first there's no place to set the flag
currently, we'd need a field in struct net_device_ops. But mainly, then
you have a code that needs to corrently handle both states of the flag,
and new-style drivers need to remember to set the flag, which is done in
a different place from the fdb_add/del themselves. It might be fewer
LOCs, but it's a harder to understand system.

Responsibility shift is easy. "Thou shalt notify." Done, easy to
understand, easy to document. When cut'n'pasting, you won't miss it.

Let me know what you think.