mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Iyappan Subramanian <iyappan@os.amperecomputing.com>,
	Keyur Chudgar <keyur@os.amperecomputing.com>,
	Quan Nguyen <quan@os.amperecomputing.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	"open list:NETWORKING DRIVERS" <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v2] drivers: net: xgene: Fix dma_unmap_single() size
Date: Thu, 15 Oct 2026 16:29:06 +0200	[thread overview]
Message-ID: <6046e419-2a1d-4e01-9f0d-f718ba8bfda9@lunn.ch> (raw)
In-Reply-To: <20261015124547.29996-2-fourier.thomas@gmail.com>

On Thu, Oct 15, 2026 at 02:45:46PM +0200, Thomas Fourier wrote:
> In xgene_enet_refill_bufpool(), the skb->data is dma-mapped with length
> len which is set to XGENE_ENET_STD_MTU which equals 1536. However, in
> xgene_enet_delete_bufpool(), the same buffer is unmapped with length
> XGENE_ENET_MAX_MTU which is 9600. This may erroneously unmap other
> DMA buffers or cause other issues.
> 
> Change unmap length to XGENE_ENET_STD_MTU.

I don't know this driver, so i could be wrong.....

map/unmap is expensive, because it needs to flush/invalidate the cache
etc. So the hot path part of the code, dealing with real frame data,
sometimes only maps/unmaps the length of the frame, which is less than
the length of the buffer, particularly when jumbo is involved.

So you could allocate a buffer for 9600 jumbo, but in the hot path
only map/unmap part of it, but when you release the buffer, you need
to unmap the full 9600 size of the buffer, to be on the safe size.

Please look at the driver and consider this. As i said, i could be
wrong...

	Andrew


  parent reply	other threads:[~2026-10-15 14:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 12:45 Thomas Fourier
2026-10-15 12:50 ` netdev-bot+sinfo
2026-10-15 14:29 ` Andrew Lunn [this message]
2026-10-16  8:23   ` Daniel Machon
2026-10-16  8:23 ` Daniel Machon

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=6046e419-2a1d-4e01-9f0d-f718ba8bfda9@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=fourier.thomas@gmail.com \
    --cc=iyappan@os.amperecomputing.com \
    --cc=keyur@os.amperecomputing.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=quan@os.amperecomputing.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

all inboxes | Powered by JetHome®