include/nvme_spec.h: update fields for power state descriptor

Adding missing fields for power state descriptor.
Update identify examples file accordingly.

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Change-Id: I23a23179fd0dbb92120d1c3f176da61a4d981990
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12864
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Ankit Kumar 2022-06-02 20:52:28 +05:30 committed by Jim Harris
parent da45400093
commit b79199af39
2 changed files with 63 additions and 7 deletions

View File

@ -1675,19 +1675,62 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
printf("Current Power State: Power State #%u\n", ps);
for (i = 0; i <= cdata->npss; i++) {
const struct spdk_nvme_power_state psd = cdata->psd[i];
printf("Power State #%u: ", i);
printf("Power State #%u:\n", i);
if (psd.mps) {
/* MP scale is 0.0001 W */
printf("Max Power: %u.%04u W\n",
printf(" Max Power: %u.%04u W\n",
psd.mp / 10000,
psd.mp % 10000);
} else {
/* MP scale is 0.01 W */
printf("Max Power: %3u.%02u W\n",
printf(" Max Power: %3u.%02u W\n",
psd.mp / 100,
psd.mp % 100);
}
/* TODO: print other power state descriptor fields */
printf(" Non-Operational State: %s\n",
psd.nops ? "Non-Operation" : "Operational");
printf(" Entry Latency: ");
if (psd.enlat) {
printf("%u microseconds\n", psd.enlat);
} else {
printf("Not Reported\n");
}
printf(" Exit Latency: ");
if (psd.exlat) {
printf("%u microseconds\n", psd.exlat);
} else {
printf("Not Reported\n");
}
printf(" Relative Read Throughput: %u\n", psd.rrt);
printf(" Relative Read Latency: %u\n", psd.rrl);
printf(" Relative Write Throughput: %u\n", psd.rwt);
printf(" Relative Write Latency: %u\n", psd.rwl);
printf(" Idle Power: ");
switch (psd.ips) {
case 1:
/* Idle Power scale is 0.0001 W */
printf("%u.%04u W\n", psd.idlp / 10000, psd.idlp % 10000);
break;
case 2:
/* Idle Power scale is 0.01 W */
printf("%u.%02u W\n", psd.idlp / 100, psd.idlp % 100);
break;
default:
printf(" Not Reported\n");
}
printf(" Active Power: ");
switch (psd.aps) {
case 1:
/* Active Power scale is 0.0001 W */
printf("%u.%04u W\n", psd.actp / 10000, psd.actp % 10000);
break;
case 2:
/* Active Power scale is 0.01 W */
printf("%u.%02u W\n", psd.actp / 100, psd.actp % 100);
break;
default:
printf(" Not Reported\n");
}
}
printf("Non-Operational Permissive Mode: %s\n",
cdata->ctratt.non_operational_power_state_permissive_mode ? "Supported" : "Not Supported");

View File

@ -1724,7 +1724,20 @@ struct spdk_nvme_power_state {
uint8_t rwl : 5; /* bits 124:120: relative write latency */
uint8_t reserved6 : 3;
uint8_t reserved7[16];
uint16_t idlp; /* bits 143:128: idle power */
uint8_t reserved7 : 6;
uint8_t ips : 2; /* bits 151:150: idle power scale */
uint8_t reserved8;
uint16_t actp; /* bits 175:160: active power */
uint8_t apw : 3; /* bits 178:176: active power workload */
uint8_t reserved9 : 3;
uint8_t aps : 2; /* bits 183:182: active power scale */
uint8_t reserved10[9];
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_power_state) == 32, "Incorrect size");