Skip to contentSkip to conversation

UAS: fix alignment of scatter/gather segments

DISCUSSION Oliver Neukum 1 participant 1 message Apr 29, 2019 USB

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines · David Laight

From: Oliver Neukum

Quoted 3 lines · David Laight

AFAICT controllers do not export that property.

Perhaps they need to ....

Feel free to make a patch.

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

Even if you decide the code is 'good enough' (I don't know what the cost is of enforcing a 2k alignment instead of 512 bytes) the comment is just plain wrong.

Usually block IO will be pages. They are 4K aligned. In terms of performance this code is unlikely to matter.

Presumably there are some cases where the buffer isn't 4k aligned. I'm guessing things like 'dd' of raw disks?

Possibly.

Quoted 6 lines

If the buffer has the wrong alignment then I presume a bounce buffer has to be allocated?
The USB controller drivers are likely to need to be able to do that anyway because buffers from the network stack can have almost arbitrary alignment (I remember that code being horrid, I don't remember a data copy in the TX path).

You can ask the network layer to undo scatter/gather. I don't see an issue.

Quoted 3 lines
Quoted 1 line

But it is needed for correctness.

If you are doing it for 'correctness' then you need the correct size.

Why? Any larger size will do.

Quoted 2 lines

If you are doing it because you've seen too small an alignment you should be mentioning the failing system.

Why?

Quoted 4 lines
Quoted 1 line

What would you want for the comment?

You need to be more specific about the alignment requirements than the old comment, not far less specific.

But the statement the old comment made are no longer correct.

Regards
Oliver