nvme-fabrics: Add host support for FC transport
Subsystems (2)
PATCH v6 5/7 nvme-fabrics: Add host support for FC transport
Add nvme-fabrics host support for FC transport
Implements the FC-NVME T11 definition of how nvme fabric capsules are performed on an FC fabric. Utilizes a lower-layer API to FC host adapters to send/receive FC-4 LS operations and FCP operations that comprise NVME over FC operation.
The T11 definitions for FC-4 Link Services are implemented which create NVMeOF connections. Implements the hooks with blk-mq to then submit admin and io requests to the different connections.
---
v6 mods:
- Add dma wrappers to allow fcloop to pass in null device ptr
- Add ability to send LS's asynchronously
- Send Disconnect(association) rather than per-queue Disconnect(queue) Disconnect(association) sent asynchronously
MAINTAINERS | 1 + drivers/nvme/host/Kconfig | 17 + drivers/nvme/host/Makefile | 3 + drivers/nvme/host/fc.c | 2585 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 2606 insertions(+) create mode 100644 drivers/nvme/host/fc.c
MAINTAINERS +1 -0
@@ -8684,6 +8684,7 @@ L: linux-nvme at lists.infradead.org S: Supported F: include/linux/nvme-fc.h F: include/linux/nvme-fc-driver.h +F: drivers/nvme/host/fc.c NVMEM FRAMEWORK M: Srinivas Kandagatla <srinivas.kandagatla at linaro.org>
drivers/nvme/host/Kconfig +17 -0
@@ -43,3 +43,20 @@ config NVME_RDMA from https://github.com/linux-nvme/nvme-cli. If unsure, say N. + +config NVME_FC + tristate "NVM Express over Fabrics FC host driver" + depends on BLOCK + depends on HAS_DMA + select NVME_CORE + select NVME_FABRICS + select SG_POOL + help + This provides support for the NVMe over Fabrics protocol using + the FC transport. This allows you to use remote block devices + exported using the NVMe protocol set. + + To configure a NVMe over Fabrics controller use the nvme-cli tool + from https://github.com/linux-nvme/nvme-cli. + + If unsure, say N.
drivers/nvme/host/Makefile +3 -0
@@ -2,6 +2,7 @@ obj-$(CONFIG_NVME_CORE) += nvme-core.o obj-$(CONFIG_BLK_DEV_NVME) += nvme.o obj-$(CONFIG_NVME_FABRICS) += nvme-fabrics.o obj-$(CONFIG_NVME_RDMA) += nvme-rdma.o +obj-$(CONFIG_NVME_FC) += nvme-fc.o nvme-core-y := core.o nvme-core-$(CONFIG_BLK_DEV_NVME_SCSI) += scsi.o
@@ -12,3 +13,5 @@ nvme-y += pci.o nvme-fabrics-y += fabrics.o nvme-rdma-y += rdma.o + +nvme-fc-y += fc.o
drivers/nvme/host/fc.c new file +2585 -0
2,585 lines not on this page · raw message
Signature · 1 line
2.5.0
PATCH v6 5/7 nvme-fabrics: Add host support for FC transport
Quoted 16 lines · James Smart
Add nvme-fabrics host support for FC transport
Implements the FC-NVME T11 definition of how nvme fabric capsules are performed on an FC fabric. Utilizes a lower-layer API to FC host adapters to send/receive FC-4 LS operations and FCP operations that comprise NVME over FC operation.
The T11 definitions for FC-4 Link Services are implemented which create NVMeOF connections. Implements the hooks with blk-mq to then submit admin and io requests to the different connections.
Signed-off-by James Smart <james.smart at broadcom.com>Reviewed-by Jay Freyensee <james_p_freyensee at linux.intel.com>---
[...]
Quoted 18 lines
drivers/nvme/host/fc.c new file +18
-0+nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) +{ +struct nvme_fc_fcp_op *op =fcp_req_to_fcp_op (req); +struct request *rq = op->rq; +struct nvmefc_fcp_req *freq = &op->fcp_req; +struct nvme_fc_ctrl *ctrl = op->ctrl; +struct nvme_fc_queue *queue = op->queue; +struct nvme_completion *cqe = &op->rsp_iu.cqe; +u16 status; + +/* +* WARNING: +* The current linux implementation of a nvme controller +* allocates a single tag set for all io queues and sizes +* the io queues to fully hold all possible tags. Thus, the +* implementation does not reference or care about the sqhd +* value as it never needs to use the sqhd/sqtail pointers +* for submission pacing.
drivers/nvme/host/fc.c line 1166
Quoted 10 lines
drivers/nvme/host/fc.c new file +10
-0+* +* This affects the FC-NVME implementation in two ways: +* 1) As the value doesn't matter, we don't need to waste +* cycles extracting it from ERSPs and stamping it in the +* cases where the transport fabricates CQEs on successful +* completions. +* 2) The FC-NVME implementation requires that delivery of +* ERSP completions are to go back to the nvme layer in order +* relative to the rsn, such that the sqhd value will always +
^^ there's a stray newline, someone should probably fix this up when applying.
Quoted 3 lines
drivers/nvme/host/fc.c new file +3
-0+* be "in order" for the nvme layer. As the nvme layer in +* linux doesn't care about sqhd, there's no need to return +* them in order.
[...]
drivers/nvme/host/fc.c line 2073
Quoted 7 lines
drivers/nvme/host/fc.c new file +7
-0+static void +nvme_fc_terminate_exchange (struct request *req,void *data,bool reserved) +{ +struct nvme_ctrl *nctrl = data; +struct nvme_fc_ctrl *ctrl =to_fc_ctrl (nctrl); +struct nvme_fc_fcp_op *op =blk_mq_rq_to_pdu (req); +int status;
^^ This could need a fixup as well.
drivers/nvme/host/fc.c line 2076
Quoted 3 lines
drivers/nvme/host/fc.c new file +3
-0+ +if (!blk_mq_request_started (req)) +return ;
Jens, Keith, Sagi, Christoph, how are the chances to get this in for v4.10?
Johannes
Signature · 6 lines
Johannes Thumshirn Storage jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
PATCH v6 5/7 nvme-fabrics: Add host support for FC transport
Quoted 4 lines · Johannes Thumshirn
^^ there's a stray newline, someone should probably fix this up when applying.
drivers/nvme/host/fc.c line 1169
Quoted 3 lines
drivers/nvme/host/fc.c new file +3
-0+* be "in order" for the nvme layer. As the nvme layer in +* linux doesn't care about sqhd, there's no need to return +* them in order.
I think the whole comment is a little overblown as we don't even pass the CQE up anymore. I've just fixed up the empty line for now, though.
Quoted 1 line
Jens, Keith, Sagi, Christoph, how are the chances to get this in for v4.10?
I've applied the patches after editing the changelogs and pushed the code out to the nvmf-4.10 branch. But I'd really like a promise from James that we'll get working controller reset code in the next weeks before we're sending the code on to Jens.
PATCH v6 5/7 nvme-fabrics: Add host support for FC transport
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Johannes Thumshirn
^^ there's a stray newline, someone should probably fix this up when applying.
drivers/nvme/host/fc.c line 1169
Quoted 3 lines
drivers/nvme/host/fc.c new file +3
-0+* be "in order" for the nvme layer. As the nvme layer in +* linux doesn't care about sqhd, there's no need to return +* them in order. I think the whole comment is a little overblown as we don't even pass the CQE up anymore. I've just fixed up the empty line for now, though.
Quoted 6 lines
Quoted 1 line
Jens, Keith, Sagi, Christoph, how are the chances to get this in for v4.10?
I've applied the patches after editing the changelogs and pushed the code out to the nvmf-4.10 branch. But I'd really like a promise from James that we'll get working controller reset code in the next weeks before we're sending the code on to Jens.
Sounds good to me.
Thanks,
Johannes
Signature · 6 lines
Johannes Thumshirn Storage jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
PATCH v6 5/7 nvme-fabrics: Add host support for FC transport
In reply to Christoph HellwigPromise made. The teardown path already works, I just haven't tied it to the entrypoint.
-- james
Quoted 3 lines · Christoph Hellwig
But I'd really like a promise from James
that we'll get working controller reset code in the next weeks before we're sending the code on to Jens.