Re: [PATCH] net: stmmac: Meet alignment requirements for DMA
From: David Miller
Date: Wed Sep 27 2017 - 00:53:32 EST
From: Paul Burton <paul.burton@xxxxxxxxxx>
Date: Tue, 26 Sep 2017 21:30:56 -0700
> Nobody said that you are required to do anything, I suggested that
> it would be beneficial if you were to suggest a change to the
> documented DMA API such that it allows your usage where it currently
> does not.
Documentation is often wrong and it is here. What 200+ drivers
actually do and depend upon trumps a simple text document.
The requirement is that the memory remains quiescent on the cpu side
while the device messes with it. And that this quiescence requirement
may or may not be on a cache line basis.
There is absolutely no requirement that the buffers themselves are
cache line aligned.
In fact, receive buffers for networking are intentionally 2-byte
aligned in order for the ipv4 headers to be naturally 32-bit aligned.
Cache line aligning receive buffers will actually make some
architectures trap because of the bad alignment.
So see, this cache line alignment requirement is pure madness from
just about any perspective whatsoever.