Skip to content

Commit 6490c9e

Browse files
hreineckeaxboe
authored andcommitted
nvmet: parse fabrics commands on io queues
Some fabrics commands can be sent via io queues, so add a new function nvmet_parse_fabrics_io_cmd() and rename the existing nvmet_parse_fabrics_cmd() to nvmet_parse_fabrics_admin_cmd(). Signed-off-by: Hannes Reinecke <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent b61775d commit 6490c9e

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

drivers/nvme/target/admin-cmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
10171017
u16 ret;
10181018

10191019
if (nvme_is_fabrics(cmd))
1020-
return nvmet_parse_fabrics_cmd(req);
1020+
return nvmet_parse_fabrics_admin_cmd(req);
10211021
if (nvmet_is_disc_subsys(nvmet_req_subsys(req)))
10221022
return nvmet_parse_discovery_cmd(req);
10231023

drivers/nvme/target/core.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,12 @@ static inline u16 nvmet_io_cmd_check_access(struct nvmet_req *req)
865865

866866
static u16 nvmet_parse_io_cmd(struct nvmet_req *req)
867867
{
868+
struct nvme_command *cmd = req->cmd;
868869
u16 ret;
869870

871+
if (nvme_is_fabrics(cmd))
872+
return nvmet_parse_fabrics_io_cmd(req);
873+
870874
ret = nvmet_check_ctrl_status(req);
871875
if (unlikely(ret))
872876
return ret;

drivers/nvme/target/fabrics-cmd.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static void nvmet_execute_prop_get(struct nvmet_req *req)
8282
nvmet_req_complete(req, status);
8383
}
8484

85-
u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req)
85+
u16 nvmet_parse_fabrics_admin_cmd(struct nvmet_req *req)
8686
{
8787
struct nvme_command *cmd = req->cmd;
8888

@@ -103,6 +103,21 @@ u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req)
103103
return 0;
104104
}
105105

106+
u16 nvmet_parse_fabrics_io_cmd(struct nvmet_req *req)
107+
{
108+
struct nvme_command *cmd = req->cmd;
109+
110+
switch (cmd->fabrics.fctype) {
111+
default:
112+
pr_debug("received unknown capsule type 0x%x\n",
113+
cmd->fabrics.fctype);
114+
req->error_loc = offsetof(struct nvmf_common_command, fctype);
115+
return NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
116+
}
117+
118+
return 0;
119+
}
120+
106121
static u16 nvmet_install_queue(struct nvmet_ctrl *ctrl, struct nvmet_req *req)
107122
{
108123
struct nvmf_connect_command *c = &req->cmd->connect;

drivers/nvme/target/nvmet.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@ u16 nvmet_file_parse_io_cmd(struct nvmet_req *req);
420420
u16 nvmet_bdev_zns_parse_io_cmd(struct nvmet_req *req);
421421
u16 nvmet_parse_admin_cmd(struct nvmet_req *req);
422422
u16 nvmet_parse_discovery_cmd(struct nvmet_req *req);
423-
u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req);
423+
u16 nvmet_parse_fabrics_admin_cmd(struct nvmet_req *req);
424+
u16 nvmet_parse_fabrics_io_cmd(struct nvmet_req *req);
424425

425426
bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
426427
struct nvmet_sq *sq, const struct nvmet_fabrics_ops *ops);

0 commit comments

Comments
 (0)