Skip to content

vhost: generic vhost API

Yuanhan Liu dpdk-dev 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest22 patches 6 repliesIn review
  2. v322 patches 10 repliesSuperseded
  3. v222 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v117 patches32 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/22vhost: introduce driver features related APIsdoc/guides/prog_guide/vhost_lib.rst lib/librte_vhost/rte_vhost_version.map lib/librte_vhost/rte_virtio_net.h +1 more+157 -21 reply
2/22net/vhost: remove feature related APIsdoc/guides/rel_notes/release_17_05.rst drivers/net/vhost/rte_eth_vhost.c drivers/net/vhost/rte_eth_vhost.h +1 more+13 -580 replies
3/22vhost: use new APIs to handle featuresexamples/tep_termination/main.c examples/vhost/main.c lib/librte_vhost/rte_vhost_version.map +5 more+83 -800 replies
4/22vhost: make notify ops per vhost driverdoc/guides/prog_guide/vhost_lib.rst doc/guides/rel_notes/release_17_05.rst drivers/net/vhost/rte_eth_vhost.c +7 more+84 -360 replies
5/22vhost: export guest memory regionslib/librte_vhost/rte_vhost_version.map lib/librte_vhost/rte_virtio_net.h lib/librte_vhost/vhost.c +2 more+70 -320 replies
6/22vhost: introduce API to fetch negotiated featureslib/librte_vhost/rte_vhost_version.map lib/librte_vhost/rte_virtio_net.h lib/librte_vhost/vhost.c+26 -01 reply
7/22vhost: export vhost vring infolib/librte_vhost/rte_vhost_version.map lib/librte_vhost/rte_virtio_net.h lib/librte_vhost/vhost.c +1 more+59 -00 replies
8/22vhost: export API to translate gpa to vvalib/librte_vhost/rte_vhost_version.map lib/librte_vhost/rte_virtio_net.h lib/librte_vhost/vhost.h +1 more+42 -290 replies
9/22vhost: turn queue pair to vringlib/librte_vhost/vhost.c lib/librte_vhost/vhost.h lib/librte_vhost/vhost_user.c +1 more+42 -800 replies
10/22vhost: export the number of vringsdoc/guides/rel_notes/release_17_05.rst drivers/net/vhost/rte_eth_vhost.c lib/librte_vhost/rte_vhost_version.map +2 more+33 -10 replies
11/22vhost: move the device ready check at proper placelib/librte_vhost/vhost_user.c+18 -220 replies
12/22vhost: drop the Rx and Tx queue macrodoc/guides/rel_notes/release_17_05.rst drivers/net/vhost/rte_eth_vhost.c examples/tep_termination/main.h +2 more+12 -31 reply
13/22vhost: do not include net specific headersdoc/guides/rel_notes/release_17_05.rst examples/vhost/main.h lib/librte_vhost/rte_virtio_net.h +1 more+13 -40 replies
14/22vhost: rename device ops structdoc/guides/prog_guide/vhost_lib.rst doc/guides/rel_notes/release_17_05.rst drivers/net/vhost/rte_eth_vhost.c +6 more+15 -120 replies
15/22vhost: rename virtio-net to vhostdoc/guides/prog_guide/vhost_lib.rst lib/librte_vhost/rte_virtio_net.h+10 -100 replies
16/22vhost: add features changed callbackdoc/guides/prog_guide/vhost_lib.rst lib/librte_vhost/rte_virtio_net.h lib/librte_vhost/vhost_user.c+20 -10 replies
17/22vhost: export APIs for live migration supportlib/librte_vhost/rte_vhost_version.map lib/librte_vhost/rte_virtio_net.h lib/librte_vhost/vhost.c +2 more+114 -360 replies
18/22vhost: introduce API to start a specific driverdoc/guides/prog_guide/vhost_lib.rst doc/guides/rel_notes/release_17_05.rst drivers/net/vhost/rte_eth_vhost.c +7 more+104 -1030 replies
19/22vhost: rename header filedoc/guides/rel_notes/deprecation.rst doc/guides/rel_notes/release_17_05.rst drivers/net/vhost/rte_eth_vhost.c +11 more+438 -4442 replies
20/22vhost: workaround the build dependency on mbuf headerlib/librte_vhost/rte_vhost.h+2 -00 replies
21/22vhost: do not destroy device on repeat mem table messagelib/librte_vhost/vhost_user.c+0 -60 replies
22/22examples/vhost: demonstrate the new generic vhost APIsexamples/vhost/Makefile examples/vhost/main.c examples/vhost/main.h +1 more+465 -70 replies

Reviews trailers per patch

21 of 22 patches have a Reviewed-by or Acked-by.

PatchMaxime Coquelin
1/22R-b
2/22A-b
3/22R-b
4/22R-b
5/22R-b
6/22R-b
7/22R-b
8/22R-b
9/22R-b
10/22R-b
11/22R-b
12/22R-b
13/22R-b
14/22R-b
15/22R-b
16/22R-b
17/22R-b
18/22R-b
19/22R-b
20/22R-b
21/22R-b
22/22

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 00/22] vhost: generic vhost API

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
Signature · 1 line
1.9.0