]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: add optional copy format support id ctrl field
authorGollu Appalanaidu <anaidu.gollu@samsung.com>
Fri, 28 May 2021 05:10:40 +0000 (10:40 +0530)
committerSteven Seungcheol Lee <sc108.lee@samsung.com>
Tue, 7 Dec 2021 08:23:12 +0000 (17:23 +0900)
Add the OCFS field in Identify Controller Structure, as per the
Ratified TP 4065b (Simple Copy Command).

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

index 1556b524cdbfa117eaff9e80c50dea8aa9c69e09..88a0664b6871b359c328420715255edec167d89b 100644 (file)
@@ -327,6 +327,7 @@ 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));
        json_object_add_value_float(root, "maxdna", maxdna);
        json_object_add_value_int(root, "maxcna", le32_to_cpu(ctrl->maxcna));
@@ -3338,6 +3339,17 @@ static void nvme_show_id_ctrl_nwpc(__u8 nwpc)
        printf("\n");
 }
 
+static void nvme_show_id_ctrl_ocfs(__u16 ocfs)
+{
+       __u16 rsvd = (ocfs & 0xfffe) >> 1;
+       __u8 copy_fmt_0 = ocfs & 0x1;
+       if (rsvd)
+               printf("  [15:1] : %#x\tReserved\n", rsvd);
+       printf("  [0:0] : %#x\tController Copy Format 0h %sSupported\n",
+               copy_fmt_0, copy_fmt_0 ? "" : "Not ");
+       printf("\n");
+}
+
 static void nvme_show_id_ctrl_sgls(__le32 ctrl_sgls)
 {
        __u32 sgls = le32_to_cpu(ctrl_sgls);
@@ -4131,6 +4143,9 @@ 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      : %#x\n", le16_to_cpu(ctrl->ocfs));
+       if (human)
+               nvme_show_id_ctrl_ocfs(ctrl->ocfs);
        printf("sgls      : %#x\n", le32_to_cpu(ctrl->sgls));
        if (human)
                nvme_show_id_ctrl_sgls(ctrl->sgls);