]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Add Timeout Parameter for Zone Management Commands
authorBrandon Paupore <brandon.paupore@wdc.com>
Wed, 23 Jun 2021 17:31:22 +0000 (12:31 -0500)
committerKeith Busch <kbusch@kernel.org>
Wed, 23 Jun 2021 17:46:29 +0000 (11:46 -0600)
Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
Documentation/nvme-zns-close-zone.1
Documentation/nvme-zns-finish-zone.1
Documentation/nvme-zns-offline-zone.1
Documentation/nvme-zns-open-zone.1
Documentation/nvme-zns-reset-zone.1
Documentation/nvme-zns-set-zone-desc.1
Documentation/nvme-zns-zone-mgmt-send.1
nvme-ioctl.c
nvme-ioctl.h
plugins/zns/zns.c

index d9624c164e419f71674f5a4a699d18683ca4106a..5f80a39b9fb95a6132637dc33382dcda232479e7 100644 (file)
@@ -32,9 +32,10 @@ nvme-zns-close-zone \- Closes one or all zones
 .SH "SYNOPSIS"
 .sp
 .nf
-\fInvme zns close\-zone nvme zns id\-ctrl\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>]
-                                                [\-\-start\-lba=<LBA> | \-s <LBA>]
-                                                [\-\-select\-all | \-a]
+\fInvme zns close\-zone\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>]
+                             [\-\-start\-lba=<LBA> | \-s <LBA>]
+                             [\-\-select\-all | \-a]
+                             [\-\-timeout=<timeout> | \-t <timeout>]
 .fi
 .SH "DESCRIPTION"
 .sp
@@ -57,6 +58,11 @@ The starting LBA of the zone to close\&.
 .RS 4
 Select all zones for this action
 .RE
+.PP
+\-t <timeout>, \-\-timeout=<timeout>
+.RS 4
+Override default timeout value\&. In milliseconds\&.
+.RE
 .SH "EXAMPLES"
 .sp
 .RS 4
index 764c683656e1cc11e744c68704c8f6e8bbf2c90e..b34801ffec99aa587f969725264d39e4a6e8f509 100644 (file)
@@ -32,9 +32,10 @@ nvme-zns-finish-zone \- Finishes one or all zones
 .SH "SYNOPSIS"
 .sp
 .nf
-\fInvme zns finish\-zone nvme zns id\-ctrl\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>]
-                                                [\-\-start\-lba=<LBA> | \-s <LBA>]
-                                                [\-\-select\-all | \-a]
+\fInvme zns finish\-zone\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>]
+                              [\-\-start\-lba=<LBA> | \-s <LBA>]
+                              [\-\-select\-all | \-a]
+                              [\-\-timeout=<timeout> | \-t <timeout>]
 .fi
 .SH "DESCRIPTION"
 .sp
@@ -57,6 +58,11 @@ The starting LBA of the zone to finish\&.
 .RS 4
 Select all zones for this action\&.
 .RE
+.PP
+\-t <timeout>, \-\-timeout=<timeout>
+.RS 4
+Override default timeout value\&. In milliseconds\&.
+.RE
 .SH "EXAMPLES"
 .sp
 .RS 4
index 9d2d0837877ad234c350e15a5088d14601de5445..2e6c17884824b3895c4859bc84992b751a2673de 100644 (file)
@@ -32,9 +32,10 @@ nvme-zns-offline-zone \- Offlines one or all zones
 .SH "SYNOPSIS"
 .sp
 .nf
-\fInvme zns offline\-zone nvme zns id\-ctrl\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>]
-                                                [\-\-start\-lba=<LBA> | \-s <LBA>]
-                                                [\-\-select\-all | \-a]
+\fInvme zns offline\-zone\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>]
+                               [\-\-start\-lba=<LBA> | \-s <LBA>]
+                               [\-\-select\-all | \-a]
+                               [\-\-timeout=<timeout> | \-t <timeout>]
 .fi
 .SH "DESCRIPTION"
 .sp
@@ -57,6 +58,11 @@ The starting LBA of the zone to offline\&.
 .RS 4
 Select all zones for this action
 .RE
+.PP
+\-t <timeout>, \-\-timeout=<timeout>
+.RS 4
+Override default timeout value\&. In milliseconds\&.
+.RE
 .SH "EXAMPLES"
 .sp
 .RS 4
index 8ea78f208e7de1acb3625bd67a2682f8091654ca..412094267b578dd478603a92be5efb2eac745d45 100644 (file)
@@ -32,9 +32,10 @@ nvme-zns-open-zone \- Opens one or all zones
 .SH "SYNOPSIS"
 .sp
 .nf
-\fInvme zns open\-zone nvme zns id\-ctrl\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>]
-                                                [\-\-start\-lba=<LBA> | \-s <LBA>]
-                                                [\-\-select\-all | \-a]
+\fInvme zns open\-zone\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>]
+                            [\-\-start\-lba=<LBA> | \-s <LBA>]
+                            [\-\-select\-all | \-a]
+                            [\-\-timeout=<timeout> | \-t <timeout>]
 .fi
 .SH "DESCRIPTION"
 .sp
@@ -57,6 +58,11 @@ The starting LBA of the zone to open\&.
 .RS 4
 Select all zones for this action
 .RE
+.PP
+\-t <timeout>, \-\-timeout=<timeout>
+.RS 4
+Override default timeout value\&. In milliseconds\&.
+.RE
 .SH "EXAMPLES"
 .sp
 .RS 4
index b02d04274531bf63199dc29bfa8fc90d87095cd0..7452e8bd9d2b00e60d4868c3849c764e70824b09 100644 (file)
@@ -33,8 +33,9 @@ nvme-zns-reset-zone \- Resets one or all zones
 .sp
 .nf
 \fInvme zns reset\-zone\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>]
-                               [\-\-start\-lba=<LBA> | \-s <LBA>]
-                               [\-\-select\-all | \-a]
+                             [\-\-start\-lba=<LBA> | \-s <LBA>]
+                             [\-\-select\-all | \-a]
+                             [\-\-timeout=<timeout> | \-t <timeout>]
 .fi
 .SH "DESCRIPTION"
 .sp
@@ -57,6 +58,11 @@ The starting LBA of the zone to reset\&.
 .RS 4
 Select all zones for this action
 .RE
+.PP
+\-t <timeout>, \-\-timeout=<timeout>
+.RS 4
+Override default timeout value\&. In milliseconds\&.
+.RE
 .SH "EXAMPLES"
 .sp
 .RS 4
index a33b06a3d9685c54bfba1d3f6958beaa0cdc74c6..7b9a52a536b4cec0ac2576a6bd674f7423f288fb 100644 (file)
@@ -33,8 +33,9 @@ nvme-zns-set-zone-desc \- Set extended descriptor data for a zone
 .sp
 .nf
 \fInvme zns setzone\-desc\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>]
-                                 [\-\-start\-lba=<IONUM>, \-s <IONUM>]
-                                 [\-data=<FILE>, \-d <FILE>]
+                               [\-\-start\-lba=<IONUM>, \-s <IONUM>]
+                               [\-data=<FILE>, \-d <FILE>]
+                               [\-\-timeout=<timeout> | \-t <timeout>]
 .fi
 .SH "DESCRIPTION"
 .sp
@@ -55,6 +56,11 @@ The starting LBA of the zone to manage send\&.
 .RS 4
 Optional file for data (default stdin)
 .RE
+.PP
+\-t <timeout>, \-\-timeout=<timeout>
+.RS 4
+Override default timeout value\&. In milliseconds\&.
+.RE
 .SH "EXAMPLES"
 .sp
 .RS 4
index f74d8a3eb7dfda53d185f7f236bf26caca9d7e18..5b58bbcd1c5406c26efe7291948c3472bc61786b 100644 (file)
@@ -33,11 +33,12 @@ nvme-zns-zone-mgmt-send \- Zone Management Send command
 .sp
 .nf
 \fInvme zns zone\-mgmt\-send\fR <device> [\-\-namespace\-id=<NUM> | \-n <NUM>]
-                                   [\-\-start\-lba=<IONUM>, \-s <IONUM>]
-                                   [\-\-select\-all, \-a]
-                                   [\-\-zsa=<NUM>, \-z <NUM>]
-                                   [\-\-data\-len=<IONUM>, \-l <IONUM>]
-                                   [\-data=<FILE>, \-d <FILE>]
+                                 [\-\-start\-lba=<IONUM>, \-s <IONUM>]
+                                 [\-\-select\-all, \-a]
+                                 [\-\-zsa=<NUM>, \-z <NUM>]
+                                 [\-\-data\-len=<IONUM>, \-l <IONUM>]
+                                 [\-data=<FILE>, \-d <FILE>]
+                                 [\-\-timeout=<timeout> | \-t <timeout>]
 .fi
 .SH "DESCRIPTION"
 .sp
@@ -78,6 +79,11 @@ Buffer length if data required
 .RS 4
 Optional file for data (default stdin)
 .RE
+.PP
+\-t <timeout>, \-\-timeout=<timeout>
+.RS 4
+Override default timeout value\&. In milliseconds\&.
+.RE
 .SH "EXAMPLES"
 .sp
 .RS 4
index fca079c8a3c5d2b934c8ebb4a646d40751db5a0e..738eeca22fed7bff4964848bfa4cc81f5b9477a2 100644 (file)
@@ -983,7 +983,7 @@ int nvme_virtual_mgmt(int fd, __u32 cdw10, __u32 cdw11, __u32 *result)
 }
 
 int nvme_zns_mgmt_send(int fd, __u32 nsid, __u64 slba, bool select_all,
-                      enum nvme_zns_send_action zsa, __u32 data_len,
+                      __u32 timeout, enum nvme_zns_send_action zsa, __u32 data_len,
                       void *data)
 {
        __u32 cdw10 = slba & 0xffffffff;
@@ -998,6 +998,7 @@ int nvme_zns_mgmt_send(int fd, __u32 nsid, __u64 slba, bool select_all,
                .cdw13          = cdw13,
                .addr           = (__u64)(uintptr_t)data,
                .data_len       = data_len,
+               .timeout_ms     = timeout,
        };
 
        return nvme_submit_io_passthru(fd, &cmd);
index e84baea02a64b3b9c6c7d637e0b04e5a118432b4..20415f6ca8462fdefc2ddfd856e21388352bd57c 100644 (file)
@@ -164,7 +164,7 @@ int nvme_self_test_log(int fd, __u32 nsid, struct nvme_self_test_log *self_test_
 int nvme_virtual_mgmt(int fd, __u32 cdw10, __u32 cdw11, __u32 *result);
 
 int nvme_zns_mgmt_send(int fd, __u32 nsid, __u64 slba, bool select_all,
-                      enum nvme_zns_send_action zsa, __u32 data_len,
+                      __u32 timeout, enum nvme_zns_send_action zsa, __u32 data_len,
                       void *data);
 int nvme_zns_mgmt_recv(int fd, __u32 nsid, __u64 slba,
                       enum nvme_zns_recv_action zra, __u8 zrasf,
index 5c5ed92ae082d6a884ea591e66dae450d79200f5..e5583177445e5ac230386481df2ab135ad739665 100644 (file)
@@ -130,12 +130,13 @@ close_fd:
        return nvme_status_to_errno(err, false);
 }
 
-static int __zns_mgmt_send(int fd, __u32 namespace_id, __u64 zslba,
-       bool select_all, enum nvme_zns_send_action zsa, __u32 data_len, void *buf)
+static int __zns_mgmt_send(int fd, __u32 namespace_id, __u64 zslba, 
+       bool select_all, __u32 timeout, enum nvme_zns_send_action zsa, 
+       __u32 data_len, void *buf)
 {
        int err;
 
-       err = nvme_zns_mgmt_send(fd, namespace_id, zslba, select_all, zsa,
+       err = nvme_zns_mgmt_send(fd, namespace_id, zslba, select_all, timeout, zsa,
                        data_len, buf);
        close(fd);
        return err;
@@ -146,6 +147,7 @@ static int zns_mgmt_send(int argc, char **argv, struct command *cmd, struct plug
 {
        const char *zslba = "starting LBA of the zone for this command";
        const char *select_all = "send command to all zones";
+       const char *timeout = "timeout value, in milliseconds";
 
        int err, fd;
        char *command;
@@ -154,6 +156,7 @@ static int zns_mgmt_send(int argc, char **argv, struct command *cmd, struct plug
                __u64   zslba;
                __u32   namespace_id;
                bool    select_all;
+               __u32   timeout;
        };
 
        struct config cfg = {};
@@ -162,6 +165,7 @@ static int zns_mgmt_send(int argc, char **argv, struct command *cmd, struct plug
                OPT_UINT("namespace-id", 'n', &cfg.namespace_id,  namespace_id),
                OPT_SUFFIX("start-lba",  's', &cfg.zslba,         zslba),
                OPT_FLAG("select-all",   'a', &cfg.select_all,    select_all),
+               OPT_UINT("timeout",      't', &cfg.timeout,       timeout),
                OPT_END()
        };
 
@@ -182,7 +186,7 @@ static int zns_mgmt_send(int argc, char **argv, struct command *cmd, struct plug
        }
 
        err = __zns_mgmt_send(fd, cfg.namespace_id, cfg.zslba,
-               cfg.select_all, zsa, 0, NULL);
+               cfg.select_all, cfg.timeout, zsa, 0, NULL);
        if (!err)
                printf("%s: Success, action:%d zone:%"PRIx64" all:%d nsid:%d\n",
                        command, zsa, (uint64_t)cfg.zslba, (int)cfg.select_all,
@@ -235,6 +239,7 @@ static int zone_mgmt_send(int argc, char **argv, struct command *cmd, struct plu
        const char *zsa = "zone send action";
        const char *data_len = "buffer length if data required";
        const char *data = "optional file for data (default stdin)";
+       const char *timeout = "timeout value, in milliseconds";
 
        int fd, ffd = STDIN_FILENO, err = -1;
        void *buf = NULL;
@@ -244,8 +249,9 @@ static int zone_mgmt_send(int argc, char **argv, struct command *cmd, struct plu
                __u32   namespace_id;
                bool    select_all;
                __u8    zsa;
-               int   data_len;
+               int     data_len;
                char   *file;
+               __u32   timeout;
        };
 
        struct config cfg = {};
@@ -255,8 +261,9 @@ static int zone_mgmt_send(int argc, char **argv, struct command *cmd, struct plu
                OPT_SUFFIX("start-lba",  's', &cfg.zslba,         zslba),
                OPT_FLAG("select-all",   'a', &cfg.select_all,    select_all),
                OPT_BYTE("zsa",          'z', &cfg.zsa,           zsa),
-               OPT_UINT("data-len",     'l', &cfg.data_len,     data_len),
-               OPT_FILE("data",         'd', &cfg.file,         data),
+               OPT_UINT("data-len",     'l', &cfg.data_len,      data_len),
+               OPT_FILE("data",         'd', &cfg.file,          data),
+               OPT_UINT("timeout",      't', &cfg.timeout,       timeout),
                OPT_END()
        };
 
@@ -319,7 +326,7 @@ static int zone_mgmt_send(int argc, char **argv, struct command *cmd, struct plu
        }
 
        err = __zns_mgmt_send(fd, cfg.namespace_id, cfg.zslba, cfg.select_all,
-                       cfg.zsa, cfg.data_len, buf);
+                       cfg.timeout, cfg.zsa, cfg.data_len, buf);
        if (!err)
                printf("zone-mgmt-send: Success, action:%d zone:%"PRIx64" "
                        "all:%d nsid:%d\n",
@@ -380,6 +387,7 @@ static int set_zone_desc(int argc, char **argv, struct command *cmd, struct plug
        const char *desc = "Set Zone Descriptor Extension\n";
        const char *zslba = "starting LBA of the zone for this command";
        const char *data = "optional file for zone extention data (default stdin)";
+       const char *timeout = "timeout value, in milliseconds";
 
        int fd, ffd = STDIN_FILENO, err;
        void *buf = NULL;
@@ -389,6 +397,7 @@ static int set_zone_desc(int argc, char **argv, struct command *cmd, struct plug
                __u64   zslba;
                __u32   namespace_id;
                char   *file;
+               __u32   timeout;
        };
 
        struct config cfg = {};
@@ -396,7 +405,8 @@ static int set_zone_desc(int argc, char **argv, struct command *cmd, struct plug
        OPT_ARGS(opts) = {
                OPT_UINT("namespace-id", 'n', &cfg.namespace_id,  namespace_id),
                OPT_SUFFIX("start-lba",  's', &cfg.zslba,         zslba),
-               OPT_FILE("data",         'd', &cfg.file,         data),
+               OPT_FILE("data",         'd', &cfg.file,          data),
+               OPT_UINT("timeout",      't', &cfg.timeout,       timeout),
                OPT_END()
        };
 
@@ -444,7 +454,7 @@ static int set_zone_desc(int argc, char **argv, struct command *cmd, struct plug
                goto close_ffd;
        }
 
-       err = __zns_mgmt_send(fd, cfg.namespace_id, cfg.zslba, 0,
+       err = __zns_mgmt_send(fd, cfg.namespace_id, cfg.zslba, 0, cfg.timeout,
                NVME_ZNS_ZSA_SET_DESC_EXT, data_len, buf);
        if (!err)
                printf("set-zone-desc: Success, zone:%"PRIx64" nsid:%d\n",