diff options
| author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2022-11-21 15:55:49 +0200 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2022-11-22 20:41:51 -0800 |
| commit | 6dbdfce7735786f9f2dd3af615c8a03ffa1246f5 (patch) | |
| tree | f62be8866926014cced077707d5770a2dbc8f5a9 /net/dsa/dsa2.c | |
| parent | net: dsa: move headers exported by switch.c to switch.h (diff) | |
| download | linux-6dbdfce7735786f9f2dd3af615c8a03ffa1246f5.tar.gz linux-6dbdfce7735786f9f2dd3af615c8a03ffa1246f5.zip | |
net: dsa: move dsa_tree_notify() and dsa_broadcast() to switch.c
There isn't an intuitive place for these 2 cross-chip notifier functions
according to the function-to-file classification based on names
(dsa_switch_*() goes to switch.c), but I consider these to be part of
the cross-chip notifier handling, therefore part of switch.c. Move them
there to reduce bloat in dsa2.c (the place where all code with no better
place to go goes).
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/dsa/dsa2.c')
| -rw-r--r-- | net/dsa/dsa2.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 7c6b689267d0..7a314c8b3aaa 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -32,52 +32,6 @@ LIST_HEAD(dsa_tree_list); static unsigned long dsa_fwd_offloading_bridges; /** - * dsa_tree_notify - Execute code for all switches in a DSA switch tree. - * @dst: collection of struct dsa_switch devices to notify. - * @e: event, must be of type DSA_NOTIFIER_* - * @v: event-specific value. - * - * Given a struct dsa_switch_tree, this can be used to run a function once for - * each member DSA switch. The other alternative of traversing the tree is only - * through its ports list, which does not uniquely list the switches. - */ -int dsa_tree_notify(struct dsa_switch_tree *dst, unsigned long e, void *v) -{ - struct raw_notifier_head *nh = &dst->nh; - int err; - - err = raw_notifier_call_chain(nh, e, v); - - return notifier_to_errno(err); -} - -/** - * dsa_broadcast - Notify all DSA trees in the system. - * @e: event, must be of type DSA_NOTIFIER_* - * @v: event-specific value. - * - * Can be used to notify the switching fabric of events such as cross-chip - * bridging between disjoint trees (such as islands of tagger-compatible - * switches bridged by an incompatible middle switch). - * - * WARNING: this function is not reliable during probe time, because probing - * between trees is asynchronous and not all DSA trees might have probed. - */ -int dsa_broadcast(unsigned long e, void *v) -{ - struct dsa_switch_tree *dst; - int err = 0; - - list_for_each_entry(dst, &dsa_tree_list, list) { - err = dsa_tree_notify(dst, e, v); - if (err) - break; - } - - return err; -} - -/** * dsa_lag_map() - Map LAG structure to a linear LAG array * @dst: Tree in which to record the mapping. * @lag: LAG structure that is to be mapped to the tree's array. |
