From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id B36F86932 for ; Wed, 7 Sep 2016 04:43:42 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 06 Sep 2016 19:43:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,294,1470726000"; d="scan'208";a="1046588454" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga002.jf.intel.com with ESMTP; 06 Sep 2016 19:43:41 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 6 Sep 2016 19:43:41 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 6 Sep 2016 19:43:40 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.109]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.102]) with mapi id 14.03.0248.002; Wed, 7 Sep 2016 10:43:39 +0800 From: "Xu, Qian Q" To: Yuanhan Liu CC: "dev@dpdk.org" , Maxime Coquelin Thread-Topic: [dpdk-dev] [PATCH 5/6] vhost: add a flag to enable Tx zero copy Thread-Index: AQHR/RSqS0Xnvff0CkSwP/T2K2rtzaBsP5WQgAALbOD//4A1AIABnXtQ Date: Wed, 7 Sep 2016 02:43:38 +0000 Message-ID: <82F45D86ADE5454A95A89742C8D1410E3912D2C0@shsmsx102.ccr.corp.intel.com> References: <1471939839-29778-1-git-send-email-yuanhan.liu@linux.intel.com> <1471939839-29778-6-git-send-email-yuanhan.liu@linux.intel.com> <82F45D86ADE5454A95A89742C8D1410E3912C500@shsmsx102.ccr.corp.intel.com> <82F45D86ADE5454A95A89742C8D1410E3912C60B@shsmsx102.ccr.corp.intel.com> <20160906100214.GC23158@yliu-dev.sh.intel.com> In-Reply-To: <20160906100214.GC23158@yliu-dev.sh.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 5/6] vhost: add a flag to enable Tx zero copy X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2016 02:43:43 -0000 Thx for the clarification. As to the naming, although it's a little confusi= ng, if people are fine with it, I'm fine.=20 -----Original Message----- From: Yuanhan Liu [mailto:yuanhan.liu@linux.intel.com]=20 Sent: Tuesday, September 6, 2016 6:02 PM To: Xu, Qian Q Cc: dev@dpdk.org; Maxime Coquelin Subject: Re: [dpdk-dev] [PATCH 5/6] vhost: add a flag to enable Tx zero cop= y 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=20 > vhost, and 1 is set as Zero-copy=3D0, and another is set zero-copy=3D1, s= o=20 > the vhost will take it as Zero-copy Enabled for all vhost, or for one vho= st. 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 enab= led. If the two vhost interfaces are attached on different socket file, zero-cop= y will be only enabled when the option is given for corresponding socket fi= le. > Does the vhost allow such usage? Or we need Yes, it's allowd. > Enforce all vhost zero-copy to be a same number.=20 Nope. --yliu >=20 > -----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=20 > zero copy >=20 > Just curious about the naming: vhost USER TX Zero copy. In fact, it's=20 > Vhost RX zero-copy For virtio, it's Virtio TX zero-copy. So, I wonder=20 > why we call it as Vhost TX ZERO-COPY, Any comments? >=20 > -----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=20 > copy >=20 > Add a new flag ``RTE_VHOST_USER_TX_ZERO_COPY`` to explictily enable Tx=20 > zero copy. If not given, Tx zero copy is disabled by default. >=20 > Signed-off-by: Yuanhan Liu > --- > 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(-) >=20 > diff --git a/doc/guides/prog_guide/vhost_lib.rst=20 > 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 se= rver > mode, a Unix domain socket file ``path`` will be created. > =20 > - Currently two flags are supported (these are valid for vhost-user only= ): > + Currently supported flags are (these are valid for vhost-user only): > =20 > - ``RTE_VHOST_USER_CLIENT`` > =20 > @@ -97,6 +97,11 @@ The following is an overview of the Vhost API function= s: > This reconnect option is enabled by default. However, it can be turn= ed off > by setting this flag. > =20 > + - ``RTE_VHOST_USER_TX_ZERO_COPY`` > + > + Tx zero copy will be enabled when this flag is set. It is disabled b= y > + default. > + > * ``rte_vhost_driver_session_start()`` > =20 > This function starts the vhost session loop to handle vhost=20 > messages. It diff --git a/lib/librte_vhost/rte_virtio_net.h=20 > 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 @@ > =20 > #define RTE_VHOST_USER_CLIENT (1ULL << 0) > #define RTE_VHOST_USER_NO_RECONNECT (1ULL << 1) > +#define RTE_VHOST_USER_TX_ZERO_COPY (1ULL << 2) > =20 > /* Enum for virtqueue management. */ > enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM}; diff --git=20 > a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index=20 > 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; > }; > =20 > struct vhost_user_connection { > @@ -203,6 +204,9 @@ vhost_user_add_connection(int fd, struct vhost_user_s= ocket *vsocket) > size =3D strnlen(vsocket->path, PATH_MAX); > vhost_set_ifname(vid, vsocket->path, size); > =20 > + if (vsocket->tx_zero_copy) > + vhost_enable_tx_zero_copy(vid); > + > RTE_LOG(INFO, VHOST_CONFIG, "new device, handle is %d\n", vid); > =20 > vsocket->connfd =3D 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 =3D strdup(path); > vsocket->connfd =3D -1; > + vsocket->tx_zero_copy =3D flags & RTE_VHOST_USER_TX_ZERO_COPY; > =20 > if ((flags & RTE_VHOST_USER_CLIENT) !=3D 0) { > vsocket->reconnect =3D !(flags & RTE_VHOST_USER_NO_RECONNECT); diff=20 > --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index=20 > 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, unsig= ned int if_len) > dev->ifname[sizeof(dev->ifname) - 1] =3D '\0'; } > =20 > +void > +vhost_enable_tx_zero_copy(int vid) > +{ > + struct virtio_net *dev =3D get_device(vid); > + > + if (dev =3D=3D NULL) > + return; > + > + dev->tx_zero_copy =3D 1; > +} > =20 > int > rte_vhost_get_numa_node(int vid) > diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index=20 > 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=20 > alloc_vring_queue_pair(struct virtio_net *dev, uint32_t qp_idx); > =20 > void vhost_set_ifname(int, const char *if_name, unsigned int if_len); > +void vhost_enable_tx_zero_copy(int vid); > =20 > /* > * Backend-specific cleanup. Defined by vhost-cuse and vhost-user. > -- > 1.9.0