Commit d84dd8cd authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

nvmet: clean up command parsing a bit

Move the special cases for fabrics commands and the discovery controller
to nvmet_parse_admin_cmd in preparation for adding passthrough support.
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 05d3046f
...@@ -879,6 +879,11 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req) ...@@ -879,6 +879,11 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
struct nvme_command *cmd = req->cmd; struct nvme_command *cmd = req->cmd;
u16 ret; u16 ret;
if (nvme_is_fabrics(cmd))
return nvmet_parse_fabrics_cmd(req);
if (req->sq->ctrl->subsys->type == NVME_NQN_DISC)
return nvmet_parse_discovery_cmd(req);
ret = nvmet_check_ctrl_status(req, cmd); ret = nvmet_check_ctrl_status(req, cmd);
if (unlikely(ret)) if (unlikely(ret))
return ret; return ret;
......
...@@ -892,14 +892,10 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq, ...@@ -892,14 +892,10 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
} }
if (unlikely(!req->sq->ctrl)) if (unlikely(!req->sq->ctrl))
/* will return an error for any Non-connect command: */ /* will return an error for any non-connect command: */
status = nvmet_parse_connect_cmd(req); status = nvmet_parse_connect_cmd(req);
else if (likely(req->sq->qid != 0)) else if (likely(req->sq->qid != 0))
status = nvmet_parse_io_cmd(req); status = nvmet_parse_io_cmd(req);
else if (nvme_is_fabrics(req->cmd))
status = nvmet_parse_fabrics_cmd(req);
else if (req->sq->ctrl->subsys->type == NVME_NQN_DISC)
status = nvmet_parse_discovery_cmd(req);
else else
status = nvmet_parse_admin_cmd(req); status = nvmet_parse_admin_cmd(req);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment