Re: [PATCH net-next v4 4/4] net: dsa: mxl862xx: add support for SerDes ports
From: Daniel Golle
Date: Tue Jun 02 2026 - 19:29:35 EST
On Tue, Jun 02, 2026 at 02:22:09PM -0700, Jakub Kicinski wrote:
> On Fri, 29 May 2026 06:40:17 +0100 Daniel Golle wrote:
> > +struct mxl862xx_xpcs_pcs_cfg {
> > +#ifdef __LITTLE_ENDIAN_BITFIELD
> > + u8 port_id:2;
> > + u8 interface:6; /* enum mxl862xx_xpcs_if_mode */
> > + u8 neg_mode:2; /* enum mxl862xx_xpcs_neg_mode */
> > + u8 permit_pause:1;
> > + u8 usx_lane_mode:2; /* enum mxl862xx_xpcs_usx_lane_mode */
> > + u8 role:1; /* enum mxl862xx_xpcs_role */
> > + u8 usx_subport:2;
> > +#elif defined(__BIG_ENDIAN_BITFIELD)
> > + u8 interface:6; /* enum mxl862xx_xpcs_if_mode */
> > + u8 port_id:2;
> > + u8 usx_subport:2;
> > + u8 role:1; /* enum mxl862xx_xpcs_role */
> > + u8 usx_lane_mode:2; /* enum mxl862xx_xpcs_usx_lane_mode */
> > + u8 permit_pause:1;
> > + u8 neg_mode:2; /* enum mxl862xx_xpcs_neg_mode */
> > +#else
> > +#error "Unknown bitfield endianness"
> > +#endif
>
> With the bitfields and MACROS for read/write this patch give off vendor
> BSP more than upstream code :( Doesn't look like the driver used
> bitfileds before, please use FIELD_GET / FIELD_PUT
It wasn't necessary before because the older and more mature parts of
the API have a different hand-writing and used only (sometimes quite
arbitrary) 8-bit, 16-bit and 32-bit types. Now this more recently
designed part of the API breaks that rule.
Anyway, a single __le16 it is then in this case, and I'll use
FIELD_PUT/FIELD_GET.