From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH 1/2] vhost: add flag for built-in virtio_net.c driver Date: Thu, 1 Feb 2018 22:46:11 +0800 Message-ID: <20180201144611.GP29540@yliu-mob> References: <20180131174651.6386-1-stefanha@redhat.com> <20180131174651.6386-2-stefanha@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, Maxime Coquelin To: Stefan Hajnoczi Return-path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 952B725B3 for ; Thu, 1 Feb 2018 15:46:16 +0100 (CET) Content-Disposition: inline In-Reply-To: <20180131174651.6386-2-stefanha@redhat.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Stefan, On Wed, Jan 31, 2018 at 05:46:50PM +0000, Stefan Hajnoczi wrote: > The librte_vhost API is used in two ways: > 1. As a vhost net device backend via rte_vhost_enqueue/dequeue_burst(). This is how DPDK vhost-user firstly implemented. > 2. As a library for implementing vhost device backends. This is how DPDK vhost-use extended later, and vhost-user scsi is the first one being added. > There is no distinction between the two at the API level or in the > librte_vhost implementation. For example, device state is kept in > "struct virtio_net" regardless of whether this is actually a net device > backend or whether the built-in virtio_net.c driver is in use. Indeed. virtio_net should be renamed to "vhost_dev" or something like this. It's part of something un-finished in the last vhost-user extension refactoring. > > The virtio_net.c driver should be a librte_vhost API client just like > the vhost-scsi code and have no special access to vhost.h internals. > Unfortunately, fixing this requires significant librte_vhost API > changes. The way I thought was to move the virtio_net.c completely to vhost pmd (drivers/net/vhost). And let vhost-user just be a generic lib without any device specific stuff. Unfortunately, it can not be done recently, as there are still a lot of applications using rte_vhost_enqueue/dequeue_burst directly, for example, OVS. > This patch takes a different approach: keep the librte_vhost API > unchanged but track whether the built-in virtio_net.c driver is in use. > See the next patch for a bug fix that requires knowledge of whether > virtio_net.c is in use. LGTM. Thanks. --yliu