NVMe over Fabrics RDMA transport drivers V2
Subsystems (4)
Christoph Hellwig
maintainerThis patch set implements the NVMe over Fabrics RDMA host and the target drivers.
The host driver is tied into the NVMe host stack and implements the RDMA transport under the NVMe core and Fabrics modules. The NVMe over Fabrics RDMA host module is responsible for establishing a connection against a given target/controller, RDMA event handling and data-plane command processing.
The target driver hooks into the NVMe target core stack and implements the RDMA transport. The module is responsible for RDMA connection establishment, RDMA event handling and data-plane RDMA commands processing.
RDMA connection establishment is done using RDMA/CM and IP resolution. The data-plane command sequence follows the classic storage model where the target pushes/pulls the data.
Changes since V1:
- updates for req_op changes in for-next (me)
- validate adrfam in nvmet-rdma (Ming)
- don't leak rsp structures on connect failure in nvmet-rdma (Steve)
- don't use RDMA/CM errors codes in reject path in nvmet-rdma (Steve)
- fix nvmet_rdma_delete_ctrl (me)
- invoke fatal error on error completion in nvmet-rdma (Sagi)
- don't leak rsp structure on disconnected queue in nvmet-rdma (Ming)
- properly set the SGL flag on AERs in nvme-rdma (me)
- correctly stop the keep alive timer on reconnect in nvme-rdma (Ming)
- stop and drain queues before freeing the tagset in nvet-rdma (Steve)
Christoph Hellwig
maintainerPATCH 1/5 blk-mq: Introduce blk_mq_reinit_tagset
From: Sagi Grimberg <[email protected]>
The new nvme-rdma driver will need to reinitialize all the tags as part of the error recovery procedure (realloc the tag memory region). Add a helper in blk-mq for it that can iterate over all requests in a tagset to make this easier.
--- block/blk-mq-tag.c | 26 ++++++++++++++++++++++++++ include/linux/blk-mq.h | 3 +++ 2 files changed, 29 insertions(+)
block/blk-mq-tag.c +26 -0
@@ -485,6 +485,32 @@ void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, }EXPORT_SYMBOL (blk_mq_tagset_busy_iter); +int blk_mq_reinit_tagset (struct blk_mq_tag_set *set) +{ +int i, j, ret =0 ; + +if (!set->ops->reinit_request) + goto out; + +for (i =0 ; i < set->nr_hw_queues; i++) { +struct blk_mq_tags *tags = set->tags[i]; + +for (j =0 ; j < tags->nr_tags; j++) { +if (!tags->rqs[j]) +continue ; + + ret = set->ops->reinit_request (set->driver_data, + tags->rqs[j]); +if (ret) + goto out; + } + } + +out: +return ret; +} +EXPORT_SYMBOL_GPL (blk_mq_reinit_tagset); +void blk_mq_queue_tag_busy_iter (struct request_queue *q,busy_iter_fn *fn,void *priv) {
include/linux/blk-mq.h +3 -0
@@ -96,6 +96,7 @@ typedef int (init_request_fn)(void *, struct request *, unsigned int, unsigned int, unsigned int);typedef void (exit_request_fn )(void *,struct request *,unsigned int ,unsigned int ); +typedef int (reinit_request_fn )(void *,struct request *);typedef void (busy_iter_fn )(struct blk_mq_hw_ctx *,struct request *,void *,bool );
@@ -145,6 +146,7 @@ struct blk_mq_ops {*/ init_request_fn *init_request;exit_request_fn *exit_request; +reinit_request_fn *reinit_request; };enum {
@@ -245,6 +247,7 @@ void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,void blk_mq_freeze_queue (struct request_queue *q);void blk_mq_unfreeze_queue (struct request_queue *q);void blk_mq_freeze_queue_start (struct request_queue *q); +int blk_mq_reinit_tagset (struct blk_mq_tag_set *set);void blk_mq_update_nr_hw_queues (struct blk_mq_tag_set *set,int nr_hw_queues);
Signature · 1 line
2.1.4
RE: [PATCH 1/5] blk-mq: Introduce blk_mq_reinit_tagset
Quoted 11 lines
From: Sagi Grimberg <[email protected]>
The new nvme-rdma driver will need to reinitialize all the tags as part of the error recovery procedure (realloc the tag memory region). Add a helper in blk-mq for it that can iterate over all requests in a tagset to make this easier.
Signed-off-by Sagi Grimberg <[email protected]>Tested-by Ming Lin <[email protected]>Reviewed-by Stephen Bates <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
Looks fine.
Christoph Hellwig
maintainerPATCH 2/5 nvme: add new reconnecting controller state
In reply to Christoph HellwigThe nvme fabric (RDMA, FC, etc...) can introduce port, link or node failures that may require a reconnect to re-establish the connection.
Add a new reconnecting state that will initially be used by the RDMA driver.
--- drivers/nvme/host/core.c | 12 ++++++++++++ drivers/nvme/host/nvme.h | 1 + 2 files changed, 13 insertions(+)
drivers/nvme/host/core.c +12 -0
@@ -88,6 +88,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,switch (old_state) {case NVME_CTRL_NEW :case NVME_CTRL_RESETTING : +case NVME_CTRL_RECONNECTING : changed = true;/* FALLTHRU */ default :
@@ -98,6 +99,16 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,switch (old_state) {case NVME_CTRL_NEW :case NVME_CTRL_LIVE : +case NVME_CTRL_RECONNECTING : + changed = true; +/* FALLTHRU */ +default : +break ; + } +break ; +case NVME_CTRL_RECONNECTING : +switch (old_state) { +case NVME_CTRL_LIVE : changed = true;/* FALLTHRU */ default :
@@ -108,6 +119,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,switch (old_state) {case NVME_CTRL_LIVE :case NVME_CTRL_RESETTING : +case NVME_CTRL_RECONNECTING : changed = true;/* FALLTHRU */ default :
drivers/nvme/host/nvme.h +1 -0
@@ -74,6 +74,7 @@ enum nvme_ctrl_state {NVME_CTRL_NEW ,NVME_CTRL_LIVE ,NVME_CTRL_RESETTING , +NVME_CTRL_RECONNECTING ,NVME_CTRL_DELETING , NVME_CTRL_DEAD, };
Signature · 1 line
2.1.4
RE: [PATCH 2/5] nvme: add new reconnecting controller state
Quoted 11 lines
The nvme fabric (RDMA, FC, etc...) can introduce port, link or node failures that may require a reconnect to re-establish the connection.
Add a new reconnecting state that will initially be used by the RDMA driver.
Reviewed-by Jay Freyensee <[email protected]>Reviewed-by Sagi Grimberg <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
Looks good.
Christoph Hellwig
maintainerPATCH 3/5 nvme-rdma.h: Add includes for nvme rdma_cm negotiation
In reply to Christoph HellwigFrom: Sagi Grimberg <[email protected]>
NVMe over Fabrics RDMA transport defines a connection establishment protocol over the RDMA connection manager. This header will be used by both the host and target drivers to negotiate the connection establishment parameters.
--- include/linux/nvme-rdma.h | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 include/linux/nvme-rdma.h
include/linux/nvme-rdma.h new file +71 -0
@@ -0,0 +1,71 @@ +/* +* Copyright (c) 2015 Mellanox Technologies. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +* +* This program is distributed in the hope it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +*/ + +#ifndef _LINUX_NVME_RDMA_H +#define _LINUX_NVME_RDMA_H + +enum nvme_rdma_cm_fmt { +NVME_RDMA_CM_FMT_1_0 =0x0 , +}; + +enum nvme_rdma_cm_status { +NVME_RDMA_CM_INVALID_LEN =0x01 , +NVME_RDMA_CM_INVALID_RECFMT =0x02 , +NVME_RDMA_CM_INVALID_QID =0x03 , +NVME_RDMA_CM_INVALID_HSQSIZE =0x04 , +NVME_RDMA_CM_INVALID_HRQSIZE =0x05 , +NVME_RDMA_CM_NO_RSC =0x06 , +NVME_RDMA_CM_INVALID_IRD =0x07 , +NVME_RDMA_CM_INVALID_ORD =0x08 , +}; + +/** +* struct nvme_rdma_cm_req - rdma connect request +* +* @recfmt: format of the RDMA Private Data +* @qid: queue Identifier for the Admin or I/O Queue +* @hrqsize: host receive queue size to be created +* @hsqsize: host send queue size to be created +*/ +struct nvme_rdma_cm_req { +__le16 recfmt; +__le16 qid; +__le16 hrqsize; +__le16 hsqsize; +u8 rsvd[24 ]; +}; + +/** +* struct nvme_rdma_cm_rep - rdma connect reply +* +* @recfmt: format of the RDMA Private Data +* @crqsize: controller receive queue size +*/ +struct nvme_rdma_cm_rep { +__le16 recfmt; +__le16 crqsize; +u8 rsvd[28 ]; +}; + +/** +* struct nvme_rdma_cm_rej - rdma connect reject +* +* @recfmt: format of the RDMA Private Data +* @fsts: error status for the associated connect request +*/ +struct nvme_rdma_cm_rej { +__le16 recfmt; +__le16 sts; +}; + +#endif /* _LINUX_NVME_RDMA_H */
Signature · 1 line
2.1.4
RE: [PATCH 3/5] nvme-rdma.h: Add includes for nvme rdma_cm negotiation
Quoted 23 lines
From: Sagi Grimberg <[email protected]>
NVMe over Fabrics RDMA transport defines a connection establishment protocol over the RDMA connection manager. This header will be used by both the host and target drivers to negotiate the connection establishment parameters.
Signed-off-by Jay Freyensee <[email protected]>Signed-off-by Ming Lin <[email protected]>Signed-off-by Sagi Grimberg <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>--- include/linux/nvme-rdma.h | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 include/linux/nvme-rdma.hinclude/linux/nvme-rdma.h new file +0
-0
include/linux/nvme-rdma.h line 3
Quoted 3 lines
include/linux/nvme-rdma.h new file +3
-0@@ -0,0 +1,71 @@ +/* +* Copyright (c) 2015 Mellanox Technologies. All rights reserved. +*
Copyright should be 2016?
Otherwise looks good.
Christoph Hellwig
maintainerPATCH 4/5 nvmet-rdma: add a NVMe over Fabrics RDMA target driver
In reply to Christoph HellwigThis patch implements the RDMA transport for the NVMe over Fabrics target, which allows exporting NVMe over Fabrics functionality over RDMA fabrics (Infiniband, RoCE, iWARP).
All NVMe logic is in the generic target and this module just provides a small glue between it and the generic code in the RDMA subsystem.
--- drivers/nvme/target/Kconfig | 10 + drivers/nvme/target/Makefile | 2 + drivers/nvme/target/rdma.c | 1448 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1460 insertions(+) create mode 100644 drivers/nvme/target/rdma.c
drivers/nvme/target/Kconfig +10 -0
@@ -24,3 +24,13 @@ config NVME_TARGET_LOOP to test NVMe host and target side features. If unsure, say N. + +config NVME_TARGET_RDMA + tristate "NVMe over Fabrics RDMA target support" + depends on INFINIBAND + select NVME_TARGET + help + This enables the NVMe RDMA target support, which allows exporting NVMe + devices over RDMA. + + If unsure, say N.
drivers/nvme/target/Makefile +2 -0
@@ -1,7 +1,9 @@ obj-$(CONFIG_NVME_TARGET) += nvmet.o obj-$(CONFIG_NVME_TARGET_LOOP) += nvme-loop.o +obj-$(CONFIG_NVME_TARGET_RDMA) += nvmet-rdma.o nvmet-y += core.o configfs.o admin-cmd.o io-cmd.o fabrics-cmd.o \ discovery.o nvme-loop-y += loop.o +nvmet-rdma-y += rdma.o
drivers/nvme/target/rdma.c new file +1448 -0
1,448 lines not on this page · raw message
Signature · 1 line
2.1.4
RE: [PATCH 4/5] nvmet-rdma: add a NVMe over Fabrics RDMA target driver
Quoted 4 lines
This patch implements the RDMA transport for the NVMe over Fabrics target, which allows exporting NVMe over Fabrics functionality over RDMA fabrics (Infiniband, RoCE, iWARP).
Quoted 8 lines
All NVMe logic is in the generic target and this module just provides a small glue between it and the generic code in the RDMA subsystem.
Signed-off-by Armen Baloyan <[email protected]>,Signed-off-by Jay Freyensee <[email protected]>Signed-off-by Ming Lin <[email protected]>Signed-off-by Sagi Grimberg <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
Looks good.
Christoph Hellwig
maintainerPATCH 5/5 nvme-rdma: add a NVMe over Fabrics RDMA host driver
In reply to Christoph HellwigThis patch implements the RDMA host (initiator in SCSI speak) driver. It can be used to connect to remote NVMe over Fabrics controllers over Infiniband, RoCE or iWarp, and uses the existing NVMe core driver as well a the new fabrics library.
To connect to all NVMe over Fabrics controller reachable on a given taget port using RDMA/CM use the following command:
nvme connect-all -t rdma -a $IPADDR
This requires the latest version of nvme-cli with Fabrics support.
--- drivers/nvme/host/Kconfig | 16 + drivers/nvme/host/Makefile | 3 + drivers/nvme/host/rdma.c | 2021 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2040 insertions(+) create mode 100644 drivers/nvme/host/rdma.c
drivers/nvme/host/Kconfig +16 -0
@@ -27,3 +27,19 @@ config BLK_DEV_NVME_SCSI config NVME_FABRICS tristate + +config NVME_RDMA + tristate "NVM Express over Fabrics RDMA host driver" + depends on INFINIBAND + depends on BLK_DEV_NVME + select NVME_FABRICS + select SG_POOL + help + This provides support for the NVMe over Fabrics protocol using + the RDMA (Infiniband, RoCE, iWarp) 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
@@ -1,6 +1,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 nvme-core-y := core.o nvme-core-$(CONFIG_BLK_DEV_NVME_SCSI) += scsi.o
@@ -9,3 +10,5 @@ nvme-core-$(CONFIG_NVM) += lightnvm.o nvme-y += pci.o nvme-fabrics-y += fabrics.o + +nvme-rdma-y += rdma.o
drivers/nvme/host/rdma.c new file +2021 -0
2,021 lines not on this page · raw message
Signature · 1 line
2.1.4
RE: [PATCH 5/5] nvme-rdma: add a NVMe over Fabrics RDMA host driver
Quoted 8 lines
This patch implements the RDMA host (initiator in SCSI speak) driver. It can be used to connect to remote NVMe over Fabrics controllers over Infiniband, RoCE or iWarp, and uses the existing NVMe core driver as well a the new fabrics library.
To connect to all NVMe over Fabrics controller reachable on a given taget port using RDMA/CM use the following command:
Quoted 8 lines
nvme connect-all -t rdma -a $IPADDR
This requires the latest version of nvme-cli with Fabrics support.
Signed-off-by Jay Freyensee <[email protected]>Signed-off-by Ming Lin <[email protected]>Signed-off-by Sagi Grimberg <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
Looks fine.
Reviewed by: Steve Wise <[email protected]>
Steve Wise
Tested-byQuoted 4 lines
This patch set implements the NVMe over Fabrics RDMA host and the target drivers.
Hey Christoph, I retested V2 using your nvmf-submit.3 branch...looks good.
Jens Axboe
maintainerQuoted 18 lines · Christoph Hellwig
This patch set implements the NVMe over Fabrics RDMA host and the target drivers.
The host driver is tied into the NVMe host stack and implements the RDMA transport under the NVMe core and Fabrics modules. The NVMe over Fabrics RDMA host module is responsible for establishing a connection against a given target/controller, RDMA event handling and data-plane command processing.
The target driver hooks into the NVMe target core stack and implements the RDMA transport. The module is responsible for RDMA connection establishment, RDMA event handling and data-plane RDMA commands processing.
RDMA connection establishment is done using RDMA/CM and IP resolution. The data-plane command sequence follows the classic storage model where the target pushes/pulls the data.
Quoted 11 lines
Changes since V1:
- updates forreq_opchanges in for-next (me)
- validate adrfam in nvmet-rdma (Ming)
- don't leak rsp structures on connect failure in nvmet-rdma (Steve)
- don't use RDMA/CM errors codes in reject path in nvmet-rdma (Steve)
- fixnvmet_rdma_delete_ctrl(me)
- invoke fatal error on error completion in nvmet-rdma (Sagi)
- don't leak rsp structure on disconnected queue in nvmet-rdma (Ming)
- properly set the SGL flag on AERs in nvme-rdma (me)
- correctly stop the keep alive timer on reconnect in nvme-rdma (Ming)
- stop and drain queues before freeing the tagset in nvet-rdma (Steve)
Added for 4.8, thanks.
Signature · 1 line
Jens Axboe