path: root/examples/vhost_scsi
AgeCommit message (Collapse)Author
2019-10-25examples: delete vhost SCSI exampleJin Yu
This example is too old and SPDK will not maintain this example anymore. Also SPDK has submitted a new vhost example vhost-blk. We will keep on maintaining vhost-blk and It shows the packed ring and live recovery support. Signed-off-by: Jin Yu <> Reviewed-by: Maxime Coquelin <>
2019-10-07vhost: add missing experimental flagJim Harris
This function is listed under EXPERIMENTAL in the, so it needs to be marked with __rte_experimental in the header file as well. Found by when trying to compile DPDK with -finstrument-functions. This script didn't catch this in the normal case, since the function is declared __rte_always_inline. This also requires updating the vhost_scsi example to allow use of this newly marked experimental API. Signed-off-by: Jim Harris <> Reviewed-by: Maxime Coquelin <>
2019-08-05remove extra blank lines at end of filesStephen Hemminger
There should not be blank lines at end of files. Signed-off-by: Stephen Hemminger <> Acked-by: Bruce Richardson <>
2019-07-03examples: fix pkg-config detection with older makeBruce Richardson
Make versions before 4.2 did not have support for the .SHELLSTATUS variable, so use another method to detect shell success. Fixes: 22119c4591a0 ("examples: use pkg-config in makefiles") Cc: Signed-off-by: Bruce Richardson <> Acked-by: Luca Boccassi <>
2019-07-02examples: support relocated DPDK installBruce Richardson
For testing of DPDK, we want to override the prefix given by the pkg-config file, so that we can get correct paths for DPDK installed in an unusual location. Signed-off-by: Bruce Richardson <> Acked-by: Luca Boccassi <>
2019-06-03build: remove unnecessary large file support definesBruce Richardson
Since we now always use _FILE_OFFSET_BITS=64 flag when building DPDK, we can remove the Makefile and C-file #defines setting it individually for parts of the build. Signed-off-by: Bruce Richardson <> Acked-by: Luca Boccassi <>
2019-05-20examples: fix make clean when using pkg-configBruce Richardson
The "make clean" command had a number of issues: - the "--ignore-fail-on-non-empty" flag is not present on BSD - the call to remove the build folder would fail if there was no build folder present. These are fixed by only removing the build folder if it exists, and by using -p flag to rmdir in place of --ignore-fail-on-non-empty Fixes: 22119c4591a0 ("examples: use pkg-config in makefiles") Cc: Signed-off-by: Bruce Richardson <> Acked-by: Luca Boccassi <>
2019-04-23examples/vhost_scsi: fix null-check for parameterBruce Richardson
Coverity points out that there is a check in the main thread loop for the ctrlr->bdev being NULL, but by that stage the pointer has already been dereferenced. Therefore, for safety, before we enter the loop do an initial check on the parameter structure. Coverity issue: 158657 Fixes: db75c7af19bb ("examples/vhost_scsi: introduce a new sample app") Cc: Signed-off-by: Bruce Richardson <> Reviewed-by: Tiwei Bie <>
2019-04-23examples/vhost_scsi: fix header check for meson buildBruce Richardson
The header check for the example app was looking for virtio_scsi.h without the "linux/" prefix, which meant it was never getting found when it should have been. Fixes: 8d47a753b7cb ("examples/vhost_scsi: disable build if missing dependency") Cc: Signed-off-by: Bruce Richardson <> Reviewed-by: Tiwei Bie <>
2019-04-17build: increase readability via shortcut variablesBruce Richardson
Define variables for "is_linux", "is_freebsd" and "is_windows" to make the code shorter for comparisons and more readable. Signed-off-by: Bruce Richardson <> Reviewed-by: David Marchand <> Acked-by: Luca Boccassi <>
2019-04-04replace snprintf with strlcpy without adding extra includeBruce Richardson
For files that already have rte_string_fns.h included in them, we can do a straight replacement of snprintf(..."%s",...) with strlcpy. The changes in this patch were auto-generated via command: spatch --sp-file devtools/cocci/strlcpy-with-header.cocci --dir . --in-place Signed-off-by: Bruce Richardson <>
2019-03-30examples: detect default build directoryBruce Richardson
Most examples have in their makefiles a default RTE_TARGET directory to be used in case RTE_TARGET is not set. Rather than just using a hard-coded default, we can instead detect what the build directory is relative to RTE_SDK directory. This fixes a potential issue for anyone who continues to build using "make install T=x86_64-native-linuxapp-gcc" and skips setting RTE_TARGET explicitly, instead relying on the fact that they were building in a directory which corresponded to the example default path - which was changed to "x86_64-native-linux-gcc" by commit 218c4e68c1d9 ("mk: use linux and freebsd in config names"). Signed-off-by: Bruce Richardson <> Acked-by: Ferruh Yigit <>
2019-03-12mk: use linux and freebsd in config namesBruce Richardson
Rather than using linuxapp and bsdapp everywhere, we can change things to use the, more readable, terms "linux" and "freebsd" in our build configs. Rather than renaming the configs we can just duplicate the existing ones with the new names using symlinks, and use the new names exclusively internally. ["make showconfigs" also only shows the new names to keep the list short] The result is that backward compatibility is kept fully but any new builds or development can be done using the newer names, i.e. both "make config T=x86_64-native-linuxapp-gcc" and "T=x86_64-native-linux-gcc" work. Signed-off-by: Bruce Richardson <>
2019-03-12build/linux: rename macro from LINUXAPP to LINUXBruce Richardson
Rename the macro to make things shorter and more comprehensible. For both meson and make builds, keep the old macro around for backward compatibility. Signed-off-by: Bruce Richardson <>
2019-02-27examples/vhost_scsi: disable build if missing dependencyAaron Conole
The vhost_scsi example code is set to build, even if the requisite header file virtio_scsi.h isn't available. This happens on some Ubuntu systems when some versions of the libc-dev package aren't available. Check whether the virtio_scsi.h file exists, and if not, set the build flag to false. Signed-off-by: Aaron Conole <> Acked-by: Bruce Richardson <>
2018-10-22mk: build with _GNU_SOURCE defined by defaultAnatoly Burakov
We use _GNU_SOURCE all over the place, but often times we miss defining it, resulting in broken builds on musl. Rather than fixing every library's and driver's and application's makefile, fix it by simply defining _GNU_SOURCE by default for all builds. Remove all usages of _GNU_SOURCE in source files and makefiles, and also fixup a couple of instances of using __USE_GNU instead of _GNU_SOURCE. Signed-off-by: Anatoly Burakov <>
2018-07-12examples: make Linux environment check consistentThomas Monjalon
Some Makefiles are using CONFIG_RTE_EXEC_ENV and others are using CONFIG_RTE_EXEC_ENV_LINUXAPP. Use the latter one for consistency. We could remove CONFIG_RTE_EXEC_ENV later if considered useless. Signed-off-by: Thomas Monjalon <>
2018-05-13examples/vhost_scsi: replace strncpy with strlcpyReshma Pattan
Use strlcpy instead of strncpy. Fixes: db75c7af19 ("examples/vhost_scsi: introduce a new sample app") Cc: Signed-off-by: Reshma Pattan <> Acked-by: Bruce Richardson <>
2018-04-23examples/vhost_scsi: move to safe GPA translation APIMaxime Coquelin
This patch uses the new rte_vhost_va_from_guest_pa() API to ensure all the descriptor buffer is mapped contiguously in the application virtual address space. As the application did not checked return of previous API, this patch just print an error if the buffer address isn't in the vhost memory regions or if it is scattered. Ideally, it should handle scattered buffers gracefully. This issue has been assigned CVE-2018-1059. Signed-off-by: Maxime Coquelin <>
2018-04-17examples: disable unsupported examples on BSD buildBruce Richardson
When building with meson, set build to false when building unsupported example apps on FreeBSD. Signed-off-by: Bruce Richardson <> Tested-by: Harry van Haaren <>
2018-02-05examples/vhost_scsi: drop unimplemented event index featureStefan Hajnoczi
The vhost_scsi example application negotiates the VIRTIO_RING_F_EVENT_IDX feature bit but does not honor it when accessing vrings. In particular, commit e37ff954405addb8ea422426a2d162d00dcad196 ("vhost: support virtqueue interrupt/notification suppression") broke vring call because vq->last_used_idx is never updated by vhost_scsi. The vq->last_used_idx field is not even available via the librte_vhost public API, so VIRTIO_RING_F_EVENT_IDX is currently only usable by the built-in virtio_net.c driver in librte_vhost. This patch drops VIRTIO_RING_F_EVENT_IDX from vhost_scsi so that vring call works again. Signed-off-by: Stefan Hajnoczi <> Reviewed-by: Changpeng Liu <> Acked-by: Yuanhan Liu <>
2018-01-30build: replace license text with SPDX tagBruce Richardson
Signed-off-by: Bruce Richardson <> Reviewed-by: Luca Boccassi <>
2018-01-30examples: enable linking both static and sharedBruce Richardson
Since the DPDK build now includes both static and shared libraries, we need a new way to enable building the examples using either method from the one installation. To do this, we add in a default "shared" target, and a separate "static" target which links in the DPDK static libraries. In both cases, the final application name is symlinked to the last-built static or shared target, with both binaries able to co-exist in the build directory. Signed-off-by: Bruce Richardson <> Acked-by: Luca Boccassi <>
2018-01-30examples: use pkg-config in makefilesBruce Richardson
Change the example app Makefiles to query if DPDK is installed and registered using pkg-config. If so, build directly using pkg-config info, otherwise fall back to using the original build system with RTE_SDK and RTE_TARGET This commit changes the makefiles for the basic examples, i.e. those which do not have multiple subdirectories underneath the main examples dir. Examples not covered are: * ethtool * multi_process * performance-thread * quota_watermark * netmap_compat * server_node_efd * vm_power_manager Signed-off-by: Bruce Richardson <> Reviewed-by: Luca Boccassi <>
2018-01-30examples: put app name and sources at top of makefilesBruce Richardson
Reorder the text in the makefiles, so that the app name and the source files are listed first. This then will allow them to be shared later in a combined makefile building with pkg-config and RTE_SDK-based build system. Signed-off-by: Bruce Richardson <> Reviewed-by: Luca Boccassi <>
2018-01-30examples: build some samples with mesonBruce Richardson
Add support for having selected example apps built as part of a meson, ninja build. By default none are built, and those to be built should be named directly in the -Dexamples='' meson configuration argument. This is useful for developers working on a feature who want to use a suitable example, or examples, to test that feature, as they can compile everything up in one go, and run the example without having to do a ninja install first. This commit adds examples which don't consist of multiple apps in subdirectories to the meson build, so they can be built by default by passing -Dexamples parameter to meson. Not included are the following examples: * ethtool * multi-process * netmap_compat * performance-thread * quota_watermark * server_node_efd * vm_power_manager To test the apps added here, use the following command, merged to one line, to add them to your meson build (command to be run inside the build directory): meson configure -Dexamples=bbdev_app,bond,cmdline,distributor,\ eventdev_pipeline_sw_pmd, exception_path,helloworld,\ ip_fragmentation,ip_pipeline,ip_reassembly, ipsec-secgw,\ ipv4_multicast,kni,l2fwd-cat,l2fwd-crypto,l2fwd-jobstats,\ l2fwd-keepalive,l2fwd,l3fwd-acl,l3fwd-power,l3fwd-vf,l3fwd,\ link_status_interrupt,load_balancer,packet_ordering,ptpclient,\ qos_meter,qos_sched,rxtx_callbacks,skeleton,tep_termination,\ timer,vhost,vhost_scsi,vmdq,vmdq_dcb Signed-off-by: Bruce Richardson <> Reviewed-by: Luca Boccassi <>
2018-01-16vhost: introduce vring call APIStefan Hajnoczi
Users of librte_vhost currently implement the vring call operation themselves. Each caller performs the operation slightly differently. This patch introduces a new librte_vhost API called rte_vhost_vring_call() that performs the operation so that vhost-user applications don't have to duplicate it. Signed-off-by: Stefan Hajnoczi <> Reviewed-by: Maxime Coquelin <> Acked-by: Yuanhan Liu <>
2018-01-04examples: use SPDX tag for Intel copyright filesBruce Richardson
Replace the BSD license header with the SPDX tag for files with only an Intel copyright on them. Signed-off-by: Bruce Richardson <>
2017-10-25examples/vhost_scsi: fix product id string terminationJacek Piasecki
Use snprintf instead strncpy to get safe null string termination. There was possible to get not terminated string after strncpy operation. Coverity issue: 158631 Fixes: db75c7af19bb ("examples/vhost_scsi: introduce a new sample app") Cc: Signed-off-by: Jacek Piasecki <> Acked-by: Maxime Coquelin <>
2017-07-19examples/vhost_scsi: introduce a new sample appChangpeng Liu
vhost-user protocol is common to many virtio devices, such as virtio_net/virtio_scsi/virtio_blk. Since DPDK vhost library removed the NET specific data structures, the vhost library is common to other virtio devices, such as virtio-scsi. Here we introduce a simple memory based block device that can be presented to Guest VM through vhost-user-scsi-pci controller. Similar with vhost-net, the sample application will process the I/Os sent via virt rings. Signed-off-by: Changpeng Liu <>