plugins/ocp: Use structure for ocp smart log#2604
Conversation
0a3fbb7 to
5603264
Compare
|
I've merged #2577, so this one needs a rebase. Thanks! |
1b03f68 to
b7a4dd9
Compare
|
Hi @igaw I rebased it. Thanks! |
|
I am not seeing any layout changes: This is with gcc on x86_64. How do you get a different layout? |
0e2127f to
eb9a59b
Compare
|
Hi @igaw I resolved the conflict. |
printed log tested (same), except below Remove wrong duplicated prints from stdout NVMe base errata version NVMe command set errata version Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
|
Urgh! This is a nasty thing in the spec. Anyway, you can't just cast the bytes to a __le16 type, because some architectures will horrible fail if you try to access a non aligned data type. x86 allows though. You need to copy the value into a proper aligned buffer before you can access it with And the compiler should actually warn but since you add a hard cast on it, you silence it up. That's why I really like to see |
|
Hi @igaw I thought it was right to move the data to uint16_t as you said, so I fixed it. Additionally, I updated ocp v2.6 spec for smart information extended. |
If the dssd point, minor version are declared as __le16, the alignment will be broken. Remove __packed keyword. Change parameter void to ocp_smart_extended_log. Reported-by: Steven Seungcheol Lee <sc108.lee@samsung.com> Signed-off-by: Minsik Jeon <hmi.jeon@samsung.com>
Log Identifier C0h. Spec Documents: https://www.opencompute.org/documents/datacenter-nvme-ssd-specification-v2-6-2-pdf Signed-off-by: Minsik Jeon <hmi.jeon@samsung.com> Co-authored-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Looks good. As far I am aware the memcpy approach is the canonical way to address the alignment issue.
Thanks! |

printed log tested (same), except below
Remove wrong duplicated prints from stdout
NVMe base errata version
NVMe command set errata version