netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Ethernet TX buffer crossing 4K boundary?
@ 2022-04-20 21:09 Joakim Tjernlund
  2022-04-21 12:32 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Joakim Tjernlund @ 2022-04-20 21:09 UTC (permalink / raw)
  To: netdev; +Cc: Eric Gratorp

We have this custom Ethernet controller that cannot DMA a buffer if the buffer crosses 4K boundary.
Any ideas how to deal with that limitation in the driver?

 Joakim


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ethernet TX buffer crossing 4K boundary?
  2022-04-20 21:09 Ethernet TX buffer crossing 4K boundary? Joakim Tjernlund
@ 2022-04-21 12:32 ` Andrew Lunn
  2022-04-21 13:39   ` David Laight
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2022-04-21 12:32 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: netdev, Eric Gratorp

On Wed, Apr 20, 2022 at 09:09:58PM +0000, Joakim Tjernlund wrote:
> We have this custom Ethernet controller that cannot DMA a buffer if the buffer crosses 4K boundary.
> Any ideas how to deal with that limitation in the driver?

Does the DMA support scatter gather? You might be able to tweak the
generic scatter gather code to generate two blocks if it crosses the
boundary.

Otherwise, maybe look at the DMA bounce buffer code. It is normally
used when the DMA is limited in its address range, and the buffer
needs copying to another address. Maybe you can add a special mode
where it looks at if a 4K page is cross and then makes use of a bounce
buffer.

	Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Ethernet TX buffer crossing 4K boundary?
  2022-04-21 12:32 ` Andrew Lunn
@ 2022-04-21 13:39   ` David Laight
  0 siblings, 0 replies; 3+ messages in thread
From: David Laight @ 2022-04-21 13:39 UTC (permalink / raw)
  To: 'Andrew Lunn', Joakim Tjernlund; +Cc: netdev, Eric Gratorp

From: Andrew Lunn
> Sent: 21 April 2022 13:33
> 
> On Wed, Apr 20, 2022 at 09:09:58PM +0000, Joakim Tjernlund wrote:
> > We have this custom Ethernet controller that cannot DMA a buffer if the buffer crosses 4K boundary.

Fix the hardware :-)

> > Any ideas how to deal with that limitation in the driver?
> 
> Does the DMA support scatter gather? You might be able to tweak the
> generic scatter gather code to generate two blocks if it crosses the
> boundary.

I'd also look at the USB3 xhci code.
That also has a perverse set of restrictions on buffer alignment.
Might give you some hints.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-21 13:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 21:09 Ethernet TX buffer crossing 4K boundary? Joakim Tjernlund
2022-04-21 12:32 ` Andrew Lunn
2022-04-21 13:39   ` David Laight

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).