Skip to contentSkip to conversation

examples/vhost: add vhostpmd support

PATCH New Sivaprasad Tummala 1 participant 1 message Apr 1, 2020 1 message not in the archive Arm/Amlogic Meson SoC support

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): v3-examples-vhost-add-vhostpmd-support.patch

#1 lore raw

PATCH v4 1/1 examples/vhost: add vhostpmd support

Added vHostPMD based configuration of vHost devices. Currently vHost library calls are used for configuring the vhost device.

vHostPMD is a pre-requisite for enabling future features supported such as FPGA and possibly CBDMA. With the vHostPMD integration, upstream features in PMD can be easily supported and additional features such as queue stats for vhost devices can be useful.

With the patch, user has an option to select
vHost PMD by passing "--use-vhost-pmd" option.
Disabled by default.

Note: vHost multi-queue is not enabled on this patch.

---
v4:
- Fixed meson dependancies
- documentation updated

V3:
- Fixed patch apply issues
- edited rte_exit info

V2:
- Reverted unregister_device to unregister_drivers - Ye Xiaolong
- Updated port_init to log and return error to main - Ye Xiaolong
- unregister_drivers for previous created vhost ports for failed vhost port configure - Ye Xialong

---
 doc/guides/sample_app_ug/vhost.rst |   4 +
 examples/vhost/Makefile            |   4 +
 examples/vhost/main.c              | 491 ++++++++++++++++++++++++-----
 examples/vhost/main.h              |   1 +
 examples/vhost/meson.build         |   3 +
 5 files changed, 420 insertions(+), 83 deletions(-)
doc/guides/sample_app_ug/vhost.rst +4 -0
index a71ada654..bb6275249 100644
@@ -152,6 +152,10 @@ note that if NIC is bound to driver with iommu enabled, dequeue zero copy
 cannot work at VM2NIC mode (vm2vm=0) due to currently we don't setup iommu
 dma mapping for guest memory.
 
+**--use-vhost-pmd**
+vHost DPDK PMD will be enabled when this option is given. By default, vHost
+direct library calls are used to configure devices.
+
 **--vlan-strip 0|1**
 VLAN strip option is removed, because different NICs have different behaviors
 when disabling VLAN strip. Such feature, which heavily depends on hardware,
examples/vhost/Makefile +4 -0
index f2b161541..ac4b132ef 100644
@@ -63,6 +63,10 @@ CFLAGS += -DALLOW_EXPERIMENTAL_API
 CFLAGS += -O2 -D_FILE_OFFSET_BITS=64
 CFLAGS += $(WERROR_FLAGS)
 
+ifeq ($(CONFIG_RTE_LIBRTE_PMD_VHOST),y
+LDLIBS += -lrte_pmd_vhost
+endif
+
 include $(RTE_SDK)/mk/rte.extapp.mk
 
 endif
examples/vhost/main.c +408 -83

578 lines not on this page · raw message

examples/vhost/main.h +1 -0
index 7cba0edbf..023f43891 100644
@@ -48,6 +48,7 @@ struct vhost_dev {
 	volatile uint8_t remove;
 
 	int vid;
+	uint16_t eth_dev_id;
 	uint64_t features;
 	size_t hdr_len;
 	uint16_t nr_vrings;
examples/vhost/meson.build +3 -0
index 872d51153..aed48eabc 100644
@@ -10,6 +10,9 @@ if not is_linux
 	build = false
 endif
 deps += 'vhost'
+if dpdk_conf.has('RTE_LIBRTE_PMD_VHOST')
+	deps += 'pmd_vhost'
+endif
 allow_experimental_apis = true
 sources = files(
 	'main.c', 'virtio_net.c'
Signature · 1 line
2.17.1