Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Hannes Reinecke and committed by
Jens Axboe
6490c9ed b61775d1

+23 -3
+1 -1
drivers/nvme/target/admin-cmd.c
··· 1017 1017 u16 ret; 1018 1018 1019 1019 if (nvme_is_fabrics(cmd)) 1020 - return nvmet_parse_fabrics_cmd(req); 1020 + return nvmet_parse_fabrics_admin_cmd(req); 1021 1021 if (nvmet_is_disc_subsys(nvmet_req_subsys(req))) 1022 1022 return nvmet_parse_discovery_cmd(req); 1023 1023
+4
drivers/nvme/target/core.c
··· 865 865 866 866 static u16 nvmet_parse_io_cmd(struct nvmet_req *req) 867 867 { 868 + struct nvme_command *cmd = req->cmd; 868 869 u16 ret; 870 + 871 + if (nvme_is_fabrics(cmd)) 872 + return nvmet_parse_fabrics_io_cmd(req); 869 873 870 874 ret = nvmet_check_ctrl_status(req); 871 875 if (unlikely(ret))
+16 -1
drivers/nvme/target/fabrics-cmd.c
··· 82 82 nvmet_req_complete(req, status); 83 83 } 84 84 85 - u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req) 85 + u16 nvmet_parse_fabrics_admin_cmd(struct nvmet_req *req) 86 86 { 87 87 struct nvme_command *cmd = req->cmd; 88 88 ··· 93 93 case nvme_fabrics_type_property_get: 94 94 req->execute = nvmet_execute_prop_get; 95 95 break; 96 + default: 97 + pr_debug("received unknown capsule type 0x%x\n", 98 + cmd->fabrics.fctype); 99 + req->error_loc = offsetof(struct nvmf_common_command, fctype); 100 + return NVME_SC_INVALID_OPCODE | NVME_SC_DNR; 101 + } 102 + 103 + return 0; 104 + } 105 + 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) { 96 111 default: 97 112 pr_debug("received unknown capsule type 0x%x\n", 98 113 cmd->fabrics.fctype);
+2 -1
drivers/nvme/target/nvmet.h
··· 420 420 u16 nvmet_bdev_zns_parse_io_cmd(struct nvmet_req *req); 421 421 u16 nvmet_parse_admin_cmd(struct nvmet_req *req); 422 422 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); 424 425 425 426 bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq, 426 427 struct nvmet_sq *sq, const struct nvmet_fabrics_ops *ops);