aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/dsa.h
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2022-08-19 20:48:18 +0300
committerPaolo Abeni <pabeni@redhat.com>2022-08-23 11:39:22 +0200
commit5dc760d1208200daaf49a2ff56a0e7dfa2d80bb2 (patch)
tree9a2543f705e988ec3de185d539bc9ec1aee201ee /include/net/dsa.h
parentnet: dsa: all DSA masters must be down when changing the tagging protocol (diff)
downloadlinux-dev-5dc760d1208200daaf49a2ff56a0e7dfa2d80bb2.tar.xz
linux-dev-5dc760d1208200daaf49a2ff56a0e7dfa2d80bb2.zip
net: dsa: use dsa_tree_for_each_cpu_port in dsa_tree_{setup,teardown}_master
More logic will be added to dsa_tree_setup_master() and dsa_tree_teardown_master() in upcoming changes. Reduce the indentation by one level in these functions by introducing and using a dedicated iterator for CPU ports of a tree. 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>
Diffstat (limited to 'include/net/dsa.h')
-rw-r--r--include/net/dsa.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index b902b31bebce..f2ce12860546 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -559,6 +559,10 @@ static inline bool dsa_is_user_port(struct dsa_switch *ds, int p)
list_for_each_entry((_dp), &(_dst)->ports, list) \
if (dsa_port_is_user((_dp)))
+#define dsa_tree_for_each_cpu_port(_dp, _dst) \
+ list_for_each_entry((_dp), &(_dst)->ports, list) \
+ if (dsa_port_is_cpu((_dp)))
+
#define dsa_switch_for_each_port(_dp, _ds) \
list_for_each_entry((_dp), &(_ds)->dst->ports, list) \
if ((_dp)->ds == (_ds))