netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Dong Yibo <dong100@mucse.com>
Cc: davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	horms@kernel.org, corbet@lwn.net, andrew+netdev@lunn.ch,
	danishanwar@ti.com, vadim.fedorenko@linux.dev,
	netdev@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v14 4/5] net: rnpgbe: Add basic mbx_fw support
Date: Fri, 17 Oct 2025 17:06:10 -0700	[thread overview]
Message-ID: <20251017170610.4f5c3f22@kernel.org> (raw)
In-Reply-To: <20251014072711.13448-5-dong100@mucse.com>

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

  reply	other threads:[~2025-10-18  0:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14  7:27 [PATCH net-next v14 0/5] Add driver for 1Gbe network chips from MUCSE Dong Yibo
2025-10-14  7:27 ` [PATCH net-next v14 1/5] net: rnpgbe: Add build support for rnpgbe Dong Yibo
2025-10-14  7:27 ` [PATCH net-next v14 2/5] net: rnpgbe: Add n500/n210 chip support with BAR2 mapping Dong Yibo
2025-10-14  7:27 ` [PATCH net-next v14 3/5] net: rnpgbe: Add basic mbx ops support Dong Yibo
2025-10-18  0:07   ` Jakub Kicinski
2025-10-18 14:42     ` Yibo Dong
2025-10-14  7:27 ` [PATCH net-next v14 4/5] net: rnpgbe: Add basic mbx_fw support Dong Yibo
2025-10-18  0:06   ` Jakub Kicinski [this message]
2025-10-14  7:27 ` [PATCH net-next v14 5/5] net: rnpgbe: Add register_netdev Dong Yibo

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=20251017170610.4f5c3f22@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=corbet@lwn.net \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=dong100@mucse.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vadim.fedorenko@linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).