Skip to content

Commit 1b18547

Browse files
nvme: eye chart plotting and dump VS eye data
-Addressing review comments -Converting all the unsigned shorts into host-endianness Signed-off-by: Sivaprasad Gutha <[email protected]>
1 parent a404eb3 commit 1b18547

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

nvme-print-stdout.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -776,9 +776,9 @@ static void stdout_eom_printable_eye(struct nvme_eom_lane_desc *lane)
776776
char *eye = (char *)lane->eye_desc;
777777
int i, j;
778778

779-
for (i = 0; i < lane->nrows; i++) {
780-
for (j = 0; j < lane->ncols; j++)
781-
printf("%c", eye[i * lane->ncols + j]);
779+
for (i = 0; i < le16_to_cpu(lane->nrows); i++) {
780+
for (j = 0; j < le16_to_cpu(lane->ncols); j++)
781+
printf("%c", eye[i * le16_to_cpu(lane->ncols) + j]);
782782
printf("\n");
783783
}
784784
}
@@ -809,16 +809,16 @@ static void stdout_phy_rx_eom_descs(struct nvme_phy_rx_eom_log *log)
809809
stdout_eom_printable_eye(desc);
810810

811811
/* Eye Data field is vendor specific */
812-
if (desc->edlen == 0)
812+
if (le16_to_cpu(desc->edlen) == 0)
813813
continue;
814814

815815
/* Hex dump Vendor Specific Eye Data */
816-
vsdata = malloc(desc->edlen);
817-
vsdataoffset = (desc->nrows * desc->ncols) +
816+
vsdata = malloc(le16_to_cpu(desc->edlen));
817+
vsdataoffset = (le16_to_cpu(desc->nrows) * le16_to_cpu(desc->ncols)) +
818818
sizeof(struct nvme_eom_lane_desc);
819819
vsdata = (unsigned char *)((unsigned char *)desc + vsdataoffset);
820820
printf("Eye Data:\n");
821-
d(vsdata, desc->edlen, 16, 1);
821+
d(vsdata, le16_to_cpu(desc->edlen), 16, 1);
822822
printf("\n");
823823

824824
p += log->dsize;

0 commit comments

Comments
 (0)