Skip to content

Commit 7d23e83

Browse files
calebsanderkeithbusch
authored andcommitted
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 <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent f9e9115 commit 7d23e83

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

drivers/nvme/host/nvme.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,11 +1164,18 @@ static inline const char *nvme_get_fabrics_opcode_str(u8 opcode)
11641164
}
11651165
#endif /* CONFIG_NVME_VERBOSE_ERRORS */
11661166

1167-
static inline const char *nvme_opcode_str(int qid, u8 opcode, u8 fctype)
1167+
static inline const char *nvme_opcode_str(int qid, u8 opcode)
11681168
{
1169-
if (opcode == nvme_fabrics_command)
1170-
return nvme_get_fabrics_opcode_str(fctype);
11711169
return qid ? nvme_get_opcode_str(opcode) :
11721170
nvme_get_admin_opcode_str(opcode);
11731171
}
1172+
1173+
static inline const char *nvme_fabrics_opcode_str(
1174+
int qid, const struct nvme_command *cmd)
1175+
{
1176+
if (nvme_is_fabrics(cmd))
1177+
return nvme_get_fabrics_opcode_str(cmd->fabrics.fctype);
1178+
1179+
return nvme_opcode_str(qid, cmd->common.opcode);
1180+
}
11741181
#endif /* _NVME_H */

drivers/nvme/host/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req)
13491349
dev_warn(dev->ctrl.device,
13501350
"I/O tag %d (%04x) opcode %#x (%s) QID %d timeout, reset controller\n",
13511351
req->tag, nvme_cid(req), opcode,
1352-
nvme_opcode_str(nvmeq->qid, opcode, 0), nvmeq->qid);
1352+
nvme_opcode_str(nvmeq->qid, opcode), nvmeq->qid);
13531353
nvme_req(req)->flags |= NVME_REQ_CANCELLED;
13541354
goto disable;
13551355
}

drivers/nvme/host/rdma.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1951,14 +1951,13 @@ static enum blk_eh_timer_return nvme_rdma_timeout(struct request *rq)
19511951
struct nvme_rdma_request *req = blk_mq_rq_to_pdu(rq);
19521952
struct nvme_rdma_queue *queue = req->queue;
19531953
struct nvme_rdma_ctrl *ctrl = queue->ctrl;
1954-
u8 opcode = req->req.cmd->common.opcode;
1955-
u8 fctype = req->req.cmd->fabrics.fctype;
1954+
struct nvme_command *cmd = req->req.cmd;
19561955
int qid = nvme_rdma_queue_idx(queue);
19571956

19581957
dev_warn(ctrl->ctrl.device,
19591958
"I/O tag %d (%04x) opcode %#x (%s) QID %d timeout\n",
1960-
rq->tag, nvme_cid(rq), opcode,
1961-
nvme_opcode_str(qid, opcode, fctype), qid);
1959+
rq->tag, nvme_cid(rq), cmd->common.opcode,
1960+
nvme_fabrics_opcode_str(qid, cmd), qid);
19621961

19631962
if (nvme_ctrl_state(&ctrl->ctrl) != NVME_CTRL_LIVE) {
19641963
/*

drivers/nvme/host/tcp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,13 +2428,13 @@ static enum blk_eh_timer_return nvme_tcp_timeout(struct request *rq)
24282428
struct nvme_tcp_request *req = blk_mq_rq_to_pdu(rq);
24292429
struct nvme_ctrl *ctrl = &req->queue->ctrl->ctrl;
24302430
struct nvme_tcp_cmd_pdu *pdu = nvme_tcp_req_cmd_pdu(req);
2431-
u8 opc = pdu->cmd.common.opcode, fctype = pdu->cmd.fabrics.fctype;
2431+
struct nvme_command *cmd = &pdu->cmd;
24322432
int qid = nvme_tcp_queue_id(req->queue);
24332433

24342434
dev_warn(ctrl->device,
24352435
"I/O tag %d (%04x) type %d opcode %#x (%s) QID %d timeout\n",
2436-
rq->tag, nvme_cid(rq), pdu->hdr.type, opc,
2437-
nvme_opcode_str(qid, opc, fctype), qid);
2436+
rq->tag, nvme_cid(rq), pdu->hdr.type, cmd->common.opcode,
2437+
nvme_fabrics_opcode_str(qid, cmd), qid);
24382438

24392439
if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE) {
24402440
/*

0 commit comments

Comments
 (0)