[dpdk-dev] [PATCH v4 00/22] vhost: generic vhost API
Yuanhan Liu
yuanhan.liu at linux.intel.com
Sat Apr 1 09:22:38 CEST 2017
This patchset makes DPDK vhost library generic enough, so that we could
build other vhost-user drivers on top of it. For example, SPDK (Storage
Performance Development Kit) is trying to enable vhost-user SCSI.
The basic idea is, let DPDK vhost be a vhost-user agent. It stores all
the info about the virtio device (i.e. vring address, negotiated features,
etc) and let the specific vhost-user driver to fetch them (by the API
provided by DPDK vhost lib). With those info being provided, the vhost-user
driver then could get/put vring entries, thus, it could exchange data
between the guest and host.
The last patch demonstrates how to use these new APIs to implement a
very simple vhost-user net driver, without any fancy features enabled.
Change log
==========
v2: - rebase
- updated release note
- updated API comments
- renamed rte_vhost_get_vhost_memory to rte_vhost_get_mem_table
- added a new device callback: features_changed(), bascially for live
migration support
- introduced rte_vhost_driver_start() to start a specific driver
- misc fixes
v3: - rebaseon top of vhost-user socket fix
- fix reconnect
- fix shared build
- fix typos
v4: - rebase
- let rte_vhost_get.*_features() to return features by parameter and
return -1 on failure
- Follow the style of ring rework to update the release note: use one
entry for all vhost changes and add sub items for each change.
Major API/ABI Changes summary
=============================
- some renames
* "struct virtio_net_device_ops" ==> "struct vhost_device_ops"
* "rte_virtio_net.h" ==> "rte_vhost.h"
- driver related APIs are bond with the socket file
* rte_vhost_driver_set_features(socket_file, features);
* rte_vhost_driver_get_features(socket_file, features);
* rte_vhost_driver_enable_features(socket_file, features)
* rte_vhost_driver_disable_features(socket_file, features)
* rte_vhost_driver_callback_register(socket_file, notify_ops);
* rte_vhost_driver_start(socket_file);
This function replaces rte_vhost_driver_session_start(). Check patch
18 for more information.
- new APIs to fetch guest and vring info
* rte_vhost_get_mem_table(vid, mem);
* rte_vhost_get_negotiated_features(vid);
* rte_vhost_get_vhost_vring(vid, vring_idx, vring);
- new exported structures
* struct rte_vhost_vring
* struct rte_vhost_mem_region
* struct rte_vhost_memory
- a new device ops callback: features_changed().
--yliu
---
Yuanhan Liu (22):
vhost: introduce driver features related APIs
net/vhost: remove feature related APIs
vhost: use new APIs to handle features
vhost: make notify ops per vhost driver
vhost: export guest memory regions
vhost: introduce API to fetch negotiated features
vhost: export vhost vring info
vhost: export API to translate gpa to vva
vhost: turn queue pair to vring
vhost: export the number of vrings
vhost: move the device ready check at proper place
vhost: drop the Rx and Tx queue macro
vhost: do not include net specific headers
vhost: rename device ops struct
vhost: rename virtio-net to vhost
vhost: add features changed callback
vhost: export APIs for live migration support
vhost: introduce API to start a specific driver
vhost: rename header file
vhost: workaround the build dependency on mbuf header
vhost: do not destroy device on repeat mem table message
examples/vhost: demonstrate the new generic vhost APIs
doc/guides/prog_guide/vhost_lib.rst | 42 +--
doc/guides/rel_notes/deprecation.rst | 9 -
doc/guides/rel_notes/release_17_05.rst | 43 +++
drivers/net/vhost/rte_eth_vhost.c | 101 ++-----
drivers/net/vhost/rte_eth_vhost.h | 32 +--
drivers/net/vhost/rte_pmd_vhost_version.map | 3 -
examples/tep_termination/main.c | 23 +-
examples/tep_termination/main.h | 2 +
examples/tep_termination/vxlan_setup.c | 2 +-
examples/vhost/Makefile | 2 +-
examples/vhost/main.c | 100 +++++--
examples/vhost/main.h | 32 ++-
examples/vhost/virtio_net.c | 405 ++++++++++++++++++++++++++
lib/librte_vhost/Makefile | 4 +-
lib/librte_vhost/fd_man.c | 9 +-
lib/librte_vhost/fd_man.h | 2 +-
lib/librte_vhost/rte_vhost.h | 427 ++++++++++++++++++++++++++++
lib/librte_vhost/rte_vhost_version.map | 16 +-
lib/librte_vhost/rte_virtio_net.h | 208 --------------
lib/librte_vhost/socket.c | 229 ++++++++++++---
lib/librte_vhost/vhost.c | 230 ++++++++-------
lib/librte_vhost/vhost.h | 113 +++++---
lib/librte_vhost/vhost_user.c | 121 ++++----
lib/librte_vhost/vhost_user.h | 2 +-
lib/librte_vhost/virtio_net.c | 71 ++---
25 files changed, 1541 insertions(+), 687 deletions(-)
create mode 100644 examples/vhost/virtio_net.c
create mode 100644 lib/librte_vhost/rte_vhost.h
delete mode 100644 lib/librte_vhost/rte_virtio_net.h
--
1.9.0
More information about the dev
mailing list