nvme/spec: add accessors to, and commented members of, zone-descriptors

The struct-accessors are added and named matching the fields defined in
the spec. to be used by the fio_plugin/nvme and other consumers of the
driver-layer. Comments to be consumed doc-generators as well as human
readers of the header-file.

The identify example is updated with the change.

Signed-off-by: Simon A. F. Lund <simon.lund@samsung.com>
Change-Id: I8d6cb82e095c5dcbc06fe892e17ce83dc0062735
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4835
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Simon A. F. Lund 2020-10-21 22:36:29 +02:00 committed by Tomasz Zawadzki
parent 6fafaa5dc6
commit 54219afe5a
2 changed files with 42 additions and 5 deletions

View File

@ -780,7 +780,7 @@ print_zns_zone_report(void)
for (i = 0; i < g_zone_report->nr_zones; i++) {
struct spdk_nvme_zns_zone_desc *desc = &g_zone_report->descs[i];
printf("Zone: %"PRIu64" ZSLBA: 0x%016"PRIx64" ZCAP: 0x%016"PRIx64" WP: 0x%016"PRIx64" ZS: %x ZT: %x ZA: %x\n",
i, desc->zslba, desc->zcap, desc->wp, desc->zs >> 4, desc->zt, desc->za);
i, desc->zslba, desc->zcap, desc->wp, desc->zs, desc->zt, desc->za.raw);
}
free(g_zone_report);
g_zone_report = NULL;

View File

@ -3109,13 +3109,50 @@ enum spdk_nvme_zns_zone_state {
};
struct spdk_nvme_zns_zone_desc {
uint8_t zt;
uint8_t zs;
uint8_t za;
uint8_t reserved3[5];
/** Zone Type */
uint8_t zt : 4;
uint8_t rsvd0 : 4;
uint8_t rsvd1 : 4;
/** Zone State */
uint8_t zs : 4;
/**
* Zone Attributes
*/
union {
uint8_t raw;
struct {
/** Zone Finished by controller */
uint8_t zfc: 1;
/** Zone Finish Recommended */
uint8_t zfr: 1;
/** Reset Zone Recommended */
uint8_t rzr: 1;
uint8_t rsvd3 : 4;
/** Zone Descriptor Valid */
uint8_t zdev: 1;
} bits;
} za;
uint8_t reserved[5];
/** Zone Capacity (in number of LBAs) */
uint64_t zcap;
/** Zone Start LBA */
uint64_t zslba;
/** Write Pointer (LBA) */
uint64_t wp;
uint8_t reserved32[32];
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_zns_zone_desc) == 64, "Incorrect size");