Re: [PATCH net-next v6 2/4] net: dsa: add bridge member iteration macro and port mask helper
From: Vladimir Oltean
Date: Mon Mar 23 2026 - 13:01:17 EST
On Mon, Mar 23, 2026 at 02:29:41AM +0000, Daniel Golle wrote:
> I wasn't aware of the similar and equally named function in
> yt921x.c[1]
Yeah, I did request from the beginning for it to be moved to
include/net/dsa.h, but I didn't follow through with the request (I guess
I forgot):
https://lore.kernel.org/netdev/20250825212357.3acgen2qezuy533y@skbuf/
> Patchwork CI has loudly uncovered it and I've learned my lesson to
> always test an all-y build when changing even the most innocent
> looking things which technically may affect other drivers.
Since all DSA drivers are all in the same folder, technically you may be
excused if you just enable all those when working on infra, instead of
allyesconfig.
> I'll move that function as-is, in a dedicated commit, to
> include/net/dsa.h as an inline function instead of the helper
> suggested here.
>
> A second commit will introduce the new helper macro
> dsa_switch_for_each_bridge_member (modified to use (struct net_device
> *) as parameter instead of (struct dsa_bridge *), and make use of it
> in dsa_bridge_ports().
>
> I'm also planning to introduce dsa_bridge_for_each_member macro in
> addition to that which works on (struct dsa_bridge *) and uses
> dsa_switch_for_each_bridge_member.
I don't like the dsa_bridge_for_each_member() name. You are likely
not considering cross-chip bridging, where a bridge spans multiple
dsa_switch structures. That is also a serious reason why your
bridge->priv design is not viable (two switches can't lay their eggs
in the same basket without overwriting each other).