Skip to content

Commit 24a5580

Browse files
zhangjian3032igaw
authored andcommitted
example: fix mi identify failed with error cntid
This command failed when we try to identify a controller that the controller id is 1. Refer to the `Figure 273: Identify - CNS Values`: +-----------+-------+ | CNS Value | CNTID | +-----------+-------+ | 01h | N | +-----------+-------+ When CNS is 01h, the CNTID field is ignored. See `Figure 270: Identify - Command Dword 10`: If this field is not used as part of the Identify operation, then * host software shall clear this field to 0h for backwards compatibility (0h is a valid controller identifier); * and the controller shall ignore this field. This filed is set to controller id in the example code, but it should be 0 when CNS is 1. PS: The NVMe that we are testing does not ignore the CNTID field and returns an error when the CNTID field is not 0. Signed-off-by: Jian Zhang <[email protected]>
1 parent 3f89041 commit 24a5580

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

examples/mi-mctp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ int do_identify(nvme_mi_ep_t ep, int argc, char **argv)
201201

202202
partial = argc > 2 && !strcmp(argv[2], "--partial");
203203

204-
ctrl = nvme_mi_init_ctrl(ep, tmp);
204+
ctrl = nvme_mi_init_ctrl(ep, ctrl_id);
205205
if (!ctrl) {
206206
warn("can't create controller");
207207
return -1;
@@ -211,7 +211,7 @@ int do_identify(nvme_mi_ep_t ep, int argc, char **argv)
211211
id_args.args_size = sizeof(id_args);
212212
id_args.cns = NVME_IDENTIFY_CNS_CTRL;
213213
id_args.nsid = NVME_NSID_NONE;
214-
id_args.cntid = ctrl_id;
214+
id_args.cntid = 0;
215215
id_args.csi = NVME_CSI_NVM;
216216

217217
/* for this example code, we can either do a full or partial identify;

0 commit comments

Comments
 (0)