Netdev List
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Dong Yibo <dong100@mucse.com>,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, vadim.fedorenko@linux.dev
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, yaojun@mucse.com
Subject: Re: [PATCH net-next v2 0/1] net: rnpgbe: fix mailbox endianness
Date: Tue, 7 Jul 2026 10:45:25 +0200	[thread overview]
Message-ID: <b110e40c-6a63-4490-8def-356471b5bda6@redhat.com> (raw)
In-Reply-To: <20260701032208.1843156-1-dong100@mucse.com>

On 7/1/26 5:22 AM, Dong Yibo wrote:
> The rnpgbe mailbox exchanges data through 32-bit MMIO registers in
> little-endian wire format.  The original code had two problems:
> 
>  1. FW structs with __le16/__le32 fields were cast to (u32 *) before
>     reaching the transport, hiding the endian annotations from sparse.
> 
>  2. No cpu_to_le32()/le32_to_cpu() conversion was performed between
>     the CPU-endian MMIO values and the little-endian payload, causing
>     data corruption on big-endian systems.
> 
> v2 fixes this by introducing union wrappers around the FW structs
> and adding the missing byte-order conversions in the transport layer.
> All pointer casts on the mailbox data path are eliminated.
> 
> Changelog:
> v1 -> v2:
> - Remove all pointer casts on the mailbox data path.  Use union
>   wrappers (mbx_fw_cmd_req_u, mbx_fw_cmd_reply_u) that overlay
>   each FW struct with a __le32 dwords[] array.  Callers fill
>   named fields with cpu_to_le16/32() and pass dwords[] directly
>   to the transport — no casts needed.
> - Change transport signatures from u32 */void * to explicit
>   __le32 * so sparse can verify endian correctness.
> - Add comments in mucse_read_mbx_pf() and mucse_write_mbx_pf()
>   explaining why memcpy_toio() cannot replace the readl()/writel()
>   loop (the mailbox uses 32-bit MMIO registers, not byte-
>   addressable RAM).
> 
> links:
> ---
> v1: https://lore.kernel.org/netdev/20260617083531.251119-1-dong100@mucse.com/

A few process notes:
- this is 'net' material, I'm applying the patch there
- no needed for a cover letter for a one-patch series

/P


  parent reply	other threads:[~2026-07-07  8:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01  3:22 [PATCH net-next v2 0/1] net: rnpgbe: fix mailbox endianness Dong Yibo
2026-07-01  3:22 ` [PATCH net-next v2 1/1] net: rnpgbe: fix mailbox endianness and remove pointer casts Dong Yibo
2026-07-01 14:47   ` Andrew Lunn
2026-07-07  8:45 ` Paolo Abeni [this message]
2026-07-07  8:50 ` [PATCH net-next v2 0/1] net: rnpgbe: fix mailbox endianness patchwork-bot+netdevbpf

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=b110e40c-6a63-4490-8def-356471b5bda6@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dong100@mucse.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vadim.fedorenko@linux.dev \
    --cc=yaojun@mucse.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