Commit Graph

2730 Commits

Author SHA1 Message Date
Seth Howell
85ceceed76 Make: remove unused CFLAGS
The CFLAGS in these files add unneeded include directories.

Change-Id: I742a75b7ce5bff2f1dfd6f92d99ebc99a1936666
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/400862
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-21 13:10:29 -05:00
Jim Harris
5665dbd91f net: add spdk_sock_group_impl
spdk_sock_group_impl represents the implementation of
a sock group for a given spdk_net_impl (posix, vpp, etc.)

This extra abstraction is required for enabling
spdk_sock_groups with sockets associated with different
spdk_net_impls.

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

Reviewed-on: https://review.gerrithub.io/400527
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-21 12:40:30 -05:00
Jim Harris
d4033356dc net: convert posix routines into an spdk_net_impl
Also convert the primary spdk_sock/spdk_sock_group
routines to use the spdk_net_impl abstraction
instead of calling the posix routines directly.

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

Reviewed-on: https://review.gerrithub.io/400335
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-21 12:40:30 -05:00
Jim Harris
8181153da0 net: move more common code out of posix routines
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I9a94bf22e36ae58ea98888e4a8ab295169d01dc5

Reviewed-on: https://review.gerrithub.io/400435
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2018-02-21 12:40:30 -05:00
Jim Harris
7ae63b0d5c net: add spdk_net_impl
This is the framework for providing multiple implementations
of TCP sockets in a single application.  This patch just
adds the framework - upcoming patches will convert the
existing POSIX implementation to use this framework.

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

Reviewed-on: https://review.gerrithub.io/400334
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-21 12:40:30 -05:00
Jim Harris
815c0bdb5f net: add spdk_posix_sock and spdk_posix_sock_group
This moves the POSIX specific pieces (namely the
file descriptor) out of the common sock/sock_group
structures and into posix-specific structures.

Note that the first member of these new structures
is the respective base structure - which allows for
simple casting between the generic and implementation-
specific structure types.

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

Reviewed-on: https://review.gerrithub.io/400333
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-21 12:40:30 -05:00
Jim Harris
4a6fe72ec0 net: make the sock_group_poll code more generic
Have the main spdk_sock_group_poll_count routine
just pass an array of sock pointers to the posix
implementation function.  Then the posix implementation
can just fill out which spdk_socks have data and let
the caller do the callback routines.

This moves a fair bit of code from the posix implementation
to the common code, which will simplify the upcoming
VPP implementation.

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

Reviewed-on: https://review.gerrithub.io/400332
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-21 12:40:30 -05:00
Jim Harris
7e5f56de06 net: move common sock_group code out of posix_sock functions
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If400fbd1c8ce3730ed3ef52b9da3fc5474de8444

Reviewed-on: https://review.gerrithub.io/400331
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-21 12:40:30 -05:00
Jim Harris
121b21f4dd net: move common close code out of posix_sock functions
Parts of the close code (for both sock and sock_group)
is generic and will apply to every net implementation
(POSIX, VPP, etc.) - so move that generic code now.

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

Reviewed-on: https://review.gerrithub.io/400330
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-21 12:40:30 -05:00
Jim Harris
c44dd70a58 net: add "posix" to all sock/sock_group function names
This is a step towards abstracting the posix implementations
of these functions behind an upcoming net_implementation
abstraction.  This will allow for use of multiple TCP
stacks in parallel.

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

Reviewed-on: https://review.gerrithub.io/400329
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2018-02-21 12:40:30 -05:00
Jim Harris
2ecab7bd6a net: remove ability to override default net_framework
In early days of SPDK, there was an experimental userspace
TCP stack called libuns.  The SPDK iSCSI target supported
using either the default POSIX/kernel TCP stack or this
libuns TCP stack.

libuns is no longer in use, but work has started on
supporting the FD.io VPP TCP userspace stack.  Abstractions
are being put in place to allow *both* the POSIX and VPP
stacks simultaneously.

So remove the concept of a "default" net_framework that is
defined with weak symbols that can be overridden by another
object file.  While here, also remove the "clear_socket_association"
concept which was specific to libuns.

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

Reviewed-on: https://review.gerrithub.io/400328
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-21 12:40:30 -05:00
Jim Harris
ad9f01264f bdev: unwind before invoking remove_cb during unregister
This avoids recursion in the case where the remove_cb
immediately closes its open descriptor, resulting in
a second call to spdk_bdev_unregister without unwinding
first.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I093786f13bb2953b8f08888a668a045581a9f81c
Reviewed-on: https://review.gerrithub.io/400305
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-20 16:01:11 -05:00
Pawel Wodkowski
e7285749ed lib/util: return const pointer from spdk_cpuset_fmt
Change-Id: Iab5f9703ae9235fd3820228127d72e85af9826bc
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/400601
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-20 13:05:36 -05:00
Pawel Wodkowski
d6408c0dd1 lib/json: add utility function for writeing key and value at once.
Change-Id: Ibbcf8cebff33159eff8345a5f0f5166cd18ea4b3
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/400600
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-20 13:05:36 -05:00
Pawel Wodkowski
1655fa48a8 vhost: always inline spdk_vhost_dev_has_feature
spdk_vhost_dev_has_feature() is internal function so we can move it's
declaration to header file. This remove function call overhead.

Change-Id: I1704e8279cd6720177047a1ae8818f68982998db
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/400241
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-20 12:35:21 -05:00
Ehud Naim
c83cd9375b nvme: fixing ctrlr mutex free
adding nvme_ctrlr_destruct_finish because nvme_transport_ctrlr_destruct may
use a destroyed mutex.

nvme_ctrlr_destruct() free "ctrlr_lock" and after that call
nvme_transport_ctrlr_destruct()->nvme_pcie_ctrlr_destruct()(with pci)->
nvme_ctrlr_proc_get_devhandle()->nvme_robust_mutex_lock(&ctrlr->ctrlr_lock);

Change-Id: I55714ea9097d2c9d844a00b5a88fa2d51a3f4469
Signed-off-by: Ehud Naim <ehudn@marvell.com>
Reviewed-on: https://review.gerrithub.io/399605
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-20 12:31:34 -05:00
Daniel Verkamp
1023ca7b46 nvmf: allow configuration of ns NGUID and EUI64
Add optional parameters to namespace creation to let the user pick the
namespace globally unique identifier and EUI-64.

Change-Id: Ia3eebaf22f8a64733a00a83f90cafb4977c2d07a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/399531
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-02-20 12:01:47 -05:00
Sebastian Basierski
526cd58003 bdev: Added functions allowing logical volume rename.
Change-Id: Ice343afdc84c2a11cd9026d128a35f7a62aa7125
Signed-off-by: Sebastian Basierski <sebastianx.basierski@intel.com>
Reviewed-on: https://review.gerrithub.io/398933
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-02-16 16:21:20 -05:00
Daniel Verkamp
250d342bc1 nvmf: pass an options struct for ns creation
This will allow more parameters to be added to
spdk_nvmf_subsystem_add_ns() without breaking API/ABI compatibility
later.

Change-Id: I6b2f58f1a2d5fcd4c754830cbd4713dc461a31fc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/399519
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-16 13:06:11 -05:00
Daniel Verkamp
8af4b6c40f nvmf: fix potential use-after-free in hot remove
The subsystem->ns array may be resized with realloc(), so old ns
pointers can become invalid.

To fix this, allocate each ns as a separate object, and change the
subsystem->ns[] array to point to the namespaces rather than containing
them.

Change-Id: I873502fa90cf840e4eaa9b1abd94a95afe0f737f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/399726
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-16 13:06:11 -05:00
Jim Harris
168cfd12ca blob: add _spdk_bs_load_complete
This reduces some code duplication and ensures all
successful load operations (whether or not it included
recovery after power fail) through the same function.

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

Reviewed-on: https://review.gerrithub.io/400164
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>
2018-02-16 11:49:47 -05:00
Shuhei Matsumoto
7ee8684c84 iscsi/rpc: Extract dump config into functions
This patch is a preparation to match response of dump with request
of construct (load).

Change-Id: I08d0e860ecd842fabf2bbea0b888a60ffd51b055
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/399992
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-02-15 15:40:02 -05:00
Ziye Yang
30ef8cac7d nvmf: Solve the coredump issue when client conduct nvme disconnect
This patch is used to solve
https://github.com/spdk/spdk/issues/235

With multiple core bining for NVMe-oF target,
the qpairs which belonging to the same ctrlr may
be scheduled to different cores. Thus there is
resource contention to access the struct spdk_nvmf_ctrlr.

And we put the thread info in polling group. Morever,
we introduce an admin_qpair in ctrlr. Since admin_qpair will
always be created at first and freed at last, to reference
this pointer is safe.

Change-Id: I12ac26f9e65b4ed8e48687750046455af0e3be1d
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/398904
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-15 13:19:08 -05:00
Shuhei Matsumoto
2982a74df9 iscsi&rpc: Add new initiator information to an existing initiator group
Adding new initiator to an existing initiator group to allow login
will be usual. This patch support the following JSON-RPC commands:
- add_initiators_to_initiator_group
- delete_initiators_from_initiator_group

Both initiator's name and netmask are optional but already added
name or netmask cannot be added.

Test code is added too.

Change-Id: Ic101210b9d00c2b36e37ece23fcba8cfe8e44eb8
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/398361
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-15 11:28:19 -05:00
Dariusz Stojaczyk
20fbd09a78 vhost: reenable indirect descriptors
Patch 808a2b05 [1] fixed overflow of avail entries count,
also fixing indirect descriptors support. Without indirect
descriptors, we usually didn't manage to fill entire queue
- there were always a couple of descriptors left. A couple,
but not enough to form a vhost-scsi descriptor. Indirect
descriptors, however, are 1-descriptor long. They have higher
possibility to fill entire avail queue, and that's why they
used to fail more often. But we can safely reenable them now.

[1] 808a2b05 ("vhost: fix overflow of avail entries count")

Change-Id: Idec8568cdfc1255fb578e5d18f5c476a4c034d2d
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/396805
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-15 11:08:57 -05:00
Daniel Verkamp
c7852cf98d jsonrpc: allow send_buf to grow as needed
Reallocate the send buffer if more data is written by the RPC handler
than currently fits in the buffer.

Change-Id: I590dd173b843aba48c768adfafaf87e4b47bcc19
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/399925
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-15 11:03:54 -05:00
Ziye Yang
114a91fdea nvmf: extract some codes in functions.
This patch is used to solve
https://github.com/spdk/spdk/issues/235
in the later patch.

Change-Id: I8ef6d3effbff7a6b27e82c397969687d0000542b
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/399349
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-14 18:09:45 -05:00
Dariusz Stojaczyk
9f0a73d901 vhost: vhost_dev_get_cpumask now returns const spdk_cpuset *
The cpuset API is const-aware, so we can safely
return const cpuset here. This will simplify
future usages of this function - for now it remains
unused.

Change-Id: If849ed49056a54035fb7a6eccde84121630f9974
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/399457
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-14 15:34:06 -05:00
Daniel Verkamp
2b8c23c7b8 env: make spdk_env_get_last_core() thread safe
Previously, the maximum core value was cached in a static variable, but
this isn't safe if multiple threads are calling at the same time.

Iterating over all core numbers is not very expensive, so just
recalculate the value for every call.

Change-Id: I4fab072f4a96ecc8801e1db293b3921a6f1534f9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/399930
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-14 15:11:00 -05:00
Dariusz Stojaczyk
b2847368cc vhost: add smp_wmb() before logging used->ring
This doesn't really fix anything as rte_vhost
logging functions are extremely poorly designed
and do smp_wmb() by themselves - but only if
logging is enabled...

Let's move the barrier in our vhost.c. This
doesn't change any behavior, but makes the code
more readable. It surely looked weird to update
the ring, log it, and then do smp_wmb().

Change-Id: I90827b14292b60bd5641a48d546e7249a0496a4b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/398326
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>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-13 19:33:03 -05:00
Dariusz Stojaczyk
da78c67091 vhost: drop VIRTIO_F_NOTIFY_ON_EMPTY feature
This feature is not particularly useful for storage.
It forces us to read additional vq memory on each
I/O completion and that's quite expensive.

Quoting VIRTIO 1.0:

```
VIRTIO_F_NOTIFY_ON_EMPTY (24)
If this feature has been negotiated by driver, the device MUST issue an
interrupt if the device runs out of available descriptors on a
virtqueue, even though interrupts are suppressed using the
VIRTQ_AVAIL_F_NO_INTERRUPT flag or the used_event field.
```

Later on:

```
Note: An example of a driver using this feature is the legacy networking
driver: it doesn’t need to know every time a packet is transmitted, but
it does need to free the transmitted packets a finite time after they
are transmitted. It can avoid using a timer if the device interrupts it
when all the packets are transmitted.
```

Change-Id: I7f53293bf811a4cd5ae8e42e18f35042ea6f4ba8
Suggested-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/398325
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>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-13 19:33:03 -05:00
Dariusz Stojaczyk
d03cac1310 vhost: don't notify on last_used_idx overflow
This is required only for event index,
which we don't support for now. The whole
NOTIFY_ON_EMPTY feature is about to be removed
soon. See subsequent patches for details. If
necessary, this should be re-implemented in a
different way.

Change-Id: Idd0c1ab929eef46e692834ffdc62472fa0f6fb74
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/398324
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-13 19:33:03 -05:00
Dariusz Stojaczyk
19725e9764 vhost: change vdev global array to a linked list
Drop max vhost initiators limitation in SPDK (64).
We're still limited by rte_vhost limits, but
they're set to 1024 at the moment.

Change-Id: Ia1ad25665d6e798bc22709cdd43b72d60f1f4cf0
Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/389811
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-13 19:27:54 -05:00
Jim Harris
e3f2a3949d sock: add sock_group abstraction
For now, this provides common abstraction for Linux epoll
and FreeBSD kqueue.  It also provides the basis for future
changes where alternate userspace TCP stacks have their own
mechanism for polling a group of descriptors.

While here, remove old epoll/kqueue code in iscsi/conn.c that
was commented out when the iSCSI idle connection code was
recently removed - we now have a real implementation of it
in sock.c so the original code is no longer needed as a
reference.

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

Reviewed-on: https://review.gerrithub.io/398969
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-13 19:25:22 -05:00
Piotr Pelplinski
7ba8c006c5 blobstore: allow xattrs to be set internally only for blobstore
Patch adds internal version of xattr functions to allow
operations on internal xattrs, which are not visible to
upper layers.
When there is at least one internal xattr set, also
SPDK_BLOB_INTERNAL_XATTR flag is set in invalid_flags to prevent
loading this blob in previous spdk versions.

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Iec918ec858f069f7cd9f36d5e8f0495ffa4a42d8
Reviewed-on: https://review.gerrithub.io/395122
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-12 19:12:14 -05:00
Daniel Verkamp
3839639759 nvme: add API to allocate CMB I/O buffers
Change-Id: I2a3c7a272dc08be5a5ecb4339622816482c4cbb0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Signed-off-by: Stephen Bates <sbates@raithlin.com>
Reviewed-on: https://review.gerrithub.io/397036
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-02-12 19:11:44 -05:00
Daniel Verkamp
f185e4ecf8 nvme/pcie: register CMB with spdk_mem_register()
Enable address translation for I/O buffers within the controller memory
buffer region by registering the CMB using spdk_mem_register().

Change-Id: I44829757ad15fbc3ea96fa494b9fb32dd67a7138
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Signed-off-by: Stephen Bates <sbates@raithlin.com>
Reviewed-on: https://review.gerrithub.io/397035
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-02-12 19:11:44 -05:00
Stephen Bates
35a331a949 vtophys: Add vtophys_get_paddr_pci()
Add a new virtual to physical (vtophys) method for
spdk_vtophys_notify() that works for PCI memory (namely NVMe CMBs and
PMRs). This new method searches all the BARs on all the detected PCI
devices to see if the vaddr resides inside any of them.

Change-Id: I68afbeffd958cf40c1e8652e13da5531811b522b
Signed-off-by: Stephen Bates <sbates@raithlin.com>
Reviewed-on: https://review.gerrithub.io/398872
Reviewed-by: Jim Harris <james.r.harris@intel.com>
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>
2018-02-12 19:11:44 -05:00
Dariusz Stojaczyk
720c627a93 vhost: return proper rc on vhost_dev_register() alloc failure
This must've been overlooked in patch 601bcbcf.

Fixes: 601bcbcf66 ("util: extend cpumask to hold more than 64 cpus")
Change-Id: Ia7e06fcacba5cd99770b81542678550e9fbc3ca2
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/399455
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-12 18:22:29 -05:00
Ziye Yang
32ad027b0c nvmf: Adjust the resource free order for transport
Reason: In spdk_nvmf_subsystem_destroy, we call
spdk_nvmf_ctrlr_destruct(ctrlr), and this function
will still use the transport, so definitely, it is
a defect(reproduced in my platform).
So we need to defer freeing the transport resource.

Change-Id: I3eee2a29c223e2759a623604485af6f081746581
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/399368
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-12 18:21:55 -05:00
Dariusz Stojaczyk
ea6c27099c vhost: removed spdk_vhost_dev_find_id
This internal function was now being used in one
place only. Inlined it so there's less code.

Change-Id: Ide52494d0e0f9563ce35ef7bf9166f62734a8309
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/399440
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-12 14:07:58 -05:00
Dariusz Stojaczyk
cd0ef03b38 vhost: abstract away vhost device array
Added vdev->id field and refactored the hot
vhost external event code operating on
g_spdk_vhost_devices array, so that we will
be able to switch from that array to a linked
list with unlimited capacity more easily.
This patch does not change any functionality
on its own.

We would very willingly reuse vdev->vid here,
but it's available only on devices with active
connections.

Change-Id: Ife911a6ca1531aade374b99ef4502cf77f691fa2
Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/389071
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-12 14:07:58 -05:00
Jim Harris
4b10029435 net, iscsi: add struct spdk_sock abstraction
This provides an abstraction layer around TCP
sockets.  Previously we just used fd integers, but
we don't want to be tied to integers for alternative
userspace TCP stacks.

Future patches will do more work to enable multiple
implementations of this abstraction.  For now, just
get the abstraction in place for POSIX sockets and
make all of the iSCSI changes associated with it.

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

Reviewed-on: https://review.gerrithub.io/398861
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2018-02-12 12:30:39 -05:00
Dariusz Stojaczyk
33285599ef vhost: fix double module fini on vhost init failure
Doing a manual vhost module fini followed
by an spdk_app_stop is wrong, as the app_stop
will trigger the vhost module fini again.
This will potentially free the g_num_ctrlrs
twice. Doing just spdk_app_stop is enough.

Fixes #238

Fixes: 3fb4bc717b ("vhost: move app fini to the vhost subsystem")
Change-Id: I70f886f6792ffc5c499a8d8cb0b6ab01855f7e9b
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/399129
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>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
2018-02-12 12:13:23 -05:00
Dariusz Stojaczyk
8f29093660 vhost/blk: set blkcfg->num_queues to the max available queues number
QEMU overrides this value anyway, but other
virtio implementation may not. Setting
blkcfg->num_queues to its target value
won't break anything, and will help out
SPDK virtio-blk driver implementation.

For equivalent field in virtio-scsi, the
Virtio 1.0 spec says:

```
num_queues
is the total number of request virtqueues exposed by the device. The
driver MAY use only one request queue, or it can use more to achieve
better performance.
```

Multiqueue for virtio-blk is oficially still
unsupported, so the blkcfg->num_queues remains
undocumented. Let's implement it adequately
to the virtio-scsi spec.

Change-Id: Ief520385997bb7e745ed17501a972c55955346d2
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/399121
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>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
2018-02-09 13:14:43 -05:00
Changpeng Liu
1c164f117d vhost-blk: enable vhost block with new added get/set config messages
New vhost user messages GET_CONFIG/SET_CONFIG can be used for
vhost-blk for the purpose to get configuration parameter such
as: Capacity and block size. This commit enable this feature,
users don't need to append capacity any more when started
QEMU. Also event notifier is added for the purpose to change
capacity of block device while QEMU is running.

Also re-enable the vhost-blk tests.

Change-Id: I06ef697984eeea3abbbd655bdcaccaa3b7aa72d7
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/386546
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2018-02-09 13:14:43 -05:00
Jim Harris
60104c6f9f net: change sock to fd in spdk_sock_create
No functional change - this just reduces an upcoming
patch that will make further changes to this function.

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

Reviewed-on: https://review.gerrithub.io/398856
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>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
2018-02-08 12:05:54 -05:00
Jim Harris
67c9ea6ad9 net: add sock.h
The socket-related code was already broken out into
lib/net/sock.c, so break out the header portions
from include/spdk/net.h into its own sock.h.

This prepares for some upcoming changes in how
TCP sockets are abstracted, to enable alternative
userspace TCP stack implementations to be used with
SPDK.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I40b162e72ea80c235b49f10b17c2085fcfb385d4
Reviewed-on: https://review.gerrithub.io/398851
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
2018-02-08 12:05:54 -05:00
Daniel Verkamp
54bfde6a09 nvmf: allow removal of listen addresses at runtime
Change-Id: I53ffdd061ba068070f66a752780229ecfe53e737
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/398688
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>
2018-02-07 12:47:27 -05:00
Daniel Verkamp
6ad3a5ce9b nvmf: check for duplicate listen addresses
Don't allow a duplicate listener to be added to a subsystem.

Change-Id: I1a5f2ae09146a31859921430fb716a36d7f2048e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/398652
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>
2018-02-07 12:47:27 -05:00