Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Documentation/nvme-admin-passthru.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ OPTIONS
-O <opcode>::
--opcode=<opcode>::
The NVMe opcode to send to the device in the command
Required argument as this param is mandatory.

-f <flags>::
--flags=<flags>::
Expand Down
1 change: 1 addition & 0 deletions Documentation/nvme-io-passthru.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ OPTIONS
-O <opcode>::
--opcode=<opcode>::
The NVMe opcode to send to the device in the command
Required argument as this param is mandatory.

-f <flags>::
--flags=<flags>::
Expand Down
1 change: 1 addition & 0 deletions Documentation/nvme-nvme-mi-recv.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ OPTIONS
-O <opcode>::
--opcode=<opcode>::
The NVMe-MI opcode to send to the device in the command
Required argument as this param is mandatory.

-n <nsid>::
--namespace-id=<nsid>::
Expand Down
1 change: 1 addition & 0 deletions Documentation/nvme-nvme-mi-send.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ OPTIONS
-O <opcode>::
--opcode=<opcode>::
The NVMe-MI opcode to send to the device in the command
Required argument as this param is mandatory.

-n <nsid>::
--namespace-id=<nsid>::
Expand Down
10 changes: 10 additions & 0 deletions nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -9123,6 +9123,11 @@ static int passthru(int argc, char **argv, bool admin,
return err;
}

if (!argconfig_parse_seen(opts, "opcode")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also update the man pages. They don't mention this option is required, only the help text from above does so.

nvme_show_error("%s: opcode parameter required", cmd->name);
return -EINVAL;
}

if (cfg.opcode & 0x01) {
cfg.write = true;
flags = O_RDONLY;
Expand Down Expand Up @@ -10186,6 +10191,11 @@ static int nvme_mi(int argc, char **argv, __u8 admin_opcode, const char *desc)
if (err)
return err;

if (!argconfig_parse_seen(opts, "opcode")) {
Copy link
Collaborator

@igaw igaw Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far I can tell, this was not enforced before, it would be a behavior change. @jk-ozlabs

Also the documentation doesn't say it's mandatory.

But I see why you added it. The help says: "opcode (required)".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with the requirement; a default opcode of 0 maps to "Read NVMe-MI data structure", and it would be a bit odd to be relying on that as an implicit command to issue.

I would agree with adding to the docs though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the documentations to add the description. (And also rebased the PR branch.) Thank you.

nvme_show_error("%s: opcode parameter required", *argv);
return -EINVAL;
}

if (admin_opcode == nvme_admin_nvme_mi_send) {
flags = O_RDONLY;
fd = STDIN_FILENO;
Expand Down