Commit Graph

385 Commits

Author SHA1 Message Date
Dariusz Stojaczyk
b5c0a51ec7 bdev_virtio: added UNMAP support
Current UNMAP implementation supports only
up to 2^32-1 unmapped blocks per request.

Change-Id: Ib473831fa32aaba465f76694afad71137288a73a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377688
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-09-28 17:08:34 -04:00
Dariusz Stojaczyk
bf5a7293d0 bdev_virtio: moved virtio_req init to separate function
This is required for upcoming UNMAP implementation.

Change-Id: I81fb744e0813121cebd64aa60a03a80bfbecc94d
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377421
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-09-28 17:08:34 -04:00
Dariusz Stojaczyk
3595fc5f40 bdev: allow allocating custom-length buffers for bdev_io
This is required for upcoming UNMAP
implementation in bdev_virtio.

While here, also added documentation for
spdk_bdev_io_get_buf().

Change-Id: Ia769ee9b8b132f31208ae66598b29a1c9ed37312
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379721
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-09-28 17:08:34 -04:00
Daniel Verkamp
d565f549b9 bdev/nvme: support large (> 2TB) unmap requests
spdk_bdev_unmap_blocks() accepts a 64-bit number of blocks, which can
exceed the NVMe Dataset Management range's 32-bit number of blocks,
which can represent up to 2 TB with 512-byte blocks.

We can support up to 0.5 PB unmap requests by using the maximum number
of descriptors in a single Dataset Management command, which should be
sufficient for now.

Change-Id: I0a4ee77a9be148355991e1a081007ffa020a3ee5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/379202
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-09-28 14:17:15 -04:00
Maciej Szwed
99ba2b25e6 lvol: hotremove support
This patch adds hotremove support of lvol base bdev

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I04dc7a0cc73fd6959824873f354d5c7db8c09a9b
Reviewed-on: https://review.gerrithub.io/379348
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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>
2017-09-28 12:46:18 -04:00
Maciej Szwed
4338d3c9a7 blob_bdev: hotremove support
This is in preparation for enabling hot remove of logical volumes when
their underlying blobstore device is hot-removed.


Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I310a3f64f0de5d628609c20a1a3b4d38df0755aa
Reviewed-on: https://review.gerrithub.io/377041
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-28 12:46:18 -04:00
Tomasz Zawadzki
b51b8b4f9c lvol: fix incorrect assumption of 1MiB cluster_size
Previously incorrectly it was assumed that cluster size
was always to be 1MiB. For most evident example of this
please see spdk_lvol_create() sz > free_clusters comparison.

This is now fixed and lvol->sz was changed to lvol->cluster_num.
It was done to increase readability - only dealing with
number of clusters when creating or resizing lvol.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If8cdbad18978319e57b6952dbf5a55d56785f108
Reviewed-on: https://review.gerrithub.io/380467
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-09-27 17:27:13 -04:00
Dariusz Stojaczyk
e2e6fd3744 bdev: set bdev_io->iovs for all direct IO types
This patch allows unmap bdev_io to
be used with spdk_bdev_io_get_buf.

bdev_io->iovs/iovcnt has been zeroed-out for other
I/O types to overwrite any previous values/pointers.

Change-Id: I570a4d82d9e4db6630a6831b1aab3259fb46cdd8
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377687
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-09-27 16:10:26 -04:00
Tomasz Zawadzki
9a58c40eba blobstore: always destroy bs_dev during spdk_bs_init()
Now bs_dev is destroyed only in two instances:
- within spdk_bs_init() on failure path
- vbdev_lvs_create() if spdk_lvs_init() errors out,
before even calling spdk_bs_init()

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I7b8af39fbe83907b0c47797f0f55ca3b941729d9
Reviewed-on: https://review.gerrithub.io/379848
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-27 13:18:18 -04:00
Daniel Verkamp
52207d7800 bdev: fix double semicolon typo
Change-Id: Ic094c34f1dc9063f12df80d77b2c70ebae9a4977
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/380066
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-26 20:02:48 -04:00
GangCao
4f1ba029b3 bdev/nvme: handle the case for no valid ns when creating bdev
Change-Id: I46d564523ea20bc7c79a3896dfb024d3d5172a93
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/379911
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-26 17:44:32 -04:00
Dariusz Stojaczyk
abb59fea38 bdev_virtio: send IO to proper target
Until now we queued all IO to hardcoded
SCSI target 0.

Change-Id: Iefb229899725f53f26e927c4fb23e8d1d613c187
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379840
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-09-26 15:53:29 -04:00
Dariusz Stojaczyk
65b6d8f495 bdev_virtio: call bdev_module_init_done only once
bdev_module_init_done could be called
multiple times when more than device
is available.

Change-Id: I17ee63a818945359648953c4f8f67678d10e8907
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379864
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-09-26 14:28:24 -04:00
Dariusz Stojaczyk
c8f052836d bdev_virtio: added virtio_driver struct
Added new struct virtio_driver together
with it's global instance. The struct should
keep all bdev_virtio related information.

Change-Id: If78967c68c4131c89cd86cb4b46f5f0194bca323
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379863
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-09-26 14:28:24 -04:00
Dariusz Stojaczyk
5bea1429e9 rte_virtio: use spdk_pci_device where possible
A mid-step towards porting virtio_pci to
use SPDK env/pci layer. See the next patch
for details.

Change-Id: Ia7cb417415bce686c3a888f949853834ddf6c7a6
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379488
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-09-26 14:28:24 -04:00
Dariusz Stojaczyk
b697382f65 rte_virtio: automatically memmap PCI resources
SPDK env/pci layer does not provide equivalent
call to actually map all pci resources. This
patch will smooth future transition of rte_virtio
to SPDK.

Change-Id: I7a67c46a99824be83875385703dd6bbf0ec9645e
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/380001
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-09-26 14:28:24 -04:00
Dariusz Stojaczyk
14f7a8eec6 gpt: fixed error-handling for vbdev_gpt_read_gpt
Fixed memleak on vbdev_gpt_read_gpt failure.
gpt_base->ch was never freed.

Change-Id: I97f6e433b26ab95253eac4753b68083f3433547b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377913
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-09-25 16:53:52 -04:00
Daniel Verkamp
3d8e44e908 bdev/null: add Write Zeroes support
Change-Id: Iad98baef576fe3d843967d0c02e9922dfc347830
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/378675
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-25 16:31:49 -04:00
Jim Harris
a0d7056f11 copy: return 0 on success and appropriate errno on failure
This code was still using an old paradigm of returning the
number of bytes associated with a successful submission.
Just return 0 on success instead - if caller needs the
number of bytes for some reason they have the information
to get it.

While here, return an appropriate negated errno where possible -
we especially want ENOMEM returned when an ioat channel runs out
of descriptors.

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

Reviewed-on: https://review.gerrithub.io/378858
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-25 13:56:29 -04:00
Jim Harris
49cf3861d1 bdev/nvme: clean up submit_request return codes
Some of the internal functions used to return the
number of bytes associated with a successfully submitted
IO, but that was changed a while ago to just return 0
for success.

So change some of the callers of these functions to
just look for != 0 for failure rather than < 0.  This
preps for some upcoming ENOMEM handling changes.

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

Reviewed-on: https://review.gerrithub.io/378856
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-25 13:56:29 -04:00
Jim Harris
d5b441e0dd bdev: clean up spdk_bdev_io_complete a bit
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I374910a7d5ecf0125228d0c99ab523804956ca78

Reviewed-on: https://review.gerrithub.io/378852
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-25 13:56:29 -04:00
Jim Harris
b4ffeaec7a bdev: fail IO submitted while reset in progress
This patch introduces per-channel flags to keep state of information
needed in the primary I/O path.  Setting/clearing of these flags
should only done through an spdk_for_each_channel() call.  Currently
there is only a RESET_IN_PROGRESS flag defined but more may be added
in the future.

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

Reviewed-on: https://review.gerrithub.io/377828
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-25 13:56:29 -04:00
Daniel Verkamp
263ed2ae21 nvme_spec: remove SGL Sub Type Invalid status code
This was removed in NVMe 1.2.1 ECN 002.

Change-Id: Icacd53c1f33043cf1c9f30bff1fb9dce1efa69b3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/378681
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-22 17:11:53 -04:00
Tomasz Zawadzki
dd9fdb0c55 lvol: remove page_size field from lvol store struct
It does not seem nessecary to include it, when this it used just once
in lvol disk creation.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I42ead55329f0ac7e55bb73702d071f118a5c7931
Reviewed-on: https://review.gerrithub.io/379678
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-09-22 15:53:06 -04:00
Tomasz Zawadzki
4912114819 lvol: split spdk_lvol_store_req structure into four separate
To increase readability, union in spdk_lvol_store_req is now split
into four separate structures.

As well spdk_bdev from lvs_basic/spdk_lvs_req was removed as it was
not needed.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I65c5155f3d15151a97cf8f8e425b26aa1966b677
Reviewed-on: https://review.gerrithub.io/379169
Reviewed-by: Maciej Szwed <maciej.szwed@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-09-22 15:53:06 -04:00
Maciej Szwed
f76ec3b495 lvol: fix memory leaks
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ife45dc8e27d767b9f09b67e7fae3b94837a14491

Reviewed-on: https://review.gerrithub.io/379458
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-22 15:50:37 -04:00
Daniel Verkamp
48d643b829 bdev/virtio: simplify READ/WRITE 10/16 logic
Now that the bdev_io read and write branches of the union have been
unified, the virtio-scsi bdev I/O code can be simplified a little bit.

Change-Id: Iadbe55862770a1b0e7f854b724a70d94c704218e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/379696
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-22 15:39:15 -04:00
Jim Harris
1f935c7a9b bdev: properly handle aborted resets
Previously, we naively assumed that a completed
reset was the reset in progress, and would
unilaterally set reset_in_progres to false.

So change reset_in_progress to a bdev_io pointer
instead.  If this is not NULL, a reset is not in
progress.  Then when a reset completes, we only
set the reset_in_progress pointer to NULL if we
are completing the reset that is in progress.

We also were not aborting queued resets when
destroying a channel so that is fixed here too.

The added unit test covers both fixes above - it will
submit two resets on a different channels, then destroy
the second channel.  This will abort the second reset
and check that the bdev still sees the first reset as in
progress.

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

Reviewed-on: https://review.gerrithub.io/378199
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-22 15:38:44 -04:00
Jim Harris
ab29d2ce5d bdev: improve handling of channel deletion with queued resets
Upper layers are not supposed to put an I/O channel if there
are still I/O outstanding.  This should apply to resets as well.

To better detect this case, do not remove the reset from
the channel's queued_reset list until it is ready to be
submitted to the bdev module.  This ensures:

1) We can detect if a channel is put with a reset outstanding.
2) We do not access freed memory, when the channel is destroyed
   before the reset message can submit the reset I/O.
3) Abort the queued reset if a channel is destroyed.

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

Reviewed-on: https://review.gerrithub.io/378198
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-22 15:38:44 -04:00
Jim Harris
c2510e75a2 bdev: add spdk_bdev_io_submit_reset
This provides an alternate path for submitting
resets to a bdev module, in preparation for some
future patches where we will want to avoid
reset-specific checks in the main I/O submission
path.

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

Reviewed-on: https://review.gerrithub.io/378670
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-22 15:38:44 -04:00
Jim Harris
81939c44f1 bdev: rename need_buf_tailq_t to bdev_io_tailq_t
We will use this typedef for some additional use
cases where are not specific to the need_buf
functionality.

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

Reviewed-on: https://review.gerrithub.io/378197
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-22 15:38:44 -04:00
Dariusz Stojaczyk
dcb7db965d bdev: unify all direct bdev_io I/O types
Since all direct bdev_io types have the same layout,
there is no need to keep them differentiated.

Change-Id: If8bb85e43c9922c0ebfc39837e3a45006e508b56
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377686
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-22 13:44:25 -04:00
Dariusz Stojaczyk
2e1a8b6c2e bdev_virtio: add SCSI READ/WRITE 16 support
Change-Id: I458dc865744ed2dd7fcf8e838029add090ff85fa
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377170
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-22 12:58:51 -04:00
Dariusz Stojaczyk
43be836ae5 bdev_virtio: use READ CAPACITY (10) for initial target scan
Added READ CAPACITY (10) support.
This is a work towards supporting both (10) and
(16)-bit SCSI commands.

If READ CAPACITY (10) returns 0xFFFFFFFF as max lba,
a READ CAPACITY (16) is sent.

As specified in SBC-3 5.10.2 READ CAPACITY (10):
```
If the number of logical blocks exceeds the maximum value that is able
to be specified in the RETURNED LOGICAL BLOCK ADDRESS field, the device
server shall set the RETURNED LOGICAL BLOCK ADDRESS field to FFFFFFFFh.
The application client should then issue a READ CAPACITY (16) command
(see 3.27) to retrieve the READ CAPACITY (16) parameter data.
```

Change-Id: If82bc45e904e91d95b124724e895350098337ae9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377091
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-22 12:58:51 -04:00
Dariusz Stojaczyk
bcaac30fe3 bdev_virtio: add alloc_virtio_disk
Added separate function for allocating virtio_scsi_disk.
This is required for the upcoming 10-bit SCSI command
support changes.

Change-Id: Ib60bfe003f37d796387944b04494baf2a77a6558
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379422
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-09-22 12:58:51 -04:00
Dariusz Stojaczyk
29df0140f0 rte_virtio: set FEATURES_OK for modern virtio-user devices
This patch also sets virtio_dev->modern for vhost-user
devices.

A word of explanation of what's happening now:
For virtio_pci, dev->modern is set when reading config,
as legacy devices have no Virtio PCI Capability in their
capability list. For virtio_user, the dev->modern should
be set if VIRTIO_F_VERSION_1 feature has been negotiated.

Change-Id: I056b1dcf65a5a6a87cda6499771399befdc59cb5
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377090
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-22 12:58:51 -04:00
Dariusz Stojaczyk
146061e9c6 rte_virtio: don't negotiate features twice for virtio-user
Moved negotiation to virtio_init_device.
This patch also cleans up feature negotiation a bit.

Change-Id: Ia67e8d694a5acebcbe37679a657d68d6c46979db
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377089
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-22 12:58:51 -04:00
Ziye Yang
8d6f9503ef bdev/malloc: remove the unnecessary operation on len
Change-Id: I9e550a879b50af0de476583f5efd4e0518667662
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/379213
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-09-20 19:59:48 -04:00
Maciej Szwed
c783caabc7 bdev: remove bdev_opened_for_write restriction
This restriction causes bdevs examination/discovery to fail
when there are asynchronous operations. We should remove this
limitation for now. Future plan is to implement approach
similar to the one that is present in kernel.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ibe5572297672022412d25a4a835dc9527ce97f3e
Reviewed-on: https://review.gerrithub.io/378758
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>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-20 14:43:32 -04:00
Tomasz Zawadzki
e21aede946 lvol: add get_lvol_stores RPC
This patch shows UUID and base bdev for logical volume stores
when get_lvol_stores() RPC is called.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Idbd0bc6c4a0334e5af8d4a674a203ddb2270f3e4
Reviewed-on: https://review.gerrithub.io/374604
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-18 12:19:16 -04:00
Dariusz Stojaczyk
09af33b6a4 rte_virtio: added virtio_dev struct
Previously virtio_hw was managing both VirtIO PCI and
vhost-user devices. Now's there virtio_dev, a common
part for both backends. virtio_hw is only used for PCI.

Note that this patch does not introduce another
abstraction layer. It only unifies an already existing
one. Previously virtio_user_dev was built on top of
virtio_hw, with most PCI fields just hanging there
unused. Now both, virtio_user_dev and virtio_hw are
built on top of virtio_dev.

Change-Id: Ida25defc0063055a81cf4039c9b85470b9880bc3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/376966
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-09-15 16:32:20 -04:00
Dariusz Stojaczyk
72ebd59086 rte_virtio: removed pci/user distinctions in common virtio_hw path
This patch removes unnecessary if (hw->virtio_user_dev)
conditions. It also makes vq_ring_mem explicitly
a physical address. There's already a separate
vq_ring_virt_mem field that's used for vhost-user.

Change-Id: Ie8d97458744b4e3ae9d0e3d72b28d29f19179706
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/376965
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-09-15 16:32:20 -04:00
Dariusz Stojaczyk
de2ecd9db1 rte_virtio: added virtio_queue.c/.h
All rte_virtio filenames have virtio_ prefix now.

Change-Id: I42018624606d68997a0e982e7b622d6a23e3c190
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/376624
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-09-15 16:32:20 -04:00
Dariusz Stojaczyk
004913cf04 rte_virtio: cleaned up virtio_user_dev_init
Removes duplicated code.

Change-Id: I3a86add4fd635441ad56f4d21d75bd8bb338d5f9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/376623
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-09-15 16:32:20 -04:00
Tomasz Zawadzki
27f44662ac lvol: Logical volume implementation
Change-Id: Ia96ae78ff9530d953181ac5f7255a38f3c8ec430
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Reviewed-on: https://review.gerrithub.io/375392
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-09-14 19:30:54 -04:00
Dariusz Stojaczyk
9f2784ec21 bdev_virtio: specify limitations in README.md
Change-Id: Ifb913c85392eb7d9803726b40895906bdf2b3281
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/378616
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-09-14 17:33:33 -04:00
Daniel Verkamp
49934e252e bdev/gpt: fix use after free of gpt_base
Fixes: 5f6306ea24 ("bdev/gpt: free base bdev_part in gpt after
examining")

Change-Id: Ia9cd64127f435b1b40f6a34b6e5166b329924ed6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/378652
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-09-14 14:26:40 -04:00
Dariusz Stojaczyk
9eabe8dc6b rte_virtio: removed eth_virtio_dev_init()
This patch also fixes segfault on startup when using
a PCI device as a DPDK secondary process.

Change-Id: I93116ae207649fae2fb3461d32d04a98cecb4cf6
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/376622
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-09-14 13:48:09 -04:00
Dariusz Stojaczyk
8bd15fa161 rte_virtio: check against descriptor table overflow
Don't allow enqueueing a request when not
enough free descriptors are available.

While here, also clarify some other
vq_desc_tail_idx code.

Change-Id: Ibcec2e31b2f609f2fd71f2426ce1a91728ed82f6
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/378154
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-09-14 13:48:09 -04:00
Dariusz Stojaczyk
3459b5a966 rte_virtio: set proper desc count on request enqueue
This was broken by commit 157969b60e.
However, this change doesn't fix any errors.
Neither vq->vq_free_cnt nor dxp->ndescs are used at the moment,
but this will change with future patches.

Fixes: 157969b60e ("bdev_virtio: added virtio_scsi_io_ctx")

Change-Id: I215d437c52f7060bf631bd193e7e59e2a4710368
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/378116
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-09-14 13:48:09 -04:00