Skip to content

Commit 4efa117

Browse files
jimmunnigaw
authored andcommitted
nvme-print: Decode Sample Rate Scale
Add human friendly decoded version of Sample Rate Scale (SRS) of the Interval Power Measurement Sample Rate (IPMSR) field in the Identify Controller Data Structure. Signed-off-by: Jim Munn <[email protected]>
1 parent 9544fab commit 4efa117

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

nvme-print-stdout.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2441,7 +2441,8 @@ static void stdout_id_ctrl_ipmsr(__le16 ctrl_ipmsr)
24412441
__u16 srs = NVME_GET(ipmsr, CTRL_IPMSR_SRS);
24422442
__u16 srv = NVME_GET(ipmsr, CTRL_IPMSR_SRV);
24432443

2444-
printf(" [15:8] : %#x\tSample Rate Scale\n", srs);
2444+
printf(" [15:8] : %#x\tSample Rate Scale (%s)\n", srs,
2445+
nvme_ipmsr_srs_to_string(srs));
24452446
printf(" [7:0] : %#x\tSample Rate Value\n", srv);
24462447

24472448
printf("\n");

nvme-print.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,6 +1580,26 @@ const char *nvme_power_measurement_action_to_string(__u8 act)
15801580
return "Reserved";
15811581
}
15821582

1583+
const char *nvme_ipmsr_srs_to_string(__u8 srs)
1584+
{
1585+
switch (srs) {
1586+
case 0:
1587+
return "Not reported";
1588+
case 1:
1589+
return "1 microsecond";
1590+
case 2:
1591+
return "10 microseconds";
1592+
case 3:
1593+
return "100 microseconds";
1594+
case 4:
1595+
return "1 millisecond";
1596+
case 5:
1597+
return "10 milliseconds";
1598+
default:
1599+
return "Reserved";
1600+
}
1601+
}
1602+
15831603
void nvme_feature_show(enum nvme_features_id fid, int sel, unsigned int result)
15841604
{
15851605
nvme_print(show_feature, NORMAL, fid, sel, result);

nvme-print.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ const char *nvme_bpwps_to_string(__u8 bpwps);
346346
const char *nvme_feature_power_limit_scale_to_string(__u8 pls);
347347
const char *nvme_power_measurement_type_to_string(__u8 pmt);
348348
const char *nvme_power_measurement_action_to_string(__u8 act);
349+
const char *nvme_ipmsr_srs_to_string(__u8 srs);
349350

350351
void nvme_dev_full_path(nvme_ns_t n, char *path, size_t len);
351352
void nvme_generic_full_path(nvme_ns_t n, char *path, size_t len);

0 commit comments

Comments
 (0)