net: rnpgbe: fix mailbox endianness
Status from this message: This patch was applied to netdev/net.git (main)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest1 patch 2 repliesApplied 1/1
- v11 patch 6 repliesSuperseded
Changes in v2 from the cover letter
- 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).
Patches in v2 All 1 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | net: rnpgbe: fix mailbox endianness and remove pointer castsdrivers/ drivers/ drivers/ +1 more | +80 | 1 reply | Applied |
Reviews trailers per patch
The patch has a Reviewed-by or Acked-by.
| Patch | Andrew Lunn |
|---|---|
| 1/1 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH net-next v2 0/1] net: rnpgbe: fix mailbox endianness
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/[email protected]/
Dong Yibo (1):
net: rnpgbe: fix mailbox endianness and remove pointer casts
.../net/ethernet/mucse/rnpgbe/rnpgbe_mbx.c | 26 ++++-- .../net/ethernet/mucse/rnpgbe/rnpgbe_mbx.h | 5 +- .../net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.c | 82 ++++++++++--------- .../net/ethernet/mucse/rnpgbe/rnpgbe_mbx_fw.h | 14 ++++ 4 files changed, 80 insertions(+), 47 deletions(-)
Signature · 1 line
2.25.1