[dpdk-dev] [PATCH v5 6/8] virtio-user: add new virtual pci driver for virtio

Yuanhan Liu yuanhan.liu at linux.intel.com
Wed Jun 1 10:21:54 CEST 2016


On Mon, May 30, 2016 at 10:55:37AM +0000, Jianfeng Tan wrote:
> This patch implements another new instance of struct virtio_pci_ops to
> drive the virtio-user virtual device. Instead of rd/wr ioport or PCI
> configuration space, this virtual pci driver will rd/wr the virtual
> device struct virtio_user_hw, and when necessary, invokes APIs provided
> by device emulation later to start/stop the device.
> 
>   ----------------------
>   | ------------------ |
>   | | virtio driver  | |----> (virtio_user_pci.c)
>   | ------------------ |
>   |         |          |
>   | ------------------ | ------>  virtio-user PMD
>   | | device emulate | |
>   | |                | |
>   | | vhost adapter  | |
>   | ------------------ |
>   ----------------------
>             |
>             |
>             |
>    ------------------
>    | vhost backend  |
>    ------------------
> 
> Signed-off-by: Huawei Xie <huawei.xie at intel.com>
> Signed-off-by: Jianfeng Tan <jianfeng.tan at intel.com>
> Acked-by: Neil Horman <nhorman at tuxdriver.com>
> ---
>  drivers/net/virtio/Makefile                      |   1 +
>  drivers/net/virtio/virtio_pci.h                  |   1 +
>  drivers/net/virtio/virtio_user/virtio_user_dev.h |   2 +
>  drivers/net/virtio/virtio_user/virtio_user_pci.c | 218 +++++++++++++++++++++++

Jianfeng, this file (virtio_user_pci.c) belongs to virtio driver, but
not virtio-user device.

I thought it a while, I found it's still better to introduce a helper
function from virtio-user device for each ops, just like the below
vdev_reset(). Sorry for noisy.

And I'd suggest to rename it to virtio_user.c, so that we can move
the virtio_user_pmd_devinit/devuninit in the next patch to there,
too. They also belong the driver side, but not the device side.

> +static void
> +vdev_read_dev_config(struct virtio_hw *hw, uint64_t offset,
> +		     void *dst, int length)

Let's user "virtio_user" consistently here, instead of vdev?

	--yliu


More information about the dev mailing list