[dpdk-dev] [PATCH 1/3] net/virtio_user: add vhost layer

Yuanhan Liu yuanhan.liu at linux.intel.com
Thu Dec 8 08:21:32 CET 2016


On Fri, Dec 02, 2016 at 02:31:13PM +0000, Jianfeng Tan wrote:
> To support vhost kernel as the backend of net_virtio_user in comming
> patches, we abstract a vhost layer to hide all vhost_user functions.
>   - Move vhost_user specific structs and macros into vhost_user.c,
>     and only keep common definitions in vhost.h;

Do that in another patch.

>   - Add a struct vhost_internal, and an array to store vhost_user and
>     vhost_kernel backends; in multiqueue case, vhost_user has only
>     one vhost FD, but vhost_kernel would have multiple FDs (equal to
>     # of queues), so we turn to use an id to index the backend info;

It's okay to add a struct for that, but what's the point of referencing
it by an id?  Instead, you could directly allocate one and return it.
This would also remove the hardcoded limit: 8 devices at most. 

>   - Add a struct vhost_ops depending on different type of backends.

Firstly, the "control" method is not well named, IMO. Something like
"send_request" is better.

And there is another way to achieve that: instead of introducing one
callback (control, or send_request) for all requests, you could
define one callback for each request. QEMU switched to that way 
few releases ago. In that way, you don't have to do the request
translation at least.

Last, please make one patch for each of 3 items. It helps review.

	--yliu


More information about the dev mailing list