Compare commits

...

47 Commits

Author SHA1 Message Date
Tomasz Zawadzki
85c0e1e841 SPDK 19.07.1
Change-Id: I7149e5d81c92712357b3c07b732a59059e64fce9
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469681
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-30 05:28:43 +00:00
Tomasz Zawadzki
93cfde17e0 CHANGELOG: updated for v19.07.1
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Icdda1deb25e5b7696e369799d7b6db01b80473ec
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469687
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-30 05:19:37 +00:00
Tomasz Zawadzki
b1c3dd41b2 configure: disable internal rte_vhost on FreeBSD
On master DPDK (d03d8622d), building SPDK on FreeBSD
fails due to attempt to build internal rte_vhost.

This started occuring with SPDK patch:
28099e0 "make: add dependencies for the rte_vhost build."

This patch disables VHOST_INTERNAL_LIB on FreeBSD,
along with vhost/virtio.

Errors seen:
./configure --enable-debug --enable-werror --with-fio=/usr/src/fio --without-isal --with-dpdk=/var/jenkins/workspace/Other_systems/freebsd_autotest/dpdk/build
Using default SPDK env in /var/jenkins/workspace/Other_systems/freebsd_autotest/spdk/lib/env_dpdk
Notice: DPDK's rte_vhost not found or version < 19.05, using internal, legacy rte_vhost library.
Vhost is only supported on Linux. Disabling it.
Virtio is only supported on Linux. Disabling it.
...
gmake -j4
...
  CC lib/rte_vhost/socket.o
In file included from socket.c:52:
./vhost.h:41:10: fatal error: 'linux/vhost.h' file not found
#include <linux/vhost.h>
         ^~~~~~~~~~~~~~~
....
  CC lib/rte_vhost/vhost_user.o
vhost_user.c:41:10: fatal error: 'asm/mman.h' file not found
#include <asm/mman.h>
         ^~~~~~~~~~~~

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468043 (master)

(cherry picked from commit 1bed73896e)
Change-Id: Ia2f5fd98a82412a5691bc0f2201f7259a45d2b4d
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468301
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-30 05:19:10 +00:00
Evgeniy Kochetov
d53a1f1cba nvmf/rdma: Handle completions for destroyed QP associated with SRQ
IB Architecture Specification vol.1 rel.13. in ch.10.3.1 "QUEUE PAIR
AND EE CONTEXT STATES" suggests the following destroy procedure for
QPs associated with SRQ:
- Put the QP in the Error State;
- wait for the Affiliated Asynchronous Last WQE Reached Event;
- either:
  * drain the CQ by invoking the Poll CQ verb and either wait for CQ
    to be empty or the number of Poll CQ operations has exceeded CQ
    capacity size; or
  * post another WR that completes on the same CQ and wait for this WR
    to return as a WC;
- and then invoke a Destroy QP or Reset QP.

Without the drain step it is possible that LAST_WQE_REACHED event is
received and QP is destroyed before the last receive WR completion is
polled from the CQ.

In SPDK there is no risk of resource leakage in this case. So, instead
of draining we can destroy QP and then just ignore receive completions
without QP and post receive WRs back to SRQ.

Fixes #903

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465747 (master)

(cherry picked from commit 87ebcb08c1)
Change-Id: Ice6d3d5afc205c489f768e3b51c6cda8809bee9a
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468300
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Eugene Kochetov <evgeniik@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-09-20 20:26:30 +00:00
Seth Howell
092a64abce make: add dependencies for the rte_vhost build.
The dependencies between vhost and rte_vhost were not added during
earlier changes. This change moves the rte_vhost directory up to the
level of the other libraries and adds the proper dependencies for when
it is linked.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467700 (master)

(cherry picked from commit 28099e0ed9)
Change-Id: I089de1cd945062b64975a0011887700c0e38bb0f
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467947
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-09-20 20:26:30 +00:00
Konrad Sztyber
84584d081f lib/ftl: delay processing ANM events initialization is completed
Start processing ANM events only after the device is fully initialized.
Otherwise some of the structures are partially filled and can be
interpreted incorrectly.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466935 (master)

(cherry picked from commit bd78196c09)
Change-Id: Ia741730cf15d44d76ce8afa7955e6a5bf42ca42b
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468305
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-20 20:26:30 +00:00
Konrad Sztyber
351fd43955 lib/ftl: track number of pending write buffer entries
Track the number of acquired but not yet submitted write buffer entries
to be able to correctly calculate the required number of entries to be
padded.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466934 (master)

(cherry picked from commit a2714d414f)
Change-Id: Ie201681937ad1d03ec125aa5912311c54a7e35c9
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468304
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-20 20:26:30 +00:00
Konrad Sztyber
22e353bcbb lib/ftl: flush the write buffer during nv_cache recovery
When recovering the data from the non-volatile cache, the data inside
the volatile cache needs to be flushed before flushing active bands.
Otherwise, if the number of blocks in a band is smaller than the number
of blocks inside the volatile cache, part of the data may not get
flushed.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466883 (master)

(cherry picked from commit cf3d42961b)
Change-Id: I4e99709c8c2a526a928578870d7fbd5fef37db02
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468303
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-20 20:26:30 +00:00
Seth Howell
a2f6965f29 test/make: add ignored libs to check_so_deps.sh
There is at least one example of an SPDK shared library dependency that
is only linked against on certain conditions, so add a framework for
dealing with those conditions now.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467699 (master)

(cherry picked from commit 18c5ce83b9)
Change-Id: I63ad767994c5f56f2908f70016e700f5bb74a5f4
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467975
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2019-09-10 22:27:45 +00:00
Ben Walker
79aba95edb Revert "nvme: small code cleanup for nvme_transport_ctrlr_scan"
This reverts commit 6129e78d26.

When the initiator sends the discovery log page, if the log page
exceeds the size of its data buffer, it will break it up into
multiple log page commands with appropriate offsets. However,
supporting offsets in log pages is an optional feature in NVMe
and reported by the EDLP bit in the identify data.

This commit changed the discovery process to no longer send an
identify command prior to doing the discovery log page command,
so the values in the identify data are always 0. If the discovery
log page exceeds the size of the data buffer (4k), it will then
fail to send the second log page with an offset because it
believes the controller does not support the feature.

Revert this change to fix it. An identify should always be sent
as part of the discovery process. A test case is included in a
follow up patch the demonstrates the bug.

Reported-by: Zahra Khatami <zahra.k.khatami@oracle.com>
Reported-by: Akshay Shah <akshay.shah@oracle.com>

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466819 (master)

(cherry picked from commit 647afdec44)
Change-Id: Iefd512a7521e0fea90541b3eb547671cfa816ea6
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467946
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-10 22:27:45 +00:00
Seth Howell
fe893ec497 configure: make BUILD_CMD an array variable.
Most modern shells know how to interpret the string version of commands
when parsing them from a variable, but some shells like the one centos 7
uses misinterpret the command causing the dpdk version check in
configure to fail erroneously. This can be observed in the CentOS logs
of recent vs dpdk master jobs on the CI.

This method looks to be the more conservative way of doing the same
thing and fixes the issue on my dev machine.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467714 (master)

(cherry picked from commit 43a713f9f0)
Change-Id: Ib51c537ec88c781eb62519e08e4252ae05e554ef
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467945
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-10 22:27:45 +00:00
Seth Howell
12f85fa320 nvmf: don't keep a global discovery log page.
Keeping a global discovery log page was meant to be a time saving
mechanism, but in the current implementation, it doesn't work properly,
and can cause undesirable behavior and potential crashes. There are two
main problems with keeping a global log page.

1. Admin qpairs can be assigned to any SPDK thread. This means that when
multiple initiators connect to the host and request the discovery log,
they can both be running through the spdk_nvmf_ctrlr_get_log_page
function at the same time. In the event that the discovery generation
counter is incremented while these accesses are occurring, it can cause
one or both of the threads to update the log at the same time. This
results in both logs trying to free the old log page (double free) and
set their log as the new one (possible memory leak).

2. The second problem is that each host is supposed to get a unique
discovery log based on the subsystems to which they have access.
Currently the code relies on whether the discovery log page offset in
the request is equal to 0 to determine if it should load a new discovery
log page or use the cached one. This is inherently faulty because it
relies on initiator provided value to determine what information to
provide from the log page. An initiator could easily send a discovery
request with an offset greater than 0 on purpose to procure most of a
log page provided to another host.

Overall, I think it's safest to not cache the log page at all anymore
and rely on a thread local fresh log page each time.

Reported-by: Curt Bruns <curt.e.bruns@intel.com>

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466839 (master)

(cherry picked from commit 20b35d769d)
Change-Id: Ib048e26f139927d888fed7019e0deec346359582
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467594
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-10 22:27:45 +00:00
Darek Stojaczyk
f666018041 env_dpdk/memory: aggregate adjacent vfio mappings
In the past, memory in spdk could have been unregistered in
different chunks than it was registered, so to account
for that the vtophys code used to register each hugepage
(2MB chunk of memory) separately to the VFIO driver. This
really made the code generally simple.

Now that memory in spdk can only be unregistered in the same
chunks it was registered in, we no longer have to register
each hugepage to VFIO separately. We could register the
entire memory region with just a single VFIO ioctl instead,
so that's we'll do now.

This serves as an optimization as we obviously send less
ioctls now, but most importantly it prevents SPDK from
reaching a VFIO registrations limit that was introduced
in Linux 5.1. [1]

The default limit is 65535, which results in SPDK being able to
make only the first 128GB of memory DMA-able. This is most
problematic for vhost where we need to register the memory
of all the VMs.

Fixes #915

[1] 492855939bdb59c6f947b0b5b44af9ad82b7e38c
("vfio/type1: Limit DMA mappings per container")

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/432442 (master)

(cherry picked from commit be04cfc342)
Change-Id: Ida40306b2684e20daa2fd8d12e0df2eef5a4bff1
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467143
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
Darek Stojaczyk
d6870e44b2 env_dpdk/memory: implement contiguity check for vtophys map
We'll be now able to check contiguity for more than 2MB
regions.

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466073 (master)

(cherry picked from commit 43f4e3932a)
Change-Id: I738ff451d534075c944972918d08e5e0cadea4f5
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467142
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
paul luse
3157ce5c4a module/compress: Clear vol element in comp_bdev struct on vol unload
When a vol is unloaded, the vol element in comp_bdev element needs to
be NULL'd so that when the comp_bdev destruct entry point is called,
we won't try to unload the vol again.

fixes issue #928

Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466441 (master)

(cherry picked from commit f4e401ea36)
Change-Id: If267335cbe2234c62351cfc39d33b0ea698ca893
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467141
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
Evgeniy Kochetov
d079cf5a70 nvmf/rdma: Fix data WR release
One of stop conditions in data WR release function was wrong. This
can cause release of uncompleted data WRs. Release of WRs that are
not yet completed leads to different side-effects, up to data
corruption.

The issue was introduced with send WR batching feature in commit
9d63933b7f.

This patch fixes stop condition and contains some refactoring to
simplify WR release function.

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466029 (master)

(cherry picked from commit 01887d3c96)
Change-Id: Ie79f64da345e38038f16a0210bef240f63af325b
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467140
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-09 21:55:22 +00:00
Tomasz Kulasek
6787994d30 net/vpp: fix detach error handling
When VPP detach fails (e.g. when VPP dies before application), net
framework never finishes.

Signed-off-by: Tomasz Kulasek <tomaszx.kulasek@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464678 (master)

(cherry picked from commit 75da6acb1a)
Change-Id: I2cbc7bde274e185fdf7f3cf1c7ea3ddd14dcf365
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467139
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
Tomasz Zawadzki
9f7075ea8d bdev: fix error path for allocating qos paramters
Every exit path in spdk_bdev_set_qos_rate_limits() should
go through _spdk_bdev_set_qos_limit_done() as soon as
ctx is allocated and qos_mod_in_progress set to true.

This patch fixes one path were it did not occur.
With this change qos_mod_in_progress is set to false,
when failure in allocating qos parameters occurs.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465659 (master)

(cherry picked from commit cfc0fbf11e)
Change-Id: I04a45dfdcde9160fd2701b44f5fde26fb0245177
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467138
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-09 21:55:22 +00:00
paul luse
a343a2c20b bdev/compress: support host buffers that cross a 2MB boundary
Only affects QAT where only partial data transfers would occur
when a host buffer crossed a 2MB boundary.

fixes issue #897

Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464719 (master)

(cherry picked from commit 7e1f967c13)
Change-Id: Ib20bfb3557c11a6da996f4b209e9bb7c634f8f49
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467137
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
Wojciech Malikowski
523b58fc04 lib/ftl: Fix padding size calculation
Padding size calculation should take into account
already acquired write buffer entries in case
number of blocks left for closing band is less than
write buffer size.

Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463525 (master)

(cherry picked from commit b08337c216)
Change-Id: I0f9c9bc94eb5a4736eede30ec424c81103e1256f
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467136
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
Maciej Szwed
25b669f22a bdev: Don't open bdev if it is being removed
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463156 (master)

(cherry picked from commit c141bd94a1)
Change-Id: I7ddff2d1186ff3c03de9b48c79297b03957002c4
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467135
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
Ben Walker
fa7fd77b62 nvmf: Delay sending AER until subsystem resumes
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464614 (master)

(cherry picked from commit 1e82ec0640)
Change-Id: Id5152a793c6b530cb1419c559ac3ed71ee042037
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467134
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
Jim Harris
9d2615484a nvme: fix WRITE_TO_RO_RANGE status code
WRITE_TO_RO_PAGE was incorrect and misleading.  This
0x82 NVMe status code indicates a write to a read-only
range of LBAs.  So modify the constant name and
associated usages to use WRITE_TO_RO_RANGE instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465083 (master)

(cherry picked from commit 0aa72ffb74)
Change-Id: I993dbebb5acc2e685a0e99aa14084942ef79d659
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467133
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
paul luse
40a0ae39a2 bdev/compress: re-type and re-name misleading variable name
Becomes important in next patch

Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464717 (master)

(cherry picked from commit 2c35c8fbea)
Change-Id: Ida19f0b59c4b841d6f5120f9130e24b57ae91560
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467132
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
Evgeniy Kochetov
0b60d077cb bdev/null: Fix infinite loop in configuration parsing
Invalid configuration file parameter in Null bdev section results in
infinite loop.

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Signed-off-by: Sasha Kotchubievsky <sashakot@mellanox.com>
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464775 (master)

(cherry picked from commit e06e34be1d)
Change-Id: I79a1a53e0f4d76a8724e7a624cabda7250b511c5
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467131
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
Shuhei Matsumoto
077ae9152d bdev/raid: Fix race issue among multiple threads to free RAID bdev
The following issue was observed.

The first thread returned the last IO channel and the second thread
then removed the first base device, but raid_bdev_cleanup() was
called before raid_bdev_destroy_cb() was called.

raid_bdev_destroy_cb() was accessed to the raid bdev already freed
by raid_bdev_cleanup() and caused segmentation fault.

The call sequence was as follows:

The first thread:
 spdk_put_io_channel() -> ch->destroy_cb -> raid_bdev_destroy_cb
-> access raid bdev

The second thread:
 raid_bdev_remove_base_devices() -> raid_bdev_deconfigure() ->
spdk_bdev_unregister() -> spdk_io_device_unregister() ->
spdk_bdev_destroy_cb() -> raid_bdev_destruct() -> raid_bdev_cleanup()
-> free raid bdev

The fix is to hold number of created channels in struct
raid_bdev_io_channel and use it in raid_bdev_destroy_cb().

Bdev layer, IO device/channel layer, and NVMe-oF layer  already
process this case correctly.

    Fixes #884.

Reported-by: yidong0635 <dongx.yi@intel.com>

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463249 (master)

(cherry picked from commit 284aca9e36)
Change-Id: Ie9d61bdddca479ce7f491ff9a08db45e71f16a8d
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467130
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 21:55:22 +00:00
Chunyang Hui
23cd855116 opal: Fix get string for bigger length
Skip token header length which varies for short,
medium and long atom.

Fix Issue #898

Signed-off-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464502 (master)

(cherry picked from commit a4516ad2ed)
Change-Id: I2351193e5a43608495f3d816ff4e5932399a6312
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467129
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Chunyang Hui <chunyang.hui@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 04:42:54 +00:00
Jim Harris
bbac3e8541 rpc: ensure RPCs are registered before aliases
Some older clang versions will reorder constructor functions
rather than execute them in the order they are defined.  This
causes registration failures for RPC aliases when the alias
is registered before the RPC that it refers to.  So use
constructor priorities to ensure that all RPCs are registered
before any aliases.

Fixes issue #892.

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463915 (master)

(cherry picked from commit 0972520167)
Change-Id: I409254ec7172faf3997aa058b433890793499458
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467128
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-09 04:42:54 +00:00
Jacek Kalwas
9d0271c815 nvmf/rdma: fix missing return statement
In case of failure during resource allocation within poll_group_create
there is a lack of return statement which could lead to NULL ptr
dereference.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463195 (master)

(cherry picked from commit db0c7f6a4f)
Change-Id: I84abe64a1843117d76b97e62656bdfc4fe2b35d8
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467127
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <jacek.kalwas@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 04:42:54 +00:00
Ziye Yang
7c8cb1b6fd sock: Add the code to free the entry
Checked code, we do not free the memory allocated
spdk_sock_placement_id_entry.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463725 (master)

(cherry picked from commit a2dcdde2da)
Change-Id: Ie614dc17334b21b8904b16ee7e6e68a24e29d6a3
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467126
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2019-09-09 04:42:54 +00:00
Seth Howell
8228117637 test: add a test to confirm shared object deps.
The shared object dependencies could easily change over time. It is
important that we keep this list up to date and we don't change
something without updating the makefiles. This script checks each shared
object file to make sure that its readelf dependencies match up with
those specified in the makefile.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466179 (master)

(cherry picked from commit 43d2562dc6)
Change-Id: If508fb0205e85f8f5d217033194bfb5b0179d11c
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466984
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
a1d67ab87a lib/mk: update OCF build.
The OCF build was broken by some of the recent changes
to the Makefiles. This change aims to fix that by separating out the ocf
environment from the ocf bdev.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465808 (master)

(cherry picked from commit 407e88fd2a)
Change-Id: Id445340033898e9ae70a4bcfc799951110762d55
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467293
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
79602d10c6 module/event: add subsystem interdependencies
The SPDK application framework defines a list of event subsystem
dependencies. When linking against individual shared libraries, it is
useful for this dependency structure to be codified in the shared
libraries themselves.

For example, when linking a bdev based application against
libspdk_bdev.so, one might wish to only specify this shared object at
link time. However, when you actually run the application, it will fail
to start because it is not linked to the copy and vmd subsystems.
However, once thesedependencies are added, one can effectively link
against only the exact subsystems they need and any dependent subsystems
will be linked in automatically.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466081 (master)

(cherry picked from commit 5c62618f26)
Change-Id: Ic986281a162ac20b523486e9f8cccf4a0787afd7
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466983
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
ec06de31cf module: add shared lib deps for all modules.
This will allow us to link individually against dpdk module libraries
without having to define those libraries dependencies.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465704 (master)

(cherry picked from commit 7e1881cef9)
Change-Id: Ief2140ec0fadd970aba990dab333d603dfb46317
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466982
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
4d8f7fae21 make: start adding inter-lib dependencies.
This will make it much easier to link against some subset of spdk
libraries when building SPDK applications.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465194 (master)

(cherry picked from commit f66caa1f80)
Change-Id: I8ad95a001965288a8b5e38eb252391fef68d7138
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466981
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
265c55d21b mk: force --no-as-needed for spdk libs.
When building shared libs, we specifically don't set the --as-needed
flag so that we still link against libraries that have constructor
functions. LD reports on its man page that the default behavior is
equivalent to --no-as-needed.

For RHEL based distros like fedora and centos this works fine. While
the LD man page shipped with ubuntu distributions also states that
--no-as-needed is the default, they don't respect that behavior and do
--as-needed linking unless you force them with --no-as-needed.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464621 (master)

(cherry picked from commit e29c6fe133)
Change-Id: I914ab849323de198af5c5e53fffb1f57fcaff5fe
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467292
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
d899c6db20 mk: add a lib deps file.
By adding this file and modifying the way we define a couple of
variables in the makefiles, we can actually avoid having to redefine
the library dependencies on a per file basis.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466063 (master)

(cherry picked from commit 9d14641dd5)
Change-Id: Ieab4aa1021b0341fc21e3b65677a9ad7f70559c2
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466980
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
0fe5d05908 lib/copy: move ioat subdir to module directory.
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465458 (master)

(cherry picked from commit f196669374)
Change-Id: I29b31344a11efd2430e0f77062fb98fa0ab1c71e
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466979
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
d592e8d252 lib/blob: move bdev subdir under module directory.
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465457 (master)

(cherry picked from commit 7392cdeff7)
Change-Id: Ifb9a1df919d32a98c328101029cc22e91915a977
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466978
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
20b4ded9ec lib/sock: move subdirs to module/sock
Rounding out the module concept of SPDK libraries.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465456 (master)

(cherry picked from commit c77565ee04)
Change-Id: I2b316153809ae9f73361648fe505274a59d0bdb3
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466977
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
b8fd519584 lib/event: move rpc and subsystems dirs to module
These directories fit in with the module concept we are forming inside
of SPDK. Essentially modules are derivative or specialized libraries that
rely on a general or core library.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465455 (master)

(cherry picked from commit f34fa35a52)
Change-Id: Ib40f05422f144ff8fd579f47a3867ef4412b3372
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466976
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
423507e1a4 mk: move the bdev modules under module directory.
This is more accurate to what they are, and will make defining library
dependencies much simpler. This change in directory does not affect the
final placement of naming of libraries at the end of time.

Signed-off-by: Seth Howell <seth.howell@intel.com>
reviewed on https://review.gerrithub.io/c/spdk/spdk/+/466975 (master)

(cherry picked from commit 07fe6a43d6)
Change-Id: Ic48a9233dff564e39ce357a9ea0a111ea2b6414b
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466975
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
84abb1db24 lib: move bdev_rpc under lib/bdev
Part of a larger series unifying and simplifying the library directory
structure.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465211 (master)

(cherry picked from commit edc8c91a90)
Change-Id: I2782165aabbea9a31cc466fc7e3bb2b9263142dc
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466974
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
f7e1db6cb7 lib: move notify_rpc under lib/notify
This is part of a larger series aimed at simplifying/flattening the
directory structure of the SPDK lib directory. The ultimate goal of this
series is to properly create dynamic linker dependencies between all
spdk shared objects.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465209 (master)

(cherry picked from commit ef6108a7eb)
Change-Id: I6beb7103404ae2c24a3d25dd93a1061680c7176c
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466973
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
0cef5d5b76 lib: combine event/iscsi_rpc with lib/iscsi/iscsi_rpc.c
Part of a larger series simplifying the library directory.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465212 (master)

(cherry picked from commit ff69b368b8)
Change-Id: Ib9c9dc9a0c92ac35a9f0260451f97fc126d10031
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466972
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
d4d03bfdd6 lib: move trace_rpc into lib/trace
Combinining these two libraries removes some directory complexity. It
also helps us to align on a common practice for including the rpc code
with a given module. This is how all of our bdev modules already do it.
The nbd, net, and scsi modules also follow this pattern.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465210 (master)

(cherry picked from commit bc83adc2db)
Change-Id: I5e4c99d7f0facacc6dfe30b2274b60e0d151f8d8
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466971
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-06 02:19:41 +00:00
Seth Howell
f9a7ef7bec mk: move log_rpc from inside log
The log_rpc library has several dependencies which depend upon the log
library. This creates a circular dependency chain that makes single
threaded make unwieldy and makes multi-threaded make impossible.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/465192 (master)

(cherry picked from commit 9d1e4260cb)
Change-Id: I35e6532afcabce0f25974ed97444a56975654904
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466970
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2019-09-06 02:19:41 +00:00
213 changed files with 1236 additions and 471 deletions

View File

@ -1,5 +1,12 @@
# Changelog
## v19.07.1:
### build
Improved inter-lib dependencies to allow linking against only a subset of SPDK
libraries when building SPDK applications.
## v19.07:
### ftl

View File

@ -37,6 +37,7 @@ SPDK_ROOT_DIR := $(CURDIR)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y += lib
DIRS-y += module
DIRS-$(CONFIG_SHARED) += shared_lib
DIRS-y += examples app include
DIRS-$(CONFIG_TESTS) += test
@ -59,7 +60,7 @@ endif
ifeq ($(CONFIG_SHARED),y)
LIB = shared_lib
else
LIB = lib
LIB = module
endif
ifeq ($(CONFIG_IPSEC_MB),y)
@ -86,8 +87,9 @@ ifneq ($(SKIP_DPDK_BUILD),1)
dpdkbuild: $(DPDK_DEPS)
endif
shared_lib: lib
lib: $(DPDKBUILD)
module: lib
shared_lib: module
app: $(LIB)
test: $(LIB)
examples: $(LIB)

View File

@ -46,7 +46,7 @@ C_SRCS := iscsi_tgt.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_iscsi event_net event_scsi event_vmd event
SPDK_LIB_LIST += jsonrpc json rpc bdev_rpc bdev iscsi scsi copy trace conf
SPDK_LIB_LIST += thread util log log_rpc trace_rpc app_rpc net sock notify
SPDK_LIB_LIST += thread util log log_rpc app_rpc net sock notify
ifeq ($(OS),Linux)
SPDK_LIB_LIST += event_nbd nbd

View File

@ -42,7 +42,7 @@ C_SRCS := nvmf_main.c
SPDK_LIB_LIST = $(ALL_MODULES_LIST)
SPDK_LIB_LIST += event_bdev event_copy event_nvmf event_net event_vmd
SPDK_LIB_LIST += nvmf event log trace conf thread util bdev copy rpc jsonrpc json net sock
SPDK_LIB_LIST += app_rpc log_rpc trace_rpc bdev_rpc notify
SPDK_LIB_LIST += app_rpc log_rpc bdev_rpc notify
ifeq ($(OS),Linux)
SPDK_LIB_LIST += event_nbd nbd

View File

@ -52,7 +52,7 @@ endif
SPDK_LIB_LIST += event_bdev event_copy event_iscsi event_net event_scsi event_nvmf event_vmd event
SPDK_LIB_LIST += nvmf trace log conf thread util bdev iscsi scsi copy rpc jsonrpc json
SPDK_LIB_LIST += app_rpc log_rpc trace_rpc bdev_rpc net sock notify
SPDK_LIB_LIST += app_rpc log_rpc bdev_rpc net sock notify
ifeq ($(OS),Linux)
SPDK_LIB_LIST += event_nbd nbd

View File

@ -48,7 +48,7 @@ endif
SPDK_LIB_LIST += event_bdev event_copy event_net event_scsi event_vmd event
SPDK_LIB_LIST += jsonrpc json rpc bdev_rpc bdev scsi copy trace conf
SPDK_LIB_LIST += thread util log log_rpc trace_rpc app_rpc
SPDK_LIB_LIST += thread util log log_rpc app_rpc
SPDK_LIB_LIST += event_nbd nbd net sock notify
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -28,7 +28,7 @@ if [ "$SPDK_TEST_OCF" -eq 1 ]; then
# So we precompile OCF now for further use as standalone static library
./configure $(echo $config_params | sed 's/--enable-coverage//g')
$MAKE $MAKEFLAGS include/spdk/config.h
CC=gcc CCAR=ar $MAKE $MAKEFLAGS -C lib/bdev/ocf/env exportlib O=$rootdir/build/ocf.a
CC=gcc CCAR=ar $MAKE $MAKEFLAGS -C lib/env_ocf exportlib O=$rootdir/build/ocf.a
# Set config to use precompiled library
config_params="$config_params --with-ocf=/$rootdir/build/ocf.a"
fi
@ -77,9 +77,7 @@ timing_enter "$make_timing_label"
$MAKE $MAKEFLAGS clean
if [ $SPDK_BUILD_SHARED_OBJECT -eq 1 ]; then
./configure $config_params --with-shared
$MAKE $MAKEFLAGS
$MAKE $MAKEFLAGS clean
$rootdir/test/make/check_so_deps.sh
report_test_completion "shared_object_build"
fi

30
configure vendored
View File

@ -369,7 +369,7 @@ scripts/detect_cc.sh --cc="$CC" --cxx="$CXX" --lto="${CONFIG[LTO]}" --ld="$LD" -
CC=$(cat mk/cc.mk | grep "CC=" | cut -d "=" -f 2)
CC_TYPE=$(cat mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2)
BUILD_CMD="$CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS"
BUILD_CMD=($CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS)
# Detect architecture and force no ISA-L if non-x86 archtecture
if [[ "${CONFIG[ISAL]}" = "y" ]]; then
@ -417,7 +417,7 @@ if [ -z "${CONFIG[ENV]}" ]; then
# program, just compile it
if ! echo -e '#include <rte_vhost.h>\n' \
'int main(void) { return rte_vhost_extern_callback_register(0, NULL, NULL); }\n' \
| $BUILD_CMD -c -Wno-deprecated-declarations -Werror \
| ${BUILD_CMD[@]} -c -Wno-deprecated-declarations -Werror \
-I"${CONFIG[DPDK_DIR]}/include" - &>/dev/null; then
echo "Notice: DPDK's rte_vhost not found or version < 19.05, using internal," \
"legacy rte_vhost library."
@ -477,6 +477,10 @@ if [[ "$OSTYPE" == "freebsd"* ]]; then
echo "Vhost is only supported on Linux. Disabling it."
CONFIG[VHOST]="n"
fi
if [[ "${CONFIG[VHOST_INTERNAL_LIB]}" == "y" ]]; then
echo "Internal rte_vhost library is only supported on Linux. Disabling it."
CONFIG[VHOST_INTERNAL_LIB]="n"
fi
if [[ "${CONFIG[VIRTIO]}" == "y" ]]; then
echo "Virtio is only supported on Linux. Disabling it."
CONFIG[VIRTIO]="n"
@ -486,7 +490,7 @@ fi
if [ "${CONFIG[RDMA]}" = "y" ]; then
if ! echo -e '#include <infiniband/verbs.h>\n#include <rdma/rdma_verbs.h>\n' \
'int main(void) { return 0; }\n' \
| $BUILD_CMD -libverbs -lrdmacm - 2>/dev/null; then
| ${BUILD_CMD[@]} -libverbs -lrdmacm - 2>/dev/null; then
echo --with-rdma requires libverbs and librdmacm.
echo Please install then re-run this script.
exit 1
@ -494,7 +498,7 @@ if [ "${CONFIG[RDMA]}" = "y" ]; then
if echo -e '#include <infiniband/verbs.h>\n' \
'int main(void) { return !!IBV_WR_SEND_WITH_INV; }\n' \
| $BUILD_CMD -c - 2>/dev/null; then
| ${BUILD_CMD[@]} -c - 2>/dev/null; then
CONFIG[RDMA_SEND_WITH_INVAL]="y"
else
CONFIG[RDMA_SEND_WITH_INVAL]="n"
@ -565,7 +569,7 @@ fi
if [[ "${CONFIG[PMDK]}" = "y" ]]; then
if ! echo -e '#include <libpmemblk.h>\nint main(void) { return 0; }\n' \
| $BUILD_CMD -lpmemblk - 2>/dev/null; then
| ${BUILD_CMD[@]} -lpmemblk - 2>/dev/null; then
echo --with-pmdk requires libpmemblk.
echo Please install then re-run this script.
exit 1
@ -574,7 +578,7 @@ fi
if [[ "${CONFIG[REDUCE]}" = "y" ]]; then
if ! echo -e '#include <libpmem.h>\nint main(void) { return 0; }\n' \
| $BUILD_CMD -lpmem - 2>/dev/null; then
| ${BUILD_CMD[@]} -lpmem - 2>/dev/null; then
echo --with-reduce requires libpmem.
echo Please install then re-run this script.
exit 1
@ -586,7 +590,7 @@ if [[ "${CONFIG[VPP]}" = "y" ]]; then
VPP_CFLAGS="-L${CONFIG[VPP_DIR]}/lib -I${CONFIG[VPP_DIR]}/include"
fi
if ! echo -e '#include <vnet/session/application_interface.h>\nint main(void) { return 0; }\n' \
| $BUILD_CMD ${VPP_CFLAGS} -lvppinfra -lsvm -lvlibmemoryclient - 2>/dev/null; then
| ${BUILD_CMD[@]} ${VPP_CFLAGS} -lvppinfra -lsvm -lvlibmemoryclient - 2>/dev/null; then
echo --with-vpp requires installed vpp.
echo Please install then re-run this script.
exit 1
@ -596,7 +600,7 @@ fi
if [[ "${CONFIG[RBD]}" = "y" ]]; then
if ! echo -e '#include <rbd/librbd.h>\n#include <rados/librados.h>\n' \
'int main(void) { return 0; }\n' \
| $BUILD_CMD -lrados -lrbd - 2>/dev/null; then
| ${BUILD_CMD[@]} -lrados -lrbd - 2>/dev/null; then
echo --with-rbd requires librados and librbd.
echo Please install then re-run this script.
exit 1
@ -610,7 +614,7 @@ if [[ "${CONFIG[ISCSI_INITIATOR]}" = "y" ]]; then
'#error\n' \
'#endif\n' \
'int main(void) { return 0; }\n' \
| $BUILD_CMD -L/usr/lib64/iscsi -liscsi - 2>/dev/null; then
| ${BUILD_CMD[@]} -L/usr/lib64/iscsi -liscsi - 2>/dev/null; then
echo --with-iscsi-initiator requires libiscsi with
echo 'LIBISCSI_API_VERSION >= 20150621.'
echo Please install then re-run this script.
@ -620,7 +624,7 @@ fi
if [[ "${CONFIG[LOG_BACKTRACE]}" = "y" ]]; then
if ! echo -e '#include <libunwind.h>\nint main(void) { return 0; }\n' \
| $BUILD_CMD -lunwind - 2>/dev/null; then
| ${BUILD_CMD[@]} -lunwind - 2>/dev/null; then
echo --enable-log-bt requires libunwind.
echo Please install then re-run this script.
exit 1
@ -629,7 +633,7 @@ fi
if [[ "${CONFIG[ASAN]}" = "y" ]]; then
if ! echo -e 'int main(void) { return 0; }\n' \
| $BUILD_CMD -fsanitize=address - 2>/dev/null; then
| ${BUILD_CMD[@]} -fsanitize=address - 2>/dev/null; then
echo --enable-asan requires libasan.
echo Please install then re-run this script.
exit 1
@ -638,7 +642,7 @@ fi
if [[ "${CONFIG[UBSAN]}" = "y" ]]; then
if ! echo -e 'int main(void) { return 0; }\n' \
| $BUILD_CMD -fsanitize=undefined - 2>/dev/null; then
| ${BUILD_CMD[@]} -fsanitize=undefined - 2>/dev/null; then
echo --enable-ubsan requires libubsan.
echo Please install then re-run this script.
exit 1
@ -647,7 +651,7 @@ fi
if [[ "${CONFIG[TSAN]}" = "y" ]]; then
if ! echo -e 'int main(void) { return 0; }\n' \
| $BUILD_CMD -fsanitize=thread - 2>/dev/null; then
| ${BUILD_CMD[@]} -fsanitize=thread - 2>/dev/null; then
echo --enable-tsan requires libtsan.
echo Please install then re-run this script.
exit 1

View File

@ -654,7 +654,7 @@ enum spdk_nvme_command_specific_status_code {
SPDK_NVME_SC_CONFLICTING_ATTRIBUTES = 0x80,
SPDK_NVME_SC_INVALID_PROTECTION_INFO = 0x81,
SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_PAGE = 0x82,
SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_RANGE = 0x82,
};
/**

View File

@ -103,14 +103,20 @@ int spdk_rpc_is_method_allowed(const char *method, uint32_t state_mask);
#define SPDK_RPC_STARTUP 0x1
#define SPDK_RPC_RUNTIME 0x2
/* Give SPDK_RPC_REGISTER a higher execution priority than
* SPDK_RPC_REGISTER_ALIAS_DEPRECATED to ensure all of the RPCs are registered
* before we try registering any aliases. Some older versions of clang may
* otherwise execute the constructors in a different order than
* defined in the source file (see issue #892).
*/
#define SPDK_RPC_REGISTER(method, func, state_mask) \
static void __attribute__((constructor)) rpc_register_##func(void) \
static void __attribute__((constructor(1000))) rpc_register_##func(void) \
{ \
spdk_rpc_register_method(method, func, state_mask); \
}
#define SPDK_RPC_REGISTER_ALIAS_DEPRECATED(method, alias) \
static void __attribute__((constructor)) rpc_register_##alias(void) \
static void __attribute__((constructor(1001))) rpc_register_##alias(void) \
{ \
spdk_rpc_register_alias_deprecated(#method, #alias); \
}

View File

@ -54,7 +54,7 @@
* Patch level is incremented on maintenance branch releases and reset to 0 for each
* new major.minor release.
*/
#define SPDK_VERSION_PATCH 0
#define SPDK_VERSION_PATCH 1
/**
* Version string suffix.

View File

@ -33,17 +33,23 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
include $(SPDK_ROOT_DIR)/mk/spdk.lib_deps.mk
DIRS-y += bdev blob blobfs conf copy event json jsonrpc \
log lvol net rpc sock thread trace util nvme vmd nvmf scsi ioat \
ut_mock iscsi notify
log log_rpc lvol net rpc sock thread trace util nvme vmd nvmf scsi \
ioat ut_mock iscsi notify
ifeq ($(OS),Linux)
DIRS-y += nbd ftl
endif
ifeq ($(CONFIG_OCF), y)
DIRS-y += env_ocf
endif
DIRS-$(CONFIG_VHOST) += vhost
DIRS-$(CONFIG_VIRTIO) += virtio
DIRS-$(CONFIG_REDUCE) += reduce
DIRS-$(CONFIG_VHOST_INTERNAL_LIB) += rte_vhost
# If CONFIG_ENV is pointing at a directory in lib, build it.
# Out-of-tree env implementations must be built separately by the user.
@ -52,9 +58,6 @@ ifeq ($(abspath $(CONFIG_ENV)),$(SPDK_ROOT_DIR)/lib/$(ENV_NAME))
DIRS-y += $(ENV_NAME)
endif
DEPDIRS-iscsi := scsi
DEPDIRS-bdev := notify
.PHONY: all clean $(DIRS-y)
all: $(DIRS-y)

View File

@ -38,37 +38,8 @@ ifeq ($(CONFIG_VTUNE),y)
CFLAGS += -I$(CONFIG_VTUNE_DIR)/include -I$(CONFIG_VTUNE_DIR)/sdk/src/ittnotify
endif
C_SRCS = bdev.c part.c scsi_nvme.c
C_SRCS = bdev.c bdev_rpc.c part.c scsi_nvme.c
C_SRCS-$(CONFIG_VTUNE) += vtune.c
LIBNAME = bdev
DIRS-y += delay error gpt lvol malloc null nvme passthru raid rpc split
ifeq ($(CONFIG_CRYPTO),y)
DIRS-y += crypto
endif
ifeq ($(CONFIG_OCF), y)
DIRS-y += ocf
DIRS-y += ocf/env
DEPDIRS-ocf := ocf/env
endif
ifeq ($(CONFIG_REDUCE),y)
DIRS-y += compress
endif
ifeq ($(CONFIG_URING),y)
DIRS-y += uring
endif
ifeq ($(OS),Linux)
DIRS-y += aio
DIRS-$(CONFIG_ISCSI_INITIATOR) += iscsi
DIRS-$(CONFIG_VIRTIO) += virtio
DIRS-$(CONFIG_PMDK) += pmem
endif
DIRS-$(CONFIG_RBD) += rbd
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -4308,6 +4308,12 @@ spdk_bdev_open(struct spdk_bdev *bdev, bool write, spdk_bdev_remove_cb_t remove_
*_desc = desc;
pthread_mutex_lock(&bdev->internal.mutex);
if (bdev->internal.status == SPDK_BDEV_STATUS_REMOVING) {
pthread_mutex_unlock(&bdev->internal.mutex);
free(desc);
*_desc = NULL;
return -ENODEV;
}
if (write && bdev->internal.claim_module) {
SPDK_ERRLOG("Could not open %s - %s module already claimed it\n",
@ -4773,8 +4779,7 @@ spdk_bdev_set_qos_rate_limits(struct spdk_bdev *bdev, uint64_t *limits,
if (!bdev->internal.qos) {
pthread_mutex_unlock(&bdev->internal.mutex);
SPDK_ERRLOG("Unable to allocate memory for QoS tracking\n");
free(ctx);
cb_fn(cb_arg, -ENOMEM);
_spdk_bdev_set_qos_limit_done(ctx, -ENOMEM);
return;
}
}

View File

@ -158,7 +158,7 @@ spdk_scsi_nvme_translate(const struct spdk_bdev_io *bdev_io, int *sc, int *sk,
*asc = SPDK_SCSI_ASC_INVALID_FIELD_IN_CDB;
*ascq = SPDK_SCSI_ASCQ_CAUSE_NOT_REPORTABLE;
break;
case SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_PAGE:
case SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_RANGE:
*sc = SPDK_SCSI_STATUS_CHECK_CONDITION;
*sk = SPDK_SCSI_SENSE_DATA_PROTECT;
*asc = SPDK_SCSI_ASC_WRITE_PROTECTED;

View File

@ -37,6 +37,4 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
C_SRCS = blobstore.c request.c zeroes.c blob_bs_dev.c
LIBNAME = blob
DIRS-y += bdev
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -37,6 +37,4 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
LIBNAME = copy
C_SRCS = copy_engine.c
DIRS-y = ioat
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -116,7 +116,7 @@ ENV_CFLAGS = $(DPDK_INC) -Wno-deprecated-declarations
ENV_CXXFLAGS = $(ENV_CFLAGS)
ENV_DPDK_FILE = $(call spdk_lib_list_to_static_libs,env_dpdk)
ENV_LIBS = $(ENV_DPDK_FILE) $(DPDK_LIB)
ENV_LINKER_ARGS = $(ENV_DPDK_FILE) -Wl,--whole-archive $(DPDK_LIB) -Wl,--no-whole-archive
ENV_LINKER_ARGS = $(ENV_DPDK_FILE) -Wl,--whole-archive,--no-as-needed $(DPDK_LIB) -Wl,--no-whole-archive
ifeq ($(CONFIG_IPSEC_MB),y)
ENV_LINKER_ARGS += -lIPSec_MB -L$(IPSEC_MB_DIR)

View File

@ -1005,7 +1005,6 @@ spdk_vtophys_notify(void *cb_ctx, struct spdk_mem_map *map,
return -EINVAL;
}
while (len > 0) {
/* Get the physical address from the DPDK memsegs */
paddr = vtophys_get_paddr_memseg((uint64_t)vaddr);
@ -1022,10 +1021,19 @@ spdk_vtophys_notify(void *cb_ctx, struct spdk_mem_map *map,
* addresses will never overlap.
*/
paddr = (uint64_t)vaddr;
rc = vtophys_iommu_map_dma((uint64_t)vaddr, paddr, VALUE_2MB);
rc = vtophys_iommu_map_dma((uint64_t)vaddr, paddr, len);
if (rc) {
return -EFAULT;
}
while (len > 0) {
rc = spdk_mem_map_set_translation(map, (uint64_t)vaddr, VALUE_2MB, paddr);
if (rc != 0) {
return rc;
}
vaddr += VALUE_2MB;
paddr += VALUE_2MB;
len -= VALUE_2MB;
}
} else
#endif
{
@ -1038,10 +1046,26 @@ spdk_vtophys_notify(void *cb_ctx, struct spdk_mem_map *map,
DEBUG_PRINT("could not get phys addr for %p\n", vaddr);
return -EFAULT;
}
/* The beginning of this address range points to a PCI resource,
* so the rest must point to a PCI resource as well.
*/
pci_phys = 1;
}
/* Get paddr for each 2MB chunk in this address range */
while (len > 0) {
/* Get the physical address from /proc/self/pagemap. */
if (pci_phys) {
paddr = vtophys_get_paddr_pci((uint64_t)vaddr);
} else {
paddr = vtophys_get_paddr_pagemap((uint64_t)vaddr);
}
if (paddr == SPDK_VTOPHYS_ERROR) {
DEBUG_PRINT("could not get phys addr for %p\n", vaddr);
return -EFAULT;
}
/* Since PCI paddr can break the 2MiB physical alignment skip this check for that. */
if (!pci_phys && (paddr & MASK_2MB)) {
DEBUG_PRINT("invalid paddr 0x%" PRIx64 " - must be 2MB aligned\n", paddr);
@ -1049,6 +1073,33 @@ spdk_vtophys_notify(void *cb_ctx, struct spdk_mem_map *map,
}
rc = spdk_mem_map_set_translation(map, (uint64_t)vaddr, VALUE_2MB, paddr);
if (rc != 0) {
return rc;
}
vaddr += VALUE_2MB;
len -= VALUE_2MB;
}
}
} else {
/* This is an address managed by DPDK. Just setup the translations. */
while (len > 0) {
paddr = vtophys_get_paddr_memseg((uint64_t)vaddr);
if (paddr == SPDK_VTOPHYS_ERROR) {
DEBUG_PRINT("could not get phys addr for %p\n", vaddr);
return -EFAULT;
}
rc = spdk_mem_map_set_translation(map, (uint64_t)vaddr, VALUE_2MB, paddr);
if (rc != 0) {
return rc;
}
vaddr += VALUE_2MB;
len -= VALUE_2MB;
}
}
break;
case SPDK_MEM_MAP_NOTIFY_UNREGISTER:
#if SPDK_VFIO_ENABLED
@ -1058,32 +1109,45 @@ spdk_vtophys_notify(void *cb_ctx, struct spdk_mem_map *map,
* we need to unmap the range from the IOMMU
*/
if (spdk_iommu_is_enabled()) {
uint64_t buffer_len = VALUE_2MB;
uint64_t buffer_len = len;
paddr = spdk_mem_map_translate(map, (uint64_t)vaddr, &buffer_len);
if (buffer_len != VALUE_2MB) {
if (buffer_len != len) {
return -EINVAL;
}
rc = vtophys_iommu_unmap_dma(paddr, VALUE_2MB);
rc = vtophys_iommu_unmap_dma(paddr, len);
if (rc) {
return -EFAULT;
}
}
}
#endif
while (len > 0) {
rc = spdk_mem_map_clear_translation(map, (uint64_t)vaddr, VALUE_2MB);
if (rc != 0) {
return rc;
}
vaddr += VALUE_2MB;
len -= VALUE_2MB;
}
break;
default:
SPDK_UNREACHABLE();
}
if (rc != 0) {
return rc;
}
vaddr += VALUE_2MB;
len -= VALUE_2MB;
}
return rc;
static int
vtophys_check_contiguous_entries(uint64_t paddr1, uint64_t paddr2)
{
/* This function is always called with paddrs for two subsequent
* 2MB chunks in virtual address space, so those chunks will be only
* physically contiguous if the physical addresses are 2MB apart
* from each other as well.
*/
return (paddr2 - paddr1 == VALUE_2MB);
}
#if SPDK_VFIO_ENABLED
@ -1274,7 +1338,7 @@ spdk_vtophys_init(void)
{
const struct spdk_mem_map_ops vtophys_map_ops = {
.notify_cb = spdk_vtophys_notify,
.are_contiguous = NULL
.are_contiguous = vtophys_check_contiguous_entries,
};
#if SPDK_VFIO_ENABLED

View File

@ -37,7 +37,7 @@
# Else if SPDK is configured with OCF precompiled library
# we just use it as SPDK lib by copying it to /build/lib/
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../..)
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
OCFDIR=$(CONFIG_OCF_DIR)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
@ -76,17 +76,17 @@ all: ocf_inc ocf_src
$(Q)$(MAKE) $(LIB)
ocf_inc:
$(Q)$(MAKE) -C "$(CONFIG_OCF_PATH)" inc O="$(SPDK_ROOT_DIR)/lib/bdev/ocf/env/" --quiet
$(Q)$(MAKE) -C "$(CONFIG_OCF_PATH)" inc O="$(SPDK_ROOT_DIR)/lib/env_ocf/" ENV= --quiet
ocf_src: ocf_inc
$(Q)$(MAKE) -C "$(CONFIG_OCF_PATH)" src O="$(SPDK_ROOT_DIR)/lib/bdev/ocf/env/" CMD=cp --quiet
$(Q)$(MAKE) -C "$(CONFIG_OCF_PATH)" src O="$(SPDK_ROOT_DIR)/lib/env_ocf/" CMD=cp ENV= --quiet
ocf_distclean:
$(Q)$(MAKE) -C "$(CONFIG_OCF_PATH)" distclean O="$(SPDK_ROOT_DIR)/lib/bdev/ocf/env/" --quiet
$(Q)$(MAKE) -C "$(CONFIG_OCF_PATH)" distclean O="$(SPDK_ROOT_DIR)/lib/env_ocf/" ENV= --quiet
clean: ocf_distclean
$(Q)rm -rf "$(SPDK_ROOT_DIR)/lib/bdev/ocf/env/include" \
"$(SPDK_ROOT_DIR)/lib/bdev/ocf/env/src" \
$(Q)rm -rf "$(SPDK_ROOT_DIR)/lib/env_ocf/include" \
"$(SPDK_ROOT_DIR)/lib/env_ocf/src" \
$(LIB) $(OBJS);
$(LIB): $(OBJS)

View File

@ -37,6 +37,4 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
LIBNAME = event
C_SRCS = app.c reactor.c rpc.c subsystem.c json_config.c
DIRS-y = rpc subsystems
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -1,115 +0,0 @@
/*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "iscsi/iscsi.h"
#include "iscsi/conn.h"
#include "spdk/rpc.h"
#include "spdk/util.h"
#include "spdk/event.h"
#include "spdk_internal/log.h"
static const struct spdk_json_object_decoder rpc_set_iscsi_opts_decoders[] = {
{"auth_file", offsetof(struct spdk_iscsi_opts, authfile), spdk_json_decode_string, true},
{"node_base", offsetof(struct spdk_iscsi_opts, nodebase), spdk_json_decode_string, true},
{"nop_timeout", offsetof(struct spdk_iscsi_opts, timeout), spdk_json_decode_int32, true},
{"nop_in_interval", offsetof(struct spdk_iscsi_opts, nopininterval), spdk_json_decode_int32, true},
{"no_discovery_auth", offsetof(struct spdk_iscsi_opts, disable_chap), spdk_json_decode_bool, true},
{"req_discovery_auth", offsetof(struct spdk_iscsi_opts, require_chap), spdk_json_decode_bool, true},
{"req_discovery_auth_mutual", offsetof(struct spdk_iscsi_opts, mutual_chap), spdk_json_decode_bool, true},
{"discovery_auth_group", offsetof(struct spdk_iscsi_opts, chap_group), spdk_json_decode_int32, true},
{"disable_chap", offsetof(struct spdk_iscsi_opts, disable_chap), spdk_json_decode_bool, true},
{"require_chap", offsetof(struct spdk_iscsi_opts, require_chap), spdk_json_decode_bool, true},
{"mutual_chap", offsetof(struct spdk_iscsi_opts, mutual_chap), spdk_json_decode_bool, true},
{"chap_group", offsetof(struct spdk_iscsi_opts, chap_group), spdk_json_decode_int32, true},
{"max_sessions", offsetof(struct spdk_iscsi_opts, MaxSessions), spdk_json_decode_uint32, true},
{"max_queue_depth", offsetof(struct spdk_iscsi_opts, MaxQueueDepth), spdk_json_decode_uint32, true},
{"max_connections_per_session", offsetof(struct spdk_iscsi_opts, MaxConnectionsPerSession), spdk_json_decode_uint32, true},
{"default_time2wait", offsetof(struct spdk_iscsi_opts, DefaultTime2Wait), spdk_json_decode_uint32, true},
{"default_time2retain", offsetof(struct spdk_iscsi_opts, DefaultTime2Retain), spdk_json_decode_uint32, true},
{"first_burst_length", offsetof(struct spdk_iscsi_opts, FirstBurstLength), spdk_json_decode_uint32, true},
{"immediate_data", offsetof(struct spdk_iscsi_opts, ImmediateData), spdk_json_decode_bool, true},
{"error_recovery_level", offsetof(struct spdk_iscsi_opts, ErrorRecoveryLevel), spdk_json_decode_uint32, true},
{"allow_duplicated_isid", offsetof(struct spdk_iscsi_opts, AllowDuplicateIsid), spdk_json_decode_bool, true},
{"min_connections_per_core", offsetof(struct spdk_iscsi_opts, min_connections_per_core), spdk_json_decode_uint32, true},
};
static void
spdk_rpc_set_iscsi_options(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct spdk_iscsi_opts *opts;
struct spdk_json_write_ctx *w;
if (g_spdk_iscsi_opts != NULL) {
SPDK_ERRLOG("this RPC must not be called more than once.\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"Must not call more than once");
return;
}
opts = spdk_iscsi_opts_alloc();
if (opts == NULL) {
SPDK_ERRLOG("spdk_iscsi_opts_alloc() failed.\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"Out of memory");
return;
}
if (params != NULL) {
if (spdk_json_decode_object(params, rpc_set_iscsi_opts_decoders,
SPDK_COUNTOF(rpc_set_iscsi_opts_decoders), opts)) {
SPDK_ERRLOG("spdk_json_decode_object() failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"Invalid parameters");
spdk_iscsi_opts_free(opts);
return;
}
}
g_spdk_iscsi_opts = spdk_iscsi_opts_copy(opts);
spdk_iscsi_opts_free(opts);
if (g_spdk_iscsi_opts == NULL) {
SPDK_ERRLOG("spdk_iscsi_opts_copy() failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"Out of memory");
return;
}
w = spdk_jsonrpc_begin_result(request);
spdk_json_write_bool(w, true);
spdk_jsonrpc_end_result(request, w);
}
SPDK_RPC_REGISTER("set_iscsi_options", spdk_rpc_set_iscsi_options, SPDK_RPC_STARTUP)

View File

@ -753,13 +753,14 @@ static void
ftl_wptr_pad_band(struct ftl_wptr *wptr)
{
struct spdk_ftl_dev *dev = wptr->dev;
size_t size = ftl_rwb_num_acquired(dev->rwb, FTL_RWB_TYPE_INTERNAL) +
ftl_rwb_num_acquired(dev->rwb, FTL_RWB_TYPE_USER);
size_t size = ftl_rwb_num_pending(dev->rwb);
size_t blocks_left, rwb_size, pad_size;
blocks_left = ftl_wptr_user_lbks_left(wptr);
assert(size <= blocks_left);
assert(blocks_left % dev->xfer_size == 0);
rwb_size = ftl_rwb_size(dev->rwb) - size;
pad_size = spdk_min(blocks_left, rwb_size);
pad_size = spdk_min(blocks_left - size, rwb_size);
/* Pad write buffer until band is full */
ftl_rwb_pad(dev, pad_size);
@ -769,8 +770,7 @@ static void
ftl_wptr_process_shutdown(struct ftl_wptr *wptr)
{
struct spdk_ftl_dev *dev = wptr->dev;
size_t size = ftl_rwb_num_acquired(dev->rwb, FTL_RWB_TYPE_INTERNAL) +
ftl_rwb_num_acquired(dev->rwb, FTL_RWB_TYPE_USER);
size_t size = ftl_rwb_num_pending(dev->rwb);
size_t num_active = dev->xfer_size * ftl_rwb_get_active_batches(dev->rwb);
num_active = num_active ? num_active : dev->xfer_size;
@ -2078,14 +2078,10 @@ _ftl_flush(void *ctx)
}
int
spdk_ftl_flush(struct spdk_ftl_dev *dev, spdk_ftl_fn cb_fn, void *cb_arg)
ftl_flush_rwb(struct spdk_ftl_dev *dev, spdk_ftl_fn cb_fn, void *cb_arg)
{
struct ftl_flush *flush;
if (!dev->initialized) {
return -EBUSY;
}
flush = ftl_flush_init(dev, cb_fn, cb_arg);
if (!flush) {
return -ENOMEM;
@ -2095,6 +2091,16 @@ spdk_ftl_flush(struct spdk_ftl_dev *dev, spdk_ftl_fn cb_fn, void *cb_arg)
return 0;
}
int
spdk_ftl_flush(struct spdk_ftl_dev *dev, spdk_ftl_fn cb_fn, void *cb_arg)
{
if (!dev->initialized) {
return -EBUSY;
}
return ftl_flush_rwb(dev, cb_fn, cb_arg);
}
static void
_ftl_process_anm_event(void *ctx)
{
@ -2108,6 +2114,12 @@ ftl_process_anm_event(struct ftl_anm_event *event)
struct ftl_band *band;
size_t lbkoff;
/* Drop any ANM requests until the device is initialized */
if (!dev->initialized) {
ftl_anm_event_complete(event);
return;
}
if (!ftl_check_core_thread(dev)) {
spdk_thread_send_msg(ftl_get_core_thread(dev), _ftl_process_anm_event, event);
return;

View File

@ -276,7 +276,7 @@ void ftl_apply_limits(struct spdk_ftl_dev *dev);
void ftl_io_read(struct ftl_io *io);
void ftl_io_write(struct ftl_io *io);
int ftl_io_erase(struct ftl_io *io);
int ftl_io_flush(struct ftl_io *io);
int ftl_flush_rwb(struct spdk_ftl_dev *dev, spdk_ftl_fn cb_fn, void *cb_arg);
int ftl_current_limit(const struct spdk_ftl_dev *dev);
int ftl_invalidate_addr(struct spdk_ftl_dev *dev, struct ftl_ppa ppa);
int ftl_task_core(void *ctx);

View File

@ -544,6 +544,27 @@ ftl_nv_cache_band_flush_cb(void *ctx, int status)
}
}
static void
ftl_nv_cache_rwb_flush_cb(void *ctx, int status)
{
struct ftl_nv_cache_restore *restore = ctx;
struct ftl_nv_cache *nv_cache = restore->nv_cache;
struct spdk_ftl_dev *dev = SPDK_CONTAINEROF(nv_cache, struct spdk_ftl_dev, nv_cache);
int rc;
if (spdk_unlikely(status != 0)) {
SPDK_ERRLOG("Flushing the write buffer failed: %s\n", spdk_strerror(-status));
ftl_nv_cache_restore_complete(restore, status);
return;
}
rc = ftl_flush_active_bands(dev, ftl_nv_cache_band_flush_cb, restore);
if (spdk_unlikely(rc != 0)) {
SPDK_ERRLOG("Unable to flush active bands: %s\n", spdk_strerror(-rc));
ftl_nv_cache_restore_complete(restore, rc);
}
}
static void
ftl_nv_cache_recovery_done(struct ftl_nv_cache_restore *restore)
{
@ -567,9 +588,9 @@ ftl_nv_cache_recovery_done(struct ftl_nv_cache_restore *restore)
range_current->start_addr < range_prev->last_addr)) {
SPDK_DEBUGLOG(SPDK_LOG_FTL_INIT, "Non-volatile cache inconsistency detected\n");
rc = ftl_flush_active_bands(dev, ftl_nv_cache_band_flush_cb, restore);
rc = ftl_flush_rwb(dev, ftl_nv_cache_rwb_flush_cb, restore);
if (spdk_unlikely(rc != 0)) {
SPDK_ERRLOG("Unable to flush active bands: %s\n", spdk_strerror(-rc));
SPDK_ERRLOG("Unable to flush the write buffer: %s\n", spdk_strerror(-rc));
ftl_nv_cache_restore_complete(restore, rc);
}

View File

@ -83,6 +83,8 @@ struct ftl_rwb {
/* Number of acquired entries */
unsigned int num_acquired[FTL_RWB_TYPE_MAX];
/* Number of acquired but not yet submitted entries */
unsigned int num_pending;
/* User/internal limits */
size_t limits[FTL_RWB_TYPE_MAX];
@ -371,6 +373,14 @@ ftl_rwb_batch_revert(struct ftl_rwb_batch *batch)
if (spdk_ring_enqueue(rwb->prio_queue, (void **)&batch, 1, NULL) != 1) {
assert(0 && "Should never happen");
}
__atomic_fetch_add(&rwb->num_pending, rwb->xfer_size, __ATOMIC_SEQ_CST);
}
unsigned int
ftl_rwb_num_pending(struct ftl_rwb *rwb)
{
return __atomic_load_n(&rwb->num_pending, __ATOMIC_SEQ_CST);
}
void
@ -457,6 +467,7 @@ ftl_rwb_acquire(struct ftl_rwb *rwb, enum ftl_rwb_entry_type type)
pthread_spin_unlock(&rwb->lock);
__atomic_fetch_add(&rwb->num_acquired[type], 1, __ATOMIC_SEQ_CST);
__atomic_fetch_add(&rwb->num_pending, 1, __ATOMIC_SEQ_CST);
return entry;
error:
pthread_spin_unlock(&rwb->lock);
@ -491,12 +502,19 @@ struct ftl_rwb_batch *
ftl_rwb_pop(struct ftl_rwb *rwb)
{
struct ftl_rwb_batch *batch = NULL;
unsigned int num_pending __attribute__((unused));
if (spdk_ring_dequeue(rwb->prio_queue, (void **)&batch, 1) == 1) {
num_pending = __atomic_fetch_sub(&rwb->num_pending, rwb->xfer_size,
__ATOMIC_SEQ_CST);
assert(num_pending > 0);
return batch;
}
if (spdk_ring_dequeue(rwb->submit_queue, (void **)&batch, 1) == 1) {
num_pending = __atomic_fetch_sub(&rwb->num_pending, rwb->xfer_size,
__ATOMIC_SEQ_CST);
assert(num_pending > 0);
return batch;
}

View File

@ -118,6 +118,7 @@ struct ftl_rwb_entry *ftl_rwb_batch_first_entry(struct ftl_rwb_batch *batch);
void *ftl_rwb_batch_get_data(struct ftl_rwb_batch *batch);
void *ftl_rwb_batch_get_md(struct ftl_rwb_batch *batch);
void ftl_rwb_disable_interleaving(struct ftl_rwb *rwb);
unsigned int ftl_rwb_num_pending(struct ftl_rwb *rwb);
static inline void
_ftl_rwb_entry_set_valid(struct ftl_rwb_entry *entry, bool valid)

View File

@ -41,6 +41,5 @@ C_SRCS = conn.c \
iscsi_rpc.c task.c
LIBNAME = iscsi
LOCAL_SYS_LIBS = -lcrypto
SPDK_DEP_LIBNAMES = scsi
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -1474,3 +1474,77 @@ spdk_rpc_get_iscsi_auth_groups(struct spdk_jsonrpc_request *request,
spdk_jsonrpc_end_result(request, w);
}
SPDK_RPC_REGISTER("get_iscsi_auth_groups", spdk_rpc_get_iscsi_auth_groups, SPDK_RPC_RUNTIME)
static const struct spdk_json_object_decoder rpc_set_iscsi_opts_decoders[] = {
{"auth_file", offsetof(struct spdk_iscsi_opts, authfile), spdk_json_decode_string, true},
{"node_base", offsetof(struct spdk_iscsi_opts, nodebase), spdk_json_decode_string, true},
{"nop_timeout", offsetof(struct spdk_iscsi_opts, timeout), spdk_json_decode_int32, true},
{"nop_in_interval", offsetof(struct spdk_iscsi_opts, nopininterval), spdk_json_decode_int32, true},
{"no_discovery_auth", offsetof(struct spdk_iscsi_opts, disable_chap), spdk_json_decode_bool, true},
{"req_discovery_auth", offsetof(struct spdk_iscsi_opts, require_chap), spdk_json_decode_bool, true},
{"req_discovery_auth_mutual", offsetof(struct spdk_iscsi_opts, mutual_chap), spdk_json_decode_bool, true},
{"discovery_auth_group", offsetof(struct spdk_iscsi_opts, chap_group), spdk_json_decode_int32, true},
{"disable_chap", offsetof(struct spdk_iscsi_opts, disable_chap), spdk_json_decode_bool, true},
{"require_chap", offsetof(struct spdk_iscsi_opts, require_chap), spdk_json_decode_bool, true},
{"mutual_chap", offsetof(struct spdk_iscsi_opts, mutual_chap), spdk_json_decode_bool, true},
{"chap_group", offsetof(struct spdk_iscsi_opts, chap_group), spdk_json_decode_int32, true},
{"max_sessions", offsetof(struct spdk_iscsi_opts, MaxSessions), spdk_json_decode_uint32, true},
{"max_queue_depth", offsetof(struct spdk_iscsi_opts, MaxQueueDepth), spdk_json_decode_uint32, true},
{"max_connections_per_session", offsetof(struct spdk_iscsi_opts, MaxConnectionsPerSession), spdk_json_decode_uint32, true},
{"default_time2wait", offsetof(struct spdk_iscsi_opts, DefaultTime2Wait), spdk_json_decode_uint32, true},
{"default_time2retain", offsetof(struct spdk_iscsi_opts, DefaultTime2Retain), spdk_json_decode_uint32, true},
{"first_burst_length", offsetof(struct spdk_iscsi_opts, FirstBurstLength), spdk_json_decode_uint32, true},
{"immediate_data", offsetof(struct spdk_iscsi_opts, ImmediateData), spdk_json_decode_bool, true},
{"error_recovery_level", offsetof(struct spdk_iscsi_opts, ErrorRecoveryLevel), spdk_json_decode_uint32, true},
{"allow_duplicated_isid", offsetof(struct spdk_iscsi_opts, AllowDuplicateIsid), spdk_json_decode_bool, true},
{"min_connections_per_core", offsetof(struct spdk_iscsi_opts, min_connections_per_core), spdk_json_decode_uint32, true},
};
static void
spdk_rpc_set_iscsi_options(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct spdk_iscsi_opts *opts;
struct spdk_json_write_ctx *w;
if (g_spdk_iscsi_opts != NULL) {
SPDK_ERRLOG("this RPC must not be called more than once.\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"Must not call more than once");
return;
}
opts = spdk_iscsi_opts_alloc();
if (opts == NULL) {
SPDK_ERRLOG("spdk_iscsi_opts_alloc() failed.\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"Out of memory");
return;
}
if (params != NULL) {
if (spdk_json_decode_object(params, rpc_set_iscsi_opts_decoders,
SPDK_COUNTOF(rpc_set_iscsi_opts_decoders), opts)) {
SPDK_ERRLOG("spdk_json_decode_object() failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"Invalid parameters");
spdk_iscsi_opts_free(opts);
return;
}
}
g_spdk_iscsi_opts = spdk_iscsi_opts_copy(opts);
spdk_iscsi_opts_free(opts);
if (g_spdk_iscsi_opts == NULL) {
SPDK_ERRLOG("spdk_iscsi_opts_copy() failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"Out of memory");
return;
}
w = spdk_jsonrpc_begin_result(request);
spdk_json_write_bool(w, true);
spdk_jsonrpc_end_result(request, w);
}
SPDK_RPC_REGISTER("set_iscsi_options", spdk_rpc_set_iscsi_options, SPDK_RPC_STARTUP)

View File

@ -40,6 +40,4 @@ ifeq ($(CONFIG_LOG_BACKTRACE),y)
LOCAL_SYS_LIBS += -lunwind
endif
DIRS-y = rpc
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -31,7 +31,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
C_SRCS = log_rpc.c

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
C_SRCS = notify.c
C_SRCS = notify.c notify_rpc.c
LIBNAME = notify
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -549,6 +549,9 @@ static size_t
opal_response_get_string(const struct spdk_opal_resp_parsed *resp, int n,
const char **store)
{
uint8_t header_len;
struct spdk_opal_resp_token token = resp->resp_tokens[n];
*store = NULL;
if (!resp) {
SPDK_ERRLOG("Response is NULL\n");
@ -561,13 +564,28 @@ opal_response_get_string(const struct spdk_opal_resp_parsed *resp, int n,
return 0;
}
if (resp->resp_tokens[n].type != OPAL_DTA_TOKENID_BYTESTRING) {
if (token.type != OPAL_DTA_TOKENID_BYTESTRING) {
SPDK_ERRLOG("Token is not a byte string!\n");
return 0;
}
*store = resp->resp_tokens[n].pos + 1;
return resp->resp_tokens[n].len - 1;
switch (token.width) {
case OPAL_WIDTH_SHORT:
header_len = 1;
break;
case OPAL_WIDTH_MEDIUM:
header_len = 2;
break;
case OPAL_WIDTH_LONG:
header_len = 4;
break;
default:
SPDK_ERRLOG("Can't get string from this Token\n");
return 0;
}
*store = token.pos + header_len;
return token.len - header_len;
}
static int

View File

@ -239,7 +239,7 @@ static const struct nvme_string command_specific_status[] = {
{ SPDK_NVME_SC_INVALID_RESOURCE_ID, "INVALID RESOURCE IDENTIFIER" },
{ SPDK_NVME_SC_CONFLICTING_ATTRIBUTES, "CONFLICTING ATTRIBUTES" },
{ SPDK_NVME_SC_INVALID_PROTECTION_INFO, "INVALID PROTECTION INFO" },
{ SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_PAGE, "WRITE TO RO PAGE" },
{ SPDK_NVME_SC_ATTEMPTED_WRITE_TO_RO_RANGE, "WRITE TO RO RANGE" },
{ 0xFFFF, "COMMAND SPECIFIC" }
};

View File

@ -1428,8 +1428,6 @@ nvme_rdma_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx,
return -1;
}
/* Direct attach through spdk_nvme_connect() API */
if (direct_connect == true) {
/* get the cdata info */
rc = nvme_ctrlr_cmd_identify(discovery_ctrlr, SPDK_NVME_IDENTIFY_CTRLR, 0, 0,
&discovery_ctrlr->cdata, sizeof(discovery_ctrlr->cdata),
@ -1444,6 +1442,8 @@ nvme_rdma_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx,
return -ENXIO;
}
/* Direct attach through spdk_nvme_connect() API */
if (direct_connect == true) {
/* Set the ready state to skip the normal init process */
discovery_ctrlr->state = NVME_CTRLR_STATE_READY;
nvme_ctrlr_connected(probe_ctx, discovery_ctrlr);

View File

@ -310,8 +310,6 @@ nvme_tcp_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx,
return -1;
}
/* Direct attach through spdk_nvme_connect() API */
if (direct_connect == true) {
/* get the cdata info */
status.done = false;
rc = nvme_ctrlr_cmd_identify(discovery_ctrlr, SPDK_NVME_IDENTIFY_CTRLR, 0, 0,
@ -322,10 +320,16 @@ nvme_tcp_ctrlr_scan(struct spdk_nvme_probe_ctx *probe_ctx,
return rc;
}
if (spdk_nvme_wait_for_completion(discovery_ctrlr->adminq, &status)) {
while (status.done == false) {
spdk_nvme_qpair_process_completions(discovery_ctrlr->adminq, 0);
}
if (spdk_nvme_cpl_is_error(&status.cpl)) {
SPDK_ERRLOG("nvme_identify_controller failed!\n");
return -ENXIO;
}
/* Direct attach through spdk_nvme_connect() API */
if (direct_connect == true) {
/* Set the ready state to skip the normal init process */
discovery_ctrlr->state = NVME_CTRLR_STATE_READY;
nvme_ctrlr_connected(probe_ctx, discovery_ctrlr);

View File

@ -1331,8 +1331,6 @@ spdk_nvmf_ctrlr_ns_changed(struct spdk_nvmf_ctrlr *ctrlr, uint32_t nsid)
ctrlr->changed_ns_list.ns_list[ctrlr->changed_ns_list_count++] = nsid;
}
}
spdk_nvmf_ctrlr_async_event_ns_notice(ctrlr);
}
static void

View File

@ -48,8 +48,8 @@
#include "spdk/bdev_module.h"
#include "spdk_internal/log.h"
static void
nvmf_update_discovery_log(struct spdk_nvmf_tgt *tgt, const char *hostnqn)
static struct spdk_nvmf_discovery_log_page *
nvmf_generate_discovery_log(struct spdk_nvmf_tgt *tgt, const char *hostnqn, size_t *log_page_size)
{
uint64_t numrec = 0;
struct spdk_nvmf_subsystem *subsystem;
@ -66,7 +66,7 @@ nvmf_update_discovery_log(struct spdk_nvmf_tgt *tgt, const char *hostnqn)
disc_log = calloc(1, cur_size);
if (disc_log == NULL) {
SPDK_ERRLOG("Discovery log page memory allocation error\n");
return;
return NULL;
}
for (sid = 0; sid < tgt->max_subsystems; sid++) {
@ -114,11 +114,9 @@ nvmf_update_discovery_log(struct spdk_nvmf_tgt *tgt, const char *hostnqn)
disc_log->numrec = numrec;
disc_log->genctr = tgt->discovery_genctr;
*log_page_size = cur_size;
free(tgt->discovery_log_page);
tgt->discovery_log_page = disc_log;
tgt->discovery_log_page_size = cur_size;
return disc_log;
}
void
@ -128,24 +126,23 @@ spdk_nvmf_get_discovery_log_page(struct spdk_nvmf_tgt *tgt, const char *hostnqn,
size_t copy_len = 0;
size_t zero_len = 0;
struct iovec *tmp;
size_t log_page_size = 0;
struct spdk_nvmf_discovery_log_page *discovery_log_page;
if (offset == 0 || tgt->discovery_log_page == NULL ||
tgt->discovery_log_page->genctr != tgt->discovery_genctr) {
nvmf_update_discovery_log(tgt, hostnqn);
}
discovery_log_page = nvmf_generate_discovery_log(tgt, hostnqn, &log_page_size);
/* Copy the valid part of the discovery log page, if any */
if (tgt->discovery_log_page) {
if (discovery_log_page) {
for (tmp = iov; tmp < iov + iovcnt; tmp++) {
copy_len = spdk_min(tmp->iov_len, length);
copy_len = spdk_min(tgt->discovery_log_page_size - offset, copy_len);
copy_len = spdk_min(log_page_size - offset, copy_len);
memcpy(tmp->iov_base, (char *)tgt->discovery_log_page + offset, copy_len);
memcpy(tmp->iov_base, (char *)discovery_log_page + offset, copy_len);
offset += copy_len;
length -= copy_len;
zero_len = tmp->iov_len - copy_len;
if (tgt->discovery_log_page_size <= offset || length == 0) {
if (log_page_size <= offset || length == 0) {
break;
}
}
@ -157,5 +154,7 @@ spdk_nvmf_get_discovery_log_page(struct spdk_nvmf_tgt *tgt, const char *hostnqn,
for (++tmp; tmp < iov + iovcnt; tmp++) {
memset((char *)tmp->iov_base, 0, tmp->iov_len);
}
free(discovery_log_page);
}
}

View File

@ -233,8 +233,6 @@ spdk_nvmf_tgt_create(uint32_t max_subsystems)
}
tgt->discovery_genctr = 0;
tgt->discovery_log_page = NULL;
tgt->discovery_log_page_size = 0;
TAILQ_INIT(&tgt->transports);
tgt->subsystems = calloc(tgt->max_subsystems, sizeof(struct spdk_nvmf_subsystem *));
@ -261,10 +259,6 @@ spdk_nvmf_tgt_destroy_cb(void *io_device)
void *destroy_cb_arg;
uint32_t i;
if (tgt->discovery_log_page) {
free(tgt->discovery_log_page);
}
if (tgt->subsystems) {
for (i = 0; i < tgt->max_subsystems; i++) {
if (tgt->subsystems[i]) {
@ -872,6 +866,8 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
struct spdk_nvmf_registrant *reg, *tmp;
struct spdk_io_channel *ch;
struct spdk_nvmf_subsystem_pg_ns_info *ns_info;
struct spdk_nvmf_ctrlr *ctrlr;
bool ns_changed;
/* Make sure our poll group has memory for this subsystem allocated */
if (subsystem->id >= group->num_sgroups) {
@ -884,6 +880,8 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
new_num_ns = subsystem->max_nsid;
old_num_ns = sgroup->num_ns;
ns_changed = false;
if (old_num_ns == 0) {
if (new_num_ns > 0) {
/* First allocation */
@ -945,10 +943,12 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
/* Both NULL. Leave empty */
} else if (ns == NULL && ch != NULL) {
/* There was a channel here, but the namespace is gone. */
ns_changed = true;
spdk_put_io_channel(ch);
ns_info->channel = NULL;
} else if (ns != NULL && ch == NULL) {
/* A namespace appeared but there is no channel yet */
ns_changed = true;
ch = spdk_bdev_get_io_channel(ns->desc);
if (ch == NULL) {
SPDK_ERRLOG("Could not allocate I/O channel.\n");
@ -957,6 +957,7 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
ns_info->channel = ch;
} else if (spdk_uuid_compare(&ns_info->uuid, spdk_bdev_get_uuid(ns->bdev)) != 0) {
/* A namespace was here before, but was replaced by a new one. */
ns_changed = true;
spdk_put_io_channel(ns_info->channel);
memset(ns_info, 0, sizeof(*ns_info));
@ -990,6 +991,14 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
}
}
if (ns_changed) {
TAILQ_FOREACH(ctrlr, &subsystem->ctrlrs, link) {
if (ctrlr->admin_qpair->group == group) {
spdk_nvmf_ctrlr_async_event_ns_notice(ctrlr);
}
}
}
return 0;
}

View File

@ -81,8 +81,6 @@ struct spdk_nvmf_tgt {
/* Array of subsystem pointers of size max_subsystems indexed by sid */
struct spdk_nvmf_subsystem **subsystems;
struct spdk_nvmf_discovery_log_page *discovery_log_page;
size_t discovery_log_page_size;
TAILQ_HEAD(, spdk_nvmf_transport) transports;
spdk_nvmf_tgt_destroy_done_fn *destroy_cb_fn;

View File

@ -644,40 +644,22 @@ static void
nvmf_rdma_request_free_data(struct spdk_nvmf_rdma_request *rdma_req,
struct spdk_nvmf_rdma_transport *rtransport)
{
struct spdk_nvmf_rdma_request_data *current_data_wr = NULL, *next_data_wr = NULL;
struct ibv_send_wr *send_wr;
int i;
struct spdk_nvmf_rdma_request_data *data_wr;
struct ibv_send_wr *next_send_wr;
uint64_t req_wrid;
rdma_req->num_outstanding_data_wr = 0;
current_data_wr = &rdma_req->data;
for (i = 0; i < current_data_wr->wr.num_sge; i++) {
current_data_wr->wr.sg_list[i].addr = 0;
current_data_wr->wr.sg_list[i].length = 0;
current_data_wr->wr.sg_list[i].lkey = 0;
data_wr = &rdma_req->data;
req_wrid = data_wr->wr.wr_id;
while (data_wr && data_wr->wr.wr_id == req_wrid) {
memset(data_wr->sgl, 0, sizeof(data_wr->wr.sg_list[0]) * data_wr->wr.num_sge);
data_wr->wr.num_sge = 0;
next_send_wr = data_wr->wr.next;
if (data_wr != &rdma_req->data) {
spdk_mempool_put(rtransport->data_wr_pool, data_wr);
}
current_data_wr->wr.num_sge = 0;
send_wr = current_data_wr->wr.next;
if (send_wr != NULL && send_wr != &rdma_req->rsp.wr) {
next_data_wr = SPDK_CONTAINEROF(send_wr, struct spdk_nvmf_rdma_request_data, wr);
}
while (next_data_wr) {
current_data_wr = next_data_wr;
send_wr = current_data_wr->wr.next;
if (send_wr != NULL && send_wr != &rdma_req->rsp.wr &&
send_wr->wr_id == current_data_wr->wr.wr_id) {
next_data_wr = SPDK_CONTAINEROF(send_wr, struct spdk_nvmf_rdma_request_data, wr);
} else {
next_data_wr = NULL;
}
for (i = 0; i < current_data_wr->wr.num_sge; i++) {
current_data_wr->wr.sg_list[i].addr = 0;
current_data_wr->wr.sg_list[i].length = 0;
current_data_wr->wr.sg_list[i].lkey = 0;
}
current_data_wr->wr.num_sge = 0;
spdk_mempool_put(rtransport->data_wr_pool, current_data_wr);
data_wr = (!next_send_wr || next_send_wr == &rdma_req->rsp.wr) ? NULL :
SPDK_CONTAINEROF(next_send_wr, struct spdk_nvmf_rdma_request_data, wr);
}
}
@ -3052,6 +3034,7 @@ spdk_nvmf_rdma_poll_group_create(struct spdk_nvmf_transport *transport)
SPDK_ERRLOG("Unable to allocate resources for shared receive queue.\n");
spdk_nvmf_rdma_poll_group_destroy(&rgroup->group);
pthread_mutex_unlock(&rtransport->lock);
return NULL;
}
}
@ -3480,6 +3463,23 @@ spdk_nvmf_rdma_poller_poll(struct spdk_nvmf_rdma_transport *rtransport,
rdma_recv = SPDK_CONTAINEROF(rdma_wr, struct spdk_nvmf_rdma_recv, rdma_wr);
if (rpoller->srq != NULL) {
rdma_recv->qpair = get_rdma_qpair_from_wc(rpoller, &wc[i]);
/* It is possible that there are still some completions for destroyed QP
* associated with SRQ. We just ignore these late completions and re-post
* receive WRs back to SRQ.
*/
if (spdk_unlikely(NULL == rdma_recv->qpair)) {
struct ibv_recv_wr *bad_wr;
int rc;
rdma_recv->wr.next = NULL;
rc = ibv_post_srq_recv(rpoller->srq,
&rdma_recv->wr,
&bad_wr);
if (rc) {
SPDK_ERRLOG("Failed to re-post recv WR to SRQ, err %d\n", rc);
}
continue;
}
}
rqpair = rdma_recv->qpair;

View File

@ -31,7 +31,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
CFLAGS += -I.

View File

@ -38,7 +38,4 @@ C_SRCS = sock.c net_framework.c
LIBNAME = sock
DIRS-y += posix
DIRS-$(CONFIG_VPP) += vpp
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -103,6 +103,7 @@ spdk_sock_map_release(int placement_id)
entry->ref--;
if (!entry->ref) {
STAILQ_REMOVE(&g_placement_id_map, entry, spdk_sock_placement_id_entry, link);
free(entry);
}
break;
}
@ -139,6 +140,7 @@ spdk_sock_remove_sock_group_from_map_table(struct spdk_sock_group *group)
STAILQ_FOREACH_SAFE(entry, &g_placement_id_map, link, tmp) {
if (entry->group == group) {
STAILQ_REMOVE(&g_placement_id_map, entry, spdk_sock_placement_id_entry, link);
free(entry);
}
}
pthread_mutex_unlock(&g_map_table_mutex);

View File

@ -34,9 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
C_SRCS = trace.c trace_flags.c
C_SRCS = trace.c trace_flags.c trace_rpc.c
LIBNAME = trace
DIRS-y = rpc
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -1,40 +0,0 @@
#
# BSD LICENSE
#
# Copyright (c) Intel Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
C_SRCS = trace_rpc.c
LIBNAME = trace_rpc
include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk

View File

@ -41,8 +41,7 @@ C_SRCS = vhost.c vhost_rpc.c vhost_scsi.c vhost_blk.c rte_vhost_compat.c
ifeq ($(CONFIG_VHOST_INTERNAL_LIB),y)
C_SRCS += vhost_nvme.c
DIRS-y += rte_vhost
CFLAGS := -Irte_vhost $(CFLAGS)
CFLAGS := -I../rte_vhost $(CFLAGS)
endif
LIBNAME = vhost

View File

@ -35,6 +35,7 @@ SPDK_LIB_FILES = $(call spdk_lib_list_to_static_libs,$(SPDK_LIB_LIST))
SPDK_LIB_LINKER_ARGS = \
-L$(SPDK_ROOT_DIR)/build/lib \
-Wl,--whole-archive \
-Wl,--no-as-needed \
$(SPDK_LIB_LIST:%=-lspdk_%) \
-Wl,--no-whole-archive

View File

@ -32,6 +32,7 @@
#
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
include $(SPDK_ROOT_DIR)/mk/spdk.lib_deps.mk
SPDK_MAP_FILE = $(SPDK_ROOT_DIR)/shared_lib/spdk.map
LIB := $(call spdk_lib_list_to_static_libs,$(LIBNAME))
@ -50,7 +51,7 @@ else
LOCAL_SYS_LIBS += -lrt
endif
SPDK_DEP_LIBS = $(call spdk_lib_list_to_shared_libs,$(SPDK_DEP_LIBNAMES))
SPDK_DEP_LIBS = $(call spdk_lib_list_to_shared_libs,$(DEPDIRS-$(LIBNAME)))
.PHONY: all clean $(DIRS-y)

154
mk/spdk.lib_deps.mk Normal file
View File

@ -0,0 +1,154 @@
#
# BSD LICENSE
#
# Copyright (c) Intel Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# A quick note on organization:
#
# Each grouping is independent from itself. it depends only on libraries
# in the grouping above it. All dependencies are listed alphabetically within
# groups. The only exception to this is the JSON_LIBS grouping which is a special
# case since they almost always occur together.
JSON_LIBS := json jsonrpc rpc
DEPDIRS-env_ocf :=
DEPDIRS-log :=
DEPDIRS-rte_vhost :=
DEPDIRS-ioat := log
DEPDIRS-sock := log
DEPDIRS-util := log
DEPDIRS-vmd := log
DEPDIRS-conf := log util
DEPDIRS-json := log util
DEPDIRS-nvme := log sock util
DEPDIRS-reduce := log util
DEPDIRS-thread := log util
DEPDIRS-blob := log util thread
DEPDIRS-copy := thread
DEPDIRS-jsonrpc := log util json
DEPDIRS-virtio := log util json thread
DEPDIRS-lvol := log util blob
DEPDIRS-rpc := log util json jsonrpc
DEPDIRS-log_rpc := log $(JSON_LIBS)
DEPDIRS-net := log util $(JSON_LIBS)
DEPDIRS-notify := log util $(JSON_LIBS)
DEPDIRS-trace := log util $(JSON_LIBS)
DEPDIRS-bdev := log util conf thread $(JSON_LIBS) notify trace
DEPDIRS-blobfs := log conf thread blob trace
DEPDIRS-event := log util conf thread $(JSON_LIBS) trace
DEPDIRS-ftl := log util nvme thread trace bdev
DEPDIRS-nbd := log util thread $(JSON_LIBS) bdev
DEPDIRS-nvmf := log sock util json nvme thread trace bdev
DEPDIRS-scsi := log util thread $(JSON_LIBS) trace bdev
DEPDIRS-iscsi := log sock util conf thread $(JSON_LIBS) trace event scsi
DEPDIRS-vhost = log util conf thread $(JSON_LIBS) bdev event scsi
ifeq ($(CONFIG_VHOST_INTERNAL_LIB),y)
DEPDIRS-vhost += rte_vhost
endif
# ------------------------------------------------------------------------
# Start module/ directory - This section extends the organizational pattern from
# above. However, it introduces several more groupings which may not strictly follow
# the ordering pattern above. These are used for convenience and to help quickly
# determine the unique dependencies of a given module. It is also grouped by directory.
BDEV_DEPS = log util $(JSON_LIBS) bdev
BDEV_DEPS_CONF = $(BDEV_DEPS) conf
BDEV_DEPS_THREAD = $(BDEV_DEPS) thread
BDEV_DEPS_CONF_THREAD = $(BDEV_DEPS) conf thread
# module/blob
DEPDIRS-blob_bdev := log thread bdev
# module/copy
DEPDIRS-copy_ioat := log ioat conf thread $(JSON_LIBS) copy
# module/sock
DEPDIRS-sock_posix := log sock
DEPDIRS-sock_vpp := log sock util thread
# module/bdev
DEPDIRS-bdev_gpt := bdev conf json log thread util
DEPDIRS-bdev_lvol := $(BDEV_DEPS) lvol blob blob_bdev
DEPDIRS-bdev_rpc := $(BDEV_DEPS)
DEPDIRS-bdev_error := $(BDEV_DEPS_CONF)
DEPDIRS-bdev_malloc := $(BDEV_DEPS_CONF) copy
DEPDIRS-bdev_split := $(BDEV_DEPS_CONF)
DEPDIRS-bdev_compress := $(BDEV_DEPS_THREAD) reduce
DEPDIRS-bdev_delay := $(BDEV_DEPS_THREAD)
DEPDIRS-bdev_aio := $(BDEV_DEPS_CONF_THREAD)
DEPDIRS-bdev_crypto := $(BDEV_DEPS_CONF_THREAD)
DEPDIRS-bdev_iscsi := $(BDEV_DEPS_CONF_THREAD)
DEPDIRS-bdev_null := $(BDEV_DEPS_CONF_THREAD)
DEPDIRS-bdev_nvme = $(BDEV_DEPS_CONF_THREAD) nvme
ifeq ($(OS),Linux)
DEPDIRS-bdev_nvme += ftl
endif
DEPDIRS-bdev_ocf := $(BDEV_DEPS_CONF_THREAD)
DEPDIRS-bdev_passthru := $(BDEV_DEPS_CONF_THREAD)
DEPDIRS-bdev_pmem := $(BDEV_DEPS_CONF_THREAD)
DEPDIRS-bdev_raid := $(BDEV_DEPS_CONF_THREAD)
DEPDIRS-bdev_rbd := $(BDEV_DEPS_CONF_THREAD)
DEPDIRS-bdev_virtio := $(BDEV_DEPS_CONF_THREAD) virtio
# module/event
# module/event/app
DEPDIRS-app_rpc := log util thread event $(JSON_LIBS)
#module/event/subsystems
# These depdirs include subsystem interdependencies which
# are not related to symbols, but are defined directly in
# the SPDK event subsystem code.
DEPDIRS-event_copy := copy event
DEPDIRS-event_net := sock net event
DEPDIRS-event_vmd := vmd conf $(JSON_LIBS) event
DEPDIRS-event_bdev := bdev event event_copy event_vmd
DEPDIRS-event_nbd := event nbd event_bdev
DEPDIRS-event_nvmf := $(BDEV_DEPS_CONF_THREAD) event nvme nvmf event_bdev
DEPDIRS-event_scsi := event scsi event_bdev
DEPDIRS-event_iscsi := event iscsi event_scsi
DEPDIRS-event_vhost := event vhost event_scsi

View File

@ -38,6 +38,7 @@ include $(SPDK_ROOT_DIR)/mk/spdk.mock.unittest.mk
C_SRCS = $(TEST_FILE)
CFLAGS += -I$(SPDK_ROOT_DIR)/lib
CFLAGS += -I$(SPDK_ROOT_DIR)/module
CFLAGS += -I$(SPDK_ROOT_DIR)/test
CFLAGS += -ffunction-sections
LDFLAGS += -Wl,--gc-sections

50
module/Makefile Normal file
View File

@ -0,0 +1,50 @@
#
# BSD LICENSE
#
# Copyright (c) Intel Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y = bdev blob copy event sock
DEPDIRS-blob :=
DEPDIRS-copy :=
DEPDIRS-sock :=
DEPDIRS-bdev := blob
DEPDIRS-event := bdev blob
.PHONY: all clean $(DIRS-y)
all: $(DIRS-y)
clean: $(DIRS-y)
include $(SPDK_ROOT_DIR)/mk/spdk.subdirs.mk

69
module/bdev/Makefile Normal file
View File

@ -0,0 +1,69 @@
#
# BSD LICENSE
#
# Copyright (c) Intel Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y += delay error gpt lvol malloc null nvme passthru raid rpc split
ifeq ($(CONFIG_CRYPTO),y)
DIRS-y += crypto
endif
ifeq ($(CONFIG_OCF), y)
DIRS-y += ocf
endif
ifeq ($(CONFIG_REDUCE),y)
DIRS-y += compress
endif
ifeq ($(CONFIG_URING),y)
DIRS-y += uring
endif
ifeq ($(OS),Linux)
DIRS-y += aio
DIRS-$(CONFIG_ISCSI_INITIATOR) += iscsi
DIRS-$(CONFIG_VIRTIO) += virtio
DIRS-$(CONFIG_PMDK) += pmem
endif
DIRS-$(CONFIG_RBD) += rbd
.PHONY: all clean $(DIRS-y)
all: $(DIRS-y)
clean: $(DIRS-y)
include $(SPDK_ROOT_DIR)/mk/spdk.subdirs.mk

View File

@ -54,7 +54,10 @@
#define NUM_MAX_XFORMS 2
#define NUM_MAX_INFLIGHT_OPS 128
#define DEFAULT_WINDOW_SIZE 15
#define MAX_MBUFS_PER_OP REDUCE_MAX_IOVECS
/* We need extra mbufs per operation to accomodate host buffers that
* span a 2MB boundary.
*/
#define MAX_MBUFS_PER_OP (REDUCE_MAX_IOVECS * 2)
#define CHUNK_SIZE (1024 * 16)
#define COMP_BDEV_NAME "compress"
#define BACKING_IO_SZ (4 * 1024)
@ -437,13 +440,15 @@ _compress_operation(struct spdk_reduce_backing_dev *backing_dev, struct iovec *s
struct rte_mbuf *src_mbufs[MAX_MBUFS_PER_OP];
struct rte_mbuf *dst_mbufs[MAX_MBUFS_PER_OP];
uint8_t cdev_id = comp_bdev->device_qp->device->cdev_id;
uint64_t total_length = 0;
struct iovec *current_src_iov = NULL;
struct iovec *current_dst_iov = NULL;
int iov_index;
uint64_t updated_length, remainder, phys_addr, total_length = 0;
uint8_t *current_src_base = NULL;
uint8_t *current_dst_base = NULL;
int iov_index, mbuf_index;
int rc = 0;
struct vbdev_comp_op *op_to_queue;
int i;
int src_mbuf_total = src_iovcnt;
int dst_mbuf_total = dst_iovcnt;
assert(src_iovcnt < MAX_MBUFS_PER_OP);
@ -477,23 +482,53 @@ _compress_operation(struct spdk_reduce_backing_dev *backing_dev, struct iovec *s
*/
/* Setup src mbufs */
for (iov_index = 0; iov_index < src_iovcnt; iov_index++) {
iov_index = mbuf_index = 0;
while (iov_index < src_iovcnt) {
current_src_iov = src_iovs[iov_index].iov_base;
current_src_base = src_iovs[iov_index].iov_base;
total_length += src_iovs[iov_index].iov_len;
assert(src_mbufs[iov_index] != NULL);
assert(src_mbufs[mbuf_index] != NULL);
src_mbufs[iov_index]->userdata = reduce_cb_arg;
updated_length = src_iovs[iov_index].iov_len;
phys_addr = spdk_vtophys((void *)current_src_base, &updated_length);
rte_pktmbuf_attach_extbuf(src_mbufs[iov_index],
current_src_iov,
spdk_vtophys((void *)current_src_iov, NULL),
src_iovs[iov_index].iov_len,
rte_pktmbuf_attach_extbuf(src_mbufs[mbuf_index],
current_src_base,
phys_addr,
updated_length,
&g_shinfo);
rte_pktmbuf_append(src_mbufs[iov_index], src_iovs[iov_index].iov_len);
rte_pktmbuf_append(src_mbufs[mbuf_index], updated_length);
remainder = src_iovs[iov_index].iov_len - updated_length;
if (iov_index > 0) {
rte_pktmbuf_chain(src_mbufs[0], src_mbufs[iov_index]);
if (mbuf_index > 0) {
rte_pktmbuf_chain(src_mbufs[0], src_mbufs[mbuf_index]);
}
/* If we crossed 2 2MB boundary we need another mbuf for the remainder */
if (remainder > 0) {
/* allocate an mbuf at the end of the array */
rc = rte_pktmbuf_alloc_bulk(g_mbuf_mp, (struct rte_mbuf **)&src_mbufs[src_mbuf_total], 1);
if (rc) {
SPDK_ERRLOG("ERROR trying to get an extra src_mbuf!\n");
goto error_src_dst;
}
src_mbuf_total++;
mbuf_index++;
current_src_base += updated_length;
phys_addr = spdk_vtophys((void *)current_src_base, &remainder);
/* assert we don't cross another */
assert(remainder == src_iovs[iov_index].iov_len - updated_length);
rte_pktmbuf_attach_extbuf(src_mbufs[mbuf_index],
current_src_base,
phys_addr,
remainder,
&g_shinfo);
rte_pktmbuf_append(src_mbufs[mbuf_index], remainder);
rte_pktmbuf_chain(src_mbufs[0], src_mbufs[mbuf_index]);
}
iov_index++;
mbuf_index++;
}
comp_op->m_src = src_mbufs[0];
@ -501,21 +536,51 @@ _compress_operation(struct spdk_reduce_backing_dev *backing_dev, struct iovec *s
comp_op->src.length = total_length;
/* setup dst mbufs, for the current test being used with this code there's only one vector */
for (iov_index = 0; iov_index < dst_iovcnt; iov_index++) {
iov_index = mbuf_index = 0;
while (iov_index < dst_iovcnt) {
current_dst_iov = dst_iovs[iov_index].iov_base;
current_dst_base = dst_iovs[iov_index].iov_base;
updated_length = dst_iovs[iov_index].iov_len;
phys_addr = spdk_vtophys((void *)current_dst_base, &updated_length);
rte_pktmbuf_attach_extbuf(dst_mbufs[iov_index],
current_dst_iov,
spdk_vtophys((void *)current_dst_iov, NULL),
dst_iovs[iov_index].iov_len,
rte_pktmbuf_attach_extbuf(dst_mbufs[mbuf_index],
current_dst_base,
phys_addr,
updated_length,
&g_shinfo);
rte_pktmbuf_append(dst_mbufs[iov_index], dst_iovs[iov_index].iov_len);
rte_pktmbuf_append(dst_mbufs[mbuf_index], updated_length);
remainder = dst_iovs[iov_index].iov_len - updated_length;
if (iov_index > 0) {
rte_pktmbuf_chain(dst_mbufs[0], dst_mbufs[iov_index]);
if (mbuf_index > 0) {
rte_pktmbuf_chain(dst_mbufs[0], dst_mbufs[mbuf_index]);
}
/* If we crossed 2 2MB boundary we need another mbuf for the remainder */
if (remainder > 0) {
rc = rte_pktmbuf_alloc_bulk(g_mbuf_mp, (struct rte_mbuf **)&dst_mbufs[dst_mbuf_total], 1);
if (rc) {
SPDK_ERRLOG("ERROR trying to get an extra dst_mbuf!\n");
goto error_src_dst;
}
dst_mbuf_total++;
mbuf_index++;
current_dst_base += updated_length;
phys_addr = spdk_vtophys((void *)current_dst_base, &remainder);
/* assert we don't cross another */
assert(remainder == dst_iovs[iov_index].iov_len - updated_length);
rte_pktmbuf_attach_extbuf(dst_mbufs[mbuf_index],
current_dst_base,
phys_addr,
remainder,
&g_shinfo);
rte_pktmbuf_append(dst_mbufs[mbuf_index], remainder);
rte_pktmbuf_chain(dst_mbufs[0], dst_mbufs[mbuf_index]);
}
iov_index++;
mbuf_index++;
}
comp_op->m_dst = dst_mbufs[0];
comp_op->dst.offset = 0;
@ -542,8 +607,12 @@ _compress_operation(struct spdk_reduce_backing_dev *backing_dev, struct iovec *s
}
/* Error cleanup paths. */
error_src_dst:
for (i = 0; i < dst_mbuf_total; i++) {
rte_pktmbuf_free((struct rte_mbuf *)&dst_mbufs[i]);
}
error_get_dst:
for (i = 0; i < src_iovcnt; i++) {
for (i = 0; i < src_mbuf_total; i++) {
rte_pktmbuf_free((struct rte_mbuf *)&src_mbufs[i]);
}
error_get_src:
@ -1074,6 +1143,7 @@ bdev_hotremove_vol_unload_cb(void *cb_arg, int reduce_errno)
SPDK_ERRLOG("number %d\n", reduce_errno);
}
comp_bdev->vol = NULL;
spdk_bdev_unregister(&comp_bdev->comp_bdev, NULL, NULL);
}

Some files were not shown because too many files have changed in this diff Show More