Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
9ce13d9
ioctl: nvme_identify use nvme_passthru_cmd directly
igaw Jul 31, 2025
0810fef
ioctl: reorder nvme_get_log and nvme_get_log_page
igaw Jul 30, 2025
ca10a4d
ioctl: nvme_get_log use nvme_passthru_cmd directly
igaw Jul 29, 2025
8a43299
test: fix rae and lsp handling in log page tests
igaw Aug 8, 2025
e7e9143
ioctl: nvme_format_nvm use nvme_passthru_cmd directly
igaw Aug 1, 2025
139eb6d
ioctl: nvme_ns_mgmt use nvme_passthru_cmd directly
igaw Aug 1, 2025
ba80d26
ioctl: nvme_ns_attach use nvme_passthru_cmd directly
igaw Aug 1, 2025
e58de59
ioctl: nvme_ns_download use nvme_passthru_cmd directly
igaw Aug 1, 2025
df17c25
ioctl: nvme_fw_commit use nvme_passthru_cmd directly
igaw Aug 1, 2025
67d41a2
ioctl: nvme_security_send use nvme_passthru_cmd directly
igaw Aug 1, 2025
7d7d67d
ioctl: nvme_set_features use nvme_passthru_cmd directly
MaisenbacherD Jul 30, 2025
49b23a5
ioctl: nvme_dsm use nvme_passthru_cmd directly
ikegami-t Aug 2, 2025
1b35385
ioctl: nvme_io use nvme_passthru_cmd directly
ikegami-t Aug 2, 2025
543b740
ioctl: add dsm and io commands dword fields
ikegami-t Aug 3, 2025
93bacb9
ioctl: nvme_copy use nvme_passthru_cmd directly
ikegami-t Aug 4, 2025
54589e3
ioctl: update nvme_copy to latest spec
igaw Sep 11, 2025
7a8dfef
ioctl: nvme_resv_acquire use nvme_passthru_cmd directly
ikegami-t Aug 10, 2025
4d92dba
ioctl: nvme_resv_register use nvme_passthru_cmd directly
ikegami-t Aug 10, 2025
bac8187
ioctl: nvme_resv_release use nvme_passthru_cmd directly
ikegami-t Aug 10, 2025
157f10a
ioctl: nvme_resv_report use nvme_passthru_cmd directly
ikegami-t Aug 10, 2025
3bad7e6
ioctl: nvme_io_mgmt_recv use nvme_passthru_cmd directly
ikegami-t Aug 11, 2025
b304791
ioctl: nvme_io_mgmt_send use nvme_passthru_cmd directly
ikegami-t Aug 11, 2025
9f1d786
ioctl: nvme_zns_mgmt_send use nvme_passthru_cmd directly
ikegami-t Aug 11, 2025
b34092f
ioctl: nvme_zns_mgmt_recv use nvme_passthru_cmd directly
ikegami-t Aug 11, 2025
f0b9aa7
ioctl: nvme_zns_append use nvme_passthru_cmd directly
ikegami-t Aug 11, 2025
f83b1b2
ioctl: nvme_dim_send use nvme_passthru_cmd directly
ikegami-t Aug 11, 2025
cc71ada
ioctl: nvme_lm_cdq use nvme_passthru_cmd directly
ikegami-t Aug 11, 2025
6194feb
ioctl: nvme_lm_track_send use nvme_passthru_cmd directly
ikegami-t Aug 11, 2025
e88499e
ioctl: nvme_lm_migration_send use nvme_passthru_cmd directly
ikegami-t Aug 11, 2025
7dbc090
ioctl: nvme_lm_migration_recv use nvme_passthru_cmd directly
ikegami-t Aug 11, 2025
bdc1952
ioctl: nvme_security_receive use nvme_passthru_cmd directly
ikegami-t Aug 25, 2025
219c26b
ioctl: nvme_get_lba_status use nvme_passthru_cmd directly
ikegami-t Aug 31, 2025
3e8e5da
ioctl: nvme_directive_send use nvme_passthru_cmd directly
ikegami-t Aug 31, 2025
e16123b
ioctl: nvme_directive_recv use nvme_passthru_cmd directly
ikegami-t Aug 31, 2025
02a60de
ioctl: nvme_virtual_mgmt use nvme_passthru_cmd directly
ikegami-t Aug 31, 2025
5bdac34
ioctl: nvme_dev_self_test use nvme_passthru_cmd directly
ikegami-t Aug 31, 2025
2312b44
ioctl: nvme_sanitize_nvm use nvme_passthru_cmd directly
ikegami-t Aug 31, 2025
7107c2d
ioctl: nvme_get_property use nvme_passthru_cmd directly
ikegami-t Aug 31, 2025
db6e7e4
ioctl: nvme_set_property use nvme_passthru_cmd directly
ikegami-t Aug 31, 2025
6afd7c9
ioctl: nvme_lockdown use nvme_passthru_cmd directly
ikegami-t Aug 31, 2025
932ba27
ioctl: nvme_capacity_mgmt use nvme_passthru_cmd directly
ikegami-t Sep 5, 2025
b62c63f
ioctl: nvme_get_features use nvme_passthru_cmd directly
MaisenbacherD Aug 11, 2025
3c347af
ioctl: remove unused enum features
igaw Sep 5, 2025
861d7b2
ioctl: refactor nvme_get_log_partial uring
ikegami-t Sep 3, 2025
4a44ef6
test/zns: fix kernel-doc-check warnings
ikegami-t Aug 19, 2025
ec2a1bc
examples: fix mi-mctp.c kernel-doc-check warning
ikegami-t Aug 25, 2025
490db9c
examples: do not use "/**" opening comment mark
ikegami-t Sep 2, 2025
b911a1a
test: fix mi.c kernel-doc-check warning
ikegami-t Aug 31, 2025
41a0855
examples: fix clang debug build
MaisenbacherD Sep 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/discover-loop.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/**
/*
* This file is part of libnvme.
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
*
* Authors: Keith Busch <[email protected]>
*/

/**
/*
* discover-loop: Use fabrics commands to discover any loop targets and print
* those records. You must have at least one configured nvme loop target on the
* system (no existing connection required). The output will look more
Expand Down
4 changes: 2 additions & 2 deletions examples/display-columnar.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/**
/*
* This file is part of libnvme.
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
*
* Authors: Keith Busch <[email protected]>
*/

/**
/*
* display-columnar: Scans the nvme topology, prints each record type in a
* column format for easy visual scanning.
*/
Expand Down
4 changes: 2 additions & 2 deletions examples/display-tree.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/**
/*
* This file is part of libnvme.
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
*
* Authors: Keith Busch <[email protected]>
*/

/**
/*
* display-tree: Scans the nvme topology, prints as an ascii tree with some
* selected attributes for each component.
*/
Expand Down
4 changes: 2 additions & 2 deletions examples/mi-conf.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/**
/*
* This file is part of libnvme.
* Copyright (c) 2022 Code Construct Pty Ltd.
*
* Authors: Jeremy Kerr <[email protected]>
*/

/**
/*
* mi-conf: query a device for optimal MTU and set for both the local MCTP
* route (through dbus to mctpd) and the device itself (through NVMe-MI
* configuration commands)
Expand Down
4 changes: 2 additions & 2 deletions examples/mi-mctp-ae.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/**
/*
* This file is part of libnvme.
*/

/**
/*
* mi-mctp-ae: open a MI connection over MCTP, supporting asynchronous event messages
*/

Expand Down
24 changes: 12 additions & 12 deletions examples/mi-mctp-csi-test.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/**
/*
* This file is part of libnvme.
*/

/**
/*
* mi-mctp-csi-test: open a MI connection over MCTP, and send two commands
* in parallel with different CSI buffers
*/
Expand Down Expand Up @@ -56,7 +56,7 @@ void hexdump(const unsigned char *buf, int len)

int do_get_log_page(nvme_mi_ep_t ep, int argc, char **argv)
{
struct nvme_get_log_args args = { 0 };
enum nvme_cmd_get_log_lid lid;
struct nvme_link *link;
uint8_t buf[4096];
uint16_t ctrl_id;
Expand All @@ -75,15 +75,11 @@ int do_get_log_page(nvme_mi_ep_t ep, int argc, char **argv)

ctrl_id = tmp & 0xffff;

args.args_size = sizeof(args);
args.log = buf;
args.len = sizeof(buf);

if (argc > 2) {
tmp = atoi(argv[2]);
args.lid = tmp & 0xff;
lid = tmp & 0xff;
} else {
args.lid = 0x1;
lid = 0x1;
}

link = nvme_mi_init_link(ep, ctrl_id);
Expand All @@ -92,14 +88,18 @@ int do_get_log_page(nvme_mi_ep_t ep, int argc, char **argv)
return -1;
}

rc = nvme_get_log(link, &args);
rc = nvme_get_log(link, NVME_NSID_NONE, false, NVME_LOG_LSP_NONE,
lid, NVME_LOG_LSI_NONE, NVME_CSI_NVM,
false, NVME_UUID_NONE,
0, buf, sizeof(buf),
sizeof(buf), NULL);
if (rc) {
warn("can't perform Get Log page command");
return -1;
}

printf("Get log page (log id = 0x%02x) data:\n", args.lid);
hexdump(buf, args.len);
printf("Get log page (log id = 0x%02x) data:\n", lid);
hexdump(buf, sizeof(buf));

return 0;
}
Expand Down
63 changes: 27 additions & 36 deletions examples/mi-mctp.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/**
/*
* This file is part of libnvme.
* Copyright (c) 2021 Code Construct Pty Ltd.
*
* Authors: Jeremy Kerr <[email protected]>
*/

/**
/*
* mi-mctp: open a MI connection over MCTP, and query controller info
*/

Expand Down Expand Up @@ -178,7 +178,6 @@ static const char *__copy_id_str(const void *field, size_t size,

int do_identify(nvme_mi_ep_t ep, int argc, char **argv)
{
struct nvme_identify_args id_args = { 0 };
struct nvme_link *link;
struct nvme_id_ctrl id;
uint16_t ctrl_id;
Expand Down Expand Up @@ -207,23 +206,19 @@ int do_identify(nvme_mi_ep_t ep, int argc, char **argv)
return -1;
}

id_args.data = &id;
id_args.args_size = sizeof(id_args);
id_args.cns = NVME_IDENTIFY_CNS_CTRL;
id_args.nsid = NVME_NSID_NONE;
id_args.cntid = 0;
id_args.csi = NVME_CSI_NVM;

/* for this example code, we can either do a full or partial identify;
* since we're only printing the fields before the 'rab' member,
* these will be equivalent, aside from the size of the MI
* response.
*/
if (partial) {
rc = nvme_identify_partial(link, offsetof(struct nvme_id_ctrl, rab),
&id_args);
rc = nvme_identify_partial(link, NVME_NSID_NONE, 0, NVME_IDENTIFY_CNS_CTRL,
NVME_CSI_NVM, 0, 0, &id,
offsetof(struct nvme_id_ctrl, rab),
NULL);
} else {
rc = nvme_identify(link, &id_args);
rc = nvme_identify(link, NVME_NSID_NONE, 0, NVME_IDENTIFY_CNS_CTRL,
NVME_CSI_NVM, 0, 0, &id, NULL);
}

if (rc) {
Expand Down Expand Up @@ -373,7 +368,7 @@ void hexdump(const unsigned char *buf, int len)

int do_get_log_page(nvme_mi_ep_t ep, int argc, char **argv)
{
struct nvme_get_log_args args = { 0 };
enum nvme_cmd_get_log_lid lid;
struct nvme_link *link;
uint8_t buf[512];
uint16_t ctrl_id;
Expand All @@ -392,15 +387,11 @@ int do_get_log_page(nvme_mi_ep_t ep, int argc, char **argv)

ctrl_id = tmp & 0xffff;

args.args_size = sizeof(args);
args.log = buf;
args.len = sizeof(buf);

if (argc > 2) {
tmp = atoi(argv[2]);
args.lid = tmp & 0xff;
lid = tmp & 0xff;
} else {
args.lid = 0x1;
lid = 0x1;
}

link = nvme_mi_init_link(ep, ctrl_id);
Expand All @@ -409,14 +400,18 @@ int do_get_log_page(nvme_mi_ep_t ep, int argc, char **argv)
return -1;
}

rc = nvme_get_log(link, &args);
rc = nvme_get_log(link, NVME_NSID_NONE, false, NVME_LOG_LSP_NONE,
lid, NVME_LOG_LSI_NONE, NVME_CSI_NVM,
false, NVME_UUID_NONE,
0, buf, sizeof(buf),
sizeof(buf),NULL);
if (rc) {
warn("can't perform Get Log page command");
return -1;
}

printf("Get log page (log id = 0x%02x) data:\n", args.lid);
hexdump(buf, args.len);
printf("Get log page (log id = 0x%02x) data:\n", lid);
hexdump(buf, sizeof(buf));

return 0;
}
Expand Down Expand Up @@ -542,7 +537,6 @@ static const char *sec_proto_description(uint8_t id)

int do_security_info(nvme_mi_ep_t ep, int argc, char **argv)
{
struct nvme_security_receive_args args = { 0 };
nvme_link_t link;
int i, rc, n_proto;
unsigned long tmp;
Expand All @@ -552,6 +546,9 @@ int do_security_info(nvme_mi_ep_t ep, int argc, char **argv)
uint16_t len;
uint8_t protocols[256];
} proto_info;
/* protocol 0x00, spsp 0x0000: retrieve supported protocols */
void *data = &proto_info;
__u32 data_len = sizeof(proto_info);

if (argc != 2) {
fprintf(stderr, "no controller ID specified\n");
Expand All @@ -572,27 +569,21 @@ int do_security_info(nvme_mi_ep_t ep, int argc, char **argv)
return -1;
}

/* protocol 0x00, spsp 0x0000: retrieve supported protocols */
args.args_size = sizeof(args);
args.data = &proto_info;
args.data_len = sizeof(proto_info);

rc = nvme_security_receive(link, &args);
rc = nvme_security_receive(link, 0, 0, 0, 0, 0, 0, data, data_len, NULL);
if (rc) {
warnx("can't perform Security Receive command: rc %d", rc);
return -1;
}

if (args.data_len < 6) {
warnx("Short response in security receive command (%d bytes)",
args.data_len);
if (data_len < 6) {
warnx("Short response in security receive command (%d bytes)", data_len);
return -1;
}

n_proto = be16_to_cpu(proto_info.len);
if (args.data_len < 6 + n_proto) {
warnx("Short response in security receive command (%d bytes), "
"for %d protocols", args.data_len, n_proto);
if (data_len < 6 + n_proto) {
warnx("Short response in security receive command (%d bytes), for %d protocols",
data_len, n_proto);
return -1;
}

Expand Down
4 changes: 2 additions & 2 deletions examples/telemetry-listen.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
/**
/*
* This file is part of libnvme.
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
*
* Authors: Keith Busch <[email protected]>
*/

/**
/*
* Open all nvme controller's uevent and listen for changes. If NVME_AEN event
* is observed with controller telemetry data, read the log and save it to a
* file in /var/log/ with the device's unique name and epoch timestamp.
Expand Down
Loading