]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: fix identify controller structure fabrics identify fields
authorGollu Appalanaidu <anaidu.gollu@samsung.com>
Tue, 2 Mar 2021 19:06:17 +0000 (00:36 +0530)
committerKeith Busch <kbusch@kernel.org>
Tue, 2 Mar 2021 19:31:07 +0000 (12:31 -0700)
The changes as per the Base NVMe 1.4b and NVMeOF 1.1 specification.
Optional Fabrics Command Support(OFCS) field added at wrong offset
of the structure, and other naming conventions fixed as per the Spec.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
linux/nvme.h
nvme-print.c

index 6ff04abb1c1ab3ba6a8f79c99aef8c6acb7c3735..1d1d8ec12406e1f25b0b39eec8d1cf04f1f26e37 100644 (file)
@@ -336,7 +336,7 @@ struct nvme_id_ctrl {
        __u8                    icsvscc;
        __u8                    nwpc;
        __le16                  acwu;
-       __le16                  ocfs;
+       __u8                    rsvd534[2];
        __le32                  sgls;
        __le32                  mnan;
        __u8                    rsvd544[224];
@@ -345,9 +345,10 @@ struct nvme_id_ctrl {
        __le32                  ioccsz;
        __le32                  iorcsz;
        __le16                  icdoff;
-       __u8                    ctrattr;
+       __u8                    fcatt;
        __u8                    msdbd;
-       __u8                    rsvd1804[244];
+       __le16                  ofcs;
+       __u8                    rsvd1806[242];
        struct nvme_id_power_state      psd[32];
        __u8                    vs[1024];
 };
index 85429e1162daaf7172ccf31f32856e2167e4efc3..25c7e23bdc8243aa78f36df1e681da91bbf48bb1 100755 (executable)
@@ -298,7 +298,6 @@ static void json_nvme_id_ctrl(struct nvme_id_ctrl *ctrl,
        json_object_add_value_int(root, "icsvscc", ctrl->icsvscc);
        json_object_add_value_int(root, "nwpc", ctrl->nwpc);
        json_object_add_value_int(root, "acwu", le16_to_cpu(ctrl->acwu));
-       json_object_add_value_int(root, "ocfs", le16_to_cpu(ctrl->ocfs));
        json_object_add_value_int(root, "sgls", le32_to_cpu(ctrl->sgls));
 
        if (strlen(subnqn))
@@ -307,8 +306,9 @@ static void json_nvme_id_ctrl(struct nvme_id_ctrl *ctrl,
        json_object_add_value_int(root, "ioccsz", le32_to_cpu(ctrl->ioccsz));
        json_object_add_value_int(root, "iorcsz", le32_to_cpu(ctrl->iorcsz));
        json_object_add_value_int(root, "icdoff", le16_to_cpu(ctrl->icdoff));
-       json_object_add_value_int(root, "ctrattr", ctrl->ctrattr);
+       json_object_add_value_int(root, "fcatt", ctrl->fcatt);
        json_object_add_value_int(root, "msdbd", ctrl->msdbd);
+       json_object_add_value_int(root, "ofcs", le16_to_cpu(ctrl->ofcs));
 
        psds = json_create_array();
        json_object_add_value_array(root, "psds", psds);
@@ -3116,10 +3116,10 @@ static void nvme_show_id_ctrl_sgls(__le32 ctrl_sgls)
        printf("\n");
 }
 
-static void nvme_show_id_ctrl_ctrattr(__u8 ctrattr)
+static void nvme_show_id_ctrl_fcatt(__u8 fcatt)
 {
-       __u8 rsvd = (ctrattr & 0xFE) >> 1;
-       __u8 scm = ctrattr & 0x1;
+       __u8 rsvd = (fcatt & 0xFE) >> 1;
+       __u8 scm = fcatt & 0x1;
        if (rsvd)
                printf("  [7:1] : %#x\tReserved\n", rsvd);
        printf("  [0:0] : %#x\t%s Controller Model\n",
@@ -3127,6 +3127,18 @@ static void nvme_show_id_ctrl_ctrattr(__u8 ctrattr)
        printf("\n");
 }
 
+static void nvme_show_id_ctrl_ofcs(__le16 ofcs)
+{
+       __u16 rsvd = (ofcs & 0xfffe) >> 1;
+       __u8 disconn = ofcs & 0x1;
+       if (rsvd)
+               printf("  [15:1] : %#x\tReserved\n", rsvd);
+       printf("  [0:0] : %#x\tDisconnect command %s Supported\n",
+               disconn, disconn ? "" : "Not");
+       printf("\n");
+
+}
+
 static void nvme_show_id_ns_nsfeat(__u8 nsfeat)
 {
        __u8 rsvd = (nsfeat & 0xE0) >> 5;
@@ -3735,7 +3747,6 @@ void __nvme_show_id_ctrl(struct nvme_id_ctrl *ctrl, enum nvme_print_flags flags,
        if (human)
                nvme_show_id_ctrl_nwpc(ctrl->nwpc);
        printf("acwu      : %d\n", le16_to_cpu(ctrl->acwu));
-       printf("ocfs      : %d\n", le16_to_cpu(ctrl->ocfs));
        printf("sgls      : %#x\n", le32_to_cpu(ctrl->sgls));
        if (human)
                nvme_show_id_ctrl_sgls(ctrl->sgls);
@@ -3744,10 +3755,13 @@ void __nvme_show_id_ctrl(struct nvme_id_ctrl *ctrl, enum nvme_print_flags flags,
        printf("ioccsz    : %d\n", le32_to_cpu(ctrl->ioccsz));
        printf("iorcsz    : %d\n", le32_to_cpu(ctrl->iorcsz));
        printf("icdoff    : %d\n", le16_to_cpu(ctrl->icdoff));
-       printf("ctrattr   : %#x\n", ctrl->ctrattr);
+       printf("fcatt     : %#x\n", ctrl->fcatt);
        if (human)
-               nvme_show_id_ctrl_ctrattr(ctrl->ctrattr);
+               nvme_show_id_ctrl_fcatt(ctrl->fcatt);
        printf("msdbd     : %d\n", ctrl->msdbd);
+       printf("ofcs      : %d\n", le16_to_cpu(ctrl->ofcs));
+       if (human)
+               nvme_show_id_ctrl_ofcs(ctrl->ofcs);
 
        nvme_show_id_ctrl_power(ctrl);
        if (vendor_show)