From: Daniel Golle <daniel@makrotopia.org>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Russell King <linux@armlinux.org.uk>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Frank Wunderlich <frankwu@gmx.de>, Chad Monroe <chad@monroe.io>,
Cezary Wilmanski <cezary.wilmanski@adtran.com>,
Liang Xu <lxu@maxlinear.com>,
"Benny (Ying-Tsan) Weng" <yweng@maxlinear.com>,
Jose Maria Verdu Munoz <jverdu@maxlinear.com>,
Avinash Jayaraman <ajayaraman@maxlinear.com>,
John Crispin <john@phrozen.org>
Subject: Re: [PATCH net-next v6 2/4] net: dsa: add bridge member iteration macro and port mask helper
Date: Mon, 23 Mar 2026 21:47:16 +0000 [thread overview]
Message-ID: <acG05C2ktiGePhQE@makrotopia.org> (raw)
In-Reply-To: <20260323211536.iqopuy2zxd75pfbh@skbuf>
On Mon, Mar 23, 2026 at 11:15:36PM +0200, Vladimir Oltean wrote:
> On Mon, Mar 23, 2026 at 04:45:18PM +0000, Daniel Golle wrote:
> > That means the driver *does* have to track a mapping between DSA
> > bridges and hardware/firmware bridges on that specific switch somehow.
>
> That's correct. From DSA's perspective, it's not an mxlbridge, it's just
> a bridge with at least one DSA switch port under it, which is given a
> kernel-wide identifier. The ports can hold a single reference to the
> common bridge, but the common bridge cannot hold a single back-reference
> to individual ports. And holding multiple references would severely
> complicate the implementation.
>
> Even if you don't implement accelerated cross-switch bridging, you can
> still have two mxl ports belonging to different switches that are both
> put by the user under the same bridge. And both switch driver instances
> would want to allocate a potentially different bridge ID, and surely
> maintain a different portmap, for that same bridge.
>
> > Or is there another existing structure in DSA I'm not aware of and
> > which could be used to implement Paolo's suggestion:
> >
> > https://lore.kernel.org/netdev/fe46d64b-1b12-48b6-b663-e7d5122b7b8a@redhat.com/
>
> The API was intended so that you could either use the bridge.num directly,
> transform it through some linear formula or as an index into a privately
> maintained array of data structures with switch-specific meaning.
>
> I didn't question why you maintain a parallel list of dynamically
> allocated mxlbridge structures instead of just having an array of
> MXL862XX_MAX_BRIDGES * sizeof(u16) for the bridge identifiers, plus
> maintain a separate portmap instead of walking through the DSA data
> structures, but now that Paolo brought it up: why?
The firmware requires bridges to be allocated, and the bridge
allocation firmware API returns the ID we got to use.
Maintaing a simple array ((ds->max_num_bridges + 1) * sizeof(u16))
to map DSA bridge num to firmware bridge ID in the driver works
fine, of course.
Regarding the request not to maintain a separate portmap for each
bridge (which was my initial approach) but instead walk through DSA
data:
My guess was the intention is to avoid duplciating data, as in: if
there is only one copy, we can be sure it's not stale or
out-of-sync...? But that's just my guess, only Paolo can tell his
reasons for having requested that.
>
> I see in v6 you're halfway there with the conversion, you got rid of the
> portmap and you could just use the array for the rest.
Ack. I'll do that and post v7.
next prev parent reply other threads:[~2026-03-23 21:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-22 0:18 [PATCH net-next v6 0/4] net: dsa: mxl862xx: add support for bridge offloading Daniel Golle
2026-03-22 0:18 ` [PATCH net-next v6 1/4] net: dsa: add driver-private pointer to struct dsa_bridge Daniel Golle
2026-03-23 16:12 ` Vladimir Oltean
2026-03-22 0:19 ` [PATCH net-next v6 2/4] net: dsa: add bridge member iteration macro and port mask helper Daniel Golle
2026-03-23 2:29 ` Daniel Golle
2026-03-23 16:31 ` Vladimir Oltean
2026-03-23 16:45 ` Daniel Golle
2026-03-23 21:15 ` Vladimir Oltean
2026-03-23 21:47 ` Daniel Golle [this message]
2026-03-24 23:31 ` Daniel Golle
2026-03-25 8:34 ` Vladimir Oltean
2026-03-25 10:43 ` Daniel Golle
2026-03-23 10:39 ` kernel test robot
2026-03-24 20:58 ` kernel test robot
2026-03-22 0:19 ` [PATCH net-next v6 3/4] dsa: tag_mxl862xx: set dsa_default_offload_fwd_mark() Daniel Golle
2026-03-22 0:19 ` [PATCH net-next v6 4/4] net: dsa: mxl862xx: implement bridge offloading Daniel Golle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=acG05C2ktiGePhQE@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=ajayaraman@maxlinear.com \
--cc=andrew@lunn.ch \
--cc=cezary.wilmanski@adtran.com \
--cc=chad@monroe.io \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=frankwu@gmx.de \
--cc=horms@kernel.org \
--cc=john@phrozen.org \
--cc=jverdu@maxlinear.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lxu@maxlinear.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=yweng@maxlinear.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox