[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aKPI6xMIgIeBzqy7@pidgin.makrotopia.org>
Date: Tue, 19 Aug 2025 01:44:27 +0100
From: Daniel Golle <daniel@...rotopia.org>
To: Andrew Lunn <andrew@...n.ch>
Cc: Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Hauke Mehrtens <hauke@...ke-m.de>, Simon Horman <horms@...nel.org>,
Russell King <linux@...linux.org.uk>,
Florian Fainelli <f.fainelli@...il.com>,
Arkadi Sharshevsky <arkadis@...lanox.com>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Andreas Schirm <andreas.schirm@...mens.com>,
Lukas Stockmann <lukas.stockmann@...mens.com>,
Alexander Sverdlin <alexander.sverdlin@...mens.com>,
Peter Christen <peter.christen@...mens.com>,
Avinash Jayaraman <ajayaraman@...linear.com>,
Bing tao Xu <bxu@...linear.com>, Liang Xu <lxu@...linear.com>,
Juraj Povazanec <jpovazanec@...linear.com>,
"Fanni (Fang-Yi) Chan" <fchan@...linear.com>,
"Benny (Ying-Tsan) Weng" <yweng@...linear.com>,
"Livia M. Rosu" <lrosu@...linear.com>,
John Crispin <john@...ozen.org>
Subject: Re: [PATCH RFC net-next 06/23] net: dsa: lantiq_gswip: load
model-specific microcode
On Sun, Aug 17, 2025 at 09:46:51PM +0100, Daniel Golle wrote:
> On Sun, Aug 17, 2025 at 05:29:16PM +0200, Andrew Lunn wrote:
> > >
> > > +struct gswip_pce_microcode {
> > > + u16 val_3;
> > > + u16 val_2;
> > > + u16 val_1;
> > > + u16 val_0;
> > > +};
> > > +
> >
> > I would leave this where it is, and just have
> >
> > struct gswip_pce_microcode;
> >
> > Since only a pointer is needed, the compiler does not need the full
> > type info, at this point.
> >
> > The structure itself is rather opaque, and only makes some sort of
> > sense when next to the MAC_ENTRY macro.
>
> The structure is also used in the function gswip_pce_load_microcode().
> Now, if we keep defining the struct fields along with the microcode this
> will become a problem once there is more than one such set of microcode
> instructions and additional header files for them. Each of them would
> need to define struct gswip_pce_microcode with its fields.
> The lantiq_pce.h header then becomes private to the driver for the
> in-SoC switches, while gswip_pce_load_microcode() would be part of the
> shared/common module use by both, in-SoC/MMIO switches as well as
> (newer) MDIO-connected ones, and I would not want to include any of the
> *_pce.h headers in the shared/common module.
>
> Obviously I can just move the struct definition in the later commit
> which actually separates the MMIO-specific parts of the driver and the
> common/shared parts into different modules. Is it that what you had in
> mind?
I didn't consider that the size of the array elements needs to be known
when defining struct gswip_hw_info in lantiq_gswip.h.
So the only reasonable solution is to make also the definition of
struct gswip_pce_microcode into lantiq_gswip.h, so lantiq_pce.h won't
have to be included before or by lantiq_gswip.h itself.
In file included from drivers/net/dsa/lantiq_gswip.c:28:
drivers/net/dsa/lantiq_gswip.h:226:44: error: array type has incomplete element type 'struct gswip_pce_microcode'
226 | const struct gswip_pce_microcode (*pce_microcode)[];
| ^~~~~~~~~~~~~
Powered by blists - more mailing lists