Commit Graph

32 Commits

Author SHA1 Message Date
Tomasz Zawadzki
2172c432cf log: simplify SPDK_LOG_REGISTER_COMPONENT
This patch removes the string from register component.
Removed are all instances in libs or hardcoded in apps.

Starting with this patch literal passed to register,
serves as name for the flag.

All instances of SPDK_LOG_* were replaced with just *
in lowercase.
No actual name change for flags occur in this patch.

Affected are SPDK_LOG_REGISTER_COMPONENT() and
SPDK_*LOG() macros.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I002b232fde57ecf9c6777726b181fc0341f1bb17
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4495
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Mellanox Build Bot
Reviewed-by: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI
2020-10-14 08:00:35 +00:00
Changpeng Liu
060d9b85bf virtio: remove unnecessary included header file
SPDK virtio library was first developed based DPDK virtio_net library, since
we will maintain this library in SPDK now, so we will remove the direct call
to DPDK library here.

Change-Id: I6a9121a13fcac0ba49563956cf347fb9ad0f9845
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478410
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-01-10 08:45:45 +00:00
Ziye Yang
016d933793 lib/virtio: change the definition of cookie
Converting to the struct virtio_req is useless.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I141268314d28cf87bdef529808c8e18bd1b41c9d
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459360
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-06-26 08:03:37 +00:00
Darek Stojaczyk
12f622b769 virtio: zero-out virtqueue structures at init
They used to be allocated with spdk_dma_zmalloc() which did
provide zeroed memory, but we unintentionally changed that
when switching to posix_memalign.

The structure might have some unitialized memory, so with
this patch we just memset it right after allocating it.

Change-Id: Id5a5685e09419901513925abaeed605c36f5199a
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451546
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-04-22 16:49:39 +00:00
Darek Stojaczyk
01103b2e4d virtio: allocate virtqueue structs using regular calloc
The DMA-able vrings are allocated separately, so
the general virtqueue object can be allocated with
regular malloc - it only contains some local PMD
context.

While here, also allocate those DMA-able vrings using
spdk_zmalloc() instead of spdk_dma_zmalloc(), as
spdk_dma_*malloc() is about to be deprecated.

Change-Id: I06b9e0256c14c21747c253f05b63ef2361f465c7
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450550
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-04-17 22:53:05 +00:00
Darek Stojaczyk
794b2533de virtio: shrink the process-local virtqueue structure
We used to ceil the size of the vring structure to the
nearest cache line boundary. That's how the original
DPDK implementation behaved, but I can't find a reason
for this. This patch gets rid of the ceiling.

Change-Id: Iaa40fdb79c60252237901f77023ff2f9e580eece
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450549
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2019-04-09 06:30:42 +00:00
Shuhei Matsumoto
ab0f787e0b virtio: Use spdk_json_write_named_* APIs throughout
Change-Id: I0e7f432e5ce8477e34907ba249f2a4e0d85e875e
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/442942
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-02-04 07:08:04 +00:00
Darek Stojaczyk
8c4ed83b49 vtophys: add length parameter to the vtophys function
This follows the same trend as the mem_map APIs.

Currently, most of the spdk_vtophys() callers manually
detect physically noncontiguous buffers to split them
into multiple physically contiguous chunks. This patch
is a first step towards encapsulating most of that logic
in a single place - in spdk_vtophys() itself.

This patch doesn't change any functionality on its own,
it only extends the API.

Change-Id: I16faa9dea270c370f2a814cd399f59055b5ccc3d
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/438449
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: wuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2019-01-09 08:24:59 +00:00
Dariusz Stojaczyk
c9e5777ede virtio: clarify feature negotiation failure
Change-Id: Ifb1566033569af0b3cf4a9dfbc8094a9883c7622
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/420980
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: 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>
2018-08-01 19:16:54 +00:00
Dariusz Stojaczyk
eeb1650c06 virtio: propagate error codes
Many functions were inconsistent in regard of error codes
they returned. In a couple of places we could print "Operation
not permitted" via strerror() from functions that were
supposed to return negative return codes, but returned
`-1` instead. (-EPERM == -1)

Change-Id: I7c36e54d449352dbd8036746e4f44a65c9b1d0b3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/419007
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: 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>
2018-08-01 19:16:54 +00:00
Dariusz Stojaczyk
117fdae94b virtio: fix false-positive assertion failure on virtqueue_req_add_iovs
We need to decrement the free_cnt before checking
if it reached 0.

Note: the vq_free_cnt overflow is asserted at the
beginning of the function.

Change-Id: I655217785e4425d1cd3c704d24321b643be55dcf
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/420584
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
2018-08-01 17:25:24 +00:00
Dariusz Stojaczyk
65165d795d virtio: fix vq init error handling
We didn't handle vq alloc or init failure, because
queues are initialized all at once on device init and
if one vq fails, all of them are to be destroyed.

This behavior is really unintuitive, and with the
latest changes we have a possible segfault scenario.
(We could spdk_dma_free() a buffer that failed to
allocate).

It is now required that the queue allocation function
cleans up after itself.

Change-Id: I6cd1d30c710eb9266288905ab982db363f972a1d
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/419001
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>
2018-07-11 21:02:06 +00:00
Dariusz Stojaczyk
3a15b49b05 virtio: move queue allocation to backend code
Right now both virtio-pci and virtio-user allocate
the queue via spdk_dma_malloc, but that's about
to change soon.

Change-Id: I3acdad45cd9a0639f9070bc448fdf8f9d2c706c0
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/417000
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>
2018-07-06 19:16:16 +00:00
Dariusz Stojaczyk
e724452ec0 virtio: call backend-specific queue cleanup on vdev stop
This was omitted in the original implementation and the
`del_queue` callback wasn't called anywhere. For virtio-user
we open some eventfds on queue creation and until now they
were never being closed.

Change-Id: Iee1ced1e17a59d5cb13449538c115678a1c1a328
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/416999
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-07-06 19:16:16 +00:00
Dariusz Stojaczyk
62844ae3ca virtio: allow config read/write to fail
For vhost-user it's a protocol feature that can simply
be not supported. The subsequent patch introduces an extra
check that may cause config read/write to fail.

Change-Id: I5b0e11845fb6021472c608477f1797dada8ab961
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/417458
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-07-05 20:47:38 +00:00
Dariusz Stojaczyk
03b12a98b2 bdev/virtio: support event index
This fixes intermittent failures with QEMU's virtio-scsi-pci
device.

Apparently, from time to time QEMU enters a broken state in
which it doesn't turn off the NO_NOTIFY flag. This flag should
be set only for the period of time virtqueues are being processed,
but QEMU makes it set all the time. This makes us not signal any
I/O submissions - SPDK thinks the device is currently processing
notifications so it will pick up our I/O automatically, but in
realitly it won't and we end up with a deadlock.

I believe kernel virtio driver doesn't hit this issue because of
event index feature. If negotiated, the NO_NOTIFY flag won't be
used at all. Initial tests show that the issue is indeed gone
with this patch.

Event index for SPDK virtio is not particularly useful when using
a poll-mode device, but it doesn't do any harm. It can be further
optimized in the future, but macro-benchmarks don't show any
performance difference compared with the legacy notification
handling so there's no hurry.

Change-Id: I46e8ab0da170780fcdc0dd239208670ee5ed6357
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/415591
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-07-02 19:17:13 +00:00
Dariusz Stojaczyk
587002f511 virtio: expose virtio descriptors as soon as possible
With upcoming event index patch we will need
to keep track of how many descriptor chains we
have really put into the avail vring. This patch
is a step towards that.

Our virtio layer abstracts away descriptor chains
as "requests". We can start requests, add descriptors
to them, and finally flush them. So far we used to put
any descriptors directly into the virtqueue desc ring,
and made them visible to the device only through
virtqueue_req_flush().

All of our virtio bdev modules currently flush the
virtqueue after adding each single request, but the
docs for the virtio API say it's possible to start
multiple subsequent requests and flush them all at
once. This was conceptually broken so far and only
the last request would be exposed to the device.

It's now fixed and subsequent requests are put
into the avail vring as soon as they're complete
(either the next request is started, or the
virtqueue is flushed).

Change-Id: I76b7db88ab094c38430edd8ff0e65681775dcb31
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/415590
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: Changpeng Liu <changpeng.liu@intel.com>
2018-07-02 19:17:13 +00:00
Dariusz Stojaczyk
8c6bd59704 virtio: remove unnecessary if
This `if` came from the original DPDK virtio PMD.
Generally, we do not want to trigger cache coherency
updates if we don't have to, but in this particular
case we know we always do.

If there were no changes to the avail index, there
would be no requests started and the function would
return much earlier.

Change-Id: Ic1231cf82288c1cb95dc89346f54d51849b8bae9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/415589
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-06-18 22:31:32 +00:00
Dariusz Stojaczyk
ba43426c3d virtio: remove DEBUGLOG about received descriptors
Once enabled, this DEBUGLOG would be printed
every poller tick. It's not practical, so it's
being removed now.

Change-Id: I8627dedcc2c0df8065ffe575059938d620491dd5
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/415588
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-06-18 22:31:32 +00:00
Ben Walker
a00b6819a1 bdev/virtio: Abort on bad index in virtio_dev_queue_get_thread
There is no way to recover from this.

Change-Id: I1667b032bab867d58ad23fa8b1bd59f81620b442
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/408246
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-04-19 15:48:36 -04:00
Dariusz Stojaczyk
0a1a4ce116 virtio: rename ops->get_queue_num callback
It actually returns the size of given queue,
so renamed it to get_queue_size to clean up
the API

Change-Id: I88551116b3dc19644764bba78b58444802a1d443
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/408174
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>
2018-04-18 12:32:00 -04:00
Pawel Wodkowski
1a6dac405b bdev/virito: add JSON config dump and generic create RPC
The new construct_virtio_dev allow creating virtio SCSI and blk for both
PCI and user transports.

Change-Id: Ibd79c4fb75e3cbd993b46227d86e915c1b740a18
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/405419
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2018-04-17 17:16:06 -04:00
Dariusz Stojaczyk
9728d6b054 virtio: check if setting status bits succeeded
This is required by the Virtio spec. (3.1 Device Init.)
It will also help us with vhost-user error handling.
set_status() doesn't have a way to return an error, so
its internal failures were silenced until now. When we
exceeded max memory region count (8) we only printed
an error message without failing any SPDK initialization.
This patch fixes that. It also removes not-particularly-
useful comments in virtio_dev_reset().

Change-Id: Ibe0010c493ef4e12e1fdd0a1679bf706f298d97e
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/405915
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>
2018-03-30 19:34:22 -04:00
Dariusz Stojaczyk
6ccc262022 virtio: remove g_virtio_driver
g_virtio_driver contained just a list of all
Virtio-SCSI devices. It's now being removed for
two reasons:
 * it's backend-specific, doesn't fit a generic virtio lib
 * it's difficult to ensure thread-safety for it

Virtio bdev modules will now manage their Virtio
devices by themselves. Virtio-SCSI has now an internal
device list. (And VirtioBlk module maps devices to
bdevs 1:1, so doesn't need any additional work here.)

Change-Id: I3bc68d76d6904df5c56f00fca7ab387871ecf88f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/405179
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-03-27 00:58:14 -04:00
Dariusz Stojaczyk
face9eb258 virtio: add mb() before checking notify flag
The kernel vhost target enables notifying after processing
each interrupt in a following manner.

 * unset NO_NOTIFY flag
 * mb()
 * check avail ring for slipped requests

And we do the following after issuing each I/O.

 * update avail ring
 * check NO_NOTIFY

If NO_NOTIFY check is reordered and read first, we might read
old `true` value, and avail ring might be updated after the
kernel has already done its check. This easily leads to deadlock.

Change-Id: I6bb4490775dfed6fb2987e97c39b713054ae26ad
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/396499
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>
2018-02-06 19:27:46 -05:00
Dariusz Stojaczyk
5926647156 virtio: inline internal functions
These didn't make much sense anyway.
Removed them so there's less code

Change-Id: I3247c640b13e5847b5f6d822072b63cad269ac8c
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/398467
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>
2018-02-06 19:27:46 -05:00
Dariusz Stojaczyk
7f0c2bf4b4 virtio: remove virtio_dev_get_status asserts
virtio_dev_get_status may result in an MMIO read,
which is quite expensive. Removed it to improve
performance on debug builds.

Change-Id: Ibe2d13ad381f02f8d258d630283c14ce20b7a340
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/398468
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>
2018-02-05 19:06:11 -05:00
Dariusz Stojaczyk
fb12bbecd2 virtio: move vdev->name allocation to generic virtio
Previously vdev->name was being allocated/freed
separately in virtio_pci and virtio_user backends.
Now it's all done in generic virtio library and
cleans up some code.

Change-Id: I810e976d09781c0c9b25c6f7fd957a83aad6c7b8
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/394704
Reviewed-by: <shuhei.matsumoto.xt@hitachi.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>
2018-01-23 22:49:21 -05:00
Dariusz Stojaczyk
8b94174a4e virtio: fix full-virtqueue handling
Distinguish between "not enough descriptors available"
and "iovcnt > queue depth".

This patch brings back I/O re-queueing for virtio bdev
module. It was temporarily disabled by 451de7e1 [1].

[1] 451de7e1: "virtio: switch to the new virtqueue API"

Change-Id: I4c4f6a6d9d91373ee647ea7cafd53ad999aa6aa2
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/393447
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>
2018-01-03 14:35:36 -05:00
Dariusz Stojaczyk
7755bed389 virtio: split device initialization to separate functions
Previously we used to manually set
vdev->max_queues and called virtio_dev_restart
to go through all virtio init states, negotiate
features and allocate virtqueues. This is,
however, insufficient for Virtio-Blk, where we
e.g. need to check against negotiated multiqueue
flag before deciding how many queues we can use
(reading num_queues field from device config is
forbidden unless VIRTIO_BLK_F_MQ is negotiated).

This patch refactors queue-num related code
and also removes various restrictions. If device
supports less queues than requested, a warning
will be printed during initialization, but
the device will now continue to init normally.

The queue-num negotiation for virtio-user should
be eventually moved to upper layers, but that is
not necessary for now.

Change-Id: I418b56fa62c17b547243422ea077f0d76555bd13
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/393087
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-12-27 15:13:03 -05:00
Dariusz Stojaczyk
a1ca7a12ff virtio: fix enqueuing zero-length descriptor chains
Previous descriptor chain was being corrupted
by setting invalid vq->req_end (virtio.c:538).

Change-Id: I4b27db02dc990e6af011a1b614e30e3050379e9f
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/392774
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-12-27 15:13:03 -05:00
Dariusz Stojaczyk
9dde5e5c27 virtio: add new library virtio
Exported lib/bdev/rte_virtio as a separate
library not dependent on bdev.

Virtio is now accessible via spdk_internal/virtio.h.
The header is marked `internal`, as it's
not meant to be used by end users. It's
not handy to handle all backend-specific
(e.g. Virtio-SCSI) logic in a user code.

For now the Virtio interface is publicly
exposed only via bdev_virtio module. We
might want to consider adding a separate,
public Virtio-SCSI library in the future.

Note: this patch doesn't do any changes
to the virtio code. Everything is
moved 1:1.

Change-Id: I805e5d12d265d82b0bc5784c89fbadb81abdb278
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/388166
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-12-26 13:03:29 -05:00