From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id CDF5EA6A for ; Thu, 26 Mar 2015 21:20:41 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 26 Mar 2015 13:20:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,474,1422950400"; d="scan'208";a="686222725" Received: from irsmsx105.ger.corp.intel.com ([163.33.3.28]) by fmsmga001.fm.intel.com with ESMTP; 26 Mar 2015 13:20:41 -0700 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.247]) by irsmsx105.ger.corp.intel.com ([163.33.3.28]) with mapi id 14.03.0224.002; Thu, 26 Mar 2015 20:20:39 +0000 From: "Butler, Siobhan A" To: "Xie, Huawei" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] vhost library doc update Thread-Index: AQHQXBeeua7YAawNK0+fiOtoRmOXd50vTGgg Date: Thu, 26 Mar 2015 20:20:38 +0000 Message-ID: <0C5AFCA4B3408848ADF2A3073F7D8CC86D567E72@IRSMSX109.ger.corp.intel.com> References: <1426090941-18785-1-git-send-email-huawei.xie@intel.com> In-Reply-To: <1426090941-18785-1-git-send-email-huawei.xie@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] vhost library doc update 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: Thu, 26 Mar 2015 20:20:42 -0000 > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Huawei Xie > Sent: Wednesday, March 11, 2015 4:22 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH] vhost library doc update >=20 > add vhost user documentation >=20 > Signed-off-by: Huawei Xie > --- > doc/guides/prog_guide/vhost_lib.rst | 52 > ++++++++++++++++++++++++++++++------- > 1 file changed, 42 insertions(+), 10 deletions(-) >=20 > diff --git a/doc/guides/prog_guide/vhost_lib.rst > b/doc/guides/prog_guide/vhost_lib.rst > index 0b6eda7..ab35b74 100644 > --- a/doc/guides/prog_guide/vhost_lib.rst > +++ b/doc/guides/prog_guide/vhost_lib.rst > @@ -31,25 +31,28 @@ > Vhost Library > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >=20 > -The vhost cuse (cuse: user space character device driver) library implem= ents > a -vhost cuse driver. It also creates, manages and destroys vhost devices= for - > corresponding virtio devices in the guest. Vhost supported vSwitch could > register -callbacks to this library, which will be called when a vhost de= vice is > activated -or deactivated by guest virtual machine. > +The vhost library implements a user space vhost driver. It supports > +both vhost-cuse > +(cuse: user space character device) and vhost-user(user space socket > server). > +It also creates, manages and destroys vhost devices for corresponding > +virtio devices in the guest. Vhost supported vSwitch could register > +callbacks to this library, which will be called when a vhost device is > +activated or deactivated by guest virtual machine. >=20 > Vhost API Overview > ------------------ >=20 > * Vhost driver registration >=20 > - rte_vhost_driver_register registers the vhost cuse driver into the > system. > - Character device file will be created in the /dev directory. > + rte_vhost_driver_register registers the vhost driver into the syst= em. > + For vhost-cuse, character device file will be created under the /d= ev > directory. > Character device name is specified as the parameter. > + For vhost-user, a unix domain socket server will be created with t= he > parameter as > + the local socket path. >=20 > * Vhost session start >=20 > rte_vhost_driver_session_start starts the vhost session loop. > - Vhost cuse session is an infinite blocking loop. > + Vhost session is an infinite blocking loop. > Put the session in a dedicate DPDK thread. >=20 > * Callback register > @@ -73,6 +76,8 @@ Vhost API Overview > Vhost Implementation > -------------------- >=20 > +Vhost cuse implementation > +~~~~~~~~~~~~~~~~~~~~~~~~~ > When vSwitch registers the vhost driver, it will register a cuse device = driver > into the system and creates a character device file. This cuse driver wil= l > receive vhost open/release/IOCTL message from QEMU simulator. > @@ -89,13 +94,40 @@ which means vhost could access the shared virtio ring > and the guest physical address specified in the entry of the ring. >=20 > The guest virtual machine tells the vhost whether the virtio device is r= eady - > for processing or is de-activated through VHOST_SET_BACKEND message. > +for processing or is de-activated through VHOST_NET_SET_BACKEND > message. > The registered callback from vSwitch will be called. >=20 > When the release call is released, vhost will destroy the device. >=20 > +Vhost user implementation > +~~~~~~~~~~~~~~~~~~~~~~~~~ > +When vSwitch registers a vhost driver, it will create a unix domain > +socket server into the system. This server will listen for a connection > +and process the vhost message from QEMU simulator. > + > +When there is a new socket connection, it means a new virtio device has > +been created in the guest virtual machine, and the vhost driver will cre= ate a > vhost device for this virtio device. > + > +For messages with a file descriptor, the file descriptor could be > +directly used in the vhost process as it is already installed by unix do= main > socket. > + * VHOST_SET_MEM_TABLE > + * VHOST_SET_VRING_KICK > + * VHOST_SET_VRING_CALL > + * VHOST_SET_LOG_FD > + * VHOST_SET_VRING_ERR > + > +For VHOST_SET_MEM_TABLE message, QEMU will send us information for > each > +memory region and its file descriptor in the ancillary data of the messa= ge. > The fd is used to map that region. > + > +There is no VHOST_NET_SET_BACKEND message as in vhost cuse to signal > us > +whether virtio device is ready or should be stopped. > +VHOST_SET_VRING_KICK is used as the signal to put the vhost device onto > data plane. > +VHOST_GET_VRING_BASE is used as the signal to remove vhost device > from data plane. > + > +When the socket connection is closed, vhost will destroy the device. > + > Vhost supported vSwitch reference > --------------------------------- >=20 > -For how to support vhost in vSwitch, please refer to vhost example in th= e > +For more vhost details and how to support vhost in vSwitch, please > +refer to vhost example in the > DPDK Sample Applications Guide. > -- > 1.8.1.4 Acked-by Siobhan Butler