[dpdk-dev] [PATCH v5 00/11] user space vhost library and vhost example

Huawei Xie huawei.xie at intel.com
Fri Sep 26 11:45:47 CEST 2014


This set of patches transforms and refactors vhost example to a user
space vhost library and a new vhost example based on this library.
This library implements a user space vhost cuse driver, and provides
generic APIs for user space ethernet vSwitch to integrate us-vhost for
fast packet switching with guest virtio.

The vhost lib consists of five APIs puls several other helper routines.
1) rte_vhost_driver_register initialises vhost driver.
2) rte_vhost_driver_callback_register registers new_device/destroy_device
callbacks. Those callbacks should be implemented in ethernet switch application.
new_device is called when a virtio_device is ready for processing.
destroy_device is called when a virtio_device is de-activated by guest.
3) rte_vhost_driver_session_start starts vhost driver
4) rte_vhost_enqueue_burst and rte_vhost_dequeue_burst for enqueue/dequeue
to/from virtio ring.

Change notes:
  v2) Turn of vhost lib by default
  v3) Fixed checkpatch issues
  v4) Split the monolithic patch
  v5) Merge merge-able rx/tx and mbuf change. Lots of coding style fixes.

Huawei Xie (11):
  1) move src files in vhost example to vhost lib directory.
  2) copy vhost rx/tx functions from main.c to a new file vhost_rxtx.c.
  3) remove main.c and main.h in vhost lib.
  4) rename virtio-net.h to rte_virtio_net.h as API header file.
  5) VMDQ, MAC learning related switching logic are removed from library.
  6) zero copy logic isn't generic enough at this stage, and is moved to example.
  7) retry logic is moved from vhost rx functions in vhost lib to switch_worker
switching function in example.
  8) add TODOs/FIXME   
    -allow application to disable cmpset reserve in rte_vhost_enqueue_burst in case
     there is no contention.      
    -fix memcpy from mbuf to vring desc when mbuf is chained and the
    desc couldn't hold all the data
    -fix vhost_set_mem_table possible race condition: two vqs concurrently   
     calls set_mem_table which cause saved mem_temp to be overided.  
  9) merge vhost merge-able rx
  10) for vhost tx, previous vhost merge-able feature introduces another version of
    virtio_dev_merge_tx, and calls virtio_dev_tx and vritio_dev_merge_tx
    respectively depends on whether the vhost device supports merge-able feature.
    Actually "merge-able" tx is the fix for memcpy from chained vring desc to mbuf.
    will use virtio_dev_merge_tx as the base for vhost tx.
  11) merge mbuf patch in vhost lib.
  12) fixes serious coding style issues.
  13) add vhost lib Makefile and vhost lib support in DPDK makefile. vhost lib is turned
off by default as it requires fuse-devel package.
  14) copy old vhost example files main.c and main.h as the base for new vhost example
  15) modify vhost example to use vhost lib API, and merge Oliver's mbuf patch.
 

 config/common_linuxapp                       |    8 +
 examples/vhost/Makefile                      |   10 +-
 examples/vhost/eventfd_link/Makefile         |   39 -
 examples/vhost/eventfd_link/eventfd_link.c   |  205 ----
 examples/vhost/eventfd_link/eventfd_link.h   |   79 --
 examples/vhost/libvirt/qemu-wrap.py          |  367 -------
 examples/vhost/main.c                        | 1465 +++++++-------------------
 examples/vhost/main.h                        |   47 +-
 examples/vhost/vhost-net-cdev.c              |  367 -------
 examples/vhost/vhost-net-cdev.h              |   83 --
 examples/vhost/virtio-net.c                  | 1165 --------------------
 examples/vhost/virtio-net.h                  |  161 ---
 lib/Makefile                                 |    1 +
 lib/librte_vhost/Makefile                    |   48 +
 lib/librte_vhost/eventfd_link/Makefile       |   39 +
 lib/librte_vhost/eventfd_link/eventfd_link.c |  205 ++++
 lib/librte_vhost/eventfd_link/eventfd_link.h |   79 ++
 lib/librte_vhost/libvirt/qemu-wrap.py        |  367 +++++++
 lib/librte_vhost/rte_virtio_net.h            |  207 ++++
 lib/librte_vhost/vhost-net-cdev.c            |  362 +++++++
 lib/librte_vhost/vhost-net-cdev.h            |  113 ++
 lib/librte_vhost/vhost_rxtx.c                |  737 +++++++++++++
 lib/librte_vhost/virtio-net.c                | 1029 ++++++++++++++++++
 mk/rte.app.mk                                |    5 +
 24 files changed, 3636 insertions(+), 3552 deletions(-)
 delete mode 100644 examples/vhost/eventfd_link/Makefile
 delete mode 100644 examples/vhost/eventfd_link/eventfd_link.c
 delete mode 100644 examples/vhost/eventfd_link/eventfd_link.h
 delete mode 100755 examples/vhost/libvirt/qemu-wrap.py
 delete mode 100644 examples/vhost/vhost-net-cdev.c
 delete mode 100644 examples/vhost/vhost-net-cdev.h
 delete mode 100644 examples/vhost/virtio-net.c
 delete mode 100644 examples/vhost/virtio-net.h
 create mode 100644 lib/librte_vhost/Makefile
 create mode 100644 lib/librte_vhost/eventfd_link/Makefile
 create mode 100644 lib/librte_vhost/eventfd_link/eventfd_link.c
 create mode 100644 lib/librte_vhost/eventfd_link/eventfd_link.h
 create mode 100755 lib/librte_vhost/libvirt/qemu-wrap.py
 create mode 100644 lib/librte_vhost/rte_virtio_net.h
 create mode 100644 lib/librte_vhost/vhost-net-cdev.c
 create mode 100644 lib/librte_vhost/vhost-net-cdev.h
 create mode 100644 lib/librte_vhost/vhost_rxtx.c
 create mode 100644 lib/librte_vhost/virtio-net.c

-- 
1.8.1.4



More information about the dev mailing list