]> git.baikalelectronics.ru Git - kernel.git/commitdiff
nvmet: parse fabrics commands on io queues
authorHannes Reinecke <hare@suse.de>
Mon, 27 Jun 2022 09:52:04 +0000 (11:52 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 2 Aug 2022 23:14:49 +0000 (17:14 -0600)
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>
drivers/nvme/target/admin-cmd.c
drivers/nvme/target/core.c
drivers/nvme/target/fabrics-cmd.c
drivers/nvme/target/nvmet.h

index 397daaf51f1baf878b1e22e3ff881582c40b8aa8..31df40ac828fa0ac102d0c7ba5ce334f48a099d8 100644 (file)
@@ -1017,7 +1017,7 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
        u16 ret;
 
        if (nvme_is_fabrics(cmd))
-               return nvmet_parse_fabrics_cmd(req);
+               return nvmet_parse_fabrics_admin_cmd(req);
        if (nvmet_is_disc_subsys(nvmet_req_subsys(req)))
                return nvmet_parse_discovery_cmd(req);
 
index c27660a660d9aebfa3f01714125810712125f4e8..527a8861781359b20b47b66f3cd4631951edc3ff 100644 (file)
@@ -865,8 +865,12 @@ static inline u16 nvmet_io_cmd_check_access(struct nvmet_req *req)
 
 static u16 nvmet_parse_io_cmd(struct nvmet_req *req)
 {
+       struct nvme_command *cmd = req->cmd;
        u16 ret;
 
+       if (nvme_is_fabrics(cmd))
+               return nvmet_parse_fabrics_io_cmd(req);
+
        ret = nvmet_check_ctrl_status(req);
        if (unlikely(ret))
                return ret;
index 70fb587e94136640aef465d8a21d85d643ee8476..f23c2872990822407d562954a8b246d39252302a 100644 (file)
@@ -82,7 +82,7 @@ static void nvmet_execute_prop_get(struct nvmet_req *req)
        nvmet_req_complete(req, status);
 }
 
-u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req)
+u16 nvmet_parse_fabrics_admin_cmd(struct nvmet_req *req)
 {
        struct nvme_command *cmd = req->cmd;
 
@@ -103,6 +103,21 @@ u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req)
        return 0;
 }
 
+u16 nvmet_parse_fabrics_io_cmd(struct nvmet_req *req)
+{
+       struct nvme_command *cmd = req->cmd;
+
+       switch (cmd->fabrics.fctype) {
+       default:
+               pr_debug("received unknown capsule type 0x%x\n",
+                       cmd->fabrics.fctype);
+               req->error_loc = offsetof(struct nvmf_common_command, fctype);
+               return NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
+       }
+
+       return 0;
+}
+
 static u16 nvmet_install_queue(struct nvmet_ctrl *ctrl, struct nvmet_req *req)
 {
        struct nvmf_connect_command *c = &req->cmd->connect;
index 2b3e5719f24e4c948cfadc8b9b19c462d79b63b1..9b18a10b1c32febdd9cd912b58ac45393e0bbfa1 100644 (file)
@@ -420,7 +420,8 @@ u16 nvmet_file_parse_io_cmd(struct nvmet_req *req);
 u16 nvmet_bdev_zns_parse_io_cmd(struct nvmet_req *req);
 u16 nvmet_parse_admin_cmd(struct nvmet_req *req);
 u16 nvmet_parse_discovery_cmd(struct nvmet_req *req);
-u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req);
+u16 nvmet_parse_fabrics_admin_cmd(struct nvmet_req *req);
+u16 nvmet_parse_fabrics_io_cmd(struct nvmet_req *req);
 
 bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
                struct nvmet_sq *sq, const struct nvmet_fabrics_ops *ops);