Re: [PATCH net-next v14 4/5] net: rnpgbe: Add basic mbx_fw support

From: Jakub Kicinski
Date: Fri Oct 17 2025 - 20:06:49 EST


On Tue, 14 Oct 2025 15:27:10 +0800 Dong Yibo wrote:
> +/* FW stores extended information in 'ext_info' as a 32-bit
> + * little-endian value. To make these flags easily accessible in the
> + * kernel (via named 'bitfields' instead of raw bitmask operations),
> + * we use the union's 'e_host' struct, which provides named bits
> + * (e.g., 'wol_en', 'smbus_en')
> + */
> +static inline void mucse_hw_info_update_host_endian(struct mucse_hw_info *info)
> +{
> + u32 host_val = le32_to_cpu(info->ext_info);
> +
> + memcpy(&info->e_host, &host_val, sizeof(info->e_host));

This is not going to be enough. C bitfields are also affected by endian.
The best practice in the kernel is to define the fields as #defines
and user FIELD_GET() or direct & / | operations with the constants.
--
pw-bot: cr