Subject: Re: [PATCH net-next v6 2/4] net: dsa: add bridge member iteration macro and port mask helper

From: Daniel Golle <[email-masked]>
Date: Wed, 25 Mar 2026 10:43:05 +0000

On Wed, Mar 25, 2026 at 10:34:27AM +0200, Vladimir Oltean wrote:
> On Tue, Mar 24, 2026 at 11:31:30PM +0000, Daniel Golle wrote:
> > On Mon, Mar 23, 2026 at 06:31:04PM +0200, Vladimir Oltean wrote:
> > > On Mon, Mar 23, 2026 at 02:29:41AM +0000, Daniel Golle wrote:
> > > > 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).
> > 
> > dsa_bridge_for_each_local_member() ?
> > 
> > dsa_switch_for_each_dsa_bridge_member()
> > (but that's too close to dsa_switch_for_each_bridge_member imho)
> > 
> > I was planning to have both, dsa_switch and dsa_bridge as parameters,
> > of course, limiting the scope to a single dsa_switch.
> 
> I'm not sure that we do need two iterators. Just
> dsa_switch_for_each_bridge_member() should be fine.

Just for convenience. In my case, all callers always have a reference
to 'struct dsa_bridge *', so instead of having the callers dereference
'struct net_device *' from that, have a macro that does it for me.