libnvme/cmds: change copy desc format 0h and 2h elbt to big-endian#3183
libnvme/cmds: change copy desc format 0h and 2h elbt to big-endian#3183igaw merged 2 commits intolinux-nvme:masterfrom
Conversation
|
@igaw @keithbusch @brandon-paupore-sndk @zwxdg @chenghong085 Could you please review the changes? For the issue: #2975 I have rejected the PR: #2977 then the issue also closed. To make consistent just created this PR changes but for the changes I considered again so still the issue: #2975 mentioned seems correct also.. To make sure should we ask to NVMe org about this specification? |
|
Would it be possible to have a unit tests for this? Given the amount of discussion around this API I think it would be great to have one. Maybe we could get a binary copy of an existing log page and decode it then? |
|
Okay will do try it later. Thank you. |
|
Just created the separated PR: #3185 for the unit test. |
There was a problem hiding this comment.
I wonder if we should rename this struct to nvme_copy_range_f0 because also the spec names this f0.
|
Looks good. I saw that there are a handful of new fields defined in the newest spec. We might want to add them too. WDYT? BTW, the commit message doesn't match anymore. This change updates the names of the fields. |
|
Yes I will do rename the struct and add new fields by additional commits. Thank you. |
694c106 to
cf45db5
Compare
|
Sorry for my recent changes and you had to rebase your work. I'll just have to read up on the little to big endian change in your explanation. It strikes me a bit odd that one field is big endian, but that might just be my OCD... |
|
No problem. The changes to move the nvme_init_* implementation to header look good. Just changed the odd big endian field to array as same with the copy range format 1 and 3. |
6109e6f to
612a752
Compare
|
Thanks for your effort in getting this sorted out. I’ve spent some time trying to figure out what we should do here, and I hope I understand it correctly now. As Keith pointed out, the command word endianness is handled by the driver. The application is responsible for getting the payload right.
So, the series here gets it right, albeit after a bit of meandering. I think it would be beneficial to reorganize the series to make the review easier for everyone involved in this discussion. Could you rearrange the series so that:
Also, please rename Thanks! |
|
Sure will do. Thank you.
But the diagram itself seems not described about the copy command descriptor itself |
About the Dword values fields below also desribed to
2. Dword 14 and 15: LBTL, LBATM and LBAT
|
Rename to copy_range_f0 and follow NVMe command set spec revision 1.2. Signed-off-by: Tokunori Ikegami <[email protected]>
b1898b7 to
30672d3
Compare
|
Just pushed the patches updated as mentioned. Thank you. |
| elbt[1] = 0; | ||
| elbt[0] = 0; | ||
| for (i = 0; i < size; i++) | ||
| #if __BYTE_ORDER == __LITTLE_ENDIAN |
There was a problem hiding this comment.
Just realized that these are not defined in the public headers of libnvme and I don't think we should.
I think we need to use htobe16 and htobe32 instead.
Would something like
__be32 elbt;
copy[i].elbt = htobe32(elbts[i]);not work?
There was a problem hiding this comment.
Yes just done as mentioned. Thank you.
Change the elbt, elbat and albatm tag fields byte ordering. Signed-off-by: Tokunori Ikegami <[email protected]>
30672d3 to
8b6577c
Compare
|
Thanks a lot! Sorry that this took so long. But hopefully this code doesn't have to be touched again :) |




Since the format 1h and 3h elbt values are set as big-endian. Also change the field name eilbrt to elbt as following spec.