net: dsa: walk through all changeupper notifier functions
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 19 Aug 2022 17:48:12 +0000 (20:48 +0300)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 23 Aug 2022 09:39:22 +0000 (11:39 +0200)
commit4c3f80d22b2eca911143ce656fa45c4699ff5bf4
tree836bbd46f3cc1d7a085ed749b4ed692b1f13bb76
parent139b5fbd525ad357a27002b37815ea82d32aa375
net: dsa: walk through all changeupper notifier functions

Traditionally, DSA has had a single netdev notifier handling function
for each device type.

For the sake of code cleanliness, we would like to introduce more
handling functions which do one thing, but the conditions for entering
these functions start to overlap. Example: a handling function which
tracks whether any bridges contain both DSA and non-DSA interfaces.
Either this is placed before dsa_slave_changeupper(), case in which it
will prevent that function from executing, or we place it after
dsa_slave_changeupper(), case in which we will prevent it from
executing. The other alternative is to ignore errors from the new
handling function (not ideal).

To support this usage, we need to change the pattern. In the new model,
we enter all notifier handling sub-functions, and exit with NOTIFY_DONE
if there is nothing to do. This allows the sub-functions to be
relatively free-form and independent from each other.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/dsa/slave.c