Commit Graph

102 Commits

Author SHA1 Message Date
Pawel Wodkowski
05fd28399a vhost_scsi: fix bug with tasks enqueue/dequeue
We need MP MC ring for tasks. So instead implementing this add per
controller ring to avoid this issue.

Change-Id: I5926ad7866ab28251aeebd163917de2df2b44a22
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/368547
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-11 17:23:25 -04:00
Fam Zheng
ee263a80fc vhost: Fix spdk_iommu_mem_unregister
The function body uses VFIO_IOMMU_MAP_DMA which appears to be a
copy&paste mistake, make it VFIO_IOMMU_UNMAP_DMA because we are doing
the opposite of spdk_iommu_mem_register.

Change-Id: If9f3b188178e71ff71221c77c1680b679fec1df0
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-on: https://review.gerrithub.io/368551
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-10 20:27:28 -04:00
Daniel Verkamp
2bdec64fbf jsonrpc: modify API to pass request to handler
This will enable asynchronous request handling in a future patch, and it
also removes the need for the RPC handlers to know about request id and
the JSON-RPC rules about notification-only requests.

Change-Id: I25aaa8e48bff8d5594ffcccecb61842b1e31ec3c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/368225
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-06 13:48:12 -04:00
Pawel Niedzwiecki
a264d9d2a3 Vhost: add support of VITRIO_BLK_F_RO
-Add a configuration option: Read-only flag

Vhost block controller can be set in read-only mode.
Option can be enabled in config file or in RPC call:
'construct_vhost_block_controllerr' with '-r' option

Change-Id: I7e58243be00d33bc04120d573fd4ed7775bb9b2c
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/366086
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-06 12:55:49 -04:00
Jim Harris
57d174ff67 bdev: add spdk_bdev_open/close
Retire the old claim/unclaim semantics in favor of
open/close.  Clients must now open a bdev to get
an spdk_bdev_desc, then pass this desc to get an
I/O channel.

This allows multiple clients to open a bdev,
although only one may open a bdev with write
access.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4d319f1278170124169a8a75fd791e926b3f7171

Reviewed-on: https://review.gerrithub.io/367611
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-07-05 18:04:28 -04:00
Dariusz Stojaczyk
76e5900d50 vhost_scsi: implemented vhost device hotremove
Vhost devices can now be removed via RPC at any time.

Change-Id: Ib91dd6eb11ae8c777e8b9498d140e89a3fe382db
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/366726
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-07-05 17:11:55 -04:00
Pawel Niedzwiecki
ff88449d6e vhost-block: add RPC calls
Following RPC calls are added
-add/remove controller
-list controllers

Change-Id: Idba407a61640de32875f7c347d609b6b9137dd63
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/363688
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-07-05 14:33:28 -04:00
Seth Howell
82cc48c862 vhost/vhost_internal: Add VIRTIO_BLOCK_F_CONFIG_WCE definition
This flag is needed for compatibility with older versions of the virtio_blk library.

Change-Id: I8243d51a39971dd37d0c65b29bd976b5b84978aa
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/367612
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-30 16:54:03 -04:00
Dariusz Stojaczyk
c6703d8d6e vhost_scsi: replaced DPDK's RTE_DIM and unlikely() with SPDK alternatives
Removed yet another direct DPDK dependencies.

Change-Id: I4df3cb8975bb7a00b1316ef7ed449248f28ab7ee
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/366724
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-30 16:32:47 -04:00
Dariusz Stojaczyk
67cd059c11 vhost_scsi: moved spdk_scsi_task_construct() out of spdk_vhost_get_tasks()
spdk_vhost_get_tasks() is now fully generic function for getting tasks,
which have to be specifically initialized *later*.
This allows us to remove extra loop inside spdk_vhost_get_tasks().

Change-Id: I9a9155189599cbae1b2eb94f64fba29a3e2d010b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/366723
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>
2017-06-30 16:32:47 -04:00
Dariusz Stojaczyk
d3d4a688cd vhost_scsi: added spdk_vhost_task_init_target()
Removed get_scsi_dev and get_scsi_lun functions, moved virtio lun field
parsing into a single function.

Change-Id: I2d1588491e0aee523b053d8ea49fdc6bb7f90613
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/366721
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-30 16:32:47 -04:00
Dariusz Stojaczyk
62eb231574 vhost: removed task.h/task.c
Vhost scsi tasks aren't complicated enough to have their own files.
Also used spdk_ring instead of rte_membuf for task management.
This patch is a first step towards making vhost task pool
queue-specific, so that it can be single-producer, single-consumer.

Change-Id: I181417f49ccd9a5b8f53d4b96c9fefddca087692
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/366720
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-30 16:32:47 -04:00
Dariusz Stojaczyk
b3ecb4c45c vhost_scsi: get vhost tasks in bulks
Instead of getting tasks from mempool 1 by 1, prefetch a whole chunk.

Change-Id: I17f61e3de9b081b61af7a2a8568681aafe26ab0a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/366719
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-30 16:32:47 -04:00
Dariusz Stojaczyk
475d400394 vhost: removed spdk_vhost_dev_task_ref/unref
Removed these functions in preperation to removing task.h/task.c.

Change-Id: I84b3c81505c0b8a7d08e2ca803aada1d20bc518e
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/366718
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-30 16:32:47 -04:00
Dariusz Stojaczyk
b93a37a8fb rte_vhost: added error log in vhost_user_set_features
Since vhost_user_set_features failure is not handled in any way, a
single error log has been added to at least to let the user know that
something has gone wrong.

Change-Id: Ifcf27320af75ba74347b742643b23e43b7c01149
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/365807
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-30 16:32:47 -04:00
Dariusz Stojaczyk
0c471fd668 vhost_scsi: enable VIRTIO_SCSI_F_CHANGE flag
As of virtio spec 1.0, driver must not accept flags which the device
did not offer (section 2.2). However, that flag is apparently being
accepted, causing silent exception to be triggered in rte_vhost. This
results in all negotiated features to be rejected in rte_vhost.

This patch is a workaround. Enabling that flag does not enforce us to do
any additional actions.

Change-Id: Iede0c0360de33d438f109442c7a83231e9d4479e
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/365806
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-30 16:32:47 -04:00
Dariusz Stojaczyk
5160ffaff5 vhost_scsi: fixed unsafe type conversion from vdev to svdev
A vhost_dev had been explicitly converted to vhost_scsi_dev in a
following manner:
vhost_dev* -> void* -> vhost_scsi_dev*

Change-Id: Idfd4307bfea7385d71e67f140554dfc2e86447b5
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/367310
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>
2017-06-30 16:32:47 -04:00
Dariusz Stojaczyk
3c497395cc vhost_scsi: implemented eventq hotremove
Implemented eventq. For now only hotremove is supported.

Change-Id: I1ec7aa2137173b5dfb30e9906dd41707e371b7a8
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/364285
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-30 16:32:47 -04:00
Dariusz Stojaczyk
f168e45283 vhost_scsi: renamed controlq poller to mgmt poller
Renamed it in preparation for handling eventq & hotremove in the very
same poller. It would only complicate code to handle all of these in
separate pollers.
This patch does not change any functionality on it's own.

Change-Id: I321e2ced0d6afb3ccb66a13bc25bbf42da20417b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/367528
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>
2017-06-30 16:32:47 -04:00
Dariusz Stojaczyk
72343bcf23 scsi: added lun hotremove callback
Added optional callback inside scsi lun hotremove, so that higher-level
abstraction can be notified about hotremove.

Change-Id: I5f1bd8160e3d770a484068dd73928bc2b64c876f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/367309
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>
2017-06-30 16:32:47 -04:00
Pawel Wodkowski
0d7e2b6416 vhost: basic virtio block implementation
Change-Id: Ie48f4acf9aa724256f0a1f67b38c334c43b3e946
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/363090
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-28 21:37:56 -04:00
Changpeng Liu
c9a97addeb vhost: don't start device before got valid descriptor
For each virt queue's kickfd and callfd, there are 2 invalid
status: VIRTIO_UNINITIALIZED_EVENTFD and VIRTIO_INVALID_EVENTFD.
Don't set the virt queue to ready status until got the valid
descriptor.

This is safe for polling mode drivers in Guest OS, the backend
vhost process will not post notification to interrupt vector for
PMD mode in Guest, but the interrupt vector still valid.

Change-Id: Icdf1e67f3c4e8da221843eb1383469ca1fba485c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/365327
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-28 17:56:02 -04:00
Ben Walker
4185205540 scsi: Remove cb_event. It is no longer necessary.
This is an artifact from a past design. There is no longer
any reason to create an event here - the bdev layer will
correctly queue events and call completions on the correct
thread.

Change-Id: I145dab4046899834c0449ec7380dcbb28215b493
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/364831
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-22 10:47:31 -04:00
Karol Latecki
293f920158 test: add vhost test plan
Change-Id: I9a38111eea5ea71f3084642f6b6fe284d981978d
Signed-off-by: Karol Latecki <karolx.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/362667
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-21 19:55:13 -04:00
Ben Walker
aacd61d54a vhost: Move subsystem initialization to event_vhost
This removes one dependency on the event framework.

Change-Id: Ib9c8160b1704a15b662a35d5ad1f32c0b745485c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/365729
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-20 16:58:35 -04:00
Dariusz Stojaczyk
bc70a4d63f vhost_scsi: properly handle requests to unsupported lun
Fixes vhost crash on null lun target.
Added extra check in vhost IO path.

Change-Id: Ia6aa29cce41c2fc74e0a8eec545e6675858a28e3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/365196
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-20 15:25:39 -04:00
Dariusz Stojaczyk
6bd3e2a0a7 vhost_scsi: do not abort on unfinished scsi tasks in destroy_device
Replaced rte_panic with SPDK_ERRLOG (for now).

Change-Id: I7ca012368ba6a49cbbf0397b3750a86da4ab776a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/365026
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-20 15:25:39 -04:00
Dariusz Stojaczyk
db751c1625 Revert "vhost: Don't panic if the task count isn't 0"
This reverts commit 86f215f38d.

Change-Id: Id3d18ffb44586ac38c5bc080a0550e5825d5ef3a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/364947
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-20 15:25:39 -04:00
Ben Walker
8fbaa73e69 vhost: Add a separate subsystem library
This separates the vhost library from the event
framework's subsystem mechanism

Change-Id: I8206fcf0d55bee71c70482d989318e9d118f710a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/365286
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-16 13:10:26 -04:00
Daniel Verkamp
dcb7abc717 vhost_iommu: handle opendir() failure
Change-Id: I82ce702ab1af83c2f5c0197a9766437f0f728dce
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/365067
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-06-15 13:51:54 -04:00
Dariusz Stojaczyk
3bfecec994 vhost_scsi: added "SCSI" keyword to trace flags
To differ them from upcoming VHOST_BLK trace flags

Change-Id: I1e82fb3430a6533cb9980b430d144ea28d269d59
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/363583
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-09 20:18:19 -04:00
Dariusz Stojaczyk
bfd1361714 vhost_scsi: removed deferred tasks
Removed deferred tasks and dynamic memory management in task processing
in vhost_scsi. Each vhost task will now have it's own iovec array

Change-Id: Ie51a2404e9cd3c4e03bcea5a8d5b16498dd4d093
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/363342
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-08 16:36:09 -04:00
Daniel Verkamp
7c418a74cb vhost: avoid use-after-free of vhost task
Change-Id: Ifd4f717ea6e12769c845e10578517da0a28dca11
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/364669
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-06-08 13:35:21 -04:00
Ben Walker
86f215f38d vhost: Don't panic if the task count isn't 0
Instead of crashing if the task count isn't 0 when
shutting down, just print an error and allow the
tasks to leak.

This isn't the long term solution, but it's a lot better than
crashing.

Change-Id: I5d388c759b563953dce8239e9a4e62c3e3db16c4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/364490
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-06-07 17:31:02 -04:00
Pawel Wodkowski
8f371c7d64 vhost: introduce spdk_vhost_vring_desc_to_iov
Extract vring_dev to iovec translation logic to common place.


Change-Id: I0c6fc5582dfe341e867ce6749ff29d14a9d12d94
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/363582
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-07 14:28:54 -04:00
Pawel Wodkowski
1b93872dbb vhost: don't expose backend structures outside backend implementation
Theres no need to have vhost SCSI (and incoming vhost block) structures
available in public API. Generic spdk_vhost_dev might be used to
communicate with backedns. Backends are responsible to check if type of
passed vdev valid.

Change-Id: I850a1cc661166ee146d513b0069bb40edc9a761a
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/363581
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-07 14:28:54 -04:00
Pawel Wodkowski
329d5510e9 vhost: move not SCSI specific parts to internal header
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Change-Id: Id17bf80c19ab05e42db094d4901b06a9bdbe7560
Reviewed-on: https://review.gerrithub.io/363089
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-07 14:28:54 -04:00
Pawel Wodkowski
ae4796ae02 vhost: generalized vhost events
Rework reactor<->pthread comunication logic, so we can reuse it in other
backends.

Change-Id: Id0f02fc9e1e0d9540f8efebdb515384b5714c966
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/362548
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-07 14:28:54 -04:00
Dariusz Stojaczyk
dd071569e9 vhost: expand spdk_vhost_dev_register functionality
Moved vdev initialization inside spdk_vhost_dev_register, so that
particular virtio device implementations don't have to e.g.
manage socket path.

spdk_vhost_dev_unregister was renamed to spdk_vhost_dev_remove

Change-Id: I240385ba25278c056737fed77f21695b2e787c6b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/363584
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-07 14:28:54 -04:00
Daniel Verkamp
adf3cc2bc8 vhost: add fallback if linux/vfio.h is missing
On older kernels that don't have VFIO, stub out the vhost IOMMU
functions.

Fixes build on older distributions (e.g. CentOS 6).

Change-Id: Icda9998e494c24d252511a4da93ecb56502fe5a7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/363473
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-02 19:47:09 -04:00
Changpeng Liu
0a49531fab vhost: remove direct DPDK API call from vhost library
Change-Id: I5bad83197824dfb9042540c573134962a917b8bd
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/363152
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2017-06-02 12:04:15 -04:00
Dariusz Stojaczyk
7d42767817 vhost: removed redundant check in get_scsi_lun()
Each call to get_scsi_lun is preceeded with the same check.

Change-Id: I4597674f0024e923908d85bbfbd5404c500fddb1
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/363172
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-01 14:15:50 -04:00
Tomasz Zawadzki
5e132b6b7a scsi: Set proper transport protocol id
This patch adds property of transport protocol id to spdk_scsi_dev.
This allows to change it depending on which appliation is using
the device. Previously only iSCSI was used for all.

Setting protocol id is done at the time when device is added to
vhost controller (vhost) or target node (iSCSI).

Please note that for SPDK vhost SAS protocol id is used,
as that is what kernel vhost reports as well.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I455a856c5d7796a749b6650fee0218d526e094ed
Reviewed-on: https://review.gerrithub.io/362864
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-06-01 12:10:22 -04:00
Pawel Wodkowski
0888dd4cc6 vhost: add device type field
Change-Id: I848c8c5dcf837c11e052bb03cba962a843f28778
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/363088
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-31 20:25:45 -04:00
Dariusz Stojaczyk
3671543a5b vhost: changed dev_construct()/destruct() to dev_load()/unload()
Since vhost_scsi::new_device() would look mostly the same in vhost_blk,
most of it's logic has been moved into spdk_vhost_dev_construct(),
which is now renamed to spdk_vhost_dev_load().

Change-Id: Ic6db93273f916bd021c2ff68946706d055a514d6
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/362547
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-31 20:25:45 -04:00
Pawel Wodkowski
d7054e23b7 vhost: move VM memory register/unregister to vhost.c
It is not vhost SCSI specific.


Change-Id: I7eff272fcd1aa47135de7178d0763b1793b298ec
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/363087
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-31 20:25:45 -04:00
Pawel Wodkowski
c190dcd767 vhost: move gpa_to_vva to vhost.c
This function is not vhost SCSI specific and can be reused. Also change
type of returned value to 'void *' so no explicit cast is needed.

Change-Id: I33a37856903dacdddae9e73e695cc66465ade089
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/363086
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-31 20:25:45 -04:00
Dariusz Stojaczyk
7a9af3963e vhost: moved vqueue/vring management to vhost.c
vqueue/vring management shouldn't differ between vhost-blk and
vhost-scsi, so it has been moved to vhost.c/vhost_internal.h

Change-Id: I5ecf2f7a34ec28deb94c7abef4225038913edf0d
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/362505
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-31 20:25:45 -04:00
Ziye Yang
6e0d1dcdfa subsystem: make subsystem init in async manner
The next patch will make bdev modules init
in the async manner.

Change-Id: I4909c80510d786daf54003b99a5925428cf37373
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/362110
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-05-31 15:30:58 -04:00
John Meneghini
8a44220b1a env: Rename spdk_malloc/zmalloc/realloc/free to spdk_dma_(func)
- rename spdk_malloc_socket to spdk_dma_malloc_socket
  - rename spdk_malloc to spdk_dma_malloc
  - rename spdk_zmalloc to spdk_dma_zmalloc
  - rename spdk_realloc to spdk_dma_realloc
  - rename spdk_free to spdk_dma_free

Change-Id: I52a11b7a4243281f9c56f503e826fd7c4a1fd883
Signed-off-by: John Meneghini <johnm@netapp.com>
Reviewed-on: https://review.gerrithub.io/362604
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-05-31 15:30:27 -04:00