e2a3f1cc6e
Make sure DEBUG macro is not defined while processing log macros, otherwise DEBUG (which should be passed as is down to RTE_LOG and concatenated with RTE_LOG_ prefix) gets substituted too early: In file included from /spdk/dpdk/build/include/rte_debug.h:46:0, from /spdk/dpdk/build/include/rte_pci.h:85, from rte_virtio/virtio_dev.c:48: rte_virtio/virtio_dev.c: In function ‘virtio_init_vring’: /spdk/dpdk/build/include/rte_log.h:333:11: error: ‘RTE_LOG_1’ undeclared (first use in this function) rte_log(RTE_LOG_ ## l, \ ^ rte_virtio/virtio_logs.h:41:2: note: in expansion of macro ‘RTE_LOG’ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) ^ rte_virtio/virtio_logs.h:42:31: note: in expansion of macro ‘PMD_INIT_LOG’ #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") ^ rte_virtio/virtio_dev.c:82:2: note: in expansion of macro ‘PMD_INIT_FUNC_TRACE’ PMD_INIT_FUNC_TRACE(); While at this, change format string type specifier to the correct one. Change-Id: I7f7bda105aa00b99bea4ea5f6a9bff268940a557 Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com> Reviewed-on: https://review.gerrithub.io/377945 Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> |
||
---|---|---|
.. | ||
rte_virtio | ||
bdev_virtio.c | ||
Makefile | ||
README.md |
SPDK virtio bdev module
This directory contains an experimental SPDK virtio bdev module. It currently supports very basic enumeration capabilities for virtio-scsi devices as well as read/write operations to any SCSI LUNs discovered during enumeration.
It supports two different usage models:
- PCI - This is the standard mode of operation when used in a guest virtual machine, where QEMU has presented the virtio-scsi controller as a virtual PCI device. The virtio-scsi controller might be implemented in the host OS by SPDK vhost-scsi, kernel vhost-scsi, or a QEMU virtio-scsi backend.
- User vhost - Can be used to connect to an SPDK vhost-scsi target running on the same host.
Note that 1GB hugepages is pretty much required to use this driver in user-vhost mode. vhost protocol requires passing a file descriptor for each region of memory being shared with the vhost target. Since DPDK opens every huge page explicitly, it is fairly limited on how many file descriptors it can pass due to the VHOST_MEMORY_MAX_NREGIONS limit of 8.
Use the following configuration file snippet to enumerate a virtio-scsi PCI device and present its LUNs as bdevs. Currently it will only work with a single PCI device.
[Virtio]
Dev Pci
Use the following configuration file snippet to enumerate an SPDK vhost-scsi controller and present its LUNs as bdevs. In this case, the SPDK vhost-scsi target has created an SPDK vhost-scsi controller which is accessible through the /tmp/vhost.0 domain socket.
[Virtio]
Dev User /tmp/vhost.0
Todo:
- Support multiple PCI devices, including specifying the PCI device by PCI bus/domain/function.
- Add unmap support.
- Add I/O channel support. Includes requesting correct number of queues (based on core count). Fail device initialization if not enough queues can be allocated.
- Add RPCs.
- Break out the "rte_virtio" code into a separate library that is not linked directly to the bdev module. This would allow that part of the code to potentially get used and tested outside of the SPDK bdev framework.
- Check for allocation failures in bdev_virtio.c code.
- Add SPDK_TRACELOGs.
- Add virtio-blk support. This will require some rework in the core virtio code (in the rte_virtio subdirectory) to allow for multiple device types.
- Bottom out on whether we should have one virtio driver to cover both scsi and blk. If these should be separate, then this driver should be renamed to something scsi specific.
- Add reset support.
- Finish cleaning up "eth" references. This includes filenames like virtio_ethdev.c and "eth" in various API calls.
- Understand and handle queue full conditions.
- Clear interrupt flag for completions - since we are polling, we do not need the virtio-scsi backend to signal completion.
- Check interrupt flag for submission. If the backend requires an interrupt, we need to signal it.
- Change read/write to use READ_16/WRITE_16 to handle LBA > 4G. We can add a basic check and bail during enumeration if INQUIRY indicates the LUN does not support >= SBC-3.
- Automated test scripts for both PCI and vhost-user scenarios.
- Document Virtio config file section in examples. Should wait on this until enough of the above items are implemented to consider this module as ready for more general use.
- Specify the name of the bdev in the config file (and RPC) - currently we just hardcode a single bdev name "Virtio0".