Re: [PATCH v2 3/5] virtio/vdev: add embeded device emulation
From: Tan, Jianfeng <hidden>
Date: 2016-02-16 02:41:03
Hi Michael, Don't know why, I have not received the email you comment on this commit. On 2/5/2016 7:20 PM, Jianfeng Tan wrote:
To implement virtio vdev, we need way to interract with vhost backend. And more importantly, needs way to emulate a device into DPDK. So this patch acts as embedded device emulation. Depends on the type of vhost file: vhost-user is used if the given path points to a unix socket; vhost-net is used if the given path points to a char device. Signed-off-by: Huawei Xie <redacted> Signed-off-by: Jianfeng Tan <redacted> --- config/common_linuxapp | 5 + drivers/net/virtio/Makefile | 4 + drivers/net/virtio/vhost.h | 194 +++++++++ drivers/net/virtio/vhost_embedded.c | 809 ++++++++++++++++++++++++++++++++++++ drivers/net/virtio/virtio_ethdev.h | 6 +- drivers/net/virtio/virtio_pci.h | 15 +- 6 files changed, 1031 insertions(+), 2 deletions(-) create mode 100644 drivers/net/virtio/vhost.h create mode 100644 drivers/net/virtio/vhost_embedded.c
...
Don't hard-code this, it's not nice.
Actually, it comes from in lib/librte_vhost/rte_virtio_net.h. If we follow your suggestion below, it'll be addressed.
Why do you duplicate ioctls? Use them from /usr/include/linux/vhost.h, etc. In fact, what's not coming from linux here comes from lib/librte_vhost/vhost_user/vhost-net-user.h. I think you should reuse code, avoid code duplication.
The reason I was considering is: a. If we include /usr/include/linux/vhost.h, then virtio cannot be used in FreeBSD. b. To use definitions in lib/librte_vhost/vhost_user/vhost-net-user.h, we need expose this header file outside. Thanks, Jianfeng