nvmet: Add install_queue callout
authorSagi Grimberg <sagi@lightbitslabs.com>
Tue, 4 Dec 2018 01:52:11 +0000 (17:52 -0800)
committerChristoph Hellwig <hch@lst.de>
Thu, 13 Dec 2018 08:58:55 +0000 (09:58 +0100)
nvmet-tcp will implement it to allocate queue commands which
are only known at nvmf connect time (sq size).

Signed-off-by: Sagi Grimberg <sagi@lightbitslabs.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/fabrics-cmd.c
drivers/nvme/target/nvmet.h

index 328ae46d8344188a709045b44ba93cce7d53620c..ee7d84621d65f47128ff39f8678a097ca7fd63b3 100644 (file)
@@ -121,6 +121,16 @@ static u16 nvmet_install_queue(struct nvmet_ctrl *ctrl, struct nvmet_req *req)
                req->rsp->sq_head = cpu_to_le16(0xffff);
        }
 
+       if (ctrl->ops->install_queue) {
+               u16 ret = ctrl->ops->install_queue(req->sq);
+
+               if (ret) {
+                       pr_err("failed to install queue %d cntlid %d ret %x\n",
+                               qid, ret, ctrl->cntlid);
+                       return ret;
+               }
+       }
+
        return 0;
 }
 
index 7d8b7a7d572a868e136495b87dd2b5475195179f..89df51ee5bdf7b7ff552efebc8daae244025726c 100644 (file)
@@ -279,6 +279,7 @@ struct nvmet_fabrics_ops {
        void (*delete_ctrl)(struct nvmet_ctrl *ctrl);
        void (*disc_traddr)(struct nvmet_req *req,
                        struct nvmet_port *port, char *traddr);
+       u16 (*install_queue)(struct nvmet_sq *nvme_sq);
 };
 
 #define NVMET_MAX_INLINE_BIOVEC        8