]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: add multiple update detected result value in fw commit
authorGollu Appalanaidu <anaidu.gollu@samsung.com>
Sat, 3 Jul 2021 18:52:36 +0000 (00:22 +0530)
committerDaniel Wagner <dwagner@suse.de>
Mon, 15 Nov 2021 11:06:28 +0000 (12:06 +0100)
Add Multiple Update Detected (MUD) field in FW Commit command
CQE CDW0 as per NVMe 2.0 Spec.

Signed-off-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
[dwagner: removed nvme-ioctl changes; part of libnvme]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvme.c

diff --git a/nvme.c b/nvme.c
index 787850ed118ced6af8d0603a72c9adf03b8e8a3a..f85d92ce348641bb087fb3dd59c80218e0977a3a 100644 (file)
--- a/nvme.c
+++ b/nvme.c
@@ -3059,6 +3059,7 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin *
        const char *action = "[0-7]: commit action";
        const char *bpid = "[0,1]: boot partition identifier, if applicable (default: 0)";
        int err, fd;
+       __u32 result;
 
        struct config {
                __u8 slot;
@@ -3099,7 +3100,7 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin *
                goto close_fd;
        }
 
-       err = nvme_fw_commit(fd, cfg.slot, cfg.action, cfg.bpid);
+       err = nvme_fw_commit(fd, cfg.slot, cfg.action, cfg.bpid, &result);
        if (err < 0)
                perror("fw-commit");
        else if (err != 0)
@@ -3125,6 +3126,16 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin *
                printf("\n");
        }
 
+       if (err >= 0) {
+               printf("Multiple Update Detected (MUD) Value: %u\n", result);
+               if (result & 0x1)
+                       printf("Detected an overlapping firmware/boot partition image update command "\
+                               "sequence due to processing a command from a Management Endpoint");
+               if ((result >> 1) & 0x1)
+                       printf("Detected an overlapping firmware/boot partition image update command "\
+                               "sequence due to processing a command from an Admin SQ on a controller");
+       }
+
 close_fd:
        close(fd);
 ret: