public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hao <haokexin@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: edumazet@google.com, claudiu.beznea@tuxon.dev,
	davem@davemloft.net, stable@vger.kernel.org,
	netdev@vger.kernel.org, andrew+netdev@lunn.ch,
	linux@armlinux.org.uk, pabeni@redhat.com,
	nicolas.ferre@microchip.com, quanyang.wang@windriver.com
Subject: Re: [net] net: macb: Shuffle the tx ring before enabling tx
Date: Sat, 7 Mar 2026 14:51:57 +0800	[thread overview]
Message-ID: <aavLDcBS5F6qCydY@pek-khao-d3> (raw)
In-Reply-To: <20260307025638.1345906-1-kuba@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1444 bytes --]

On Fri, Mar 06, 2026 at 06:56:38PM -0800, Jakub Kicinski wrote:
> Does this memcpy corrupt the descriptor fields on systems with 64-bit DMA?
> The macb_tx_desc() macro uses macb_adj_dma_desc_idx() to properly space the
> descriptor pointers in the ring according to the descriptor size reported by
> macb_dma_desc_get_size(bp), which can be 8 bytes (base), 16 bytes (with
> DMA64), or 24 bytes (with DMA64 + PTP). However, all three memcpy calls in
> this function use sizeof(struct macb_dma_desc), which is only 8 bytes and
> covers only the addr and ctrl fields.
> 
> On systems where macb_dma64(bp) == true, such as the AMD ZynqMp platform
> this patch targets, each descriptor has an additional macb_dma_desc_64
> struct containing the upper 32 bits of the DMA address (addrh field).
> 
> When the shuffle copies descriptors using only 8 bytes, it moves the lower
> 32-bit address (desc->addr) and control word (desc->ctrl) to new positions
> but leaves the upper 32-bit address (addrh) unmoved in the old location.
> After the shuffle, hardware reads a composite 64-bit DMA address from
> mismatched descriptor slots: the old slot's addrh combined with the new
> slot's addr.

This is indeed an issue. Coincidentally, all the upper 32-bit addresses in the
tx ring were identical, which is why it went undetected during testing.
My apologies for this oversight; I will address it in the v2 version.

Thanks,
Kevin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2026-03-07  6:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 14:32 [PATCH net] net: macb: Shuffle the tx ring before enabling tx Kevin Hao
2026-03-07  2:56 ` [net] " Jakub Kicinski
2026-03-07  6:51   ` Kevin Hao [this message]

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=aavLDcBS5F6qCydY@pek-khao-d3 \
    --to=haokexin@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.com \
    --cc=quanyang.wang@windriver.com \
    --cc=stable@vger.kernel.org \
    /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