Skip to content

Commit 2fafbf3

Browse files
nvme-cli: Add 'transport type' error to the error log
* Update show_error_log * Update json_error_log Signed-off-by: Revanth Rajashekar <[email protected]>
1 parent 5c1ab09 commit 2fafbf3

2 files changed

Lines changed: 31 additions & 11 deletions

File tree

nvme-print.c

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,19 @@ void json_nvme_id_uuid_list(struct nvme_id_uuid_list *uuid_list)
14521452
json_free_object(root);
14531453
}
14541454

1455+
static const char *nvme_trtype_to_string(__u8 trtype)
1456+
{
1457+
switch(trtype) {
1458+
case 0: return "The transport type is not indicated or the error "\
1459+
"is not transport related.";
1460+
case 1: return "RDMA Transport error.";
1461+
case 2: return "Fibre Channel Transport error.";
1462+
case 3: return "TCP Transport error.";
1463+
case 254: return "Intra-host Transport error.";
1464+
default: return "Reserved";
1465+
};
1466+
}
1467+
14551468
void show_error_log(struct nvme_error_log_page *err_log, int entries, const char *devname)
14561469
{
14571470
int i;
@@ -1462,17 +1475,19 @@ void show_error_log(struct nvme_error_log_page *err_log, int entries, const char
14621475
for (i = 0; i < entries; i++) {
14631476
printf(" Entry[%2d] \n", i);
14641477
printf(".................\n");
1465-
printf("error_count : %"PRIu64"\n", le64_to_cpu(err_log[i].error_count));
1466-
printf("sqid : %d\n", err_log[i].sqid);
1467-
printf("cmdid : %#x\n", err_log[i].cmdid);
1468-
printf("status_field : %#x(%s)\n", err_log[i].status_field,
1478+
printf("error_count : %"PRIu64"\n", le64_to_cpu(err_log[i].error_count));
1479+
printf("sqid : %d\n", err_log[i].sqid);
1480+
printf("cmdid : %#x\n", err_log[i].cmdid);
1481+
printf("status_field : %#x(%s)\n", err_log[i].status_field,
14691482
nvme_status_to_string(le16_to_cpu(err_log[i].status_field) >> 1));
1470-
printf("parm_err_loc : %#x\n", err_log[i].parm_error_location);
1471-
printf("lba : %#"PRIx64"\n",le64_to_cpu(err_log[i].lba));
1472-
printf("nsid : %#x\n", err_log[i].nsid);
1473-
printf("vs : %d\n", err_log[i].vs);
1474-
printf("cs : %#"PRIx64"\n",
1483+
printf("parm_err_loc : %#x\n", err_log[i].parm_error_location);
1484+
printf("lba : %#"PRIx64"\n",le64_to_cpu(err_log[i].lba));
1485+
printf("nsid : %#x\n", err_log[i].nsid);
1486+
printf("vs : %d\n", err_log[i].vs);
1487+
printf("trtype : %s\n", nvme_trtype_to_string(err_log[i].trtype));
1488+
printf("cs : %#"PRIx64"\n",
14751489
le64_to_cpu(err_log[i].cs));
1490+
printf("trtype_spec_info: %#x\n", err_log[i].trtype_spec_info);
14761491
printf(".................\n");
14771492
}
14781493
}
@@ -3021,8 +3036,11 @@ void json_error_log(struct nvme_error_log_page *err_log, int entries, const char
30213036
json_object_add_value_uint(error, "nsid",
30223037
le32_to_cpu(err_log[i].nsid));
30233038
json_object_add_value_int(error, "vs", err_log[i].vs);
3039+
json_object_add_value_int(error, "trtype", err_log[i].trtype);
30243040
json_object_add_value_uint(error, "cs",
30253041
le64_to_cpu(err_log[i].cs));
3042+
json_object_add_value_int(error, "trtype_spec_info",
3043+
le16_to_cpu(err_log[i].trtype_spec_info));
30263044

30273045
json_array_add_value_object(errors, error);
30283046
}

nvme.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ struct nvme_error_log_page {
4141
__le64 lba;
4242
__le32 nsid;
4343
__u8 vs;
44-
__u8 resv[3];
44+
__u8 trtype;
45+
__u8 resv[2];
4546
__le64 cs;
46-
__u8 resv2[24];
47+
__le16 trtype_spec_info;
48+
__u8 resv2[22];
4749
};
4850

4951
struct nvme_firmware_log_page {

0 commit comments

Comments
 (0)