nvme: add extended reservation data structure definition
Rename some fields to let the name is consistent with specification. Change-Id: Ie63fb69465f1448a8ffbb99eaa8f356371fa4af1 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/432972 Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
3c98150821
commit
d49bbbf053
@ -170,7 +170,7 @@ reservation_ns_report(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpa
|
|||||||
int ret, i;
|
int ret, i;
|
||||||
uint8_t *payload;
|
uint8_t *payload;
|
||||||
struct spdk_nvme_reservation_status_data *status;
|
struct spdk_nvme_reservation_status_data *status;
|
||||||
struct spdk_nvme_reservation_ctrlr_data *cdata;
|
struct spdk_nvme_registered_ctrlr_data *cdata;
|
||||||
struct spdk_nvme_ns *ns;
|
struct spdk_nvme_ns *ns;
|
||||||
|
|
||||||
ns = spdk_nvme_ctrlr_get_ns(ctrlr, ns_id);
|
ns = spdk_nvme_ctrlr_get_ns(ctrlr, ns_id);
|
||||||
@ -204,17 +204,18 @@ reservation_ns_report(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpa
|
|||||||
}
|
}
|
||||||
|
|
||||||
status = (struct spdk_nvme_reservation_status_data *)payload;
|
status = (struct spdk_nvme_reservation_status_data *)payload;
|
||||||
fprintf(stdout, "Reservation Generation Counter %u\n", status->generation);
|
fprintf(stdout, "Reservation Generation Counter %u\n", status->gen);
|
||||||
fprintf(stdout, "Reservation type %u\n", status->type);
|
fprintf(stdout, "Reservation type %u\n", status->rtype);
|
||||||
fprintf(stdout, "Reservation Number of Registered Controllers %u\n", status->nr_regctl);
|
fprintf(stdout, "Reservation Number of Registered Controllers %u\n", status->regctl);
|
||||||
fprintf(stdout, "Reservation Persist Through Power Loss State %u\n", status->ptpl_state);
|
fprintf(stdout, "Reservation Persist Through Power Loss State %u\n", status->ptpls);
|
||||||
for (i = 0; i < status->nr_regctl; i++) {
|
for (i = 0; i < status->regctl; i++) {
|
||||||
cdata = (struct spdk_nvme_reservation_ctrlr_data *)(payload + sizeof(struct
|
cdata = (struct spdk_nvme_registered_ctrlr_data *)(payload +
|
||||||
spdk_nvme_reservation_status_data) * (i + 1));
|
sizeof(struct spdk_nvme_reservation_status_data) +
|
||||||
fprintf(stdout, "Controller ID %u\n", cdata->ctrlr_id);
|
sizeof(struct spdk_nvme_registered_ctrlr_data) * i);
|
||||||
|
fprintf(stdout, "Controller ID %u\n", cdata->cntlid);
|
||||||
fprintf(stdout, "Controller Reservation Status %u\n", cdata->rcsts.status);
|
fprintf(stdout, "Controller Reservation Status %u\n", cdata->rcsts.status);
|
||||||
fprintf(stdout, "Controller Host ID 0x%"PRIx64"\n", cdata->host_id);
|
fprintf(stdout, "Controller Host ID 0x%"PRIx64"\n", cdata->hostid);
|
||||||
fprintf(stdout, "Controller Reservation Key 0x%"PRIx64"\n", cdata->key);
|
fprintf(stdout, "Controller Reservation Key 0x%"PRIx64"\n", cdata->rkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
spdk_dma_free(payload);
|
spdk_dma_free(payload);
|
||||||
|
@ -1640,32 +1640,57 @@ enum spdk_nvme_reservation_acquire_action {
|
|||||||
|
|
||||||
struct __attribute__((packed)) spdk_nvme_reservation_status_data {
|
struct __attribute__((packed)) spdk_nvme_reservation_status_data {
|
||||||
/** reservation action generation counter */
|
/** reservation action generation counter */
|
||||||
uint32_t generation;
|
uint32_t gen;
|
||||||
/** reservation type */
|
/** reservation type */
|
||||||
uint8_t type;
|
uint8_t rtype;
|
||||||
/** number of registered controllers */
|
/** number of registered controllers */
|
||||||
uint16_t nr_regctl;
|
uint16_t regctl;
|
||||||
uint16_t reserved1;
|
uint16_t reserved1;
|
||||||
/** persist through power loss state */
|
/** persist through power loss state */
|
||||||
uint8_t ptpl_state;
|
uint8_t ptpls;
|
||||||
uint8_t reserved[14];
|
uint8_t reserved[14];
|
||||||
};
|
};
|
||||||
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_reservation_status_data) == 24, "Incorrect size");
|
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_reservation_status_data) == 24, "Incorrect size");
|
||||||
|
|
||||||
struct __attribute__((packed)) spdk_nvme_reservation_ctrlr_data {
|
struct __attribute__((packed)) spdk_nvme_reservation_status_extended_data {
|
||||||
uint16_t ctrlr_id;
|
struct spdk_nvme_reservation_status_data data;
|
||||||
|
uint8_t reserved[40];
|
||||||
|
};
|
||||||
|
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_reservation_status_extended_data) == 64,
|
||||||
|
"Incorrect size");
|
||||||
|
|
||||||
|
struct __attribute__((packed)) spdk_nvme_registered_ctrlr_data {
|
||||||
|
/** controller id */
|
||||||
|
uint16_t cntlid;
|
||||||
/** reservation status */
|
/** reservation status */
|
||||||
struct {
|
struct {
|
||||||
uint8_t status : 1;
|
uint8_t status : 1;
|
||||||
uint8_t reserved1 : 7;
|
uint8_t reserved1 : 7;
|
||||||
} rcsts;
|
} rcsts;
|
||||||
uint8_t reserved2[5];
|
uint8_t reserved2[5];
|
||||||
/** host identifier */
|
/** 64-bit host identifier */
|
||||||
uint64_t host_id;
|
uint64_t hostid;
|
||||||
/** reservation key */
|
/** reservation key */
|
||||||
uint64_t key;
|
uint64_t rkey;
|
||||||
};
|
};
|
||||||
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_reservation_ctrlr_data) == 24, "Incorrect size");
|
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_registered_ctrlr_data) == 24, "Incorrect size");
|
||||||
|
|
||||||
|
struct __attribute__((packed)) spdk_nvme_registered_ctrlr_extended_data {
|
||||||
|
/** controller id */
|
||||||
|
uint16_t cntlid;
|
||||||
|
/** reservation status */
|
||||||
|
struct {
|
||||||
|
uint8_t status : 1;
|
||||||
|
uint8_t reserved1 : 7;
|
||||||
|
} rcsts;
|
||||||
|
uint8_t reserved2[5];
|
||||||
|
/** reservation key */
|
||||||
|
uint64_t rkey;
|
||||||
|
/** 128-bit host identifier */
|
||||||
|
uint8_t hostid[16];
|
||||||
|
uint8_t reserved3[32];
|
||||||
|
};
|
||||||
|
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_registered_ctrlr_extended_data) == 64, "Incorrect size");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Change persist through power loss state for
|
* Change persist through power loss state for
|
||||||
|
Loading…
x
Reference in New Issue
Block a user