mirror of
https://github.com/torvalds/linux.git
synced 2024-11-29 07:31:29 +00:00
nvme: split out fabrics version of nvme_opcode_str()
nvme_opcode_str() currently supports admin, IO, and fabrics commands. However, fabrics commands aren't allowed for the pci transport. Currently the pci caller passes 0 as the fctype, which means any fabrics command would be displayed as "Property Set". Move fabrics command support into a function nvme_fabrics_opcode_str() and remove the fctype argument to nvme_opcode_str(). This way, a fabrics command will display as "Unknown" for pci. Convert the rdma and tcp transports to use nvme_fabrics_opcode_str(). Signed-off-by: Caleb Sander <csander@purestorage.com> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
parent
f9e9115d0c
commit
7d23e836b0
@ -1164,11 +1164,18 @@ static inline const char *nvme_get_fabrics_opcode_str(u8 opcode)
|
||||
}
|
||||
#endif /* CONFIG_NVME_VERBOSE_ERRORS */
|
||||
|
||||
static inline const char *nvme_opcode_str(int qid, u8 opcode, u8 fctype)
|
||||
static inline const char *nvme_opcode_str(int qid, u8 opcode)
|
||||
{
|
||||
if (opcode == nvme_fabrics_command)
|
||||
return nvme_get_fabrics_opcode_str(fctype);
|
||||
return qid ? nvme_get_opcode_str(opcode) :
|
||||
nvme_get_admin_opcode_str(opcode);
|
||||
}
|
||||
|
||||
static inline const char *nvme_fabrics_opcode_str(
|
||||
int qid, const struct nvme_command *cmd)
|
||||
{
|
||||
if (nvme_is_fabrics(cmd))
|
||||
return nvme_get_fabrics_opcode_str(cmd->fabrics.fctype);
|
||||
|
||||
return nvme_opcode_str(qid, cmd->common.opcode);
|
||||
}
|
||||
#endif /* _NVME_H */
|
||||
|
@ -1349,7 +1349,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req)
|
||||
dev_warn(dev->ctrl.device,
|
||||
"I/O tag %d (%04x) opcode %#x (%s) QID %d timeout, reset controller\n",
|
||||
req->tag, nvme_cid(req), opcode,
|
||||
nvme_opcode_str(nvmeq->qid, opcode, 0), nvmeq->qid);
|
||||
nvme_opcode_str(nvmeq->qid, opcode), nvmeq->qid);
|
||||
nvme_req(req)->flags |= NVME_REQ_CANCELLED;
|
||||
goto disable;
|
||||
}
|
||||
|
@ -1951,14 +1951,13 @@ static enum blk_eh_timer_return nvme_rdma_timeout(struct request *rq)
|
||||
struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq);
|
||||
struct nvme_rdma_queue *queue = req->queue;
|
||||
struct nvme_rdma_ctrl *ctrl = queue->ctrl;
|
||||
u8 opcode = req->req.cmd->common.opcode;
|
||||
u8 fctype = req->req.cmd->fabrics.fctype;
|
||||
struct nvme_command *cmd = req->req.cmd;
|
||||
int qid = nvme_rdma_queue_idx(queue);
|
||||
|
||||
dev_warn(ctrl->ctrl.device,
|
||||
"I/O tag %d (%04x) opcode %#x (%s) QID %d timeout\n",
|
||||
rq->tag, nvme_cid(rq), opcode,
|
||||
nvme_opcode_str(qid, opcode, fctype), qid);
|
||||
rq->tag, nvme_cid(rq), cmd->common.opcode,
|
||||
nvme_fabrics_opcode_str(qid, cmd), qid);
|
||||
|
||||
if (nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_LIVE) {
|
||||
/*
|
||||
|
@ -2428,13 +2428,13 @@ static enum blk_eh_timer_return nvme_tcp_timeout(struct request *rq)
|
||||
struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
|
||||
struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
|
||||
struct nvme_tcp_cmd_pdu *pdu = nvme_tcp_req_cmd_pdu(req);
|
||||
u8 opc = pdu->cmd.common.opcode, fctype = pdu->cmd.fabrics.fctype;
|
||||
struct nvme_command *cmd = &pdu->cmd;
|
||||
int qid = nvme_tcp_queue_id(req->queue);
|
||||
|
||||
dev_warn(ctrl->device,
|
||||
"I/O tag %d (%04x) type %d opcode %#x (%s) QID %d timeout\n",
|
||||
rq->tag, nvme_cid(rq), pdu->hdr.type, opc,
|
||||
nvme_opcode_str(qid, opc, fctype), qid);
|
||||
rq->tag, nvme_cid(rq), pdu->hdr.type, cmd->common.opcode,
|
||||
nvme_fabrics_opcode_str(qid, cmd), qid);
|
||||
|
||||
if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE) {
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user