summaryrefslogtreecommitdiffstats
path: root/nvme-wrap.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-31 04:13:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-01-31 04:13:03 +0000
commitd2082ee94267e4ca59b187c5e37dac03c1d65187 (patch)
treecd93a882e0726a7df500fedf2263263984406b36 /nvme-wrap.c
parentReleasing debian version 2.2.1-4. (diff)
downloadnvme-cli-d2082ee94267e4ca59b187c5e37dac03c1d65187.tar.xz
nvme-cli-d2082ee94267e4ca59b187c5e37dac03c1d65187.zip
Merging upstream version 2.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'nvme-wrap.c')
-rw-r--r--nvme-wrap.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/nvme-wrap.c b/nvme-wrap.c
index c31ec11..ae7cd92 100644
--- a/nvme-wrap.c
+++ b/nvme-wrap.c
@@ -77,6 +77,12 @@ int nvme_cli_identify_ns(struct nvme_dev *dev, __u32 nsid,
return do_admin_op(identify_ns, dev, nsid, ns);
}
+int nvme_cli_identify_ns_descs(struct nvme_dev *dev, __u32 nsid,
+ struct nvme_ns_id_desc *descs)
+{
+ return do_admin_op(identify_ns_descs, dev, nsid, descs);
+}
+
int nvme_cli_identify_allocated_ns(struct nvme_dev *dev, __u32 nsid,
struct nvme_id_ns *ns)
{
@@ -95,6 +101,20 @@ int nvme_cli_identify_allocated_ns_list(struct nvme_dev *dev, __u32 nsid,
return do_admin_op(identify_allocated_ns_list, dev, nsid, list);
}
+int nvme_cli_identify_primary_ctrl(struct nvme_dev *dev, __u32 nsid,
+ struct nvme_primary_ctrl_cap *cap)
+{
+ return do_admin_op(identify_primary_ctrl, dev, nsid, cap);
+}
+
+int nvme_cli_identify_secondary_ctrl_list(struct nvme_dev *dev, __u32 nsid,
+ __u16 ctrl_id,
+ struct nvme_secondary_ctrl_list *sc_list)
+{
+ return do_admin_op(identify_secondary_ctrl_list, dev, nsid, ctrl_id,
+ sc_list);
+}
+
int nvme_cli_get_features(struct nvme_dev *dev,
struct nvme_get_features_args *args)
{
@@ -335,6 +355,19 @@ int nvme_cli_fw_commit(struct nvme_dev *dev,
return do_admin_args_op(fw_commit, dev, args);
}
+int nvme_cli_admin_passthru(struct nvme_dev *dev, __u8 opcode, __u8 flags,
+ __u16 rsvd, __u32 nsid, __u32 cdw2, __u32 cdw3,
+ __u32 cdw10, __u32 cdw11, __u32 cdw12, __u32 cdw13,
+ __u32 cdw14, __u32 cdw15, __u32 data_len,
+ void *data, __u32 metadata_len, void *metadata,
+ __u32 timeout_ms, __u32 *result)
+{
+ return do_admin_op(admin_passthru, dev, opcode, flags, rsvd, nsid,
+ cdw2, cdw3, cdw10, cdw11, cdw12, cdw13, cdw14, cdw15,
+ data_len, data, metadata_len, metadata, timeout_ms,
+ result);
+}
+
/* The MI & direct interfaces don't have an exactly-matching API for
* ns_mgmt_create, as we don't support a timeout for MI.
*/
@@ -360,3 +393,26 @@ int nvme_cli_get_feature_length2(int fid, __u32 cdw11, enum nvme_data_tfr dir,
return err;
return nvme_get_feature_length(fid, cdw11, len);
}
+
+int nvme_cli_security_send(struct nvme_dev *dev,
+ struct nvme_security_send_args* args)
+{
+ return do_admin_args_op(security_send, dev, args);
+}
+
+int nvme_cli_security_receive(struct nvme_dev *dev,
+ struct nvme_security_receive_args* args)
+{
+ /* Cannot use do_admin_args_op here because the API have different suffix*/
+ if (dev->type == NVME_DEV_DIRECT) {
+ args->fd = dev->direct.fd;
+ args->timeout = NVME_DEFAULT_IOCTL_TIMEOUT;
+ return nvme_security_receive(args);
+ }
+
+ if (dev->type == NVME_DEV_MI)
+ return nvme_mi_admin_security_recv(dev->mi.ctrl, args);
+
+ return -ENODEV;
+}
+