summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2026-04-01 16:34:30 +0300
committerJakub Kicinski <kuba@kernel.org>2026-04-07 04:30:33 +0300
commitb0a79590d10847f190ed377d2664377d7068191d (patch)
tree88b702c7df77aa7371c5a0cb2c1b6b90ea536f25 /include
parent98f28d8d6e5a5ed058dd37854c19e9b3bae72eff (diff)
downloadlinux-b0a79590d10847f190ed377d2664377d7068191d.tar.xz
net: dsa: move dsa_bridge_ports() helper to dsa.h
The yt921x driver contains a helper to create a bitmap of ports which are members of a bridge. Move the helper as static inline function into dsa.h, so other driver can make use of it as well. Signed-off-by: Daniel Golle <daniel@makrotopia.org> Link: https://patch.msgid.link/4f8bbfce3e4e3a02064fc4dc366263136c6e0383.1775049897.git.daniel@makrotopia.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/net/dsa.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 6c17446f3dcc..e93b4feaca96 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -831,6 +831,19 @@ dsa_tree_offloads_bridge_dev(struct dsa_switch_tree *dst,
return false;
}
+static inline u32
+dsa_bridge_ports(struct dsa_switch *ds, const struct net_device *bdev)
+{
+ struct dsa_port *dp;
+ u32 mask = 0;
+
+ dsa_switch_for_each_user_port(dp, ds)
+ if (dsa_port_offloads_bridge_dev(dp, bdev))
+ mask |= BIT(dp->index);
+
+ return mask;
+}
+
static inline bool dsa_port_tree_same(const struct dsa_port *a,
const struct dsa_port *b)
{