Commit Graph

2397 Commits

Author SHA1 Message Date
Ben Walker
fcb4776fe7 event: Pollers must now be registered from the thread they run on.
Change-Id: I864cd8a6c206dfbe62fcb3f72275c1ae51aa4ed7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387688
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-11-17 11:11:23 -05:00
Ben Walker
4927c20681 iscsi: Treat unregistering pollers as a synchronous operation
We always unregister pollers from the core they're running on,
so we don't need the async completion event when unregistering
them. To avoid changing the logic, create events instead.

Change-Id: Ib50d93e1578684bea69200d89a5e0d383acc8cfe
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387685
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-11-17 11:11:23 -05:00
Ben Walker
435138b76d scsi: Register all pollers to the current core
Register all pollers to the current core. If necessary, send
an event to the correct core before registering.

Change-Id: Ie34cc8b11143a58c0f621c87c409a3d09d929648
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387682
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
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-11-17 11:11:23 -05:00
Ben Walker
95bbc6bf29 io_channel: Add spdk_io_channel_from_ctx
This is the inverse operation of spdk_io_channel_get_ctx.

Change-Id: Ica6593240dfb05cb53dc7ec910bc0a78270e81c0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/387679
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-17 11:11:23 -05:00
Liang Yan
bb28be8adc event: ignore duplicated shutdown signals if signal received
Change-Id: Ib1e184f831eef82432308279c6d8ea43088748ef
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
Reviewed-on: https://review.gerrithub.io/387273
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
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-11-16 18:24:46 -05:00
Daniel Verkamp
ed53cba059 nvme: normalize PCI addresses before comparing
Use the env abstraction PCI functions to compare PCI addresses so that
details like whether or not domain is specified or whether 0-padding is
present don't affect the comparison.

For example, 0000:01:00.0 should compare equal to 01:00.0.

Change-Id: I9f3aaeb5f8fdbf3e246e31a41b4c09151288015e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/387202
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-11-16 18:17:09 -05:00
Ed Rodriguez
63bf022b93 trace: Move trace flags to separate implementation file
Change-Id: Ibe31b961fec36644cf64716c512429d68e873e88
Signed-off-by: Ed rodriguez <edwinr@netapp.com>
Reviewed-on: https://review.gerrithub.io/386170
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-11-15 18:57:12 -05:00
Maciej Szwed
bdba3e7e01 lvol: fix lvol store load on lvols load fail
Currently when one of lvols fail during loading we end up
with empty lvol store loaded, where we actually should
unload lvol store as well.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I90ce3b79baba0db0d875b106c94924be394aada9

Reviewed-on: https://review.gerrithub.io/385950
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-15 18:05:09 -05:00
Cunyin Chang
97f3104bc7 blobfs: Add conf parse for blobfs.
This patch make the cache buffer shift of blobfs configurable. We
can configure the cache buffer shift according workload, it will
help to improve the performance.

Change-Id: Ied1c2e5d6fd9eaa7aa0759c03c654fcf2e77aa23
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/383381
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-15 18:03:00 -05:00
Ben Walker
ea134c5cbf nvmf: Store subsystems in array instead of a list
This helps enforce uniqueness of the subsystem id and
allows for quick lookup by that id.

Change-Id: I4d2948892839d42b8c2b2a406682848415ad2bd6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/376251
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-11-15 17:54:13 -05:00
Dariusz Stojaczyk
fbccbb28c7 pci/dpdk: use rte_eal_dev_attach/detach for DPDK 17.11-rc3
DPDK 17.11-rc3 removes pci_probe*
and pci_detach functions. It introduces
different ones - rte_eal_dev_attach/detach.
Those have a slightly different signature.

Change-Id: Iadde9ff37c64190dad41929997f9ff78379f36e1
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/387656
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-11-15 17:52:05 -05:00
Dariusz Stojaczyk
779dd1bc10 env/dpdk: compile with rte_pci and rte_bus_pci for DPDK 17.11-rc1
DPDK 17.11-rc1 moved a part of it's
eal code into two separate libraries.

Change-Id: Ibcea448487a001c30abb68447e3fe2104ba9a7c3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/387655
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-15 17:52:05 -05:00
Dariusz Stojaczyk
db704770d6 env/dpdk: use rte_virt2iova instead of rte_virt2phys for DPDK 17.11
DPDK 17.11-rc3 switched to IOVA-centric
addressing. The old API is still available,
but is deprecated.

Change-Id: I7b54a1e626e39368acd2190dec725dbf30c7a5de
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/387654
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-15 17:52:05 -05:00
Dariusz Stojaczyk
c138dfe229 dpdk: include rte_config.h where necessary
DPDK 17.11 removed all rte_config.h includes
from rte_*.h headers, meaning we should either
use gcc param -include rte_config.h (just
like DPDK does), or include this file before
each other rte_*.h include. Since we're using
the latter approach in many places already,
I decided to follow it.

While here, also removed rte_vdev.h dependency
from rte_virtio/virtio_user.c. It's not used
anyway.

Change-Id: I865ee9f828211c03a60fd0446f7a418d5dddd140
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/387653
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-15 17:52:05 -05:00
Dariusz Stojaczyk
3c293a883c rte_virtio: remove legacy PCI device support
Legacy PCI code is hard to maintain
and compiles with DPDK 17.05 only.
If we ever need this functionality
in SPDK, we should first add proper
env/pci layer for direct UIO/VFIO
communication, and then revisit this
topic.

Change-Id: I25622c16f467633e01003c9edbb7e6f297c68a86
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/385302
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-15 17:52:05 -05:00
PepperJo
4382434855 nvme/pcie: add memory barrier process completions
Because ppc64 has less strict memory ordering behaviour
than x86 we need to introduce a memory barrier when
polling for completions due to possible reordering
of tracker and cpl access.

Change-Id: Id17116c38b2ba69154c175c539fc97c60897deb0
Signed-off-by: Jonas Pfefferle <jpf@zurich.ibm.com>
Reviewed-on: https://review.gerrithub.io/383728
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-11-15 17:24:19 -05:00
Shuhei Matsumoto
7bcb08c02b iscsi: Load balancing of iSCSI target is not working
When an iSCSI connection is closed, spdk_iscsi_conn_stop_poller()
is called in spdk_iscsi_conn_destruct() or
spdk_iscsi_conn_check_shutdown().

However, through both paths, g_num_connections[] is decremented
twice:
 (1) in spdk_iscsi_conn_stop_poller()
 (2) in spdk_iscsi_conn_free()
This behavior makes g_num_connections[] negative unexpectedly and
for some cases load balancing does not work and the same CPU is
always selected.

How to fix:
spdk_iscsi_conn_stop_poller() is called in the following functions:
- spdk_iscsi_conn_check_shutdown()
- spdk_iscsi_conn_destruct()
- spdk_iscsi_conn_handle_idle().

[Idea 1]
Remove the code to decrement g_num_connections[] from
spdk_iscsi_conn_free().

[Idea 2]
Remove the code to decrement g_num_connections[] from
spdk_iscsi_conn_stop_poller(). Add the code to decrement
g_num_connections[] to __add_idle_conn().

[Idea 1] is simple because just only one line is deleted.

[Idea 2] may be more symmetric than [Idea 1] but to find the right
place to add the code in __add_idle_conn() is not clear and
difficult.

Hence [Idea 1] is proposed.

[Idea 1] may not be the optimal one and more refactoring may be
done.

Change-Id: I81050f4a0e7b3ddd40896f46ab2eb8de14bbcb3a
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/384026
Reviewed-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
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-11-15 13:25:06 -05:00
Ed Rodriguez
85c146ef6e log: Create a separate implementation file for common log flag operations.
Change-Id: I2524b7881885a0784492a8189bf22a0b8c92d470
Signed-off-by: Ed rodriguez <edwinr@netapp.com>
Reviewed-on: https://review.gerrithub.io/386169
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-11-14 15:53:37 -05:00
Shuhei Matsumoto
f9bf9cdd1c iscsi: change the return value of ACL func to bool
The following functions returns 1 and 0 for succcess and error,
respectively:
- spdk_iscsi_tgt_node_allow_ipv6()
- spdk_iscsi_tgt_node_allow_ipv4()
- spdk_iscsi_tgt_node_allow_netmask()
- spdk_iscsi_tgt_node_access()

Using bool for this purpose will avoid our misunderstanding.

Change-Id: I927876e0503c0eee5364e829a4713f9a345996f6
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/383664
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>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-11-14 15:44:40 -05:00
Shuhei Matsumoto
92a6988676 iscsi: delete global PG tag check from SendTargets
In the Appendix C. SendTargets Operation in the iSCSI Specification
(RFC7143), there is the following description:

  In a Discovery session, a target MUST return all path information
  (IP address-port pairs and Target Portal Group Tags) for the
  targets on the target Network Entity that the requesting
  initiator is authorized to access.

However no description such that Target Portal Group Tag is used
to check authorization of the requesting initiator.

Moreover, according to the iSCSI Specification (RFC7143),
Target Portal Group Tag is unique within an iSCSI Target Node.

  Tarrget Portal Group Tag identifies a portal group within an
  iSCSI node.

However, current SPDK uses Target Portal Group Tag to check
authorization of the requesting initiator by mistake. This
implementation does not have any compatibility with other storage.

Hence delete the code related with Target Portal Group Tag from
SendTargets function.

Change-Id: If4b79f0d8fe8f5892a798e4f6716045fd18cf0a4
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/383660
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>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-11-14 15:44:40 -05:00
Shuhei Matsumoto
335fb0e85f net&iscsi: force overwrite "*" and "[*]" by wildcard
SPDK have used "*" and "[*]" as wildcard address
for iSCSI network portal. These abbreviations may be convenient
but unusual. If "*" or "[*]" is used, output warning message
and forcefully overwrite "*" or "[*]" by "0.0.0.0" or "[::]"
respectively.

After confirming that the usage of "*" and "[*]" is not used any
more, the code for "*" and "[*]" will be deleted.

Change-Id: Ibb8fb0d4598ffa1f7b1690ad6afd10d5ae162612
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/383556
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-11-14 15:44:40 -05:00
GangCao
58fb5a17f0 blob: handle the case that channel is not created
There is case like no memory to create the channel.
Needs to handle this properly.

Change-Id: I5d13d18037e6aa8f057769b1ef345f45597b22af
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/386016
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-11-14 15:43:08 -05:00
Dariusz Stojaczyk
2c4c7c8870 rte_vhost: mantain separate virtio features field in virtio_net
There are two separate abstraction layers:
* vsocket - which represents a unix domain socket
* virtio_net - which represents a vsocket connection

There can be many connections
on the same socket. vsocket
provides an API to enable/disable
particular virtio features on
the fly, but it's the virtio_net
that uses these features.
virtio_net used to rely on
vsocket->features during
feature negotiation, breaking
the layer encapsulation (and
yet causing a deadlock - two
locks were being locked in a
separate order). Now each
virtio_net device has it's own
copy of vsocket features, created
at the time of virtio_net creation.
vsocket->features have to be
still present, as features can be
enabled/disabled while no
virtio_net device has been
created yet.

Fixes #214

Change-Id: Ic4b2dd8cae6050813fc9a420b2ed30bc5ae60393
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/386294
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-11-14 15:39:49 -05:00
Ben Walker
eb8571d463 bdev: Fix bug where cpl on finish is called early
The process of spdk_bdev_finish will always result in an
early call to the user's completion notification - prior
to the actual shutdown events happening.

Change-Id: Ib53393deb794b616d2b7ec94cb41502305bd99b7
Reviewed-on: https://review.gerrithub.io/386707
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
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>
2017-11-14 15:08:56 -05:00
Ben Walker
6447eb670a event: Allow spdk_subsystem_fini_next to be called from any core
Change-Id: Idc39c101c23cebe9538d59c0026d169c93c44e23
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/386715
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-11-14 15:08:56 -05:00
Ben Walker
a1133a9b67 event: Remove extra event from subsystem shutdown path
Change-Id: I1b4a64fc5efdb5abd8bdcd9e91a7e8fb06fbfe3a
Reviewed-on: https://review.gerrithub.io/386714
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@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-11-14 15:08:56 -05:00
Daniel Verkamp
aaa189ae7f nvme: add actual shutdown time to log message
Change-Id: I482ad9e722f6fb775c1c91c8661212250a6914bc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/386722
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
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-11-14 10:54:04 -05:00
Daniel Verkamp
ffee381d82 nvme: allow a minimum of 10 seconds for shutdown
Some devices may report a RTD3E time that is shorter than their actual
shutdown time in practice; force the timeout to be at least 10 seconds
to allow for a reasonable amount of shutdown time.

This doesn't add any extra delay for devices that do complete the
shutdown process within their reported RTD3E time, since we will return
as soon as the device reports that it is finished shutting down.

Change-Id: I365e66ba6a938400be516df170bd3ff288810caf
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/386719
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
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-11-14 10:54:04 -05:00
Jim Harris
618c8f9040 iscsi: cleanup iscsi_subsystem.c
1) Replace some perror() calls with SPDK_ERRLOG
2) Use spdk_conf_section_get_boolval() to simplify the code

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

Reviewed-on: https://review.gerrithub.io/386666
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-11-13 14:58:34 -05:00
Jim Harris
d97476efdf iscsi: shutdown iscsi library as part of subsystem fini path
With the new asynchronous subsystem finish framework, we can
drive shutdown of existing connections as part of the subsystem
finish path instead of a separate spdk_iscsi_shutdown function
called as the shutdown function in response to SIGINT.

This is a step towards enabling a single target app that
supports multiple protocols (i.e. iSCSI + vhost + NVMe-oF).

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

Reviewed-on: https://review.gerrithub.io/386695
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>
2017-11-13 14:57:49 -05:00
Jim Harris
6bef902ca5 rpc: add default UNIX domain socket listen address
RPC is a default feature required for almost all usages,
so enable RPC by default, but with a UNIX domain socket
for security reasons.

-r can now be used from the command line to specify
an alternative RPC listen address from the default
/var/tmp/spdk.sock.

Remove the Enable parameter from the Rpc config section
but still allow specifying an alternative listen address
using the Listen parameter as an alternative to the
command line option.  This keeps backward compatibility
for this release for anyone using the configuration file
still.

Remove the Rpc sections from all configuration files
that were using them, except for those that specified
alternate TCP ports for multi-process test cases.  We
can fix these later to use an alternate UNIX domain
socket and to use the command line instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ife0d03fcab638c67b659f1eb85348ddc2b55c4c4
Reviewed-on: https://review.gerrithub.io/386561
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-11-13 14:57:49 -05:00
Jim Harris
fbb9430ec4 app: add spdk_app_parse_args()
This is a helper function that eliminates a lot of
duplicated code in our target applications, specifically
around common command line argument parsing and usage
messages.  This patch only moves the iscsi, nvmf and
vhost targets to use this function, but there are other
test/example applications that could also take advantage
of it to reduce duplicated code and improve consistency.

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

Reviewed-on: https://review.gerrithub.io/386542
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>
2017-11-13 14:57:49 -05:00
Shuhei Matsumoto
1b306f4b54 net: spdk_sock_getaddr() support IPv6 transparently
spdk_sock_getaddr() (in lib/net/sock.c) only support IPv4.
Hence IPv6 cannot be used in SPDK iSCSI target.
By adding the code to support IPv6 transparently, IPv6 becomes
available in SPDK iSCSI target.

Change-Id: I236f2c6cb1e61283dde090729fecd8f743cec3fc
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/383672
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>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-11-10 18:54:21 -05:00
PepperJo
2e7c008fe2 nvme/pcie: page size alignment rings
cmd and cpl rings must be aligned on page size boundaries.

Change-Id: I103eed32adfaa4388bc7d672ee166973f796b343
Signed-off-by: Jonas Pfefferle <jpf@zurich.ibm.com>
Reviewed-on: https://review.gerrithub.io/383727
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-11-10 17:26:15 -05:00
Maciej Szwed
0c06e1ea89 lvol: show total accessible clusters in lvol store
Show total accessible clusters when listing lvol stores
instead of total blocks. This is more readable for user.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I22a14f626816769cf2f494ae30cfd8ee63897771
Reviewed-on: https://review.gerrithub.io/385634
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-11-10 17:24:31 -05:00
Tomasz Zawadzki
5eb52b951c blobstore: store usable number of clusters in blobstore structure
At the moment there was no way to a user of blobstore api to know,
how many clusters are availible to him. Total_clusters describes
number of clusters for metadata and user data.

New field added total_data_clusters, keeping number of clusters
that can be used to create blobs - meaning just user data.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I60555217644557410844f74628375a6b46fd2ac7
Reviewed-on: https://review.gerrithub.io/385633
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-11-10 17:24:31 -05:00
Jim Harris
973a27d08c app: add print_level to opts structure
This allows us to remove some duplicated code from our
main target applications.

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

Reviewed-on: https://review.gerrithub.io/385714
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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-11-10 17:00:58 -05:00
Jim Harris
4bcfef0021 rpc: remove rpc subsystem
RPC is core functionality for SPDK applications and should always
be initialized last (after all subsystems have been initialized).
So make RPC a first class citizen and integrate it with the
app framework directly instead of making it an "optional" subsystem.
Then we initializing it after all subsystems have completed
initialization, and tear it down before tearing down subsystems.

We can also do some other cleanup while here - for example, reactors
are already started when spdk_rpc_initialize() is called, so remove
the extra event that was added during initialization since this is no
longer needed.

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

Reviewed-on: https://review.gerrithub.io/385914
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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-11-10 17:00:58 -05:00
Jim Harris
0441ffcc05 nbd: do not free spdk_nbd_disk with io outstanding
There is a race condition here, where kernel could have
outstanding I/O to nbd device at the same time we terminate
the nbd application.  In this case, we cannot free the
spdk_nbd_disk since it contains the io structure that
will be referenced when the SPDK poller completes one
of those I/O.

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

Reviewed-on: https://review.gerrithub.io/385927
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-11-10 17:00:58 -05:00
GangCao
40dd3c29a4 event: create the ring on other available sockets
There may have the situation that associated socket does
not have enough memory for the event pool and the related
ring buffer. As the event pool will be created at any
available socket, this will be same for the ring.

The basic idea is to first allocate the memory for the
core associated socket and then try other available sockects
before terminating.

Change-Id: I52c240289899c136b607629c12c0250ad859c8ac
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/385972
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.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-11-10 13:03:31 -05:00
Tomasz Zawadzki
5a597c6f16 bs_dev: Add notice log when device does not support unmap
Previously lack of support for specific bdev was not known to user.
This impacts all unmap operations, such as initialization of blobstore.
It should be useful to user to know it will take longer

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I89bf3bc0342558fda9a8964fb5cb1daa3a8ed79e
Reviewed-on: https://review.gerrithub.io/385999
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-11-09 13:38:49 -05:00
Daniel Verkamp
7ea544b46a nvmf: move poll groups to public API
The end goal is to have the application create one poll group per core.
Then each poll group will have a single CQ per network device and an I/O
channel per back-end storage device to poll.

This is just the first step toward that, which is to wire up the
creation of the per-core poll groups in the application.

Note that the app poll groups don't do anything yet.  We'll need
additional library API changes to make the library use the existing poll
groups, rather than creating a new poll group per subsystem as we do
right now.

Change-Id: I2d4e2a5e5aa354d37714750f1d5b1d1e4ab9edce
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/381887
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-11-09 12:51:18 -05:00
GangCao
d544d14494 nvme: add the traddr for the ctrlr in the failed state
When a ctrlr is failed to initialize and to respond other
requests, the nvme_ctrlr_fail() will be always called. Add
a log there to have the traddr information so that applications
can know which ctrlr has the problem.

Change-Id: I951062a51349af81a505472f79e3c00a1ead2fbf
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/386189
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-11-09 12:40:24 -05:00
Ziye Yang
5b707a6e87 nvmf/rdma: Solve the qpair thread and channel issue.
According to the current code, rdma qpair is always created
by the thread on acceptor_core, thus we need to
change the related I/O channel during polling if the core
configured for subsystem is not same with the acceptor core.\

With this patch, we can run NVMe-oF tgt with multiple cores,
and each subsystem can configure different core to handle.

Change-Id: I6163a871f65115e545a4f3fd9cc46b3bafb13249
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/383683
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-11-09 12:39:31 -05:00
Changpeng Liu
e098347a17 nvme: print correct shutdown timeout value for error case
Change-Id: I3db00323c20786713750d13a61b1531d8b1ce7f6
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/386087
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-09 11:32:37 -05:00
Maciej Szwed
ed56bffbcb bdev/lvol: correct messages displayed on screen during tasting
During tasting, if bdev is already claimed, we send errors on screen.
This is expected behavior so we should send only debug logs.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ic5766cfa3aed88099415991998381de69ee8b8b6

Reviewed-on: https://review.gerrithub.io/384229
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-09 11:32:27 -05:00
Ziye Yang
c1b68ce131 nvmf/rdma: remove this include since it is not used
Change-Id: Ibdfa8be770d7bfcb2baaf29fa5b32dea064ffbd0
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/383383
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-11-03 20:20:25 -04:00
Daniel Verkamp
acb9d2488d nvme: use RTD3E to determine shutdown timeout
NVMe 1.2 introduced a new Identify Controller field, RTD3E ("RTD3 Entry
Latency"), which allows the device to report the expected time for a
normal shutdown.  Use this as the timeout for the shutdown process when
available instead of hard-coding 5 seconds.

Change-Id: I14e7223c81ba397771cf00b49f034f25d21b6e82
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/385301
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-11-03 19:21:32 -04:00
Jim Harris
32bff28a25 nvme: use spdk_pci_device_claim() in nvme_pcie_ctrlr_construct
spdk_pci_device_claim() can be used to ensure only one process
at a time uses any given PCI device.  Previously this was only
used in the bdev_nvme driver - other apps like nvme/perf do
not use spdk_pci_device_claim() and could effectively rip out
the device from a running bdev-based app like the NVMe-oF target.

So instead of modifying all of the nvme apps, put this logic into
the core nvme driver instead so that all applications get the
benefit transparently.  Save the fd when the controller is constructed
and then close it when the controller is destructed to handle the
detach (including hotplug) cases.

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

Reviewed-on: https://review.gerrithub.io/385524
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-03 18:48:33 -04:00
Jim Harris
3178ad6476 env: return fd from spdk_pci_device_claim()
This allows users of this interface to then close the fd
when they want to release the claim.

This prepares for calling spdk_pci_device_claim() in the
nvme driver to cover not just the bdev_nvme driver but all
of our nvme example and test applications as well.  We'll
want the fd returned so that we can properly close it during
detach (including hotplug) use cases.

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

Reviewed-on: https://review.gerrithub.io/385523
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: Ben Walker <benjamin.walker@intel.com>
2017-11-03 18:48:33 -04:00
Jim Harris
df7cf89394 iscsi, vhost, nvmf: allow running without config file
If the default config file does not exist, keep the
app's config_file options field as NULL, so that the
app code will not fail when trying to open a non-existent
file.

Also leverage the recent iSCSI and NVMe-oF refactoring,
to just skip trying to read config file parameters if no
config file exists (or the requisite section in the config
file is not present).  vhost already handled this so it did
not need to be modified.

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

Reviewed-on: https://review.gerrithub.io/385497
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-03 18:42:53 -04:00
Jim Harris
33a14041bb iscsi: make Mutual infer CHAP for DiscoveryAuthMethod options
Previously users would have to pass CHAP and Mutual as
separate words on the DiscoveryAuthMethod line - but
this was problematic since then we would have to check
that the user did not specify Mutual without CHAP.

So instead just make Mutual infer CHAP.

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

Reviewed-on: https://review.gerrithub.io/385495
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>
2017-11-03 18:42:53 -04:00
Jim Harris
28544c4bad iscsi: ignore invalid parameters
Some invalid parameters would result in an immediate app exit, while
others such as DefaultTime2Wait would adjust an invalid value
rather than causing an app exit.

Instead, be consistent and just ignore any invalid values, with an
error message.

One exception is the CHAP + Mutual check - this will be fixed
in a separate patch.

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

Reviewed-on: https://review.gerrithub.io/385494
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-03 18:42:53 -04:00
Jim Harris
e19368049f iscsi: add spdk_iscsi_read_parameters_from_config_file()
Move all of the code related to reading global iSCSI
parameters to a new function.

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

Reviewed-on: https://review.gerrithub.io/385493
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-03 18:42:53 -04:00
Jim Harris
6ffb301539 iscsi: add spdk_iscsi_log_globals()
spdk_iscsi_app_read_parameters() does an SPDK_DEBUGLOG
for each of the global parameters - consolidate these
and move them to a separate function.

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

Reviewed-on: https://review.gerrithub.io/385492
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-03 18:42:53 -04:00
Jim Harris
b64b9814c2 iscsi: separate config file param access from defaults
Modify spdk_iscsi_app_read_parameters() so that it sets
up all of the default values first, and then reads the
config file to update any parameters that may have been
specified.

This is in preparation for breaking out the config file
reading into a separate function that can be skipped
if no config file is available.  In this case it will just
use the defaults.

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

Reviewed-on: https://review.gerrithub.io/385491
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-03 18:42:53 -04:00
Changpeng Liu
d804492f02 vhost: exit the vhost app for error configuration
Change-Id: I56cc1df278a35bf40f3bb67d25af6dc3658aac82
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/382770
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-03 17:39:24 -04:00
Shuhei Matsumoto
fed2667127 iscsi and ut/iscsi: deny initiator grp w/ empty netmask
spdk_iscsi_tgt_node_access() (in lib/iscsi/tgt_node.c) regards
empty netmask of IG as ALL (allow all initiator's IP address).
However any user cannot create IG whose netmask is empty by both
JSON-RPC and config file. Instead user can create IG whose
netmask is ALL.

The code to regard empty netmask of IG as ALL never run in production.
Hence delete the code and add UT to confirm the fix.

Change-Id: Ib7206d0986db9093cfb6b36191be26293ff6c67a
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/382920
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>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-03 14:08:47 -04:00
Shuhei Matsumoto
e5c6b9c761 iscsi: turn <add/delete name&mask of IG> into functions
Group the code fragments of add/delete name and mask of initiators
and create spdk_iscsi_init_grp_add/delete_initiators/netmasks()
functions. Memory alloc/free is done in these functions.

Change-Id: I40f2873c5336a05813c0e34797c109386eda4229
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381246
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>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2017-11-03 14:08:47 -04:00
Shuhei Matsumoto
e5f7f8ba4a iscsi: delete spdk_iscsi_init_grp_destroy_by_tag()
This function is not used and there is already similar one.
Hence delete this function.

Change-Id: Iff290c4762cf5da7211382e367e5b137ab8fbf7d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381245
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-11-03 14:08:47 -04:00
Jim Harris
11bd19c80c iscsi: remove global data members for non-configurable parameters
FirstBurstLength, MaxBurstLength and MaxRecvDataSegmentLength
cannot be configured, so there is no need to keep global data
members for these parameters - just use the default #defines
instead.

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

Reviewed-on: https://review.gerrithub.io/385490
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-11-03 12:18:02 -04:00
Jim Harris
ed2f2d9d0e iscsi: remove configuration for unsupported parameters
Our iSCSI target does not support disabling InitialR2T,
DataPDUInOrder and DataSequenceInOrder, and will fail
if someone tries to disable them in the config file.

So instead, just do not support these parameters at all.
This simplifies the code and reduces confusion.

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

Reviewed-on: https://review.gerrithub.io/385489
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2017-11-03 12:18:02 -04:00
Jim Harris
cce7b3078d iscsi: remove global MaxOutstandingR2T parameter
This was not used anywhere - sessions default to
DEFAULT_MAXOUTSTANDINGR2T and never look at the global
MaxOutstandingR2T value.

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

Reviewed-on: https://review.gerrithub.io/385488
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2017-11-03 12:18:02 -04:00
Maciej Szwed
ea22acd559 lvol: read lvols names on lvol store tasting
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I2077dab7b343e662bdcfd5681b4850c258f0431f

Reviewed-on: https://review.gerrithub.io/385406
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2017-11-02 13:59:48 -04:00
Ziye Yang
43727fb7e5 nvmf/rdma: Add the buffer size check for data_buf_pool
Change-Id: I65e84971f2d55f27b0c0c1a1b226fc4da4b3cf89
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/382763
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-11-01 15:45:35 -04:00
Isaac Otsiabah
ce18c1f121 RPC: Add rpc support to update firmware.
Modified the above files to add rpc support to update NVMe firmware. Currently,
the path parameter must be local to the RPC Server.

Change-Id: I2b14e37792a2f0a5759e8b13e21137e7f346e58e
Signed-off-by: Isaac Otsiabah <iotsiabah@us.fujitsu.com>
Reviewed-on: https://review.gerrithub.io/369083
Reviewed-by: Paul von Stamwitz <pvonstamwitz@us.fujitsu.com>
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-10-31 12:49:31 -04:00
Daniel Verkamp
872fdc8e41 bdev/virtio: check if unmap is supported via VPD page
As part of the SCSI target scan, request the Block Thin Provisioning VPD
page to determine if the target device supports Unmap, and report it via
the io_type_supported bdev callback.

Change-Id: Id2fdaf3a2cae72e6356a862d40ff772f9d12d144
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/384131
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-30 12:17:50 -04:00
Daniel Verkamp
5304beccd3 bdev/virtio: move scan results into a structure
This prepares for adding more steps to the scanning phase.  Each step
will put its results into the scan info struct, and the final
alloc_virtio_disk() call will copy the info to the allocated disk at the
end of each target scan.

Change-Id: I836ada42e25c817bb1998328cb592acac25be08d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/384130
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-30 12:17:50 -04:00
Daniel Verkamp
5b9f0ddc53 scsi: use scsi_spec.h enums for VPD page numbers
Change-Id: I9783803a2f1ce5bb16d9336f7fecbd4f06dcdd52
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/384136
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-29 12:12:47 -04:00
Piotr Pelplinski
511adde02f lvol: add lvs name in rpc calls
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Ic6770371d9d62cbdd40ae0612eb4f7dceccd507f
Reviewed-on: https://review.gerrithub.io/383771
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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-10-27 13:10:21 -04:00
Piotr Pelplinski
e5b0dd6ead pmem: bdev names for pmem bdevs
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Ifbb02f99cd2e5752b2bc9091733b87ddadec11a4

Reviewed-on: https://review.gerrithub.io/383895
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-27 13:10:07 -04:00
Dariusz Stojaczyk
5447fb12a9 bdev_virtio: fix scan inquiry alloc_len
Some devices expect alloc_len
to be the same as payload len.

Kernel vhost-scsi reports:
Expected Transfer Length: 256 does
not match SCSI CDB Length: 255 for
SAM Opcode: 0x12.

Change-Id: I499290c207b77be6757441da002f9fcc9eebcecd
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/383779
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-10-27 13:07:25 -04:00
Dariusz Stojaczyk
cfa668375b bdev_virtio: retry sending scan requests
Scan requests will be re-sent
if non-critical failure has
happened.

This is actually required, as
some Virtio SCSI devices require
a dummy request to clear it's
POWER ON OCCURED unit attention
status after Virtio device init.
The very first request might fail
with asc = 0x29 (POWER ON, RESET,
OR BUS RESET OCCURED), but
subsequent requests will be
processed correctly.

Change-Id: I809bfe7952062995078f33dccb92192d722e6574
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/383689
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-10-27 13:07:25 -04:00
Tomasz Zawadzki
fde584034d lvol: give EEXIST error code on lvs name conflict
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1df83cbd6414a1bb8f54328c735950b9476e323b
Reviewed-on: https://review.gerrithub.io/384105
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-27 13:07:09 -04:00
Pawel Wodkowski
ff1863f428 vhost: interrupts coalescing
Virtio spec say that any IRQ requests are only hints. So try to limit
number of interrupts generated by vhost by defining minimum interval
between sending IRQ. Coalescing is disabled by default. Can be enabled
using RPC command 'set_vhost_controller_coalescing'.

Change-Id: I9b96014d004ea0ea022b4498c6b47d30d867091a
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/378130
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-10-27 13:06:40 -04:00
Seth Howell
8bfcbf0c8a rdma: in qpair_destroy, free recvs struct array
Fixing a memory leak.

Change-Id: I410986bb9d73818b0dd141a24a28a81a37bd8937
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/384109
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-27 13:06:21 -04:00
Tomasz Zawadzki
6c54c13cd4 event/subsystem/bdev: asynchronous SPDK finish
First this change moves spdk_subsystem_fini() to trigger on
spdk_app_stop(). This ensures that spdk_subsystem_fini() is called
before reactors are stopped in spdk_reactors_stop().

Finish paths for subsystems, bdevs and copy engine is now
asynchronous.
Each of those three mentioned have to make sure they are
asynchronous as well.

Only bdev that currently has requirement for asynchronous finish
are logical volume.
Thus the change in vbdev_lvol.c making it move to next bdev module
only after all lvol stores were unloaded.

Fio_plugin finish of bdev and copy_engine was removed for now.
Next patch in series adds it back with async support.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I80ee2d084f3d82c50bf1329e08996604ae61b1b3
Reviewed-on: https://review.gerrithub.io/381536
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-10-27 13:03:55 -04:00
Dariusz Stojaczyk
071cc42c7b bdev_virtio: remove internal README.md
The *TODO* section was outdated. Most of
this README's contents have been already
moved to doc/virtio.md and doc/bdev.md.

Change-Id: I2f2108afdc543276c9f08ae053ccebdbd6b1a229
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/384054
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-27 11:02:48 -04:00
Tomasz Zawadzki
9583e73901 lvol: remove lvs from global list after callback
Inserting into g_spdk_lvol_pairs list is done in vbdev_lvs_create_cb,
at that point it is known that it can be used. Meanwhile removing
was done at start of _vbdev_lvs_remove, to prevent possibility to
access it when waiting for destruct callback to complete.

This made checking if the g_spdk_lvol_pairs list is empty unreliable
to detect if all lvs were destroyed - they could still be being
processed and callback not yet called.

This patch removes lvs from global list only after the callback of
_vbdev_lvs_remove is called.

It will be used in future patch during asynchronous
finish of vbdev module to determine when all lvs were removed.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I638fe63a80b3cf00e9773f5a8c7be315d2c05555
Reviewed-on: https://review.gerrithub.io/382986
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-10-26 17:23:58 -04:00
Tomasz Zawadzki
2196023bc7 lvol: consolidate vbdev_lvs_unload and vbdev_lvs_destruct
To avoid code duplication those two functions were merged.
New _vbdev_lvs_remove function deals with differences by
additional argument "destroy".

No functional difference should be observed after this patch.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I09067646ec9b9656f361077c54906a618e4e0c48
Reviewed-on: https://review.gerrithub.io/383908
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-10-26 17:23:58 -04:00
Tomasz Zawadzki
ebf0312eef lvol: Add vbdev_lvs_destruct() and change unload behaviour [3/3]
This patch adds new API to remove logical volume store
from device it is on. It is only used from RPC, when
user explicitly requests. It allows to use the device to
use as any other bdev.

vbdev_lvs_unload() is now only called from hotremove and
during application shutdown. Which makes it possible to
load it again during application start up.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If6452ecc3fff99237d1704ff7cd8de4d7133221d
Reviewed-on: https://review.gerrithub.io/382021
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-10-26 17:23:58 -04:00
Daniel Verkamp
d189b8eedd blob_bdev: add unmap -> write_zeroes fallback
If the bdev doesn't support unmap, we should not send unmap I/O.
Instead, use spdk_bdev_write_zeroes(), which has a fallback in the bdev
layer for devices that don't natively support it.

Change-Id: I1bd05d3518716f8e60501dbb4f9da0fee23cf7c2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383491
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-26 17:23:58 -04:00
Maciej Szwed
e68e2e749b lvol: do not unload/destroy lvs when operation on lvol is pending
There is a scenario where we can try do unload or remove
lvol store while lvol present on that lvol store is being
closed or destroyed.

Scenario:
1. send delete_bdev rpc command
2. command returns before lvol is actually closed/destroyed
   (does not wait for callback)
3. send destroy_lvol_store rpc command
4. lvs is destroyed before lvol is destroyed
5. lvol destroy callback is called on destroeyd lvol store

Aboive scenario can be reproduced using:
spdk/test/vhost/spdk_vhost.sh --integrity-lvol-scsi

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ie715279195bd4b1145cf05d4f5a8477b4fac87f7
Reviewed-on: https://review.gerrithub.io/383595
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-10-26 17:23:58 -04:00
Maciej Szwed
2baeea7dd4 bdev: add callback to spdk bdev unregister and bdev destruct
Currently deleting bdev does not support asynchronous delete
operations. Because of that results are returned before device
is actually deleted and some operation can be peformed on that
device after removal of this device started.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I305c302d8abd5d7c2c0f947fca70c58396872132
Reviewed-on: https://review.gerrithub.io/383732
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-10-26 17:23:58 -04:00
Dariusz Stojaczyk
a17d431612 bdev_virtio: fix setting name for modern pci devices
It used to be NULL.

Fixes: a85a4452
("bdev_virtio/rpc: add construct_virtio_user_scsi_bdev")

Change-Id: I490b41571e5667cf95b59b2e316006d1ef7381e8
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/383892
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>
2017-10-26 15:09:57 -04:00
Piotr Pelplinski
9d17cbdd23 blob: fix bug when specifing cluster size < 4096
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: I59cbef4ce1bfe8af113c66c2c9cb9f208440c0aa

Reviewed-on: https://review.gerrithub.io/383887
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-10-26 14:21:22 -04:00
Pawel Kaminski
b84cf820af test/vhost: Test Plan for vhost initiator.
Change-Id: I51a45ef1d94de6324744af7801b59a6b73578dd2
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/377563
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
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>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-26 14:07:59 -04:00
Pawel Wodkowski
a85a4452f3 bdev_virtio/rpc: add construct_virtio_user_scsi_bdev
Change-Id: I2a351442ead0874d98bdfb23079a723d7665dbb1
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/381186
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-10-25 18:31:56 -04:00
Daniel Verkamp
d822c2055e rte_virtio: check payload size in vhost_user_read
Make sure the recv() can't write beyond the end of the msg buffer.

Change-Id: Ibc4bb51ac3a1c2a027a458d59356b7a5496eca7e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383646
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-25 18:30:18 -04:00
Daniel Verkamp
22077b210b rte_virtio: use size_t/ssize_t in vhost_user_read
Use the correct size types (rather than int) for values passed to and
returned from recv().

Change-Id: I2d38eed63e2d9c9f056d1053e156088fd361c88b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383645
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-25 18:30:18 -04:00
Jim Harris
e6d053e78a lvol: add lvol unique name
Add a name to each lvol which is persisted as a blob
xattr.  lvol names must be unique within its
lvolstore.

While here, fix a few lvol_ut issues that were caught
as part of testing the lvol unique names.  Also fix
a couple of tests that registered the wrong string
name with CUnit.

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

Reviewed-on: https://review.gerrithub.io/383567
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-10-25 12:10:38 -04:00
Jim Harris
c6f1d12930 lvol: move name to old_name
There are some upcoming changes which will deprecate
the old lvsuuid_blobid name in favor of an
lvs_name/lvol_name name where these names are
user-specified.

In preparation for this change, rename the previous
lvol->name to lvol->old_name.  This will allow us
to add a new lvol->name but keep the original
old_name during the transition.

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

Reviewed-on: https://review.gerrithub.io/383534
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-10-25 12:10:38 -04:00
Jim Harris
08ac0074ce lvol: add unique lvolstore name
Each lvolstore now has a unique name which is persisted to
metadata.  Eventually this will provide a friendlier
way to reference logical volumes, in the form
lvolstore_name/lvol_name.

This patch only covers the unique lvolstore name.  An
lvolstore may not be created nor loaded if its name
conflicts with an already loaded blobstore.

Currently there is no way to rename an lvolstore to
resolve a conflict.  This will be coming in the future.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I842f13b79776e5b8f81e56de10778c35328e8cd3
Reviewed-on: https://review.gerrithub.io/383533
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-25 12:10:38 -04:00
Daniel Verkamp
e50cc5fd45 scripts/check_format: check trailing whitespace
Fix up the two existing instances of trailing whitespace in text files,
and add a check to enforce that no new trailing whitespace is added.

Change-Id: I2197bed69bb356142aa6d2e4e8261c7434dd358b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383291
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-10-24 17:35:23 -04:00
Daniel Verkamp
ba90c8876e rte_virtio: use spdk/stdinc.h
Replace POSIX and standard C #includes with the central SPDK stdinc.h
and remove the rte_virtio exclusion from header checking in
scripts/check_format.sh

Change-Id: Ie53d11de7cd9a51c59957e3c500bd8b9b4c4bc5e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383003
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-24 17:19:44 -04:00
Daniel Verkamp
94678ad9ee rte_virtio: reformat with check_format.sh
Remove the exclusion of the rte_virtio code from scripts/check_format.sh
since we will be maintaining this code going forward (unlike rte_vhost,
which we intend to keep up to date with upstream DPDK).

Change-Id: I30c186e566ca777dff552a36af53443d197a8824
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383002
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-24 17:19:44 -04:00
Daniel Verkamp
e36d36e4f9 bdev: fix write zeroes fallback error path
If an I/O fails during the write zeroes fallback to write on a split
I/O, the previous code would call spdk_bdev_io_complete() again on the
same I/O, causing infinite recursion.

Fix this by restoring the original user callback before completing the
I/O, as well as using _spdk_bdev_io_complete() rather than
spdk_bdev_io_complete() to avoid double-counting the statistics.

This also preserves the original bdev_io->status code set by the module,
rather than always setting it to SPDK_BDEV_IO_STATUS_FAILED.

Change-Id: Ib71fa6e54eed3d5823652971f7c439e0ff236fc1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383506
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2017-10-24 13:51:20 -04:00
Maciej Szwed
87a0945c50 lvol: add lvol reference counter to spdk_lvol_open()
This patch is a continuation of patch https://review.gerrithub.io/#/c/383252/
on which this series should be rebased. This series introduces
spdk_lvol_open function where reference counter should be also used.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I962db95eaba34c7c18e639076ad86696e8209196

Reviewed-on: https://review.gerrithub.io/383264
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-24 13:36:51 -04:00
Jim Harris
1efd9cfa2f lvol: delete super blob in spdk_lvs_destroy
If we don't delete the super blob, this blob structure
will leak.

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

Reviewed-on: https://review.gerrithub.io/383311
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>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2017-10-24 13:36:51 -04:00
Jim Harris
7d8fe2ca2c lvol: keep list of open lvolstores
This will be used in a future patch to ensure we do not
allow creating or loading an lvolstore with a names that
matches an already opened lvolstore.

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

Reviewed-on: https://review.gerrithub.io/383012
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-10-24 13:36:51 -04:00
Jim Harris
17218f8f34 lvol: add internal function for freeing spdk_lvol_store
Currently this is just a free(), but a future patch will
also remove spdk_lvol_stores from a common list.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iff0f14fbe2003448d24f6fb1484f0e95acfe90ff
Reviewed-on: https://review.gerrithub.io/383011
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2017-10-24 13:36:51 -04:00
Maciej Szwed
199e73908d lvol: Lvol store tasting
This patch introduces lvol store and lvols parameters saving
on persistent memories and loading it from saved data on app start.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ia63f0cf3d6365d59f31c5f0a1724636bfe73b5b8
Reviewed-on: https://review.gerrithub.io/375764
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-10-24 13:36:51 -04:00
Dariusz Stojaczyk
3788c907bb rte_vhost: fix double free on shutdown
The vhost connection can be closed
concurrently from 2 places:
 * the connection thread itself
 * rte_vhost_driver_unregister
The connection thread will terminate
the connection if any recv error
occured. The unregister function
will terminate the connection
together with the thread.
However, there is no sychronization
between those two. The connection
thread runs in the background
without any mutex.

The rte_vhost_driver_unregister
now signals the connection thread
to terminate itself and waits
until it's killed.

Change-Id: I012e97ebb8a79edcb2c17c28b2fc7e8041bf92b3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/383085
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-23 15:35:25 -04:00
Daniel Verkamp
f26983fa07 rte_virtio: move pci_dump_json_config out of #ifdef
pci_dump_json_config() is used for both legacy and modern PCI virtio
devices, so move it out of the #ifdef PCI_LEGACY_SUPPORT so it is
available when building against older DPDK versions.

Change-Id: I986f9e6a81abda64d77f954b15807d06e35d1748
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383487
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-23 15:35:14 -04:00
Tomasz Zawadzki
79745b8c8b blobstore: do not allow for spdk_bs_unload if blobs are still open
It is possible that a user will call spdk_bs_unload() with blobs
list not-empty. Instead of just asserting that, now the call fails
with appropriate error.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I83818453d6c90ff9b5bf657c90e12b2f9d5ca013
Reviewed-on: https://review.gerrithub.io/383220
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-23 15:31:48 -04:00
Dariusz Stojaczyk
fb99e9e644 rte_virtio: disable legacy PCI for dpdk < 17.05-rc4
17.05-rc4 is the version e.g.
rte_pci_ioport_read function was
introduced in. The bdev_virtio
module previously did not compile
with older DPDK versions.

Change-Id: Ib96d5d7934166acc552515b02bfba25b71929438
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382829
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>
2017-10-23 12:33:58 -04:00
Daniel Verkamp
e55a3c9450 lvol: fix lvol_req NULL check in spdk_lvol_destroy()
This was looking at req, but req had already been allocated and checked
for NULl previously; this line was intended to be checking lvol_req.

Change-Id: I8603d35fb4582c109e9d02f4964bbd6d21735324
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/383312
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2017-10-23 12:17:07 -04:00
Pawel Niedzwiecki
97e82c0c06 vhost_scsi: validate length of virtio descriptors
Casting pointers without checking their length could
potentially lead to a crash

Change-Id: I7c61e5818ecfbf32bb363858965503341353c51e
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/382420
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-23 11:53:55 -04:00
Seth Howell
3f9cbe513b blob: add write_zeroes support
Unmap does not guarantee that erased blocks will return all zeroes.
using write_zeroes when unmapping metadata gives the
desired behavior for a blob.

Only metadata pages will be cleared with write_zeroes in this patch;
blob data clusters will still call unmap.  This behavior may be made
configurable in a later patch (to allow the user to request zeroing of
clusters rather than just unmapping).

Change-Id: I1b210abac110867ce703bcfdeb634eb45aa9d5c9
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/372004
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-23 11:50:16 -04:00
Seth Howell
3fd7f28dc9 bdev: add fallback from write_zeroes to writev
if write_zeroes is not supported by the block device, we can get the
same behavior by simply writing a buffer full of zeroes to the blocks
we want to erase. I also incorporate splitting into the bdev layer to
accomodate large i/o.

Change-Id: I8fa1bfaaf22d7bfc6e3afb6e89d22fa9f7767e55
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/373829
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-23 11:50:16 -04:00
Seth Howell
5f5edbcb8c scsi_bdev: increase max I/O size to 4 MiB
This is necessary to avoid failing very large write_zeroes operations.

This is the minimal workaround to get the current bdevio tests to pass -
the real fix will be implemented in the bdev layer later.

Change-Id: I4e49f1b4da5d4c7f9507757d6c71ba3880d22437
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/383306
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-23 11:50:16 -04:00
Jim Harris
4a3ef93344 env/dpdk: unlink hugepage_info and config files immediately for single process apps
There is no need to wait until an atexit() to unlink these - we can do it immediately
since the open refs will still be valid.

Note: changed the remove() calls to unlink() to be more precise, since these are
files and not directories.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib160131bcf3beb9783c6fc4de021f64c43c943a9
Reviewed-on: https://review.gerrithub.io/382697
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
2017-10-20 19:43:26 -04:00
Tomasz Zawadzki
f71f486d0b lvol: Add spdk_lvs_destroy() API [2/3]
This goes along with previous patch in series.
Adding functionality to remove logical volume store from
device.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6338a35ed02838498a3cd9bb2dddd25803e65f79
Reviewed-on: https://review.gerrithub.io/382020
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-10-20 16:06:53 -04:00
Tomasz Zawadzki
2df9f03c47 blobstore: New API call to destroy blobstore [1/3]
Currently exposed API allows to load/unload and to
initialize blobstore on a device.

A spdk_bs_destroy() call is added in order to reach
functional parity with spdk_bs_init(). It was not
possible to remove blobstore from device from within
SPDK previously.

spdk_bs_destroy() takes blobstore pointer as argument
(instead of bs_dev), because blobstore has to be already
loaded to destroy it.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I2c493a4407868fcf08fd1766a19fc8463f634ef5
Reviewed-on: https://review.gerrithub.io/382019
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-10-20 16:06:53 -04:00
Maciej Szwed
63fce5595b lvol: add reference counter for open lvols
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I3a86f28056e67b3c237441fb1048ca6ccd081ae7

Reviewed-on: https://review.gerrithub.io/383252
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-10-20 16:06:53 -04:00
Maciej Szwed
94cf9837aa lvol: support callbacks in lvol close/destroy functions
Close and destroy lvol functions should support callback
functions so that they can be processed sequentially
and also give user result.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I9e87fb281916c65c17b2b7e54e91228844962048

Reviewed-on: https://review.gerrithub.io/383230
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-10-20 14:26:01 -04:00
Dariusz Stojaczyk
7dee96ce24 bdev_virtio: added --without-virtio configure flag
SPDK can now be compiled without
the virtio driver.

Change-Id: I92999c871d28875d519749a73a7f2230c3881fbe
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382828
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-10-19 19:06:12 -04:00
Pawel Wodkowski
17a302a138 bdev_virtio/rpc: implement dump json config RPC
Change-Id: Ieb0e69743da893659538c37c37d6ee8802080b86
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/381986
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-10-19 19:05:01 -04:00
Cunyin Chang
9f891d14ce blob: Make the files persisted cross power failure.
We only sync the metadata and data in the runtime of blobstore, which
means we only update the used md bitmap and used clusters bitmap in memory.
if the system crushed, we have no chance to sync the used md bitmap and
used clusters bitmap into disk, then next time when we try to load the
blobstore, all the data will lost, this patch add the logic to recover the
valid data from last dirty shutdown. We will go through all the metadata pages
to find all valid data and rebuild them.

Change-Id: Ieb7c5f932206b1b68fdde0cee35f2d2cb3a4f309
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/376470
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-10-19 15:13:58 -04:00
Jim Harris
e739a50f48 blob: initialize super_blob and bstype during load
A recent patch did some refactoring on how the superblock is
written out - it introduced a bug where on load we would
write out INVALID for super_blob id and a null bstype when
clearing the clean bit.

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

Reviewed-on: https://review.gerrithub.io/383129
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>
2017-10-19 13:23:58 -04:00
Jim Harris
f97c8b3142 lvol: add spdk_lvs_opts_init()
Some future patches will require specifying an lvol_store
name when calling spdk_lvs_init().  This means that passing
NULL for spdk_lvs_opts will no longer be an option.  So
add an spdk_lvs_opts_init() (similar to spdk_bs_opts_init)
which will initialize a default value for the cluster size.

While here, prepend an underscore to spdk_setup_lvs_opts, since
this function is not part of the public SPDK API.

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

Reviewed-on: https://review.gerrithub.io/383030
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-19 13:23:58 -04:00
Shuhei Matsumoto
f678097d50 iscsi: add spdk_iscsi_init_grp_create() function
init_grp.c has init_grp_destroy() function but does not have
init_grp_create() function. Hence add init_grp_create() function.
init_grp_create() function check duplication of init groups.

Change-Id: I49c64254846ae4edd7a0bb2cf3250fb6f53239f4
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381243
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-19 13:11:09 -04:00
Dariusz Stojaczyk
97a3b814e0 rte_virtio: fix vdev->max_queues
We interpeted max request queue
count as number of all queues.
It did not take into account
eventq and controlq.

This patch also fixes overall
max_queues negotiation for
modern PCI devices.

Fixes 8b0a4a3 ("bdev_virtio: implement multiqueue")

Change-Id: I834cb973772ca5946ac26d18bd3eeb2783f48ea9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382816
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-10-19 13:00:51 -04:00
Dariusz Stojaczyk
770dcb0006 rte_virtio: fix setting NEXT flag for the last chain descriptor
It was wrongly assumed that
each READ will contain at least
one iovec. This could potentially
corrupt the desc array.

Change-Id: I48ca7efbe4bea897e0ad16184452bddcf3daf49b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/383009
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-19 10:56:21 -04:00
Dariusz Stojaczyk
a922e9f302 bdev_virtio: add xmit_pkt error handling for target scan
Only the initial xmit_pkt is checked
against an error, the subsequent
xmits are just asserted. As scan
messages are sent 1-by-1 if the first
request (containing 3 iovectors) has
been enqueued successfully so should
the next ones.

Change-Id: Ie102256a42ef1c67132d606af90ab96771adba10
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382784
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>
2017-10-19 10:56:21 -04:00
Dariusz Stojaczyk
f35ca8f7df bdev_virtio: properly handle full-queue scenario
In case of not enough free descriptors
the bdev_virtio will fail the I/O with
NOMEM status.

Change-Id: I1cb0cd5453ff70468898bc8e414b53b9c64dbe50
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382783
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>
2017-10-19 10:56:21 -04:00
Dariusz Stojaczyk
c6ba3fe473 bdev_virtio: set unique name for the bdevs
Previously all bdevs were using
hardcoded name Virtio0.

Change-Id: Ib990027a0edd4e200aa4b6f4689ccb9e0824a9c3
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382926
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-10-19 00:34:12 -04:00
Dariusz Stojaczyk
08fcc22f42 bdev/gpt: check against get_io_channel failure
Added an additional error check.

Change-Id: I5b662cdf23fba21cd59fe416829f1c71b9499ca6
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382928
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-10-19 00:33:06 -04:00
Dariusz Stojaczyk
3070826140 bdev_virtio: explicitly return -1 on channel creation failure
This doesn't change any behavior
as queue_idx was always either
0 or -1, but makes it clear that
this function always returns
-1 on error. This is required
by current io_channel implementation.

Change-Id: I2b613ab9ff1e48d5b4aee0cd499bbc0a04cb765c
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382927
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>
2017-10-19 00:33:06 -04:00
Cunyin Chang
23ec116cbb bdev/virtio: Fix the compile bug.
Change-Id: I790b5cc9147182e106ac6d1fbd66ab95c4beec01
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/383038
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-10-19 00:02:09 -04:00
Daniel Verkamp
8eef5183d3 bdev: remove spdk_bdev_poller_start() lcore option
Always start bdev pollers on the calling core.

This removes the lcore concept from the bdev poller abstraction and
simplifies the job of spdk_bdev_initialize() callers providing their own
poller and event implementations.

All callers except the NVMe bdev hotplug poller already used the current
core as the parameter.  The NVMe HotplugPollCore option was undocumented
and unused in any of the tests or example configuration files, so it
should be safe to remove.

Change-Id: I93b466e1e58901b8785c40cbe296fa46c157850f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382857
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-18 20:28:29 -04:00
Dariusz Stojaczyk
19ddb108de bdev_virtio: implement controlq and RESETs
A single thread that initialized
bdev_virtio subsystem will be used
to poll control queues for all
virtio devices.

Every io_channel will put it's e.g.
RESET requests to the controlq MP-SC
spdk_ring. The controlq poller will
dequeue these requests and put them
into the virtio queue. The same
poller will then poll for completions
and send them to proper threads
that submitted given requests.

Change-Id: I90ae7c5d76dc89cc52ff69cf2a60e27a9314557c
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382201
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-10-18 13:08:45 -04:00
Dariusz Stojaczyk
922aaac68b env/ring: add spdk_ring_count
Added a wrapper for rte_ring_count().

Change-Id: Ia12fde3f250604a0f801309ed1c4706a311e7896
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382919
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
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>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-18 13:08:45 -04:00
Dariusz Stojaczyk
eba48d825c rte_virtio: add missing if() brackets
Some error messages were printed
outside of the error-checking
if() condition.

Fixes: bd273d4 ("rte_vhost: replace strerror() with spdk_strerror_r()")

Change-Id: Icf965ae56ffc2e0970572308b38607ac63cdb1f2
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382943
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>
2017-10-18 13:00:34 -04:00
Ziye Yang
6f95c32590 lib/nvmf: Create a shared buffer waiting list
Our previous implementation makes the buffer allocation
in an unfair way and this patch can solve this issue.

With this patch, we can use limited buffer to support
high I/O depth.

Change-Id: I0e7a073c0b4539090218aa461d50620287bb4b63
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/382528
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-10-18 12:50:51 -04:00
Dariusz Stojaczyk
ab8a0460a9 bdev: clear bdev_io->iov for unmap
Values from previous bdev_ios
were reused and were taken into
account e.g. in bdev_io_get_buf()
to check if a buffer is already
assigned.

Change-Id: I239aaf83a4ce8a9342c1820e3ac9e9ccf6a28336
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382959
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-10-18 12:48:37 -04:00
Tomasz Zawadzki
4768b198da iscsi: wait with spdk_app_stop until poller is unregistered
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I9218b618544def301a4509eda1b266390a80dba5
Reviewed-on: https://review.gerrithub.io/382830
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>
2017-10-18 12:32:28 -04:00
Daniel Verkamp
4835489a9d blobfs: fix bstype debug prints
Add newlines to the debug logs.

Also dump the mismatched bstype via SPDK_TRACEDUMP() rather than as a
string, since it may not be null terminated.

Change-Id: Icad567373c56f24aea550903a1370c3734465472
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382855
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-17 16:26:02 -04:00
Daniel Verkamp
31521306a5 log: change spdk_trace_dump() to take a void *
Previously, spdk_trace_dump() took a const uint8_t * as the buffer, but
it is more flexible to allow any type to be passed (we are just going to
interpret it as an array of bytes anyway).

Change-Id: I1750316928cd330ed461bb513ff8af37e0170ef3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382854
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-17 16:26:02 -04:00
Daniel Verkamp
450e2b88c7 blobfs: use struct spdk_bs_type to represent types
Rather than using char arrays to represent blobstore types, just use the
publicly-defined struct spdk_bs_type.

Change-Id: I8bbfd95085e16f9d53106c176038e067ff1266d7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382853
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-17 16:26:02 -04:00
Daniel Verkamp
80b44ea20f rte_virtio: remove unused PCI ID #defines
These #defines are not currently used, and they have equivalents already
defined in spdk/pci_ids.h:

VIRTIO_PCI_VENDORID == SPDK_PCI_VID_VIRTIO
VIRTIO_PCI_DEVICEID_SCSI_MODERN == PCI_DEVICE_ID_VIRTIO_SCSI_MODERN

Change-Id: I0016ab0a26f4aa7ff4a5ee10f66da867b590e0e6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382734
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: Jim Harris <james.r.harris@intel.com>
2017-10-17 15:26:43 -04:00
Daniel Verkamp
3501062e53 bdev/virtio: clean up unused/duplicate #includes
Change-Id: Ia0dcddd29f75938cad6e7bfe23ab64909ecc1669
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382733
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: Jim Harris <james.r.harris@intel.com>
2017-10-17 15:26:43 -04:00
Daniel Verkamp
bd273d4789 rte_vhost: replace strerror() with spdk_strerror_r()
strerror() is potentially not thread safe; use the thread-safe SPDK
wrapper instead.

Change-Id: I5f6f4b0b19a0298b07f71f05aee4574e8b21f5fa
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382732
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-17 15:26:43 -04:00
Dariusz Stojaczyk
f67dddc6f4 bdev_virtio: fix memleak on init failure
This patch also introduces
vq->poller_ctx. It will be later
reused for per-virtqueue task pools
to allow multiple threads using
the same virtqueue.

Since at the time of scanning there
is no I/O traffic, this field is
now being used to keep scan base
pointer. It has to be freed if an
initialization error occurs.

Change-Id: Ia54ee6c8402d38218dc811b4994761105d17269a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382199
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-10-17 15:21:09 -04:00
Dariusz Stojaczyk
13017493af bdev: added spdk_bdev_io_get_thread()
This is required for virtio-initiator,
where multiple io_channels have to
share the same virtio queue. A single
poller will receive responses from
a virtio queue and send the completions
to the thread that submitted bdev_io.

Change-Id: I951c7655aaa17d41a680d437661afff27d2c3077
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382200
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>
2017-10-17 15:21:09 -04:00
Daniel Verkamp
0fbde3af96 bdev/lvol: fix total_blocks and free_blocks names
The get_lvol_stores RPC had typos in the free_blocks and total_blocks
fields (they were named "free_num_blocks" and "total_num_blocks", which
didn't match the names of the actual variables).

Change-Id: Ib66b04ec2f0c272048a826bfa59338db1d028e34
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382522
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-17 13:59:34 -04:00
Daniel Verkamp
3772d46c2e bdev/lvol: add lvol_store_uuid to driver_specific
Change-Id: I85ce977183be4de9efacb66637e7895f22f58508
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382521
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-17 13:59:34 -04:00
Daniel Verkamp
b10dac2c78 bdev/lvol: add module name to driver_specific JSON
This allows the caller to know which bdev module is exporting the bdev
and therefore how to interpret the driver_specific fields.

Change-Id: I09641645875827eabc0a831fff5b0b5bed6b03d0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382519
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-17 13:59:34 -04:00
Dariusz Stojaczyk
04b2fee404 vhost: replaced tasks ring with dynamic array
Each virtqueue will now contain
it's own buffer for I/O tasks.

Some of the task struct fields
are now the same across subsequent
I/Os, so they can be now set
just once - at the vdev start/stop.

This simplifies the code, the
debugging process and also introduces
additional sanity check preventing
vhost from processing two requests
with the same id at the same time.

Change-Id: Idcf388e8bf7c92e5536199c35eb0eb6339c00d84
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/369114
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>
2017-10-17 13:37:56 -04:00
Pawel Wodkowski
3a33129a6d vhost: wrap rte_vhost_vring into spdk_vhost_vring
This enable storing SPDK specific stuff per queue. First use of
this will be event index feature.

Change-Id: Ieca6fa47a6f2e23bec73d2cda8b0ed8b9185bd28
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/376636
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>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-17 13:37:56 -04:00
Maciej Szwed
eb8b1e20a9 blobstore: add bstype to blobstore super block
Introducing bstype as a way to identify and verify
 blobstore type.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I50267b5408625be10fe0c146ae329016d5509b4a
Reviewed-on: https://review.gerrithub.io/380476
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-17 13:36:03 -04:00
Daniel Verkamp
dc72227595 rte_virtio: unlock vdev mutex on error path
Change-Id: Ice2f157d79ba88a80d01460b67b78376aa0a5890
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382721
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: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-17 11:34:38 -04:00
Daniel Verkamp
9864668f25 bdev/virtio: verify block device peripheral type
The virtio bdev should only attempt to issue SBC commands if the SCSI
device is a block device.

Change-Id: Ib29edbd19f9f34bdafe5ea3f7085c57537134625
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382714
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-10-17 11:32:45 -04:00
Daniel Verkamp
fc5f527c21 scsi: split Inquiry peripheral type and qualifier
The SCSI spec defines two separate fields within the first byte of
the Inquiry data.  Define them as bitfields and add enum values for the
peripheral qualifier field.

Change-Id: Ibbb158338da199fc1b67b04c52ec91633577c571
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382713
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-10-17 11:32:45 -04:00
Shuhei Matsumoto
a07416d8d0 iscsi: delete spdk_iscsi_find_init_grp() function.
the function of spdk_iscsi_find_init_grp() is duplicated with
of spdk_iscsi_init_grp_find_by_tag(). The later one should be kept.
Hence delete former one.

Change-Id: I8d397648bd400550445de49c8a7731f0932f5324
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381244
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-16 19:27:35 -04:00
Daniel Verkamp
904f3aa1e1 lvol: don't pass lvs to cb_fn after it was freed
Change-Id: I6d3669bc19b51fd72af7ea27aa4d2a88dee59e58
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382509
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-16 15:52:14 -04:00
Dariusz Stojaczyk
9760edb041 bdev_virtio: add defines for virtqueue IDs
Remove some magic numbers from the code.

Change-Id: I494d57331888dd03f0bbff1f6beeac46139d7e96
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382348
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>
2017-10-16 15:48:09 -04:00
Dariusz Stojaczyk
8b0a4a3c53 bdev_virtio: implement multiqueue
Virtqueues now have to be "acquired"
by a logical CPU core in order to
perform any traffic on them. The
acquire mechanism is thread-safe to
prevent two reactors accessing the
same virtqueue at the same time.

For now a single virtqueue
may be used by only one io_channel.
Support for shared virtqueues will
be implemented in future.

Added new param "Queues" to the
virtio config file for VirtioUser
bdevs. VirtioPci will use the
max available queues num -
negotiated during QEMU startup.

Change-Id: I3fd4b9d8c470f26ca9b84838b3c64de6f9e48300
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/377337
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-10-16 15:48:09 -04:00
Dariusz Stojaczyk
14db5b6646 rte_virtio: removed virtio_logs.h
Replaced old PMD_*LOG with
* SPDK_WARNLOG
* SPDK_ERRLOG
* SPDK_DEBUGLOG

Added 3 new trace flags:
* virtio_dev - SPDK_TRACE_VIRTIO_DEV
* virtio_pci - SPDK_TRACE_VIRTIO_PCI
* virtio_user - SPDK_TRACE_VIRTIO_USER

This patch also makes error
messages to be printed on
non-debug builds. Some messages
should be still reworded, but
that will be done in a separate
patch.

Change-Id: I2dd4c71dfce20cde0ef010a1d91ac6f166bb2c98
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382620
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-10-16 15:48:09 -04:00
Dariusz Stojaczyk
7e4f3dbfdc rte_virtio: remove virtio_queue.h/.c
Moved their contents to virtio_dev
files. virtio_queue was already deeply
connected with virtio_dev. There's
no need to keep them separate.

Change-Id: I540c04eb954fe0618817c020f9453aebf3d98ba9
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382619
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>
2017-10-16 15:48:09 -04:00
Dariusz Stojaczyk
66d101ffee rte_virtio: remove virtqueue_notify()
Simplified some code.

Change-Id: I9fc42da93a4c2df3714775d73508de118a5e6b1a
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382618
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>
2017-10-16 15:48:09 -04:00
Pawel Wodkowski
cc3c79065c env: don't free DPDK eal arguments
Documentation of rte_eal_init() lie. At least two parameters (huge-dir
and file-prefix) are held and used internally trought the lifetime of
application.

Change-Id: Ie418b5f2b0d7fbea5c217e47a555a520d3256360
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/382677
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>
2017-10-16 15:29:58 -04:00
Tomasz Zawadzki
7aba48fe1e subsystem: move allocation of subsystem_init event to subsystem
Previously two spdk_events were allocated in spdk_app_start().

Now app allocated spdk_event for function to be called after
initialization is complete. Meanwhile subsystem allocates
its own spdk_event.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I4822f76d30cc2f7b95a86a4ffbfc61b80c0a903e
Reviewed-on: https://review.gerrithub.io/382673
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-10-16 15:14:36 -04:00
Tomasz Zawadzki
9f12ec9d32 lvol: remove lvol from lvol_store->lvols list once in lvol destroy
spdk_lvol_destroy() and spdk_lvol_close() behave very similar to
each other. With exception that spdk_lvol_destroy() deletes blob,
after closing the blob.

The order of calls in spdk_lvol_destroy() case:
- spdk_lvo_destroy() calls spdk_bs_md_close_blob()
- _spdk_lvol_delete_blob_cb is callback from closing the blob,
which calls spdk_bs_md_delete_blob()
- _spdk_lvol_close_blob_cb is callback from deleting the blob

The order of calls in spdk_lvol_close() case:
- spdk_lvo_close() calls spdk_bs_md_close_blob()
- _spdk_lvol_close_blob_cb is callback from closing the blob

Lvol was removed from lvol store lvol list in two cases,
spdk_lvol_destroy() and _spdk_lvol_close_blob_cb().
This caused lvol to be removed twice from the list in
lvol destroy case.

This change makes it so it is more clear, that lvol is removed
from lvol store lvol list in both cases and just once.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I204645850ca2c46f03a9035518b00f50c75e2b1a
Reviewed-on: https://review.gerrithub.io/382425
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-10-16 13:13:22 -04:00
Tomasz Zawadzki
df45eaecf7 lvol: prevent unloading lvol store when lvols are open
Similar to blobstore unload, lib/lvol assumes that unloading
lvol store is only possible after no lvols on it are open.

Before spdk_lvs_unload() is possible, for each lvol
on that lvol store spdk_lvol_close() or spdk_lvol_destroy()
has to be called.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I86bae67ec322a61fdc0045d799854eecd1f36407
Reviewed-on: https://review.gerrithub.io/382252
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-10-16 13:13:22 -04:00
Daniel Verkamp
5aecabfbd5 bdev/virtio: remove unused virtio_user_dev parts
Several fields in struct virtio_user_dev are not referenced anywhere (a
few have cleanup code but no other assignments); remove them.

Also drop is_vhost_user_by_type() and virtio_user_handle_cq(), which
aren't used anywhere.

Change-Id: I7c80ccbadbd5263a2886dc9028108b898d6485ae
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382505
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-16 11:17:16 -04:00
Daniel Verkamp
64096b6031 bdev/virtio: check allocation in virtio_user_dev_init()
Change-Id: Ib8cc74b4b975013c97c3b5cc68489d8ac9b3970d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382495
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-10-16 11:17:16 -04:00
Daniel Verkamp
7aa53faabd bdev/virtio: remove __rte_unused annotations
These are just noise, since we don't enable the unused parameter
warning.

Also remove an unused variable, txvq, in virtio_dev_start() that
had been left behind since it was marked as __rte_unused.

Change-Id: I7bda85ef5f2208dd36d8f1806d8241a04b893123
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382494
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-10-16 11:17:16 -04:00
Daniel Verkamp
c32510daa8 bdev/virtio: remove unused dirent.h and fcntl.h
These were included under #ifdef RTE_EXEC_ENV_LINUXAPP, which is not
defined in the SPDK build system, so they were already not getting
included.

Change-Id: I6b90c8230632647bb9237f86ec52c09133891a2d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382488
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-10-16 11:17:16 -04:00
Daniel Verkamp
f5c4413ca4 bdev/virtio: use SPDK likely/unlikely macros
Replace the DPDK rte_branch_prediction.h likely/unlikely with
spdk/likely.h spdk_likely/spdk_unlikely.

Change-Id: I51ad42ee2b29b8f33436fa960deda67a0dd0b0f0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382486
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2017-10-16 11:17:16 -04:00
Dariusz Stojaczyk
aab8511796 vhost_scsi: minor cleanup
Clarify some error messages
and simplify the code.

Change-Id: I586ea55a1d9fa10142d4a9d469b62f1b83076cd5
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/381925
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-10-13 19:13:00 -04:00
Shuhei Matsumoto
6bb01df6d7 iscsi: delete spdk_iscsi_init_grp_deletable() function
This function was only useful for old (and incorrect) iSCSI
topology with SPDK. Hence this function can be removed.

Change-Id: I6147382b0731a896df3c988fae0173923a9a85fc
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/381242
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2017-10-13 18:38:55 -04:00
Daniel Verkamp
35875d5314 bdev/rbd: combine readv and writev functions
These are identical now that the spdk_bdev_io I/O-specific unions were
combined.

Change-Id: I2579f4fd100c5ebb3550b806c7fdac38c6160a69
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382373
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2017-10-13 15:25:51 -04:00
Ziye Yang
847c1c3ad4 nvmf/rdma: Remove rdmq_req if there is error or obtaining buf.
For the normal case, we can avoid re-adding it into
pending data buf list if there is no buffer.

Change-Id: I400e3c6c60bb1d1df13782faf2dd32ca2bd897a3
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/382402
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-10-13 15:13:31 -04:00
Maciej Szwed
f1c7998742 lvol: return meaningful RPC errors
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: If809fe808150498c7ad6797855fda3097e3b0c84

Reviewed-on: https://review.gerrithub.io/382470
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-10-13 14:50:30 -04:00
Cunyin Chang
5bf109d507 blob: Optimization of data structure and functions for bs load and unload.
This patch reduce duplicate data structure and make some functions common
for both bs load and unload porcess in the future.

Change-Id: I40b2135e89a705aa5073c1ded4c7b28be4b32f6e
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/381912
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-10-13 14:49:30 -04:00
Tomasz Zawadzki
1887183f13 bdev_pmem: pmem pool file managment via RPC
Three new RPC are added, that allow to control pmem pool file.
- create_pmem_pool(path to file, total file size, block size)
- pmem_pool_info(path to file)
- delete_pmem_pool(path to file)

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id9025b7d988608957700b41f74874159d18c6ad3
Reviewed-on: https://review.gerrithub.io/379006
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>
2017-10-13 10:48:39 -04:00
Pawel Niedzwiecki
c31fb325a7 vhost_scsi: fail requests to device marked for removal
Change-Id: Ie9eea844a64653cf9c016eb3ad96c80546600762
Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com>
Reviewed-on: https://review.gerrithub.io/382170
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2017-10-13 10:47:32 -04:00
Daniel Verkamp
709f7b0104 bdev/virtio: replace rte_read/write with spdk_mmio
Remove one use of DPDK-specific functions in the virtio initiator code.

Change-Id: I538185270da83674e937dac64c9b1130fab36ac4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382074
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: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2017-10-13 10:46:00 -04:00
Dariusz Stojaczyk
201c0188ac bdev_virtio: define virtio devs in separate config sections
This is required for adding
optional params for vdevs.

Since virtio-initiator README.md
had to be changed, some outdated
entries from TODO section has
been removed as a part of this
patch as well.

Change-Id: I472a966d8e4166305fb19ad3ab20e53289a1e071
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382347
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-10-12 19:40:19 -04:00
Maciej Szwed
ee732292d6 lvol: create super blob on lvolstore initialization
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I68a56666d30a550de4a2dc5a66fb669dfbad12dd
Reviewed-on: https://review.gerrithub.io/379659
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-10-12 16:34:54 -04:00
Shuhei Matsumoto
0e5b81b3d7 scsi: remove port from scsi_dev dynamically
Current implementation supports only adding port to scsi_dev.
This change is required to support dynamic remapping of portals.

Change-Id: Idce49aeae43c8861ebe2807df853694f7bacf884
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/379931
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-12 15:46:14 -04:00
Pawel Wodkowski
205a00d9fa vhost: disable indirect descriptors
Some problems with indirect descriptors shown. Disable it for now to
have time to investigate it.

Change-Id: I8c6cfff94dc2159ab01f72986a8ae7d42c353e8b
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/382301
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-10-12 14:21:43 -04:00
Daniel Verkamp
6f6645e2d8 bdev/malloc: allow user to specify bdev name
The construct_malloc_bdev RPC method now takes an optional "name"
parameter to request a specific name for the created bdev, rather than
using the auto-generated Malloc%d-style name.

scripts/rpc.py is updated to add the new optional parameter, and it uses
-b/--name to match the corresponding parameter to construct_nvme_bdev.

Also update one of the test scripts to use the new parameter to get test
coverage.

Change-Id: I1f5bf76f406b8ea8a709d856f7624a38fbfa0d5f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/381728
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-10-11 23:55:45 -04:00
Ziye Yang
e35816b4be bdev/gpt: change the log level.
Change it from error_log to debug_log level to
avoid missleading while there does not have
GPT_PROTECTIVE_MBR type.

Change-Id: I51f7bf2994db227b4c9f1bf80d3bb0e05c047e59
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/382080
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-10-11 14:00:16 -04:00
Ziye Yang
b114103736 nvme_rdma: set retry_count field in rdma_conn_param
For using SoftRoce, there will be packets loss,
so we need to use this value for re-transmission.
retry_count means the maximum number of times that
a data transfer operation should be retried on the
connection when an error occurs.

Change-Id: Ibd81a33d3838bbdf0c054f01666e7ec59bb0a38f
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/382079
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-10-11 13:59:10 -04:00
Maciej Szwed
e46404f9cb bdev: remove bdev_opened field from spdk_bdev structure
bdev_opened field in spdk_bdev structure is no longer required.


Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ie4a368425b11b1c2e1a3a48b5858857b3935498b
Reviewed-on: https://review.gerrithub.io/381375
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
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>
2017-10-11 12:13:38 -04:00
Maciej Szwed
6ae7b826ca lvol: claim base bdev on lvol load
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Idd19b8be38a843dfd50710c09d0c6c31773c2f0c
Reviewed-on: https://review.gerrithub.io/380014
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>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-11 12:13:38 -04:00
Maciej Szwed
c4fe479812 blob: add support for base bdev claim
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ia6b6e5352ce4da04784fb0a3ea1efd0552650067
Reviewed-on: https://review.gerrithub.io/381548
Reviewed-by: Piotr Pelpliński <piotr.pelplinski@intel.com>
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>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-11 12:13:38 -04:00
Dariusz Stojaczyk
6c0233c0a5 bdev_virtio: slight cleanup
Fixed typos, updated comments and
simplified the code.

Change-Id: I7eaa7227518d376d86cd4a6eb0348f1efc7b47fd
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/382024
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-10-10 17:41:12 -04:00
Seth Howell
3da8f166d4 env_dpdk/init: remove shared memory files at exit
In multiprocess applications some shared memory files are left around
after a primary process exits because they can be used by secondary
processes to init memory. However, all primary dpdk processes create
these folders so we need to delete them after a single process spdk
application exits.

Change-Id: If51be95811fb66632316ae260762e5291641b537
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/381721
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-10-10 17:40:23 -04:00
Pawel Wodkowski
683a6712ee bdev: return error code if get_io_channel callback fail
This is needed for proper IO channel allocation failure handling.

Change-Id: I795e5bcce5296a52c119d2300974b8cb3fc0d576
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/381187
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
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>
2017-10-10 16:19:05 -04:00
Tomasz Zawadzki
b1ccfaca01 subsystem: remove fini return code
Closing the framework has to go through all subsystems
without failure, so return codes are unnecessary.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I53c9b4df12d2357e641130869f398b18637e6ff7
Reviewed-on: https://review.gerrithub.io/381681
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
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>
2017-10-10 10:56:34 -04:00
Tomasz Zawadzki
48b2eff97d app: spdk_app_fini no longer gives return code
spdk_app_fini() changed to void, as no operation within it
can fail with meaningful return code.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If77cbf745a8e3fcba4ea24411aa1816f3910cde7
Reviewed-on: https://review.gerrithub.io/381537
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>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-10-10 10:56:34 -04:00
Dariusz Stojaczyk
88f6b9a66e vhost_scsi: fix scsi_task leak
The task was being aborted before
setting it's free_cb. This
results in i.e. not allowing
vhost device to stop it's pollers,
as it would endlessly wait for
this task to finish.

Change-Id: I0de2d1f21da109db1045e433c07f153316e09997
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/381866
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-10-09 14:09:00 -04:00
Dariusz Stojaczyk
29a33dab93 vhost: implemented indirect descriptors
Every descriptor may now contain
a separate descriptor table.

This increases the maximum number
of concurrent IO in a virtqueue
from about (vq->size / 3) to
(vq->size * SPDK_VHOST_IOVS_MAX).

Knowing that SPDK_VHOST_IOVS_MAX
is 128, and assuming that vq->size
is 128 (current hardcoded limit
for QEMU), this gives us over 16k
concurrent possible iovectors
on the fly

Change-Id: I0853d80f6f90d53f8774231972b430a5bf05460e
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/373703
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-10-09 14:09:00 -04:00
Dariusz Stojaczyk
024e0e9095 vhost: check against virtio descriptor table overflow
Also squashed function has_next_desc
into get_next_desc to simplify the
code.

We can't just mask indexes with
(desc_table_size - 1), since in
indirect descriptors case
desc_table_size might not be a
power of 2.

Change-Id: I8053b0e37c553548d76c7a9cfe6b4dbc11c28cfc
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/373744
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-10-09 14:09:00 -04:00
Dariusz Stojaczyk
00e59e3bba rte_virtio: implement virtio_user_stop_device
It was en empty function before.

Also, don't stop the device in
virtio_user_dev_uninit, the device
is stopped separately before
removing (unititializing) it.

Change-Id: Ib540ee4a55bd3f983b50f35a138c1690daba1d98
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/379156
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-10-09 14:08:28 -04:00
Dariusz Stojaczyk
1faea41722 bdev_virtio: destruct all vdevs on shutdown
This patch also resets each device
before destructing it. This is urgently
required for virtio_pci, as it notifies
the QEMU about our shutdown.

This patch fixes running subsequent
bdev_virtio instances in PCI mode within
the same vhost.

Change-Id: I2569251362f2aaf058f6e44f068b280244bd38c1
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/381201
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-10-09 14:08:28 -04:00
GangCao
6368d6c0f5 nvme: add new spdk_nvme_connect() API to directly attach the ctrlr
With this new API, callers can attach one specific ctrlr identified by
the transport ID directly along with optional ctrlr opts. If connecting
to multiple controllers, it is still suggested to use spdk_nvme_probe()
and filter the requested controllers with the probe callback.

Two primary use cases:
1) connecting to the NVMe-oF discovery controller
2) more straightforward way to connect a specific controller (avoiding
the probe callback)

A typical usage of this API with specific ctrlr_opts:
1. struct spdk_nvme_ctrlr_opts user_opts = {}
2. Call spdk_nvme_ctrlr_get_default_ctrlr_opts(&user_opts, sizeof(user_opts))
3. Modify the content of the initialized user_opts with user required value like
   user_opts.num_io_queues = 8
4. Call spdk_nvme_connect(&trid, &user_opts, sizeof(user_opts))

Change-Id: Idf67ee5966f6753918c12604342c892d2f3bbe3a
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.gerrithub.io/370634
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-10-09 12:31:12 -04:00