On 19/10/2020 13:12, Jason Gunthorpe wrote:
On Mon, Oct 19, 2020 at 10:50:14AM +0100, Tvrtko Ursulin wrote:
overshoot the max_segment if it is not a multiple of PAGE_SIZE. Simply fix
the alignment before starting and don't expose this implementation detail
to the callers.
What does not make complete sense to me is the statement that input
alignment requirement makes it impossible to connect to DMA layer, but then
the patch goes to align behind the covers anyway.
At minimum the kerneldoc should explain that max_segment will still be
rounded down. But wouldn't it be better for the API to be more explicit and
just require aligned anyway?
Why?
The API is to not produce sge's with a length longer than max_segment,
it isn't to produce sge's of exactly max_segment.
Everything else is an internal detail
(Half-)pretending it is disconnected from PAGE_SIZE, when it really
isn't, isn't the most obvious API design in my view.
In other words, if you let users pass in 4097 and it just works by
rounding down to 4096, but you don't let them pass 4095, I just find
this odd.
My question was why not have callers pass in page aligned max segment
like today which makes it completely transparent.
Regards,
Tvrtko