[dpdk-dev] [PATCH 1/2] vhost: add flag for built-in virtio_net.c driver

Yuanhan Liu yliu at fridaylinux.org
Thu Feb 1 15:46:11 CET 2018


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


More information about the dev mailing list