All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
	netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Keith Busch <keith.busch@intel.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v2 14/14] nvme-tcp: add NVMe over TCP host driver
Date: Wed, 21 Nov 2018 09:56:45 +0100	[thread overview]
Message-ID: <20181121085645.GA29747@lst.de> (raw)
In-Reply-To: <20181120030019.31738-16-sagi@grimberg.me>

On Mon, Nov 19, 2018 at 07:00:16PM -0800, Sagi Grimberg wrote:
> From: Sagi Grimberg <sagi@lightbitslabs.com>
> 
> This patch implements the NVMe over TCP host driver. It can be used to
> connect to remote NVMe over Fabrics subsystems over good old TCP/IP.
> 
> The driver implements the TP 8000 of how nvme over fabrics capsules and
> data are encapsulated in nvme-tcp pdus and exchaged on top of a TCP byte
> stream. nvme-tcp header and data digest are supported as well.
> 
> To connect to all NVMe over Fabrics controllers reachable on a given taget
> port over TCP use the following command:
> 
> 	nvme connect-all -t tcp -a $IPADDR
> 
> This requires the latest version of nvme-cli with TCP support.
> 
> Signed-off-by: Sagi Grimberg <sagi@lightbitslabs.com>
> Signed-off-by: Roy Shterman <roys@lightbitslabs.com>
> Signed-off-by: Solganik Alexander <sashas@lightbitslabs.com>
> ---
>  drivers/nvme/host/Kconfig  |   15 +
>  drivers/nvme/host/Makefile |    3 +
>  drivers/nvme/host/tcp.c    | 2306 ++++++++++++++++++++++++++++++++++++
>  3 files changed, 2324 insertions(+)
>  create mode 100644 drivers/nvme/host/tcp.c
> 
> diff --git a/drivers/nvme/host/Kconfig b/drivers/nvme/host/Kconfig
> index 88a8b5916624..0f345e207675 100644
> --- a/drivers/nvme/host/Kconfig
> +++ b/drivers/nvme/host/Kconfig
> @@ -57,3 +57,18 @@ config NVME_FC
>  	  from https://github.com/linux-nvme/nvme-cli.
>  
>  	  If unsure, say N.
> +
> +config NVME_TCP
> +	tristate "NVM Express over Fabrics TCP host driver"
> +	depends on INET
> +	depends on BLK_DEV_NVME
> +	select NVME_FABRICS
> +	help
> +	  This provides support for the NVMe over Fabrics protocol using
> +	  the TCP 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.
> diff --git a/drivers/nvme/host/Makefile b/drivers/nvme/host/Makefile
> index aea459c65ae1..8a4b671c5f0c 100644
> --- a/drivers/nvme/host/Makefile
> +++ b/drivers/nvme/host/Makefile
> @@ -7,6 +7,7 @@ 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
> +obj-$(CONFIG_NVME_TCP)			+= nvme-tcp.o
>  
>  nvme-core-y				:= core.o
>  nvme-core-$(CONFIG_TRACING)		+= trace.o
> @@ -21,3 +22,5 @@ nvme-fabrics-y				+= fabrics.o
>  nvme-rdma-y				+= rdma.o
>  
>  nvme-fc-y				+= fc.o
> +
> +nvme-tcp-y				+= tcp.o
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> new file mode 100644
> index 000000000000..4c583859f0ad
> --- /dev/null
> +++ b/drivers/nvme/host/tcp.c
> @@ -0,0 +1,2306 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * NVMe over Fabrics TCP host.
> + * Copyright (c) 2018 LightBits Labs. All rights reserved.
> + */
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/slab.h>
> +#include <linux/err.h>
> +#include <linux/nvme-tcp.h>
> +#include <net/sock.h>
> +#include <net/tcp.h>
> +#include <linux/blk-mq.h>
> +#include <crypto/hash.h>
> +
> +#include "nvme.h"
> +#include "fabrics.h"
> +
> +struct nvme_tcp_queue;
> +
> +enum nvme_tcp_send_state {
> +	NVME_TCP_SEND_CMD_PDU = 0,
> +	NVME_TCP_SEND_H2C_PDU,
> +	NVME_TCP_SEND_DATA,
> +	NVME_TCP_SEND_DDGST,
> +};
> +
> +struct nvme_tcp_send_ctx {
> +	struct bio		*curr_bio;
> +	struct iov_iter		iter;
> +	size_t			offset;
> +	size_t			data_sent;
> +	enum nvme_tcp_send_state state;
> +};
> +
> +struct nvme_tcp_recv_ctx {
> +	struct iov_iter		iter;
> +	struct bio		*curr_bio;
> +};

I don't understand these structures.  There should only be
a bio to be send or receive, not both.  Why do we need two
curr_bio pointers?

To me it seems like both structures should just go away and
move into nvme_tcp_request ala:


	struct bio		*curr_bio;

	/* send state */
	struct iov_iter		send_iter;
	size_t			send_offset;
	enum nvme_tcp_send_state send_state;
	size_t			data_sent;

	/* receive state */
	struct iov_iter		recv_iter;


WARNING: multiple messages have this Message-ID (diff)
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH v2 14/14] nvme-tcp: add NVMe over TCP host driver
Date: Wed, 21 Nov 2018 09:56:45 +0100	[thread overview]
Message-ID: <20181121085645.GA29747@lst.de> (raw)
In-Reply-To: <20181120030019.31738-16-sagi@grimberg.me>

On Mon, Nov 19, 2018@07:00:16PM -0800, Sagi Grimberg wrote:
> From: Sagi Grimberg <sagi at lightbitslabs.com>
> 
> This patch implements the NVMe over TCP host driver. It can be used to
> connect to remote NVMe over Fabrics subsystems over good old TCP/IP.
> 
> The driver implements the TP 8000 of how nvme over fabrics capsules and
> data are encapsulated in nvme-tcp pdus and exchaged on top of a TCP byte
> stream. nvme-tcp header and data digest are supported as well.
> 
> To connect to all NVMe over Fabrics controllers reachable on a given taget
> port over TCP use the following command:
> 
> 	nvme connect-all -t tcp -a $IPADDR
> 
> This requires the latest version of nvme-cli with TCP support.
> 
> Signed-off-by: Sagi Grimberg <sagi at lightbitslabs.com>
> Signed-off-by: Roy Shterman <roys at lightbitslabs.com>
> Signed-off-by: Solganik Alexander <sashas at lightbitslabs.com>
> ---
>  drivers/nvme/host/Kconfig  |   15 +
>  drivers/nvme/host/Makefile |    3 +
>  drivers/nvme/host/tcp.c    | 2306 ++++++++++++++++++++++++++++++++++++
>  3 files changed, 2324 insertions(+)
>  create mode 100644 drivers/nvme/host/tcp.c
> 
> diff --git a/drivers/nvme/host/Kconfig b/drivers/nvme/host/Kconfig
> index 88a8b5916624..0f345e207675 100644
> --- a/drivers/nvme/host/Kconfig
> +++ b/drivers/nvme/host/Kconfig
> @@ -57,3 +57,18 @@ config NVME_FC
>  	  from https://github.com/linux-nvme/nvme-cli.
>  
>  	  If unsure, say N.
> +
> +config NVME_TCP
> +	tristate "NVM Express over Fabrics TCP host driver"
> +	depends on INET
> +	depends on BLK_DEV_NVME
> +	select NVME_FABRICS
> +	help
> +	  This provides support for the NVMe over Fabrics protocol using
> +	  the TCP 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.
> diff --git a/drivers/nvme/host/Makefile b/drivers/nvme/host/Makefile
> index aea459c65ae1..8a4b671c5f0c 100644
> --- a/drivers/nvme/host/Makefile
> +++ b/drivers/nvme/host/Makefile
> @@ -7,6 +7,7 @@ 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
> +obj-$(CONFIG_NVME_TCP)			+= nvme-tcp.o
>  
>  nvme-core-y				:= core.o
>  nvme-core-$(CONFIG_TRACING)		+= trace.o
> @@ -21,3 +22,5 @@ nvme-fabrics-y				+= fabrics.o
>  nvme-rdma-y				+= rdma.o
>  
>  nvme-fc-y				+= fc.o
> +
> +nvme-tcp-y				+= tcp.o
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> new file mode 100644
> index 000000000000..4c583859f0ad
> --- /dev/null
> +++ b/drivers/nvme/host/tcp.c
> @@ -0,0 +1,2306 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * NVMe over Fabrics TCP host.
> + * Copyright (c) 2018 LightBits Labs. All rights reserved.
> + */
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +#include <linux/module.h>
> +#include <linux/init.h>
> +#include <linux/slab.h>
> +#include <linux/err.h>
> +#include <linux/nvme-tcp.h>
> +#include <net/sock.h>
> +#include <net/tcp.h>
> +#include <linux/blk-mq.h>
> +#include <crypto/hash.h>
> +
> +#include "nvme.h"
> +#include "fabrics.h"
> +
> +struct nvme_tcp_queue;
> +
> +enum nvme_tcp_send_state {
> +	NVME_TCP_SEND_CMD_PDU = 0,
> +	NVME_TCP_SEND_H2C_PDU,
> +	NVME_TCP_SEND_DATA,
> +	NVME_TCP_SEND_DDGST,
> +};
> +
> +struct nvme_tcp_send_ctx {
> +	struct bio		*curr_bio;
> +	struct iov_iter		iter;
> +	size_t			offset;
> +	size_t			data_sent;
> +	enum nvme_tcp_send_state state;
> +};
> +
> +struct nvme_tcp_recv_ctx {
> +	struct iov_iter		iter;
> +	struct bio		*curr_bio;
> +};

I don't understand these structures.  There should only be
a bio to be send or receive, not both.  Why do we need two
curr_bio pointers?

To me it seems like both structures should just go away and
move into nvme_tcp_request ala:


	struct bio		*curr_bio;

	/* send state */
	struct iov_iter		send_iter;
	size_t			send_offset;
	enum nvme_tcp_send_state send_state;
	size_t			data_sent;

	/* receive state */
	struct iov_iter		recv_iter;

  parent reply	other threads:[~2018-11-21  8:56 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20  3:00 [PATCH v2 00/14] TCP transport binding for NVMe over Fabrics Sagi Grimberg
2018-11-20  3:00 ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH v2 01/14] ath6kl: add ath6kl_ prefix to crypto_type Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH v2 02/14] datagram: open-code copy_page_to_iter Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH v2 03/14] iov_iter: pass void csum pointer to csum_and_copy_to_iter Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH v2 04/14] datagram: consolidate datagram copy to iter helpers Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH v2 04/14] net/datagram: " Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH v2 05/14] iov_iter: introduce hash_and_copy_to_iter helper Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH v2 06/14] datagram: introduce skb_copy_and_hash_datagram_iter helper Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH v2 07/14] nvme-core: add work elements to struct nvme_ctrl Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-21 13:04   ` Christoph Hellwig
2018-11-21 13:04     ` Christoph Hellwig
2018-11-21 22:28     ` Sagi Grimberg
2018-11-21 22:28       ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH v2 08/14] nvmet: Add install_queue callout Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-21 13:05   ` Christoph Hellwig
2018-11-21 13:05     ` Christoph Hellwig
2018-11-20  3:00 ` [PATCH v2 09/14] nvmet: allow configfs tcp trtype configuration Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-21 13:05   ` Christoph Hellwig
2018-11-21 13:05     ` Christoph Hellwig
2018-11-20  3:00 ` [PATCH v2 10/14] nvme-fabrics: allow user passing header digest Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-21 13:06   ` Christoph Hellwig
2018-11-21 13:06     ` Christoph Hellwig
2018-11-20  3:00 ` [PATCH v2 11/14] nvme-fabrics: allow user passing data digest Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-21 13:06   ` Christoph Hellwig
2018-11-21 13:06     ` Christoph Hellwig
2018-11-20  3:00 ` [PATCH v2 12/14] nvme-tcp: Add protocol header Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH v2 13/14] nvmet-tcp: add NVMe over TCP target driver Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-21 13:07   ` Christoph Hellwig
2018-11-21 13:07     ` Christoph Hellwig
2018-11-21 22:29     ` Sagi Grimberg
2018-11-21 22:29       ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH v2 14/14] nvme-tcp: add NVMe over TCP host driver Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-20 23:34   ` Narayan Ayalasomayajula
2018-11-20 23:34     ` Narayan Ayalasomayajula
2018-11-20 23:34     ` Narayan Ayalasomayajula
2018-11-21  0:10     ` Sagi Grimberg
2018-11-21  0:10       ` Sagi Grimberg
2018-11-21  0:41   ` Ethan Weidman
2018-11-21  0:41     ` Ethan Weidman
2018-11-21  5:43     ` Sagi Grimberg
2018-11-21  5:43       ` Sagi Grimberg
2018-11-21  8:56   ` Christoph Hellwig [this message]
2018-11-21  8:56     ` Christoph Hellwig
2018-11-21 22:27     ` Sagi Grimberg
2018-11-21 22:27       ` Sagi Grimberg
2018-11-21 12:01   ` Mikhail Skorzhinskii
2018-11-21 12:01     ` Mikhail Skorzhinskii
2018-11-21 22:28     ` Sagi Grimberg
2018-11-21 22:28       ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH nvme-cli v2 15/14] nvme: Add TCP transport Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-20  9:36   ` Arend van Spriel
2018-11-20  9:36     ` Arend van Spriel
2018-11-20 22:56     ` Sagi Grimberg
2018-11-20 22:56       ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH nvme-cli v2 16/14] fabrics: add tcp port tsas decoding Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg
2018-11-20  3:00 ` [PATCH nvme-cli v2 17/14] fabrics: add transport header and data digest Sagi Grimberg
2018-11-20  3:00   ` Sagi Grimberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181121085645.GA29747@lst.de \
    --to=hch@lst.de \
    --cc=davem@davemloft.net \
    --cc=keith.busch@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.