nvme: introduce new set of cmd/cpl printers
Having functions without qpair on the interface allows for wider usage e.g. by nvmf layer. Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com> Change-Id: I3a51ad53f00eb29e2ba2681ef4ff0cc2a197b65d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3176 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Community-CI: Broadcom CI Community-CI: Mellanox Build Bot
This commit is contained in:
parent
f096f252d0
commit
61668cc43e
@ -2975,6 +2975,22 @@ void spdk_nvme_qpair_print_command(struct spdk_nvme_qpair *qpair,
|
|||||||
void spdk_nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair,
|
void spdk_nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair,
|
||||||
struct spdk_nvme_cpl *cpl);
|
struct spdk_nvme_cpl *cpl);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Prints (SPDK_NOTICELOG) the contents of an NVMe submission queue entry (command).
|
||||||
|
*
|
||||||
|
* \param qid Queue identifier.
|
||||||
|
* \param cmd Pointer to the submission queue command to be formatted.
|
||||||
|
*/
|
||||||
|
void spdk_nvme_print_command(uint16_t qid, struct spdk_nvme_cmd *cmd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Prints (SPDK_NOTICELOG) the contents of an NVMe completion queue entry.
|
||||||
|
*
|
||||||
|
* \param qid Queue identifier.
|
||||||
|
* \param cpl Pointer to the completion queue element to be formatted.
|
||||||
|
*/
|
||||||
|
void spdk_nvme_print_completion(uint16_t qid, struct spdk_nvme_cpl *cpl);
|
||||||
|
|
||||||
struct ibv_context;
|
struct ibv_context;
|
||||||
struct ibv_pd;
|
struct ibv_pd;
|
||||||
struct ibv_mr;
|
struct ibv_mr;
|
||||||
|
@ -108,22 +108,20 @@ nvme_get_string(const struct nvme_string *strings, uint16_t value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nvme_admin_qpair_print_command(struct spdk_nvme_qpair *qpair,
|
nvme_admin_qpair_print_command(uint16_t qid, struct spdk_nvme_cmd *cmd)
|
||||||
struct spdk_nvme_cmd *cmd)
|
|
||||||
{
|
{
|
||||||
|
assert(cmd != NULL);
|
||||||
|
|
||||||
SPDK_NOTICELOG("%s (%02x) sqid:%d cid:%d nsid:%x "
|
SPDK_NOTICELOG("%s (%02x) qid:%d cid:%d nsid:%x cdw10:%08x cdw11:%08x\n",
|
||||||
"cdw10:%08x cdw11:%08x\n",
|
nvme_get_string(admin_opcode, cmd->opc), cmd->opc, qid, cmd->cid, cmd->nsid, cmd->cdw10,
|
||||||
nvme_get_string(admin_opcode, cmd->opc), cmd->opc, qpair->id, cmd->cid,
|
cmd->cdw11);
|
||||||
cmd->nsid, cmd->cdw10, cmd->cdw11);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nvme_io_qpair_print_command(struct spdk_nvme_qpair *qpair,
|
nvme_io_qpair_print_command(uint16_t qid, struct spdk_nvme_cmd *cmd)
|
||||||
struct spdk_nvme_cmd *cmd)
|
|
||||||
{
|
{
|
||||||
assert(qpair != NULL);
|
|
||||||
assert(cmd != NULL);
|
assert(cmd != NULL);
|
||||||
|
|
||||||
switch ((int)cmd->opc) {
|
switch ((int)cmd->opc) {
|
||||||
case SPDK_NVME_OPC_WRITE:
|
case SPDK_NVME_OPC_WRITE:
|
||||||
case SPDK_NVME_OPC_READ:
|
case SPDK_NVME_OPC_READ:
|
||||||
@ -131,36 +129,41 @@ nvme_io_qpair_print_command(struct spdk_nvme_qpair *qpair,
|
|||||||
case SPDK_NVME_OPC_COMPARE:
|
case SPDK_NVME_OPC_COMPARE:
|
||||||
SPDK_NOTICELOG("%s sqid:%d cid:%d nsid:%d "
|
SPDK_NOTICELOG("%s sqid:%d cid:%d nsid:%d "
|
||||||
"lba:%llu len:%d\n",
|
"lba:%llu len:%d\n",
|
||||||
nvme_get_string(io_opcode, cmd->opc), qpair->id, cmd->cid,
|
nvme_get_string(io_opcode, cmd->opc), qid, cmd->cid, cmd->nsid,
|
||||||
cmd->nsid,
|
|
||||||
((unsigned long long)cmd->cdw11 << 32) + cmd->cdw10,
|
((unsigned long long)cmd->cdw11 << 32) + cmd->cdw10,
|
||||||
(cmd->cdw12 & 0xFFFF) + 1);
|
(cmd->cdw12 & 0xFFFF) + 1);
|
||||||
break;
|
break;
|
||||||
case SPDK_NVME_OPC_FLUSH:
|
case SPDK_NVME_OPC_FLUSH:
|
||||||
case SPDK_NVME_OPC_DATASET_MANAGEMENT:
|
case SPDK_NVME_OPC_DATASET_MANAGEMENT:
|
||||||
SPDK_NOTICELOG("%s sqid:%d cid:%d nsid:%d\n",
|
SPDK_NOTICELOG("%s sqid:%d cid:%d nsid:%d\n",
|
||||||
nvme_get_string(io_opcode, cmd->opc), qpair->id, cmd->cid,
|
nvme_get_string(io_opcode, cmd->opc), qid, cmd->cid, cmd->nsid);
|
||||||
cmd->nsid);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SPDK_NOTICELOG("%s (%02x) sqid:%d cid:%d nsid:%d\n",
|
SPDK_NOTICELOG("%s (%02x) sqid:%d cid:%d nsid:%d\n",
|
||||||
nvme_get_string(io_opcode, cmd->opc), cmd->opc, qpair->id,
|
nvme_get_string(io_opcode, cmd->opc), cmd->opc, qid, cmd->cid, cmd->nsid);
|
||||||
cmd->cid, cmd->nsid);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
spdk_nvme_print_command(uint16_t qid, struct spdk_nvme_cmd *cmd)
|
||||||
|
{
|
||||||
|
assert(cmd != NULL);
|
||||||
|
|
||||||
|
if (qid == 0 || cmd->opc == SPDK_NVME_OPC_FABRIC) {
|
||||||
|
nvme_admin_qpair_print_command(qid, cmd);
|
||||||
|
} else {
|
||||||
|
nvme_io_qpair_print_command(qid, cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spdk_nvme_qpair_print_command(struct spdk_nvme_qpair *qpair, struct spdk_nvme_cmd *cmd)
|
spdk_nvme_qpair_print_command(struct spdk_nvme_qpair *qpair, struct spdk_nvme_cmd *cmd)
|
||||||
{
|
{
|
||||||
assert(qpair != NULL);
|
assert(qpair != NULL);
|
||||||
assert(cmd != NULL);
|
assert(cmd != NULL);
|
||||||
|
|
||||||
if (nvme_qpair_is_admin_queue(qpair)) {
|
spdk_nvme_print_command(qpair->id, cmd);
|
||||||
nvme_admin_qpair_print_command(qpair, cmd);
|
|
||||||
} else {
|
|
||||||
nvme_io_qpair_print_command(qpair, cmd);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct nvme_string generic_status[] = {
|
static const struct nvme_string generic_status[] = {
|
||||||
@ -297,15 +300,28 @@ spdk_nvme_cpl_get_status_string(const struct spdk_nvme_status *status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spdk_nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair,
|
spdk_nvme_print_completion(uint16_t qid, struct spdk_nvme_cpl *cpl)
|
||||||
struct spdk_nvme_cpl *cpl)
|
|
||||||
{
|
{
|
||||||
SPDK_NOTICELOG("%s (%02x/%02x) sqid:%d cid:%d cdw0:%x sqhd:%04x p:%x m:%x dnr:%x\n",
|
assert(cpl != NULL);
|
||||||
|
|
||||||
|
/* Check that sqid matches qid. Note that sqid is reserved
|
||||||
|
* for fabrics so don't print an error when sqid is 0. */
|
||||||
|
if (cpl->sqid != qid && cpl->sqid != 0) {
|
||||||
|
SPDK_ERRLOG("sqid %u doesn't match qid\n", cpl->sqid);
|
||||||
|
}
|
||||||
|
|
||||||
|
SPDK_NOTICELOG("%s (%02x/%02x) qid:%d cid:%d cdw0:%x sqhd:%04x p:%x m:%x dnr:%x\n",
|
||||||
spdk_nvme_cpl_get_status_string(&cpl->status),
|
spdk_nvme_cpl_get_status_string(&cpl->status),
|
||||||
cpl->status.sct, cpl->status.sc, cpl->sqid, cpl->cid, cpl->cdw0,
|
cpl->status.sct, cpl->status.sc, qid, cpl->cid, cpl->cdw0,
|
||||||
cpl->sqhd, cpl->status.p, cpl->status.m, cpl->status.dnr);
|
cpl->sqhd, cpl->status.p, cpl->status.m, cpl->status.dnr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
spdk_nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair, struct spdk_nvme_cpl *cpl)
|
||||||
|
{
|
||||||
|
spdk_nvme_print_completion(qpair->id, cpl);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
nvme_completion_is_retry(const struct spdk_nvme_cpl *cpl)
|
nvme_completion_is_retry(const struct spdk_nvme_cpl *cpl)
|
||||||
{
|
{
|
||||||
|
@ -135,6 +135,8 @@
|
|||||||
spdk_nvme_qpair_remove_cmd_error_injection;
|
spdk_nvme_qpair_remove_cmd_error_injection;
|
||||||
spdk_nvme_qpair_print_command;
|
spdk_nvme_qpair_print_command;
|
||||||
spdk_nvme_qpair_print_completion;
|
spdk_nvme_qpair_print_completion;
|
||||||
|
spdk_nvme_print_command;
|
||||||
|
spdk_nvme_print_completion;
|
||||||
|
|
||||||
spdk_nvme_cpl_get_status_string;
|
spdk_nvme_cpl_get_status_string;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user