DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xu, Qian Q" <qian.q.xu@intel.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: Re: [dpdk-dev] [PATCH 5/6] vhost: add a flag to enable Tx zero copy
Date: Wed, 7 Sep 2016 02:43:38 +0000	[thread overview]
Message-ID: <82F45D86ADE5454A95A89742C8D1410E3912D2C0@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20160906100214.GC23158@yliu-dev.sh.intel.com>

Thx for the clarification. As to the naming, although it's a little confusing, if people are fine with it, I'm fine. 


-----Original Message-----
From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com] 
Sent: Tuesday, September 6, 2016 6:02 PM
To: Xu, Qian Q <qian.q.xu@intel.com>
Cc: dev@dpdk.org; Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: Re: [dpdk-dev] [PATCH 5/6] vhost: add a flag to enable Tx zero copy

On Tue, Sep 06, 2016 at 09:42:38AM +0000, Xu, Qian Q wrote:
> Another interesting thing to me is the ZERO-COPY settings. If I have 2 
> vhost, and 1 is set as Zero-copy=0, and another is set zero-copy=1, so 
> the vhost will take it as Zero-copy Enabled for all vhost, or for one vhost.


The flag is per vhost-user socket file path.

If you have two vhost interfaces attached on the same socket files (when it acts as the server), the two vhost interface will both with zero copy enabled.

If the two vhost interfaces are attached on different socket file, zero-copy will be only enabled when the option is given for corresponding socket file.

> Does the vhost allow such usage? Or we need

Yes, it's allowd.

> Enforce all vhost zero-copy to be a same number. 

Nope.

	--yliu

> 
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Xu, Qian Q
> Sent: Tuesday, September 06, 2016 5:00 PM
> To: Yuanhan Liu; dev@dpdk.org
> Cc: Maxime Coquelin
> Subject: Re: [dpdk-dev] [PATCH 5/6] vhost: add a flag to enable Tx 
> zero copy
> 
> Just curious about the naming: vhost USER TX Zero copy. In fact, it's 
> Vhost RX zero-copy For virtio, it's Virtio TX zero-copy. So, I wonder 
> why we call it as Vhost TX ZERO-COPY, Any comments?
> 
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Yuanhan Liu
> Sent: Tuesday, August 23, 2016 4:11 PM
> To: dev@dpdk.org
> Cc: Maxime Coquelin; Yuanhan Liu
> Subject: [dpdk-dev] [PATCH 5/6] vhost: add a flag to enable Tx zero 
> copy
> 
> Add a new flag ``RTE_VHOST_USER_TX_ZERO_COPY`` to explictily enable Tx 
> zero copy. If not given, Tx zero copy is disabled by default.
> 
> Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> ---
>  doc/guides/prog_guide/vhost_lib.rst |  7 ++++++-
>  lib/librte_vhost/rte_virtio_net.h   |  1 +
>  lib/librte_vhost/socket.c           |  5 +++++
>  lib/librte_vhost/vhost.c            | 10 ++++++++++
>  lib/librte_vhost/vhost.h            |  1 +
>  5 files changed, 23 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/guides/prog_guide/vhost_lib.rst 
> b/doc/guides/prog_guide/vhost_lib.rst
> index 6b0c6b2..15c2bf7 100644
> --- a/doc/guides/prog_guide/vhost_lib.rst
> +++ b/doc/guides/prog_guide/vhost_lib.rst
> @@ -79,7 +79,7 @@ The following is an overview of the Vhost API functions:
>    ``/dev/path`` character device file will be created. For vhost-user server
>    mode, a Unix domain socket file ``path`` will be created.
>  
> -  Currently two flags are supported (these are valid for vhost-user only):
> +  Currently supported flags are (these are valid for vhost-user only):
>  
>    - ``RTE_VHOST_USER_CLIENT``
>  
> @@ -97,6 +97,11 @@ The following is an overview of the Vhost API functions:
>      This reconnect option is enabled by default. However, it can be turned off
>      by setting this flag.
>  
> +  - ``RTE_VHOST_USER_TX_ZERO_COPY``
> +
> +    Tx zero copy will be enabled when this flag is set. It is disabled by
> +    default.
> +
>  * ``rte_vhost_driver_session_start()``
>  
>    This function starts the vhost session loop to handle vhost 
> messages. It diff --git a/lib/librte_vhost/rte_virtio_net.h 
> b/lib/librte_vhost/rte_virtio_net.h
> index 9caa622..5e437c6 100644
> --- a/lib/librte_vhost/rte_virtio_net.h
> +++ b/lib/librte_vhost/rte_virtio_net.h
> @@ -53,6 +53,7 @@
>  
>  #define RTE_VHOST_USER_CLIENT		(1ULL << 0)
>  #define RTE_VHOST_USER_NO_RECONNECT	(1ULL << 1)
> +#define RTE_VHOST_USER_TX_ZERO_COPY	(1ULL << 2)
>  
>  /* Enum for virtqueue management. */
>  enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM}; diff --git 
> a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index 
> bf03f84..5c3962d 100644
> --- a/lib/librte_vhost/socket.c
> +++ b/lib/librte_vhost/socket.c
> @@ -62,6 +62,7 @@ struct vhost_user_socket {
>  	int connfd;
>  	bool is_server;
>  	bool reconnect;
> +	bool tx_zero_copy;
>  };
>  
>  struct vhost_user_connection {
> @@ -203,6 +204,9 @@ vhost_user_add_connection(int fd, struct vhost_user_socket *vsocket)
>  	size = strnlen(vsocket->path, PATH_MAX);
>  	vhost_set_ifname(vid, vsocket->path, size);
>  
> +	if (vsocket->tx_zero_copy)
> +		vhost_enable_tx_zero_copy(vid);
> +
>  	RTE_LOG(INFO, VHOST_CONFIG, "new device, handle is %d\n", vid);
>  
>  	vsocket->connfd = fd;
> @@ -499,6 +503,7 @@ rte_vhost_driver_register(const char *path, uint64_t flags)
>  	memset(vsocket, 0, sizeof(struct vhost_user_socket));
>  	vsocket->path = strdup(path);
>  	vsocket->connfd = -1;
> +	vsocket->tx_zero_copy = flags & RTE_VHOST_USER_TX_ZERO_COPY;
>  
>  	if ((flags & RTE_VHOST_USER_CLIENT) != 0) {
>  		vsocket->reconnect = !(flags & RTE_VHOST_USER_NO_RECONNECT); diff 
> --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 
> ab25649..5461e5b 100644
> --- a/lib/librte_vhost/vhost.c
> +++ b/lib/librte_vhost/vhost.c
> @@ -290,6 +290,16 @@ vhost_set_ifname(int vid, const char *if_name, unsigned int if_len)
>  	dev->ifname[sizeof(dev->ifname) - 1] = '\0';  }
>  
> +void
> +vhost_enable_tx_zero_copy(int vid)
> +{
> +	struct virtio_net *dev = get_device(vid);
> +
> +	if (dev == NULL)
> +		return;
> +
> +	dev->tx_zero_copy = 1;
> +}
>  
>  int
>  rte_vhost_get_numa_node(int vid)
> diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index 
> 718133e..3081180 100644
> --- a/lib/librte_vhost/vhost.h
> +++ b/lib/librte_vhost/vhost.h
> @@ -279,6 +279,7 @@ void vhost_destroy_device(int);  int 
> alloc_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx);
>  
>  void vhost_set_ifname(int, const char *if_name, unsigned int if_len);
> +void vhost_enable_tx_zero_copy(int vid);
>  
>  /*
>   * Backend-specific cleanup. Defined by vhost-cuse and vhost-user.
> --
> 1.9.0

  reply	other threads:[~2016-09-07  2:43 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23  8:10 [dpdk-dev] [PATCH 0/6] vhost: add Tx zero copy support Yuanhan Liu
2016-08-23  8:10 ` [dpdk-dev] [PATCH 1/6] vhost: simplify memory regions handling Yuanhan Liu
2016-08-23  9:17   ` Maxime Coquelin
2016-08-24  7:26   ` Xu, Qian Q
2016-08-24  7:40     ` Yuanhan Liu
2016-08-24  7:36       ` Xu, Qian Q
2016-08-23  8:10 ` [dpdk-dev] [PATCH 2/6] vhost: get guest/host physical address mappings Yuanhan Liu
2016-08-23  9:58   ` Maxime Coquelin
2016-08-23 12:32     ` Yuanhan Liu
2016-08-23 13:25       ` Maxime Coquelin
2016-08-23 13:49         ` Yuanhan Liu
2016-08-23 14:05           ` Maxime Coquelin
2016-08-23  8:10 ` [dpdk-dev] [PATCH 3/6] vhost: introduce last avail idx for Tx Yuanhan Liu
2016-08-23 12:27   ` Maxime Coquelin
2016-08-23  8:10 ` [dpdk-dev] [PATCH 4/6] vhost: add Tx zero copy Yuanhan Liu
2016-08-23 14:04   ` Maxime Coquelin
2016-08-23 14:31     ` Yuanhan Liu
2016-08-23 15:40       ` Maxime Coquelin
2016-08-23  8:10 ` [dpdk-dev] [PATCH 5/6] vhost: add a flag to enable " Yuanhan Liu
2016-09-06  9:00   ` Xu, Qian Q
2016-09-06  9:42     ` Xu, Qian Q
2016-09-06 10:02       ` Yuanhan Liu
2016-09-07  2:43         ` Xu, Qian Q [this message]
2016-09-06  9:55     ` Yuanhan Liu
2016-09-07 16:00       ` Thomas Monjalon
2016-09-08  7:21         ` Yuanhan Liu
2016-09-08  7:57           ` Thomas Monjalon
2016-08-23  8:10 ` [dpdk-dev] [PATCH 6/6] examples/vhost: add an option " Yuanhan Liu
2016-08-23  9:31   ` Thomas Monjalon
2016-08-23 12:33     ` Yuanhan Liu
2016-08-23 14:14   ` Maxime Coquelin
2016-08-23 14:45     ` Yuanhan Liu
2016-08-23 14:18 ` [dpdk-dev] [PATCH 0/6] vhost: add Tx zero copy support Maxime Coquelin
2016-08-23 14:42   ` Yuanhan Liu
2016-08-23 14:53     ` Yuanhan Liu
2016-08-23 16:41       ` Maxime Coquelin
2016-08-29  8:32 ` Xu, Qian Q
2016-08-29  8:57   ` Xu, Qian Q
2016-09-23  4:11     ` Yuanhan Liu
2016-10-09 15:20   ` Yuanhan Liu
2016-09-23  4:13 ` [dpdk-dev] [PATCH v2 0/7] vhost: add dequeue " Yuanhan Liu
2016-09-23  4:13   ` [dpdk-dev] [PATCH v2 1/7] vhost: simplify memory regions handling Yuanhan Liu
2016-09-23  4:13   ` [dpdk-dev] [PATCH v2 2/7] vhost: get guest/host physical address mappings Yuanhan Liu
2016-09-26 20:17     ` Maxime Coquelin
2016-09-23  4:13   ` [dpdk-dev] [PATCH v2 3/7] vhost: introduce last avail idx for dequeue Yuanhan Liu
2016-09-23  4:13   ` [dpdk-dev] [PATCH v2 4/7] vhost: add dequeue zero copy Yuanhan Liu
2016-09-26 20:45     ` Maxime Coquelin
2016-10-06 14:37     ` Xu, Qian Q
2016-10-09  2:03       ` Yuanhan Liu
2016-10-10 10:12         ` Xu, Qian Q
2016-10-10 10:14           ` Maxime Coquelin
2016-10-10 10:22             ` Xu, Qian Q
2016-10-10 10:40               ` Xu, Qian Q
2016-10-10 11:48               ` Maxime Coquelin
2016-09-23  4:13   ` [dpdk-dev] [PATCH v2 5/7] vhost: add a flag to enable " Yuanhan Liu
2016-09-26 20:57     ` Maxime Coquelin
2016-09-23  4:13   ` [dpdk-dev] [PATCH v2 6/7] examples/vhost: add an option " Yuanhan Liu
2016-09-26 21:05     ` Maxime Coquelin
2016-09-23  4:13   ` [dpdk-dev] [PATCH v2 7/7] net/vhost: " Yuanhan Liu
2016-09-26 21:05     ` Maxime Coquelin
2016-10-09  7:27   ` [dpdk-dev] [PATCH v3 0/7] vhost: add dequeue zero copy support Yuanhan Liu
2016-10-09  7:27     ` [dpdk-dev] [PATCH v3 1/7] vhost: simplify memory regions handling Yuanhan Liu
2016-10-09  7:27     ` [dpdk-dev] [PATCH v3 2/7] vhost: get guest/host physical address mappings Yuanhan Liu
2016-11-29  3:10       ` linhaifeng
2016-11-29 13:14       ` linhaifeng
2016-10-09  7:27     ` [dpdk-dev] [PATCH v3 3/7] vhost: introduce last avail idx for dequeue Yuanhan Liu
2016-10-09  7:27     ` [dpdk-dev] [PATCH v3 4/7] vhost: add dequeue zero copy Yuanhan Liu
2016-10-09  7:27     ` [dpdk-dev] [PATCH v3 5/7] vhost: add a flag to enable " Yuanhan Liu
2016-10-09  7:27     ` [dpdk-dev] [PATCH v3 6/7] examples/vhost: add an option " Yuanhan Liu
2016-10-09  7:28     ` [dpdk-dev] [PATCH v3 7/7] net/vhost: " Yuanhan Liu
2016-10-11 13:04     ` [dpdk-dev] [PATCH v3 0/7] vhost: add dequeue zero copy support Xu, Qian Q
2016-10-12  7:48     ` Yuanhan Liu
2016-10-09 10:46 ` [dpdk-dev] [PATCH 0/6] vhost: add Tx " linhaifeng
2016-10-10  8:03   ` Yuanhan Liu
2016-10-14  7:30     ` linhaifeng

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=82F45D86ADE5454A95A89742C8D1410E3912D2C0@shsmsx102.ccr.corp.intel.com \
    --to=qian.q.xu@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=yuanhan.liu@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).