diff mbox series

[v2,06/20] nvme: Fix reservation status related structs

Message ID 20220809000419.10674-7-michael.christie@oracle.com
State Superseded
Headers show
Series Use block pr_ops in LIO | expand

Commit Message

Mike Christie Aug. 9, 2022, 12:04 a.m. UTC
This fixes the following issues with the reservation status structs:

1. resv10 is bytes 23:10 so it should be 14 bytes.
2. regctl_ds only supports 64 bit host IDs.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 include/linux/nvme.h | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

Comments

Christoph Hellwig Aug. 9, 2022, 7:19 a.m. UTC | #1
On Mon, Aug 08, 2022 at 07:04:05PM -0500, Mike Christie wrote:
> This fixes the following issues with the reservation status structs:
> 
> 1. resv10 is bytes 23:10 so it should be 14 bytes.
> 2. regctl_ds only supports 64 bit host IDs.

This doesn't actually seem to be used by the kernel at all.  Which
I guess means I need to go back into my todo list and tackle the
discussion if we want to have non-kernel bits in nvme.h to start
with.
Chaitanya Kulkarni Aug. 9, 2022, 11:09 a.m. UTC | #2
On 8/9/22 00:19, Christoph Hellwig wrote:
> On Mon, Aug 08, 2022 at 07:04:05PM -0500, Mike Christie wrote:
>> This fixes the following issues with the reservation status structs:
>>
>> 1. resv10 is bytes 23:10 so it should be 14 bytes.
>> 2. regctl_ds only supports 64 bit host IDs.
> 
> This doesn't actually seem to be used by the kernel at all.  Which
> I guess means I need to go back into my todo list and tackle the
> discussion if we want to have non-kernel bits in nvme.h to start
> with.

Having non-kernel bits in nvme.h creates confusion, I've raised this
question in past, in case old nvme-cli (without libnvme) was the
reason to keep them in kernel maybe we can sort this out since
now that nvme-cli and libnvme are spilt ?

-ck
diff mbox series

Patch

diff --git a/include/linux/nvme.h b/include/linux/nvme.h
index ae53d74f3696..ae4a76076420 100644
--- a/include/linux/nvme.h
+++ b/include/linux/nvme.h
@@ -757,20 +757,37 @@  enum {
 	NVME_LBART_ATTRIB_HIDE	= 1 << 1,
 };
 
+struct nvme_registered_ctrl {
+	__le16	cntlid;
+	__u8	rcsts;
+	__u8	rsvd3[5];
+	__le64	hostid;
+	__le64	rkey;
+};
+
+struct nvme_registered_ctrl_ext {
+	__le16	cntlid;
+	__u8	rcsts;
+	__u8	rsvd3[5];
+	__le64	rkey;
+	__u8	hostid[16];
+	__u8	rsvd32[32];
+};
+
 struct nvme_reservation_status {
 	__le32	gen;
 	__u8	rtype;
 	__u8	regctl[2];
 	__u8	resv5[2];
 	__u8	ptpls;
-	__u8	resv10[13];
-	struct {
-		__le16	cntlid;
-		__u8	rcsts;
-		__u8	resv3[5];
-		__le64	hostid;
-		__le64	rkey;
-	} regctl_ds[];
+	__u8	resv10[14];
+	union {
+		struct {
+			__u8	rsvd24[40];
+			struct nvme_registered_ctrl_ext regctl_eds[0];
+		};
+		struct nvme_registered_ctrl regctl_ds[0];
+	};
 };
 
 enum nvme_async_event_type {