We plan to use these buffers for more than just reads.
Change-Id: I8fa6cb432a6cfe4406fbf240cd3aa2ae4ab5f3d5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
The user can get there via the bdev, so this didn't
have a purpose.
Change-Id: I7f85bb71d5ee238d37ba3624d0ac68a161c95e49
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Older kernel headers don't have the definition of this macro, so define
it if necessary.
This is the same workaround as used in rte_vhost/vhost.h.
Change-Id: I01e0661db05de517adf8e24a47c63d32853cd385
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
vhost_net.c file is not needed and fail scan build so remove it.
Change-Id: I5817201373f7253cc8bc1a9bdc5884197e166a14
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
guest_pages is being allocated in vhost_setup_mem_table(), reallocated
in add_one_guest_page(), but never freed. This patch fixes a memory
leak.
Change-Id: Ie381c43bafea5cdea2ac9f057c0282044a340dce
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
This prevents from destroying & recreating user device in "incomplete"
vring state. virtio_is_ready() was returning true for devices with
vrings which did not have valid callfd (their VHOST_USER_SET_VRING_CALL
hasn't arrived yet)
Change-Id: Idc4b41efd544ff5c6b093a5a48798b41c55bbe06
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
vhost-net devices might keep track of last descriptors indices by
themselves, and assuming they initially start at 0, but that is not the
case for vhost-scsi. Initial last descriptor indices are set via
VHOST_USER_SET_VRING_BASE message, and we cannot possibly predict what
will they be. Setting these to vqueue->used->idx is also not an option,
because there might be some yet unprocessed requests between these and
the actual last_idx. This patch adds API for getting/setting last
descriptor indices of vrings, so that they can be synchronized between
user-device and rte_vhost.
The last_idx flow could be as following:
* vhost start
* received SET_VRING_BASE msg, last_idx is set on rte_vhost side
* created user-device, last_idx pulled from rte_vhost
* requests are being processed by user-device, last_idx changes
* destroyed user-device, last_idx pushed to rte_vhost
* *at this point, vrings could be recreated and another SET_VRING_BASE
message could arrive, so last_idx would be set*
* recreated user-device, last_idx pulled from rte_vhost
Change-Id: I247ba4e461a2a2b524ccade364f5b7bf260f7538
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
There is an issue when QEMU sets new memory table just after guest OS
starts booting. Then, if guest OS tries to issue any I/O to device (e.g.
using BIOS INT13h - EDD) it will get stuck because previous addresses of
mmaped memory might change.
To fix this issue, defer using the new mem table until after we receive
the first SET_VRING_ADDR message. SET_VRING_ADDR will be sent by QEMU
when guest OS virtio (e.g. virtio-scsi) driver starts initialization.
At this point it is safe to invalidate the old mem tables because there
will be no more outstanding IO at this point.
Change-Id: I24772be87a8b6c8781868b9b7773317761499748
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
For now DPDK assumes that callfd, kickfd and last_idx are being set just
once during vring initialization and device cannot be running while DPDK
receives SET_VRING_KICK, SET_VRING_CALL and SET_VRING_BASE messages.
However, that assumption is wrong. For Vhost SCSI messages might arrive
at any point of time, possibly multiple times, one after another.
QEMU issues SET_VRING_CALL once during device initialization, then again
during device start. The second message will close previous callfd,
which is still being used by the user-implementation of vhost device.
This results in writing to invalid (closed) callfd.
This patch destroys vhost device before setting callfd, kickfd and last
vring indices. It will be recreated right after (with updated vring
data).
Change-Id: I293bd91106f53f6c2f65d8b8a41f47ae7548cddc
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
This will be decoupled from the build to start. Next
patches will modify this code to prepare it for use with
SPDK vhost-scsi. The final patch will replace the existing
v17.02-based code with this version, and make the necessary
SPDK vhost changes to use it.
This enables to better track the differences between upstream
DPDK and our internal copy, while not breaking the build at
any point in the git history.
While here, expand the POSIX include file check to exclude
any directory starting with lib/vhost/rte_vhost (which would
include this new directory).
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Icf1202c1b7a898edff12aa226943a08b578cf962
Scan the source for POSIX includes outside of the
allowed locations in check_format.sh. This only
tests for POSIX headers - not Linux Standards Base.
Also, fix one bug that was caught by this addition.
Change-Id: Ib0ca93fe6ac552dc49d95b27b4803e40282027e8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
LOG_DEBUG is a symbol defined by POSIX, so if sys/log.h
is included the symbols conflict.
We'll need to push this patch to upstream DPDK too.
Change-Id: Ib263731864aca4791226ea6e3abb5ddfe42e97d8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
FOREACH_DEVICE_ON_PCIBUS macro has been defined since rc2.
Change-Id: Iad61401520735dfde4e5715c32e74a54a2dff7da
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Replace with it with check the returned req
via spdk_unlikely macro
Change-Id: I1202b3955af9a68496d8ced7cf66c20cf26f7fff
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
The SCSI layer always passes task->iovs to spdk_bdev_readv(), so there
is no way for task->iovs != bdev_io->u.read.iovs to be true.
Change-Id: I4c0a2075c6e50e4304d62707a29bededa37b4e5c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The SCSI task bdev I/O should never be pending when spdk_scsi_task_put()
is called, and just setting the status to failed is not correct (when
the bdev eventually completes the I/O, it will write into the now-freed
bdev_io, which may be reused by someone else).
Change-Id: Iaad6ce9ab41539652abc40147fed47c5012109dc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The SCSI layer was not using the task ID for anything; the iSCSI layer
was using it to store the task tag, so move it there and rename it to
"tag" to make its purpose clear.
Change-Id: Ibda4f4e215056116b9be4a3a0264f98bc4c29535
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The SCSI layer doesn't use subtasks; these are an iSCSI layer concept.
Change-Id: I83871f02362f10fd4ecd4b2a1544eb76bfa53595
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
In the pattern set by spdk_bdev_io_complete_nvme_status(), allow
blockdev modules to complete a bdev_io with a SCSI status code.
Also move it to the internal bdev header file, since only bdev modules
should be setting bdev_io status codes.
Change-Id: I8b6afad2c02d7c010c5e60f06a7c7e0785eb87ca
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Move the scsi_nvme translation code from the SCSI library into bdev, and
provide a generic way to translate any bdev_io status into a SCSI
status.
Change-Id: Ib61a6209387c24543e31574e2b5ca249e2ac8b74
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Since we keep a copy of DPDK vhost library, the header file don't
have dependency on DPDK vhost library.
Change-Id: I14d48e10227633547231e4f429e7375ffa76128d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
The code will locks clear to put those definitions into tree.h header
Change-Id: Ib1a34f19d9849acd7ea979eb0a6e153b0e8e39de
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Since DPDK 17.05 API rte_eal_device_insert is only used for
virtual device scan and initialization, for PCI devices
which use Domain:Bus:Dev:Function, this API is no longer
valid.
Change-Id: I1ab63dfc3af188d01836e67cd8db745e035fc450
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
These channels can handle generic bdev context.
Change-Id: I61f41884ddf4cf86fa156e9051421b354bbb349d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
When destroying a connection, we need to check if we got to
full feature phase before freeing any io channels. This is because
the io channels are only allocated as part of a successful login.
The Calsoft iSCSI test suite has tests which will fail login.
Since the test system was just using a malloc backend with memcpy,
so even though a channel was NULL in some cases, it was never used
since the memcpy engine doesn't need it.
This prepares for some future patches which extend the use
of io channels in the bdev layer.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2fb7b18a781caa0aadca319aa1e61a6ccf2c55fd
This allows astyle to format the cast of address-of operations
correctly.
Change-Id: I9c8a4545c44601e769acc712ec7acf3a96f45ebb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The ISID field is a 6-byte field in network (big-endian) byte order.
The previous code was casting the uint8_t isid[6] value into uint64_t,
which was actually casting the address of the first byte of isid (not
the contents of the array), and it was also not correctly converting
byte order.
Change-Id: Idd114e06d30040cf28931d7da7ffdc8d6c45e82a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Avoid allocating a large amount of stack space when increasing
NVME_MAX_CONTROLLERS.
Change-Id: I7017e5ed9f4d4f5c860dac608c3e5ae3c35864e7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The contents of struct spdk_scsi_lun don't need to be part of the public
API.
Change-Id: I101b77871054557380610fd901ab38bada463202
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
The VirtualBox emulated NVMe device will intermittently
hang on the first read/write command after an I/O
qpair has been allocated. The frequency of the hang
diminishes if a delay is added after allocating the I/O
qpair - until it disappears completely with a 100us delay.
So add a quirk to insert this delay.
Note - the 100us delay was tested by running
the hello_world example app 50000 times.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I237e31b1b8a1a1e28262851ae0a21cd7345f0f1a