Skip to content

Commit f3b9bf5

Browse files
committed
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 fdcb92c commit f3b9bf5

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
@@ -1542,6 +1542,26 @@ const char *nvme_power_measurement_action_to_string(__u8 act)
15421542
return "Reserved";
15431543
}
15441544

1545+
const char *nvme_ipmsr_srs_to_string(__u8 srs)
1546+
{
1547+
switch (srs) {
1548+
case 0:
1549+
return "Not reported";
1550+
case 1:
1551+
return "1 microsecond";
1552+
case 2:
1553+
return "10 microseconds";
1554+
case 3:
1555+
return "100 microseconds";
1556+
case 4:
1557+
return "1 millisecond";
1558+
case 5:
1559+
return "10 milliseconds";
1560+
default:
1561+
return "Reserved";
1562+
}
1563+
}
1564+
15451565
void nvme_feature_show(enum nvme_features_id fid, int sel, unsigned int result)
15461566
{
15471567
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
@@ -345,6 +345,7 @@ const char *nvme_bpwps_to_string(__u8 bpwps);
345345
const char *nvme_feature_power_limit_scale_to_string(__u8 pls);
346346
const char *nvme_power_measurement_type_to_string(__u8 pmt);
347347
const char *nvme_power_measurement_action_to_string(__u8 act);
348+
const char *nvme_ipmsr_srs_to_string(__u8 srs);
348349

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

0 commit comments

Comments
 (0)