Message ID | 20210909095324.12978-2-LinoSanfilippo@gmx.de (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Fix for KSZ DSA switch shutdown | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | success | CCed 7 of 7 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 10 this patch: 10 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 21 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 10 this patch: 10 |
netdev/header_inline | success | Link |
diff --git a/include/net/dsa.h b/include/net/dsa.h index f9a17145255a..7d4094faaa3a 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -1039,6 +1039,7 @@ static inline int dsa_ndo_eth_ioctl(struct net_device *dev, struct ifreq *ifr, } #endif +void dsa_tree_shutdown(struct dsa_switch_tree *dst); void dsa_unregister_switch(struct dsa_switch *ds); int dsa_register_switch(struct dsa_switch *ds); struct dsa_switch *dsa_switch_find(int tree_index, int sw_index); diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 1b2b25d7bd02..0588581f6531 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -1066,6 +1066,14 @@ static void dsa_tree_teardown(struct dsa_switch_tree *dst) dst->setup = false; } +void dsa_tree_shutdown(struct dsa_switch_tree *dst) +{ + mutex_lock(&dsa2_mutex); + dsa_tree_teardown(dst); + mutex_unlock(&dsa2_mutex); +} +EXPORT_SYMBOL_GPL(dsa_tree_shutdown); + /* Since the dsa/tagging sysfs device attribute is per master, the assumption * is that all DSA switches within a tree share the same tagger, otherwise * they would have formed disjoint trees (different "dsa,member" values).
Provide the function dsa_tree_shutdown() that can be called by DSA drivers to tear down the DSA tree. This is particularly useful for shutdown handlers to make sure that the DSA tree is torn down (and thus all references to the master device are released) before the master device is deregistered. Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de> --- include/net/dsa.h | 1 + net/dsa/dsa2.c | 8 ++++++++ 2 files changed, 9 insertions(+)