nvme-cli: add support for an abort command
PATCH 1/2 nvme-cli: add support for an abort command
Add support for an abort command.
sqid and cid are enough to be __u16, but declared in __u32 to check being without either or both parameters.
Signed-off-by Minwoo Im <minwoo.im.dev at gmail.com>
--- nvme-builtin.h | 1 + nvme-ioctl.c | 13 +++++++++++++ nvme-ioctl.h | 1 + nvme.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 65 insertions(+)
nvme-builtin.h +1 -0
@@ -59,6 +59,7 @@ COMMAND_LIST( ENTRY("gen-hostnqn", "Generate NVMeoF host NQN", gen_hostnqn_cmd) ENTRY("dir-receive", "Submit a Directive Receive command, return results", dir_receive) ENTRY("dir-send", "Submit a Directive Send command, return results", dir_send) +ENTRY ("abort" ,"Submit an Abort, return results" , abort_cmd) );#endif
nvme-ioctl.c +13 -0
@@ -778,3 +778,16 @@ int nvme_dir_recv(int fd, __u32 nsid, __u16 dspec, __u8 dtype, __u8 doper,return err; } +int nvme_abort (int fd,__u16 sqid,__u16 cid,__u32 *result) +{ +struct nvme_admin_cmd cmd = { + .opcode = nvme_admin_abort_cmd, + .cdw10 = cid <<16 | sqid, + }; +int err; + + err =nvme_submit_admin_passthru (fd, &cmd); +if (!err && result) + *result = cmd.result; +return err; +}
nvme-ioctl.h +1 -0
@@ -127,5 +127,6 @@ int nvme_dir_recv(int fd, __u32 nsid, __u16 dspec, __u8 dtype, __u8 doper, __u32 data_len, __u32 dw12, void *data, __u32 *result);int nvme_get_properties (int fd,void **pbar);int nvme_set_property (int fd,int offset,int value); +int nvme_abort (int fd,__u16 sqid,__u16 cid,__u32 *result);#endif /* _NVME_LIB_H */
nvme.c +50 -0
56 lines not on this page · raw message
Signature · 1 line
2.7.4