Commit Graph

1731 Commits

Author SHA1 Message Date
Ben Walker
0606eaad1a No longer wrap assert()
assert is part of the C standard library and is available
on any platform we'd consider porting to. Don't put a
wrapper around it.

Change-Id: I0acfdd6a8a269d6c37df38fb7ddf4f1227630223
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-19 10:53:06 -07:00
Ben Walker
888014289c nvme: No longer abstract away pthread calls
pthreads are widely supported and are available on any
platform we currently foresee porting to. Use that API
instead of attempting to abstract it away to simplify
the code.

Change-Id: I822f9c10910020719e94cce6fca4e1600a2d9f2a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-19 10:53:06 -07:00
Ben Walker
1f75a72781 ioat: No longer abstract away pthread calls
pthreads are widely supported and are available on any
platform we currently foresee porting to. Use that API
instead of attempting to abstract it away to simplify
the code.

Change-Id: I28123d427ea8da07c6329b0233f0702f2d85c2a0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-19 10:53:06 -07:00
Daniel Verkamp
69c7ff06dc json: allow decoding of non-standard comments
Comments are not allowed in the JSON RFC, but some JSON libraries accept
JavaScript-style comments.

Add a flag that enables non-spec-compliant comment parsing.

Change-Id: I9dfb66bb46ecff1a22d8af5a9c50620686a4707c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-19 09:49:18 -07:00
Daniel Verkamp
0b8198ce27 overhead: remove redundant system lib options
spdk.common.mk already adds -pthread and -lrt.

Change-Id: If6ea5aa5875ddd5043c2915dbe3e785a4dab7f56
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-19 09:47:57 -07:00
Ben Walker
f0ab59a325 nvmf: Include the JSON RPC server
This allows live configuration of the target, much like
the iSCSI target. More function calls will be added
over time.

Also, make the tests wait until the target is listening
on the RPC port to determine that the target is ready.

Change-Id: I8f762e49511d482ef820f6b25a7d3ad9a8bb41f9
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-19 09:47:04 -07:00
Tsuyoshi Uchida
0d2330c2df nvme: Add some status codes specified in NVM Express 1.2b (#37) 2016-08-19 08:52:31 -07:00
Daniel Verkamp
1d737a8dc0 test/iscsi: add target node config parsing test
Change-Id: I39d74043e73aef9e51aca342308b0ec774a9c481
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-18 09:54:34 -07:00
Daniel Verkamp
b4a15dfb46 test/iscsi: add parameter negotiation unit test
Change-Id: I9411c01960a8cff4b128a08fb42d3970915dbf6f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-18 09:54:34 -07:00
Liang Yan
2dc1a19ad9 nvmf/test:rename nvmf_c to nvmf
Change-Id: I4fd806903456232b16505aaa732d7a1239ca6e53
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
2016-08-17 14:11:51 -07:00
Ben Walker
086346a4fc event: Allow idle reactors to sleep
The user can now specify a maximum delay, in microseconds, that
defines the maximum amount of time a reactor will sleep for
between polling for new events. By default, the time is 0
which means the reactor will never sleep.

Change-Id: I94cddb69c832524878cad97b66673daa4bd5c721
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-17 10:02:38 -07:00
Daniel Verkamp
0b3bd6a9c5 nvme/overhead: track min and max submit/complete
Add slightly better statistics to get a range of values instead of just
the average.

Change-Id: I159994dce38412755afdd8980030c407125957e9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-17 09:32:37 -07:00
Daniel Verkamp
0d61bf4b50 autotest: move NVMe device cleanup to startup
Make sure any partition tables or other random data on the disks is
cleaned up before running the tests, rather than trying to clean it up
on failure when the system is in a potentially bad state.

Change-Id: Ia2119485aee6a50243744328dff2314d7a72adad
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-17 09:04:16 -07:00
Tsuyoshi Uchida
81976ebd55 nvme: modify not to retry IOs on reset (#33)
When a controller reset is finished, all outstanding IOs and all queued
IOs which submitted before the reset are returned to the caller.
2016-08-15 10:01:02 -07:00
Daniel Verkamp
5d8c94536a event: hide struct spdk_poller internals
This leaves more flexibility for future changes to the poller
representation without requiring API changes (after this one).

It also prevents the user from accidentally using poller fields in a
non-thread-safe way, since they can't be accessed directly anymore.

Change-Id: I7677d5b93668665d29ae39c5e0ba74333ad3f878
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-12 10:42:12 -07:00
Cunyin Chang
fc75d2a282 nvmf: Add nvmf controller operation structure.
Change-Id: I3f8c0cea7fbbf443b13ed336a786d0e14927131e
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-08-09 15:50:40 -07:00
Daniel Verkamp
f279de1f71 nvmf: set ASQSZ in discovery log
Report the maximum admin queue size correctly.

Change-Id: I52cad654bf59806e0abb8d869c22973647056617
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 08:45:38 -07:00
Daniel Verkamp
6697ff02f9 nvmf: test nvme cli over NVMf
Change-Id: I2d71945edc9596775092b59f70ca108c775b322e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-05 12:51:30 -07:00
Daniel Verkamp
021be6df16 bdev: add Linux AIO (libaio) backend
Change-Id: I6e7de4330f0c792514df21557a3010adef08c670
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-05 09:08:23 -07:00
Daniel Verkamp
5a9fa1d146 test/bdev: move large I/O bdevperf test to nightly
We are already testing bdevperf in the previous 'verify' test, and the
I/O splitting is handled by the NVMe-specific tests, so shorten the bdev
tests somewhat by only doing the large I/O bdevperf test in the nightly
test run.

Change-Id: I33439be4553ea94127e2039069dd7f58162e5d0f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-05 08:48:36 -07:00
Daniel Verkamp
79f158a3b2 test/iscsi: shorten FIO tests
Move the long verify to nightly testing only, and make the other FIO
invocations shorter.

Change-Id: Ic09b88aa16ad2ce62113821ad0c66dbf44a5721e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-04 16:48:35 -07:00
GangCao
b724e2e5a6 nvme: change global g_nvme_driver object to a pointer
This is a step towards enabling sharing SPDK NVMe
device access from multiple processes using DPDK's
multi-process framework.

Change-Id: I57d5eec158b42addc1036bd2583596471a467a95
Signed-off-by: GangCao <gang.cao@intel.com>
2016-08-04 15:45:35 -07:00
Ben Walker
1e92d78a10 iscsi: Add an iscsi target application
Similar to our NVMf target, this is an iSCSI target that
can interoperate with the Linux and Windows standard iSCSI
initiators.

Change-Id: I6961c5ef99f7b161c396330ed5b543ea29b0ca7b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-04 13:15:33 -07:00
Daniel Verkamp
c41ab41c17 event: add timer-based pollers
Allow pollers to be scheduled to be run periodically every N
microseconds instead of every iteration of the reactor loop.

Change-Id: Iaea3e98965d81044e6dc5ce5f406bcb7a455289e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-03 09:00:54 -07:00
Changpeng Liu
aeb3d50603 nvme: add gitignore to overhead directory
Change-Id: I83f18ad923fe8b96034f75e752180f5a4462ad1f
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-08-02 14:33:21 -07:00
Ben Walker
e648950f89 bdev: Delete bdev_db
Combine the necessary functionality with the main bdev file.

Change-Id: I96d796bc87ac2a8688cdf1fd3c16d2a7c8aef730
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-02 09:08:51 -07:00
Daniel Verkamp
d054c97e65 test/nvme: add overhead to autotest
Change-Id: Ic52f23c80f8698d361064365336c32b394fd2c98
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-01 16:43:06 -07:00
Jim Harris
766da93b27 test: only apply overhead test heuristic for AIO test case
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I29ee2575ba13724baad4caac72b35c57b92347ac
2016-08-01 14:32:08 -07:00
Jim Harris
da214ab254 nvme: add new test application to measure SW overhead
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I330ca1577e5725b0e135422156328d5b165e79a3
2016-08-01 12:58:30 -07:00
Daniel Verkamp
bd4ac74eaf scsi: import SCSI/blockdev translation layer
Change-Id: Ie96943f40ea8be4156d55bc5eeacc567743cf9d6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-01 10:35:01 -07:00
Changpeng Liu
5627b6871e nvmf: add identify namespace list support to NVMf target
We reported virtualized NVMe devices through NVMe over Fabric specification,
with 1.2.1 NVMe version. For direct mode, the NVMe device maybe has lower
version, such as 1.0, the identify namespace list can not support in those
devices, so we need to add helper function here to simulate such commands
from initiator.

Change-Id: I226f4f34bf61017f538d2dd80332f1d054a501f1
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-07-29 15:49:41 -07:00
Ben Walker
8e1a8b8752 nvmf: Change fio tests to write and verify
No need to do read and writes plus verify - the verify is
a read itself.

Change-Id: I28d08717e49b1327b04490810f8e6069504173c2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-26 09:24:31 -07:00
Ben Walker
e660e677b8 nvmf: Delete partitions when tests end
Change-Id: Ia30e037e98df8b0c781ce769453bbf891091334d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-26 09:24:31 -07:00
Ben Walker
0e1dcce24a nvmf: Disconnect the initiator on test exit.
Change-Id: I8e640a77dc4c17582ff5ec0a4daba4f1d509c30c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-25 14:12:58 -07:00
Daniel Verkamp
1d81cbc955 test/nvmf: stub out per-file unit tests
Change-Id: I9606b82dbfaa6c84d8dafc07fb76a113e3436083
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-22 12:50:44 -07:00
Ben Walker
944695ca21 nvmf: Remove controller.[ch] and probe for each subsystem.
This is a much simpler approach and is only slightly
less efficient.

Change-Id: I909de376d576a74156c1be447e90e7dbc240f025
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-22 09:24:45 -07:00
Cunyin Chang
d439f4408a nvmf: Add subsystem modes
Change-Id: I74f69eb10e4d8807a323f463775f4953fe0baee0
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-07-21 17:45:06 -07:00
Daniel Verkamp
861e78bf48 bdev: add block device abstraction layer
Change-Id: I235cf146a52714756c9782c03b118f518c5f5182
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-21 10:35:03 -07:00
Daniel Verkamp
b8f95cbb1a subsystem_ut: add missing copyright header
Change-Id: I85783dcc5b8fb1ecadc8afbe9994ea97c31647c6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-20 13:46:37 -07:00
Daniel Verkamp
b1860be94a test/nvme: run hello_world example during autotest
Change-Id: I31d1a5a7a03eb4dc105f31ec031d722f5d5563e6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-20 09:05:10 -07:00
Ben Walker
88245ea26b nvmf: Rename MaxConnectionsPerSession to MaxQueuesPerSession
Change-Id: I9891f9ed481b93312152c2a59f4263003167f1d6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-20 07:26:58 -07:00
Ben Walker
207223c4f4 nvmf: Clean up documentation in configuration files
Change-Id: I030b5a60b9da513734188a02c8e5a1726f5a764c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-20 07:26:58 -07:00
Ben Walker
2b9d85c448 nvmf: Remove host.[ch] and port.[ch]
These can be simplified and merged into the subsystem.

Remove the concept of mappings from subsystems and replace
it with a list of hosts and ports. The host is optional -
not specifying a host means any host can connect.

Change-Id: Ib3786acb40a34b7e10935af55f4b6756d40cc906
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-15 14:35:24 -07:00
Daniel Verkamp
6a1383813c nvmf: rename FabricIntf to Listen, add transport
Change the Port configuration file entries to a new format:

[Port1]
  Listen <transport> <address>:<service>

Initially, this still only supports RDMA, but the new format will allow
specifying other transports once they are added.

Change-Id: Iadfd19b91db57b571064379368dbe77204ccecbb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-15 13:07:43 -07:00
Daniel Verkamp
3f80d55199 CONFIG: rename CONFIG_NVMF to CONFIG_RDMA
The NVMf target is being refactored to split the RDMA transport-specific
code into its own file.  Once this is complete, we should be able to
plug in other transports and build the NVMf target without any RDMA
dependency if desired.

To enable this, change the CONFIG option to RDMA; it still controls
whether the whole NVMf target is built for now, but once the RDMA
dependency is actually made optional, we will be able to build the
generic NVMf target code without libibverbs installed.

Change-Id: I8cd90a9aaa85dcefcc9b0f8f2e7b6af21958b2a8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-14 12:58:17 -07:00
Ben Walker
32a70c1ffc nvmf: Remove subsystem groups
This never really made sense, so replace it with a list of
subsystems.

Change-Id: Ie7a9400083c091ac7142d01c23948200f515bdf7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-14 10:35:21 -07:00
Ben Walker
b531f5914e nvmf: Remove NodeBase. Each Subsystem now defines its own NQN
This is just extra complication for no real benefit.

Change-Id: I528af98e799d0641e753390fe35ff561fa3d7d76
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-14 10:34:04 -07:00
Ben Walker
9113e6a949 nvmf: Sync before unloading the NVMf initiator
This is a bit heavy handed, but really make sure all
activity has ceased.

Change-Id: Iaa1ce16fd9e059f9eaec6712226344d69075b243
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:19:54 -07:00
Daniel Verkamp
c9090beffe test/nvmf: remove redundant process_core calls
This is handled by autotest.sh already.

Change-Id: I2210df16fc10f36507c469318b278d6f5568e48f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 09:13:00 -07:00
Daniel Verkamp
b6af6bc6c1 test/nvmf: leave modules alone if already loaded
There's no benefit of reloading the NIC drivers (unless the drivers
themselves are buggy), so save some time by skipping the rmmod of
drivers we are about to load.

Change-Id: I05c3fd06042a2e06333d0cac123d24e6cce65b23
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 09:13:00 -07:00
Daniel Verkamp
176856c92b test/nvmf: don't try to unload nvme module
Only nvme-rdma should be loaded as part of the NVMf testing.

Change-Id: I232363bf0988ea9bd99a37df27c39cc8e9732ad5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 09:13:00 -07:00
Daniel Verkamp
18ab3da5ad test/nvmf: clean up filesystem test
Inline function that is only called once.

Fix == bashism.

Create the filesystems on the partition created by parted rather than on
the raw namespace block device.

Add 'sync' invocations to make sure data gets flushed to the block
device we are testing.

Drop the copy-pasted FIO cleanup code (filesystem test does not run
FIO).

Change-Id: Id47d68db208a618841291c4184824031476268f1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 09:13:00 -07:00
Daniel Verkamp
de81deda06 test/nvmf: disable tracelogs for filesystem test
Change-Id: Ia29ae2504afa28dbea6c2800ca3777cdcbde4dc3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 09:13:00 -07:00
Daniel Verkamp
c4bb610d93 test/nvmf: only run RDMA NIC setup once
Change-Id: I69607670de95652f997712ad3e7441718c97e3ab
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 09:13:00 -07:00
Daniel Verkamp
e6a5bb1067 test/nvmf: make sure non-zero returns fail tests
Add 'set -e' to all nvmf test scripts.

Change-Id: I8271268a4b82335adf07719f4bde13e9086b5a77
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 09:13:00 -07:00
Ben Walker
11b0c3cc51 nvmf: Standardize rdma init/fini functions
Change-Id: Ifa453e865e110cd534d34aae1bc036cc9f09b1bd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 09:06:30 -07:00
Daniel Verkamp
20c1996756 test/nvmf: disable fio verify_async
Change-Id: If30690930087f12c82cbe0abe8345c8cc1d7d9bc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-07 17:00:00 -07:00
Daniel Verkamp
a9df326a0e nvmf: only allow one Controller per Subsystem
Multiple NVMe controllers within a subsystem does not work correctly,
since we would need to virtualize the controller data, namespace IDs,
and so on.  For now, only allow pass-through mapping of a single NVMe
controller per subsystem.

Change-Id: Ib2d3576d2856c46a086f38eb6bec56f3e7a73575
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-07 15:09:30 -07:00
Daniel Verkamp
0e93df5c34 nvme: combine CAP register into one 64-bit union
Previously, we used cap_lo and cap_hi to represent the 32-bit halves of
the full CAP register.  However, it is simpler to keep them in a single
64-bit structure, and is no less efficient on 64-bit platforms.

Also name the NSSRS field from NVMe 1.2, which was previously reserved.

Change-Id: I1d5d9b0dccbb12373b4aed3db29c883881d43223
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-07 13:52:16 -07:00
Daniel Verkamp
80c350ed69 nvmf: evaluate .. in $rootdir
Make the path to the executable shorter so it fits in the coredump.

Change-Id: I651c6cb4bd37fea51dd8e39b47a97c4edeace22f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-07 11:29:41 -07:00
Cunyin Chang
adcbbe19ff event: Add dpdk framework start function into event.
Make sure the reactor mask in profile take effect.

Change-Id: Ia471b2b88a711f05738cf93068c4f3a8c9a3039d
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-07-01 10:07:42 -07:00
Changpeng Liu
4fbe54f10e nvmf: add discovery subsystem to NVMf target
Change-Id: I4ee79ad268ae75208feddd62e22d6210a9c0d944
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-06-30 16:20:09 -07:00
Ben Walker
a84c493af3 nvmf: Enable tracing in filesystem test.
There is a sporadic error mounting ext4. Enable
tracing to attempt and catch it.

Change-Id: I8cb8425cbd076add0676064fccce66fdd4531b19
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-30 09:32:02 -07:00
Daniel Verkamp
fa45aa0ae7 nvmf: remove unused RPC section
Change-Id: Ib7b9c894573e4e8fd6e21b414fec038abd43d1e2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-29 15:37:52 -07:00
Daniel Verkamp
4946c154c2 nvmf: change default RDMA port to 4420
4420 is the officially assigned IP port from IANA for NVMe over Fabrics.

Change-Id: I433a5ed0780d1ffd7ca6512617759d59fa5e8def
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-29 15:36:14 -07:00
Daniel Verkamp
42111e78de nvmf: replace IQN references with NQN
NVMe over Fabrics defines its own NVMe Qualified Name (NQN) format; it
does not use iSCSI Qualified Names.

Also change the default node base for nvmf_tgt to "nqn.2016-06.io.spdk".

Change-Id: I2b73c1426ef1d8c83cc2df499d79228ea61257cd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-28 14:38:15 -07:00
Daniel Verkamp
19fec6bb9c nvme: add remove callback to spdk_nvme_probe()
This will allow removal notifications to be propagated to the library
user (e.g. for hotplug).

The callback is currently unused, but this at least prepares the API for
the future hotplug support.

Based on a patch by Dave Jiang <dave.jiang@intel.com>

Change-Id: I20b1c2dbf5e084e0b45a7e51205aba4514ee9a95
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-28 14:21:58 -07:00
Daniel Verkamp
e2d3cc6502 nvme: replace rte_memcpy with specialized function
Use the knowledge that both the source and destination of
nvme_copy_command() are aligned to emit the aligned variants of the
SSE2/AVX mov instructions.

Change-Id: I0a7e32a3bb10b9a1920cd85691b79fa7172eecb3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-28 14:17:21 -07:00
Daniel Verkamp
eb9d77a910 test/nvme: allocate aligned memory in unit tests
Match the expected alignment for nvme_alloc_request() and nvme_malloc()
to allow optimized memory copy code to work even in the unit tests.

Change-Id: I546692a6df9615a12a8209618fb6159a9c9e426b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-28 14:10:29 -07:00
Daniel Verkamp
2a3e39a154 nvmf: add spdk_ prefix to struct nvmf_request
Also finish up the req_state -> req conversion.

Change-Id: I131dd52dcd36a790b942e06f0207a3274cc04ffc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 10:24:00 -07:00
Ben Walker
d7fbeda710 nvmf: Move process_*_cmd functions to request.h/c
Change-Id: I16481463a8735f71387c69dd9ca4e187d743d8fc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 11:30:59 -07:00
Ben Walker
2a2615ec6e nvmf: Unify completion path of fabric and other commands.
Fabric commands were skipping a step, so unify all
types of requests through the same completion path.

Change-Id: I5f38a7e1cdcdf33baf71486d5ddae9f5a6157fac
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 09:25:19 -07:00
Ben Walker
6b10df3576 nvme: Update nvme_spec.h to 1.2.1
This moves some definitions from nvmf_spec.h to
nvme_spec.h based on the latest publication.

Change-Id: I51b0abd16f7d034696239894aea5089f8ac70c40
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 09:18:14 -07:00
Daniel Verkamp
1d3ee6c5f1 nvmf: remove nvmf_request cb_fn field
It is always set to nvmf_process_async_completion and is only used
within the library.

Also rename nvmf_process_async_completion to spdk_nvmf_request_complete
to clarify its purpose.

Change-Id: Ie737fb60688329bfe329a8553c4a40ff2e5f8f1d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
8836a17f80 nvmf: drop redundant nvmf_process_admin_cmd params
Everything necessary for processing an admin command is now stored in
nvmf_request.

Change-Id: I74e75a5b7bb3b406ad167c2b31cab1af7a1f270a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
2f5ccef310 nvmf: remove redundant nvmf_process_io_cmd params
Everything necessary for processing an I/O is now stored in
nvmf_request.

Change-Id: I3f390707ebe83ea66a116dcfda4d0388a6823629
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
39cc59635a build: include -lrt and -lpthread in LDFLAGS
Simplify the build rules so that common libraries are always linked.

Also fix up a couple of -lpciaccess instances that should have been
changed to $(PCIACCESS_LIB).

Change-Id: I4c50fa3aa59cae013d3385e38fbb830794299f6e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 09:04:02 -07:00
Daniel Verkamp
4db1b420f4 vtophys: fix usermode address range check
vtophys() was checking for out-of-range addresses incorrectly: vfn_2mb
is already shifted to account for 2 MB hugepages, but it was being
compared with a mask that did not account for the shift.  This would
allow out-of-bounds access to the 128tb map array for certain invalid
addresses (it had no effect on addresses within the valid userspace
range).

Change-Id: Ida7455595e586494c9025f9ba65d050abb16b1b9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-22 16:41:29 -07:00
GangCao
c65210d034 nvme: return error immediately when enabling controller failed
Change-Id: Id9cf6873cc831bd5099df49db95ef5073badf461
Signed-off-by: GangCao <gang.cao@intel.com>
2016-06-21 16:37:15 -04:00
Ziye Yang
7991eb1957 Create a utility and enable WRR arbitration mechanism
Change-Id: I2194863ae812ece72c17b78e003ccf7895b8a812
Signed-off-by: GangCao <gang.cao@intel.com>
2016-06-21 16:35:04 -07:00
Ben Walker
422b147499 nvmf: Standardize names in init_grp.h
Prefix with spdk_nvmf_host.

Change-Id: I053030febf5b7157cc2c7075ac6170bc59ce0ced
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-17 13:31:05 -07:00
Ben Walker
6eb1bee64b nvmf: Rename spdk_nvmf_init_grp to spdk_nvmf_host
Host is the term used in the specification.

Change-Id: Ie9a06e3ff176e00e2fdcdc5bede701fe768d4b35
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-17 13:31:05 -07:00
Ben Walker
e1d1040703 nvmf: Improve script that detects RDMA NICs
Work around an issue with the mlx4 driver.
Make discovery of NICs more generic.

Change-Id: I9701d8d7937faa299d12d7ca4bfe1c923983c263
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-17 13:23:17 -07:00
Daniel Verkamp
1bb4fac463 nvmf: remove unimplemented AuthFile config
This enables SPDK_NVMF_BUILD_ETC to be moved out of the library as well,
since only authfile was using it before

Change-Id: I10d1145881f9a0358d7effe2d2d9851899413e1b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-09 14:25:26 -07:00
Ben Walker
58f9dcd220 nvmf: Rename SubsystemGroup to Susbystem in conf file
The section is really defining a subsystem as defined
by the NVMf specification. There does not appear to be
any need for a group of subsystems.

This change only updates the configuration file. It does
not remove all references to a subsystem group from
the code.

Change-Id: I38e62735a5ac924dcafacb3c9a332a103d751d4a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-09 14:24:57 -07:00
Ben Walker
a4b857213b nvmf: Rename InitiatorGroup config section to Host
The specification refers to this concept as a Host,
so use that term. This only changes the configuration
file usage. Initiator groups are still referenced in
the code and will be removed later.

Change-Id: I897f4dbdfb65d94da1e5a77434fc07a2c18bcdc2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-08 16:37:32 -07:00
Daniel Verkamp
1c089ae19c nvmf: rename framework.c to nvmf.c
Change-Id: Ia9b4bf4738ad9e1ae158f3a610da8f0ab87e0215
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-08 13:15:26 -07:00
Ziye Yang
34731b0b17 nvmf: create a common script file for nvmf automation test
Put the common funcs in test/nvmf/common.sh to
reduce duplicated code

Change-Id: I1c72f6fb22d092dafb7fb134b8bb3780b5525e48
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Signed-off-by: Gang Cao <gang.cao@intel.com>
2016-06-08 09:28:57 -07:00
Ziye Yang
2c43473adc nvmf: fix fabricintf parsing in spdk_nvmf_parse_port function
The index should be 0 for fabricintf.
Moreover, when there is no fabricintf found, error should
be returned

Change-Id: I3aa04566a5a318b8c921dd37c8573ed075254266
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-06-08 09:11:35 -07:00
Daniel Verkamp
d237632434 nvmf: add unit tests
Change-Id: I22c57c3989f4b69cb35ef4e17507864d0f07f084
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-08 08:49:38 -07:00
Daniel Verkamp
91330eb5c8 nvmf: add automated fio and mkfs tests
Change-Id: I499ae29155b8f053babf18750cecb5c8d210d59c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-07 10:16:01 -07:00
Daniel Verkamp
c711736d6f test/log: fix typo
Change-Id: Iff84a6e17a2e6bf5848fee33d5bf5ed289058c7c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-01 09:48:39 -07:00
Daniel Verkamp
eeeac6676d Add event-driven application framework
Change-Id: Iba90db6d8853dde972b4eec2c35eb44eeddae780
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-31 09:58:05 -07:00
Daniel Verkamp
ab1f6bdc54 nvme: add enum for opcode data direction
NVMe opcodes contain a two-bit field that encodes the expected data
direction for each command.  Add an enum and a function to extract these
bits.

Change-Id: Ie214319f121cf0899c6aa5663866f2988b128dd2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-27 08:59:14 -07:00
Daniel Verkamp
376d117c90 jsonrpc: add JSON-RPC 2.0 library
Change-Id: I4f58792c3af1f85f55144717478f868ebe5b1700
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-23 10:28:58 -07:00
Ben Walker
ddb59105ee nvme: Add an fio plugin
Change-Id: Ife815e371325df7fbec388530dc09097c3e4ffac
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-05-18 13:51:36 -07:00
Daniel Verkamp
09d3e4c9dd test/nvme: use SPDK_CU_ASSERT_FATAL()
Use SPDK_CU_ASSERT_FATAL instead of CU_ASSERT_FATAL so static analyzers
recognize that g_request cannot be NULL in the following lines.

Change-Id: Ie7ab3bd34a177bea0d565441014e8db12be8bb01
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-16 10:43:10 -07:00
Daniel Verkamp
53cb5d8fa6 test/json: initialize variable to silence warning
If spdk_json_number_to_int32() works correctly, it will initialize the
value of i32, but since this is a unit test, we should make sure i32 is
initialized to catch bugs.

Fixes a clang warning during scan-build.

Change-Id: Iecf0531d2992acf584b10e2de5f8c53553a9f3b6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-16 10:41:04 -07:00
Daniel Verkamp
97421601b7 cunit: add test result JSON formatting
Change-Id: I3ccafd2f22447dbb178c7627352a4ced0d25b73f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-12 15:42:09 -07:00
Changpeng Liu
ca3d1c5b45 spdk: add controller memory buffer support in driver
The D3700/D3600 series support Controller Memory Buffer(CMB) feature,
CMB is available for holding submission queues, for those controllers
which can support submission queues in CMB, user can set the option
whether to enable it or not.

Change-Id: I8b0dc9e28dd6f5bb01bee99a532087212c04e492
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-05-13 08:14:10 +08:00
Daniel Verkamp
ed694026b8 json: fix spdk_json_write_val with nested objects
When recursively calling spdk_json_write_val() on another object or
array, the child call will handle printing out the whole
subobject/array, so the parent call should skip over all of its values.

Also fix the return value for the array/object case - if we get to the
end of the array or object, we should return 0 for success.

Change-Id: I1da80c88ab8759620114c1ab141baaaaf9f0023a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-11 10:43:02 -07:00
Cunyin Chang
f2168e1d73 nvme: Add firmware upgrade interface and unit test suite
Change-Id: If66e5f97f6793df0388629fab7c3d0e9f9d5eb67
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-05-11 10:18:33 -07:00
Daniel Verkamp
aaa533adc7 log: add SPDK logging library
Change-Id: I3d4060b619a3976ffff75c05f86214e3fcd18fb5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-09 15:54:49 -07:00
Daniel Verkamp
cd48a01fcb build: wrap $(CURDIR) relative paths in $(abspath)
Resolve relative paths before using them to clean up command lines.

This should also help shorten the overall command line length that gets
embedded in the binary and used when locating the executable from a
coredump.

Change-Id: Ibff9849ede198bb04313496c8b7131485ffaf14f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-09 13:56:07 -07:00
Daniel Verkamp
f9193f4ce7 json: add JSON parser and encoder libraries
Change-Id: Id73fb7e300d66d31a7c3986c0334b6f56e284905
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-09 13:30:02 -07:00
Daniel Verkamp
0313b2bbed test/nvme: initialize payload.md in ctrlr_cmd_ut
Fix copy of uninitialized data in the unit tests.

Change-Id: Ib71a6fc90edb07f7ddac3067ff0efbda7938bf17
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-06 12:52:05 -07:00
Cunyin Chang
10f0f4b0e9 spdk: Add Intel specific log page.
This patch add support for Intel specific log pages :
marketing description page.

Change-Id: I87bccb2af286279598c9dd3c870094b384a0d2f7
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-05-05 13:39:14 +08:00
Fangfang Wei
1e9c43ddc7 spdk: Add ns write with metadata unit test
Change-Id: I65dd28aed568dc5d9098ed389701f65e9d0e1925
Signed-off-by: Fangfang Wei <fangfangx.wei@intel.com>
2016-05-04 14:58:41 -07:00
Changpeng Liu
784182ed47 SPDK: Add end-to-end data protection support in driver
For those controllers which can support end-to-end data protection
feature, add the support in the driver layer.

Change-Id: Ifac3dd89dec9860773c850416a6116113a6ce22a
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-04-28 15:46:13 -07:00
Liang Yan
b2db4f94ec nvme/test: Add hw sgl request unit test
Change-Id: I1364a6634b9be25ff647eee56c91e312ae3d004e
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-04-28 14:26:24 +08:00
Liang Yan
11932ec118 nvme/test: Update unit test for the changes of PRP entries number
Change-Id: Ib58a0da307f9c5db36f6b14acd122cf2e2a0d377
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-04-18 13:54:26 -07:00
Daniel Verkamp
2cf675bb29 nvme: rename remove_child_request for consistency
Rename nvme_remove_child_request() to nvme_request_remove_child() and
move it next to nvme_request_add_child() to make the symmetry clear.

Change-Id: I78747c44ab3db1a656b33555a45f634dc5a55b31
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-04-08 16:51:15 -07:00
Daniel Verkamp
87a3244f97 nvme: handle CC.EN = 0 && CSTS.RDY = 1 on startup
This can happen if the controller is still resetting as the SPDK NVMe
driver takes control.

Change-Id: I263ae8f2e7b271e0448450557452a115c90c4fb6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-04-08 16:47:25 -07:00
Ziye Yang
deb90a93de SPDK: add nvme_remove_child_request helper function
This patch is used to add a nvme_request remove child
helpler function

Change-Id: I1e5bb228d53333ca3601f4ae30fcd801ea39e532
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-04-08 09:36:57 -07:00
Daniel Verkamp
42e10f3e01 autotest: only run NVMe AER test in nightly tests
Change-Id: I39c54db5474ec5fe56f83f1297aa2d0c0445baaf
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-28 15:11:55 -07:00
Cunyin Chang
eae688576a spdk: Add nvme format interface and unit tests.
Change-Id: Ie0506debf547a5fc011e116421387a5adb7abf0e
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-03-17 13:37:20 -07:00
Daniel Verkamp
e3eba25d92 test/nvme/sgl: free SGL element buffers
Change-Id: I1bfcbda4722ae42bd54433bf43e5c954b0775f01
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 15:53:56 -07:00
Daniel Verkamp
af058fd758 test/nvme/sgl: calculate physical address earlier
The next_sge callback can be called multiple times for a single I/O if
the I/O is split.  Get the physical address for each element once
instead of every time the SGL is walked.

Also bake the SGL element offset into the physical address.

Change-Id: I5d83426a234ffe9d13b89621077dbbb1561181c9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 15:53:56 -07:00
Daniel Verkamp
e1c602bdc3 test/nvme/sgl: remove unused pci_dev field
Change-Id: Icf85717e43476d1f9f0856f2ece3afa6743f555a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 15:53:56 -07:00
Daniel Verkamp
51f7c833f3 test/nvme/sgl: factor out common len calculation
Also use uint32_t consistently for counting SGL elements.

Change-Id: Ibeffffdc5e0eccd11681703cd333bfb64319e164
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 15:53:56 -07:00
Daniel Verkamp
50e43f1ea0 test/nvme/sgl: add SGL element offset field
This allows us to test elements with particular (mis-)alignments without
depending on the internal behavior of the DPDK allocator.

Change-Id: I006358b82ae3a677353333954ba88d1bcfe289f6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 15:53:56 -07:00
Daniel Verkamp
dffd55353b test/nvme/sgl: replace iovec with custom struct
There's no reason to use the system-defined iovec structure; we only use
it for our internal scatter-gather callbacks.  Define our own structure
so it can be extended.

Change-Id: Ifc055adfdae8cddd53e7f5d638a24f1e812b1ac6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 15:53:56 -07:00
Daniel Verkamp
9d9023846c test/nvme/sgl: print test names
This helps identify which iteration of the test failed.

Change-Id: I9186de08ea8217348b8ee61b0ecba4e9d7ab986e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 15:34:45 -07:00
Daniel Verkamp
eb555b139e nvme: add return code to nvme_qpair_submit_request
If the controller is failed, attempting to submit additional I/O is
futile - it will be immediately failed using the completion callback,
which can result in infinite recursion if the application code resubmits
I/Os on failure.

Instead, provide a way for request submission to indicate failure, and
use it to exit early if the controller is failed; this can only happen
when a reset failed (timed out).

If a request is submitted directly by the user when the controller has
failed, we can return an error code directly.  For the case where I/O
was queued and is being resubmitted after a reset, we still need to call
the completion handler via _nvme_fail_request_ctrlr_failed().

Change-Id: I9e144328d524b25db2acf48e923b584746e8d0b6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 12:16:47 -07:00
Daniel Verkamp
c1592f3880 autotest: shorten nvme/perf runtime
This test is only intended to validate functionality, not actual
performance, so one second is plenty.

Change-Id: I2ff198c035226b50a113f9ff189c1abbd0fd1c17
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 12:10:32 -07:00
Daniel Verkamp
4ad99808f2 nvme: allow user to override controller defaults
Provide a new structure, spdk_nvme_ctrlr_opts, to let the user modify
the default controller initialization options during probe/attach.

Currently, only the number of queue pairs can be modified in this way;
other options will be added later.

Change-Id: Ie27b9429291d93a9353c0d820f0ad467d3b0e7cb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-16 08:14:15 -07:00
Liang Yan
23f95df80d nvme/test: Add qprio unit test
Change-Id: I2e7cac7f7a0e65d6a15fed10ef2c0eb46b71c5e9
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-03-15 13:02:21 -07:00
Daniel Verkamp
1dd7473078 nvme: create tracker pool in a single allocation
Replace the previous code that allocated each tracker individually with
one large allocation per queue pair.

struct nvme_tracker is now explicitly padded to reach exactly 4096 bytes
to allow normal array indexing to work correctly while maintaining the
alignment requirement that ensures each tracker's PRP list does not
cross a page boundary.

This also allows removal of the act_tr array, since the tr array can be
indexed directly now, and each tracker can store its own active state.

Change-Id: Ia7c51735b96594d12f7f478cefcc4aedc84207ad
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-15 09:20:25 -07:00
Daniel Verkamp
3272320c73 nvme: make I/O queue allocation explicit
The previous method for registering I/O queues did not allow the user
to specify queue priority for weighted round robin arbitration, and it
limited the application to one queue per controller per thread.

Change the API to require explicit allocation of each queue for each
controller using the new function spdk_nvme_ctrlr_alloc_io_qpair().

Each function that submits a command on an I/O queue now takes an
explicit qpair parameter rather than implicitly using the thread-local
queue.

This also allows the application to allocate different numbers of
threads per controller; previously, the number of queues was capped at
the smallest value supported by any attached controller.

Weighted round robin arbitration is not supported yet; additional
changes to the controller startup process are required to enable
alternate arbitration methods.

Change-Id: Ia33be1050a6953bc5a3cca9284aefcd95b01116e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-14 16:00:54 -07:00
Daniel Verkamp
a606a3ed5c nvme/reset: simplify timing logic and shorten test
Change-Id: I070223e25988e9a35a4df91331ea88bc4f7c5f13
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-14 08:12:36 -07:00
Daniel Verkamp
17005b5756 nvme: remove nvme_request::timeout field
This field is write-only in the current code; the NVMe library does
not track timeouts on requests.

Change-Id: I50e53bb3c299bf16912c48be8aad3eec829154af
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-09 16:56:05 -07:00
Changpeng Liu
2374599671 spdk: fix wrong length parameter for large IO when uses hardware SGL
When I/O spans a stripe boundary, the driver splits the request into
multiple requests, so for 1 segment memory larger than the stripe
size, we also need to split the segment memory.

Change-Id: I22ea5734d7066865a57a3c90fe18d5f76f373f1d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-03-09 15:22:08 -07:00
Daniel Verkamp
dfeacab2e2 nvme/reset: clean up Makefile
Remove the common code that was factored out to spdk.common.mk.

Change-Id: I2a6265fa144b2c03f3484e2aa528fd1e15d13429
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-08 10:43:27 -07:00
Liang Yan
74a82a26b5 spdk: Add payload_offset unit test in split_test4
Add CUnit test case to verify payload_offset value in split_test4

Change-Id: I4a9a33854295ed802709bbe4f11746d284ed8cbd
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-03-07 14:34:44 -07:00
Liang Yan
802d7fe0b9 spdk: Update sgl request unit test
Add test case which verify invalid second phys_addr would cause
_nvme_fail_request_bad_vtophys be called.

Change-Id: Id1b62e249b7192e29334bd7cab33815722f5662d
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-03-07 14:34:33 -07:00
Liang Yan
ddc4e7d0d5 spdk: Add ns cmd readv and writev unit test
Change-Id: I993daff2e5b729c72a96e030d380a5eb71bd41e3
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-03-07 14:34:11 -07:00
Daniel Verkamp
3cbeaae6e9 nvme: add unit tests for nvme_ctrlr_process_init()
Change-Id: I87899f1e6bff5d79e5c48fc22d6ac8cdaceee8ee
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-07 13:34:25 -07:00
Changpeng Liu
eb9ef5cc2b nvme: Add SGL support in NVMe driver
For those NVMe controllers which can support SGL feature in
firmware, we will use SGL for scattered payloads.

Change-Id: If688e6494ed62e8cba1d55fc6372c6e162cc09c3
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-03-04 09:36:40 -07:00
Cunyin Chang
9841610855 spdk: Add namespace management interface and unit tests.
Change-Id: I9d203bf7532d50b1f8c8ca50c50df09ded8b5256
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-03-04 09:52:30 +08:00
Daniel Verkamp
345d9a4da3 nvme: add spdk_ prefix to nvme_qpair_process_completions()
This will be exposed in the public API.  This rename is in a separate
commit to ease review.

Change-Id: I1b7fef36f85265db27935ac4d22ceef3c7282502
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-01 14:42:04 -07:00
Daniel Verkamp
89bf6d5ce1 nvme: add error checking for internal ctrlr_cmds
Many of the internal controller initialization functions did not check
for allocation failure; add return codes and check them where
applicable.

Change-Id: Id1b33bb06fca84035369d8b7ecd4c36b8ba7134c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-01 14:42:03 -07:00
Daniel Verkamp
5ee7a5df37 nvme: add spdk_nvme_ns_is_active() function
This function returns true if the namespace is active or false if it is
inactive (e.g. no namespace has been attached to the specified namespace
ID yet).

Also use the new function to add checks in the examples and tests where
applicable.

Change-Id: I35465b315ae1a1677c5a82191ad9b1da1c216d50
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-03-01 14:40:44 -07:00
Daniel Verkamp
6eb18e2f3d nvme: rename nvme_qpair to spdk_nvme_qpair
Prepare for qpair to be exposed as part of the public API.

Change-Id: Ia63e863e95554adceeade20c829f12fe346375d5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-29 10:11:35 -07:00
Liang Yan
d6ec160211 spdk: Add sgl request unit test
Change-Id: I07b253c394d82b92564bfbdea8014e75b8dbf9ce
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-02-26 11:14:17 -07:00
Daniel Verkamp
61f706e8c8 test/nvme/reset: fix behavior with >1 ns per ctrlr
Store each namespace's associated controller in its ns_entry structure
rather than trying to assign them during associate_workers_with_ns().

Change-Id: I679a1902d5c787e35f3afb5292342ce369f1fe52
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-25 13:26:02 -07:00
Daniel Verkamp
20abbe8abe nvme: perform resets in parallel during attach
When multiple NVMe controllers are being initialized during
spdk_nvme_probe(), we can overlap the hardware resets of all controllers
to improve startup time.

Rewrite the initialization sequence as a polling function,
nvme_ctrlr_process_init(), that maintains a per-controller state machine
to determine which initialization step is underway.  Each step also has
a timeout to ensure the process will terminate if the hardware is hung.

Currently, only the hardware reset (toggling of CC.EN and waiting for
CSTS.RDY) is done in parallel; the rest of initialization is done
sequentially in nvme_ctrlr_start() as before.  These steps could also be
parallelized in a similar framework if measurements indicate that they
take a significant amount of time.

Change-Id: I02ce5863f1b5c13ad65ccd8be571085528d98bd5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-25 13:25:59 -07:00
Daniel Verkamp
a62b194f1b nvme: add timestamp counter interface to nvme_impl
Change-Id: Ic652163e4f5944c1516eaf58615f7eabcbe34a7a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-24 21:17:12 -07:00
Liang Yan
02191a0086 spdk: nvme ns cmd child requests testing
Two test cases should be added.
1. ns cmd don't have child requests;
2. Assert that the correct number of child requests are created
and verify that each one has the correct payload_offset.

Change-Id: I1182a1a6673ceaf2ba35be268f80d8668af82848
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-02-24 16:57:53 -07:00
Daniel Verkamp
959bc24b0a autotest: run ioat_ut under Valgrind
Change-Id: I235bd39c0f4c85f12db20a87976ce73cfdb89bc2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-19 15:24:09 -07:00
Daniel Verkamp
c162dd0e38 nvme_qpair_ut: clean up submitted tracker
This fixes a memory leak in the unit test.

Change-Id: Ie94459e8e46e966c437ad43702a04f1a8f9becdb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-19 13:15:34 -07:00
Daniel Verkamp
6ce73aa6e7 nvme: add spdk_ prefix
Shorten commonly-used names:
controller -> ctrlr
namespace -> ns

Change-Id: I64f0ce7c65385bab0283f8a8341a3447792b3312
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-10 11:27:45 -07:00
Daniel Verkamp
ad35d6cd86 nvme_spec: add spdk_ prefixes
Use shorter names for commonly-used objects:
namespace -> ns
controller -> ctrlr
command -> cmd
completion -> cpl

Change-Id: I97d192546b35a6aeb76ad3a709f65631502cde71
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-09 11:06:48 -07:00
Daniel Verkamp
8332f9e47e nvme_intel: add spdk_ prefixes and tweak names
Change-Id: I7c256bce365c92636f4f183e218117a1d7fe63d9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-08 16:53:36 -07:00
Daniel Verkamp
516c37562d vtophys: add spdk_ prefix
vtophys() -> spdk_vtophys()
VTOPHYS_ERROR -> SPDK_VTOPHYS_ERROR

Change-Id: I68ab24fbb48f419ba1d41b78d7c9958cf666b800
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-08 14:28:56 -07:00
Daniel Verkamp
8cb09df68e pci_ids: add SPDK_ prefix
PCI_VENDOR_ID_INTEL -> SPDK_PCI_VID_INTEL

Also change the inclusion guard macro to be consistent with the other
SPDK headers.

Change-Id: I29346267172cb8c07cc4289eed4eca2d55e942d6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-08 14:28:47 -07:00
Liang Yan
7a9b004c65 spdk: Add reservation cmd unit test
Change-Id: I859376e792c2be981d8877b068126f8c9a192abd
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-02-08 11:02:30 -07:00
Daniel Verkamp
93933831f7 pci: clean up public pci.h interface
Rename all functions with a spdk_ prefix, and provide enough of an API
to avoid apps needing to #include <pciaccess.h>.

The opaque type used in the public API for a PCI device is now
struct spdk_pci_device *.

Change-Id: I1e7a09bbc5328c624bec8cf5c8a69ab0ea8e8254
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-08 09:58:13 -07:00
Daniel Verkamp
047c5aaaa8 ioat: refactor ioat_attach() API into ioat_probe()
Similar to the NVMe API change, this allows better abstraction of the
PCI subsystem.

Change-Id: I2b84d9c3c498a08d4451b4ff27d0865f0456c210
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-08 09:50:57 -07:00
Ziye Yang
ff6125195c SPDK: Support configuring libpciaccess library
With CONFIG_PCIACCESS=y in CONFIG file, we can
use libpciaccess library; With CONFIG_PCIACCESS=n
in CONFIG file, we use pciaccess functions provided
in DPDK.

Change-Id: I786c5589b8e7909ba2e59d222938dd5ba45bf92d
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-02-04 17:30:09 -07:00
Daniel Verkamp
8374a727a9 nvme: refactor nvme_attach() into nvme_probe()
The new probing API will find all NVMe devices on the system and ask the
caller whether to attach to each one.  The caller will then receive a
callback once each controller has finished initializing and has been
attached to the driver.

This will enable cleanup of the PCI abstraction layer (enabling us to
use DPDK PCI functionality) as well as allowing future work on parallel
NVMe controller startup and PCIe hotplug support.

Change-Id: I3cdde7bfab0bc0bea1993dd549b9b0e8d36db9be
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-03 11:15:31 -07:00
Haomai Wang
20c767e796 nvme: add support for write zeroes command
Change-Id: I07ae5805c434d3c06ac24c1a8e09c761b5506ff4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-02-03 10:28:35 -07:00
Daniel Verkamp
5578f74dd4 test/nvme/sgl: fix dereference before NULL check
Change-Id: I7976f4598d61df501dc917bc77bec225c907b9b1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-02-01 15:45:22 -07:00
Daniel Verkamp
0ca6afb850 Add .gitignore for test/lib/nvme/sgl/sgl
Change-Id: I0bd68c19382111542e83498af3e4d070a1a1c076
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-29 15:05:04 -07:00
Cunyin Chang
aa2970b9f3 nvme: Add Intel NVMe device supported feature quirks
This patch adds Intel NVMe device list and overrides the
supported log pages according to the quirk list.

In particular, the READ_CMD_LATENCY and WRITE_CMD_LATENCY pages are
supported on Intel DC P3x00 devices despite not being listed in the
Intel vendor-specific log page directory.

Change-Id: I3a2b6a5fa142c6e9c93567df65e85980bd3c7cc0
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-01-29 13:45:05 -07:00
Daniel Verkamp
c02b179490 Remove year from copyright headers.
Also add a space between Copyright and (c).

The copyright year can be determined using git metadata.

Also remove the duplicated "All rights reserved." - every instance of
this line already has a corresponding "All rights reserved" immediately
below it, except for examples/ioat/kperf/kmod/dma_perf.c, where I have
added it manually.

Performed using this command:

git ls-files | xargs sed -i -e 's/Copyright(c) \(.*\) Intel Corporation. All rights reserved./Copyright (c) Intel Corporation./'

Change-Id: I3779f404966800709024eb1eb66a50068af2716c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-28 08:54:18 -07:00
Cunyin Chang
16eee6e20e spdk: Add new API to check if given feature supported.
1 Add new API nvme_ctrlr_is_feature_supported().
2 Add unit test for new API.

Change-Id: Ia6d8710755c3b13984fca9d56700efe043be1402
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-01-28 08:45:21 +08:00
Daniel Verkamp
407a57165d nvme: combine various payload types into a struct
This cleans up the I/O splitting code somewhat.

It also moves the SGL payload function pointers up into the hot cache
section of struct nvme_request without pushing the other important
members past the cacheline boundary (because payload is now a union).

Change-Id: I14a5c24f579d57bb84d845147d03aa53bb4bb209
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-27 16:52:53 -07:00
Ben Walker
81f4046402 nvme: add FUA and LR support
Support for the Force Unit Access and Limited Retry
bits on reads and writes.

Change-Id: I9860848358377d63a967a4ba6ee9c061faf284d4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-01-25 15:22:26 -07:00
Changpeng Liu
92fa3ec537 spdk: add NVMe reservation commands support
NVMe reservations provide capabilities that may be used by two or more
hosts to coordinate access to a shared namespace, here we add the 4
reservation commands: reservation register/acquire/release/report.

Change-Id: Ib03ae2120a57dd14aa64311a6ffeb39fda73018c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-01-25 11:42:41 -07:00
Ziye Yang
a4133bc687 SPDK: remove the unnessary pci_device parameter
This patch is used to remove unnessary pci_device
related parameter

Change-Id: I8869307f49364797543c88ffa9c456da34d1487d
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-01-25 14:34:29 +08:00
Changpeng Liu
d3d6d19bef spdk: add scattered payloads support to NVMe driver
For the purpose to support different types of input scattered payloads,
such as iovs or scattered list, we define common method in the NVMe
driver, users should implement their own functions to iterate each
segment memory.

Change-Id: Id2765747296a66997518281af0db04888ffc4b53
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-01-22 14:51:53 -07:00
Cunyin Chang
d2806e6204 spdk: Move the declaration of set/get feature API to nvme.h.
Change-Id: Iad4863b51850920fbe15fce6638c7439a94b58fd
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-01-21 15:58:01 -07:00
Daniel Verkamp
52ca42aa8a test/nvme/aer: use nvme_ctrlr_cmd_get_log_page()
Change-Id: I1c9be5dcc8ff0e9b21d17524e43de2b34f429d04
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-15 13:40:58 -07:00
Daniel Verkamp
af99c46557 nvme: add return code to nvme_ctrlr_cmd_get_log_page
Request allocation may fail, so we need a way to indicate failure to the
caller.

Change-Id: I278c3f42e4d2fa1902bb0ab33ad3bf7c7007fd0d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-15 12:49:16 -07:00
Cunyin Chang
9945c00cf2 NVMe: Add public API to get log pages.
1 Add supported log pages data structure.
2 Bulid up supported log pages when NVME start.
3 Provide unified API for getting log pages.
3 Unit test suit optimization base on above modification.

Change-Id: I03cdb93f5c94e6897510d7f19bc7d9f4e70f9222
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-01-15 09:10:35 +08:00
Daniel Verkamp
040742359e pci: rename pci_device_has_non_null_driver to non_uio
This more accurately represents what function it performs.

Also remove pci_device_has_uio_driver() from the public API.  Callers
should use pci_device_has_non_uio_driver() instead.

Change-Id: I9623fe1345b43e981d5823804e33d01ac0d3bb1c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-12 08:58:02 -07:00
Daniel Verkamp
2ced60e9bf nvme: return number of completions processed
nvme_ctrlr_process_io_completions() and
nvme_ctrlr_process_admin_completions() now return the number of
completions processed.

This also adds the possibility of returning an error from the
process_*_completions functions (currently unused, but this at least
gets the API ready in case error conditions are added later).

Change-Id: I1b32ee4f2f3c1c474d646fa2d6b8b7bbb769785f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-11 14:44:22 -07:00
Daniel Verkamp
3d6b230ae9 nvme/utest: add asserts to check allocations
Make sure allocation succeed in the unit tests.

Change-Id: I1c9dd64c256d529f2e40be49448d56359969a6f5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-08 09:31:13 -07:00
Daniel Verkamp
5f844a0477 nvme/utest: add SPDK_CU_ASSERT_FATAL wrapper
The normal CU_ASSERT_FATAL macro calls a function that is not marked as
noreturn, so static analyzers (e.g. scan-buid) can't figure out that
fatal asserts are really fatal.

Add a wrapper macro that calls abort(), which the analyzer can determine
does not return.

Change-Id: I0c087bf9c8d3c272bf88120caa70e87dab6d9546
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-08 09:31:10 -07:00
Liang Yan
a0ba9ce276 nvme/reset: don't crash if no namespaces are usable
Change-Id: I79b03c97f09125070dbdb1abe49db4a338f6a27f
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2016-01-06 12:21:04 -07:00
Daniel Verkamp
cb18017c42 nvme/aer: check command completion status
If any command fails during the asynchronous event request test, exit
the test with an error rather than waiting for an event that won't
arrive.

Change-Id: I7297afe362bfdac04dd6585cc97ffdceb9f0096e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-06 10:30:12 -07:00
Daniel Verkamp
3b38dd8282 autotest: remove extra process_core invocations
The top-level autotest.sh script will catch any core dumps at the end of
the test run, so sprinkling process_core in the individual test scripts
is unnecessary.

Also make the per-component test scripts run with 'set -e' (exit on
error).

Change-Id: I85f124e164ca93d35eaf672a428a841c119c550b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-01-05 15:31:56 -07:00
Liang Yan
d5cbe304b9 nvme: update nvme_ns_cmd_deallocate unit test
The deallocate command's num_ranges have changed to unit16_t.
Update the nvme_ns_cmd_deallocate unit test for the change.

Change-Id: I43b8637bbb953b0e56c39998e1e6682a54304a8f
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2015-12-30 09:40:22 -07:00
Daniel Verkamp
c8f27b9e6e nvme: mark a few more functions static
nvme_qpair_submit_tracker() and nvme_qpair_manual_complete_request() are
only used from within nvme_qpair.c, so they can be static.

nvme_qpair_submit_tracker() is moved up to avoid needing a declaration
(no other code change).

nvme_ctrlr_hw_reset() is only used from within nvme_ctrlr.c, so it can
be static.

Change-Id: I9a7953d7baaec76e875dd535daf557ea24bef801
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-12-23 08:59:49 -07:00
Daniel Verkamp
d4ab30ba33 ioat: add user-mode Intel I/OAT driver
The ioat driver supports DMA engine copy offload hardware available on
Intel Xeon platforms.

Change-Id: Ida0b17b25816576948ddb1b0443587e0f09574d4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-12-09 10:14:15 -07:00
Daniel Verkamp
01b48b7c90 build: define a common Makefile clean command
Use $(CLEAN_C) throughout the Makefiles to clean up a consistent set of
generated files.

This also adds coverage files to the list of cleaned files.

Change-Id: Iceb922935a45c9eecbf2f3443bd0ee4f5c966825
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-12-07 15:14:36 -07:00
Liang Yan
ed616a7902 nvme: test admin and io queue in nvme_qpair_destroy
Change-Id: Ic0377960a75d0ec9ed9eb489e7806dc4b27e8be5
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2015-12-04 09:37:57 +08:00
Daniel Verkamp
2a00199d30 nvme: minor nvme reset test cleanups
Change-Id: Ia397d4c8325d059b19a41e079789e157dca5dfb1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-12-02 16:17:30 -07:00
Liang Yan
1df5899cf5 nvme: Add reset test tool
Realize reset tool to test nvme reset function.

Change-Id: Ia38de1907ddce46738f74b65d3d15ca9f911ac7f
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2015-12-01 13:26:16 +08:00
Jim Harris
366d931183 Reduce NVME_MAX_IO_QUEUES to 1024.
Most devices today support far fewer than 1024, but this is a
more reasonable default upper limit than the spec-defined 64K.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia8a6d80c3a5aa181f27c8354758c6ca468013d92
2015-11-30 09:33:34 -07:00
Daniel Verkamp
1c3b08c63c build: move $(OBJS) definition to spdk.common.mk
Change-Id: I2dd592269ef644cfe73921151b9b174dc255323d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-11 14:59:55 -07:00
Daniel Verkamp
1c28700070 build: remove useless 'objs' targets
The .o files are always kept anyway, so there is no need for an explicit
rule.

Change-Id: Id1687ba89daabfda5802e4328deb127403277928
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-11 14:59:54 -07:00
Daniel Verkamp
dba4829471 build: factor out common compile and link commands
Add common $(COMPILE_C), $(LINK_C), and $(LIB_C) variables that contain
the commands to build a .o from a .c, an app from objects and libraries,
and a library from objects, respectively.

Change-Id: Ie2eaa13156b8bf3db7a4ffa66161382d829aef07
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-11 14:59:54 -07:00
Daniel Verkamp
22eced89c4 build: simplify vtophys test Makefile
Use the standard pattern of OBJS automatically generated from C_SRCS,
and also link against libspdk_memory instead of including the object
file directly.

Change-Id: I0c8cd8996cde2bcc1f25d9d97811fff3b0bbc88b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-11 14:59:54 -07:00
Daniel Verkamp
668847e150 nvme: add max completions limit to I/O polling
nvme_ctrlr_process_io_completions() now takes a second parameter,
max_completions, to let the user limit the number of I/Os completed on
each poll.

If there are many I/Os waiting to be completed, the
nvme_ctrlr_process_io_completions() function could run for a long time
before returning control to the user, so the max_completions parameter
lets the user have more control of latency.

Change-Id: I3173059d94ec1cc5dbb636fc0ffd3dc09f3bfe4b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-05 15:07:52 -07:00
Daniel Verkamp
189814de83 autotest: tweak nvme/perf command to test splits
Previously, the I/O splitting code and child I/O completion were not
being tested (aside from in the unit tests).

Tweak the I/O size so that it will get split into two child I/Os on
devices with 128 KB striping.

This causes nvme_cb_complete_child() to be exercised, improving code
coverage.

Change-Id: Ia0299f7f809f8edb93452b5ad45939977a9f67f1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-04 14:35:25 -07:00
Daniel Verkamp
3677f46af8 build: allow make to work from any directory
Set SPDK_ROOT_DIR explicitly in each Makefile so that make from a
subdirectory will work (assuming all dependencies from the upper
directory have already been built).  This allows partial rebuilds of the
source tree, as well as building the unit tests without requiring DPDK.

Change-Id: I3f65b805d490b40ff5ec53cceb61df542ce814f1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-04 10:19:08 -07:00
Daniel Verkamp
2e03f6fe1c build: enable strict prototypes warning
This catches functions with empty parameter lists, which are not the
same as void parameter lists in C, as well as other (less-likely)
K&R-style parameter lists.

Change-Id: I18b09e01a60b3669d1cc5d8d96eec20cd872c497
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 16:05:06 -07:00
Daniel Verkamp
8307eb5f55 build: enable missing function declaration warning
This helps weed out functions that should be static, functions that are
not declared in public header files, and .c files that don't include
their .h interface headers.

Change-Id: Ie39f83ad4b320847e4a938bd1d4d0b4fa21c2ffa
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 14:40:23 -07:00
Daniel Verkamp
fd93c1b1ef build: enable missing field initializer warning
Replace {0} initializers with {}, since it is equivalent and simpler
(and avoids the warning).

Change-Id: Id2014a352e2c627598cd3b4f1ca04dba35f2dc3a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 14:40:22 -07:00
Daniel Verkamp
a945f60c79 build: enable signed-vs-unsigned compare warning
Change-Id: I93f069241cb74b3ec7d272bc390998372c376b16
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 14:40:22 -07:00
Daniel Verkamp
f79a334e33 build: fix old-style declaration warnings
Fix all of the uses of __thread so they are at the beginning (similar to
e.g. static).

Don't actually enable -Wold-style-declaration, since clang doesn't
understand that.

Change-Id: I0dcbb758143eab90fc978334c8f256c6602cc4cd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-11-02 14:40:12 -07:00
Daniel Verkamp
4f677a1d4c nvme: only invoke request free macro in one place
Rename the nvme_free_request macro to nvme_dealloc_request to match
nvme_alloc_request and add a wrapper function to nvme.c so that the
macro contents are only expanded once.

The DPDK nvme_impl.h uses rte_mempool_put(), which generates a large
amount of code inline.  Moving this macro expansion to a wrapper
function avoids inlining it in the multiple places nvme_free_request()
gets called, most of which are error handling cases that are not in the
hot I/O path.

Change-Id: I64ea9c39ba47e26672eee8d5058f1489e07eee5b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-20 07:43:41 -07:00
Daniel Verkamp
38997df85d nvme/test: fix memory leaks in nvme_ns_cmd_ut
The I/O splitting tests don't pass the I/Os through the normal
completion path, so we need to free the children ourselves.

Fixes all Valgrind warnings for nvme_ns_cmd_ut.

Change-Id: Iaf7d9f7f4cab71428a0123ee30d0f6042001e423
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-19 10:57:34 -07:00
Daniel Verkamp
84b8f0cc8b autotest: output timing in flamegraph format
Change-Id: I9f571ce635431613fc6a84e106e5052cce2dbf54
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-08 16:07:47 -07:00
Liang Yan
ae482f07c1 nvme: Add get_status_string test for nvme_qpair
Change-Id: Ib3f9d342549de52869ec984d0bc61ccd25b71a14
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2015-10-08 13:44:54 +08:00
Daniel Verkamp
5fc71d7e40 nvme: disable valgrind for nvme_ut
nvme_ut is testing multi-threaded operations, and Valgrind's thread
behavior is different than running the program natively.  Under
Valgrind, the unit test essentially hangs waiting for the global
variable to be updated.

Change-Id: Id3665002c16ac3e695c50325375305a76f72cee4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-06 10:21:23 -07:00
Daniel Verkamp
8780063f2c nvme: run unit tests under Valgrind if available
Change-Id: Iad8403903d420418692793d9940e33e2d3772e6b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-05 11:00:29 -07:00
Daniel Verkamp
1c96eff6a2 nvme: fix uninitialized memory in nvme_qpair_ut
nvme_alloc_request() does not zero out the request (this is
intentional, since the real implementation uses a mempool where requests
get reused).  Add nvme_allocate_request() wrapper that initializes the
request correctly.  This fixes all uses of uninitialized memory caught
by Valgrind in nvme_qpair_ut.  This test was also failing in practice on
FreeBSD due to non-zero buffers returned from malloc().

Change-Id: I2d6ea29289bd4887aaa9120fba6bce10088e6917
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-10-05 10:33:22 -07:00
Daniel Verkamp
cac5caec8b nvme: sync up unit test nvme_impl.h mutex wrapper
The default version of nvme_impl.h was cleaned up to release the pthread
mutex attr on failure cases, but the unit test version did not receive
this update.

Change-Id: I899b7dc809393dc8e6fd24ed98e1d0a61ecf1c95
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-30 16:18:18 -07:00
Daniel Verkamp
364331fd94 nvme: add I/O split test with stripe size enabled
Change-Id: I49166c2a07274cf66a8a9519805308c0db5ab13b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-28 14:20:03 -07:00
Daniel Verkamp
ac0c37924c nvme: validate child I/O in splitting test
Check the LBA and block count fields of the I/Os generated by the
splitting function to ensure they were split correctly.

Change-Id: I84abb1ac462fb7423d51a1be384fd1be68dfecae
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-28 14:04:51 -07:00
Daniel Verkamp
d4ee014f21 nvme: use CU_ASSERT_FATAL to abort tests on errors
Instead of repeating the check for conditions that must be fulfilled to
continue the tests, just use CU_ASSERT_FATAL, which will abort the test
and return.

Change-Id: If617b286a587d9efb1ce57b90061634ed5bc7ae8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-28 14:04:11 -07:00
Daniel Verkamp
21b37d4ee6 nvme: make the unit test assert actually assert
The current implementation of nvme_assert in the unit test nvme_impl.h
just prints the message and continues.

We should not be triggering assert conditions, even in the unit test
code, so make nvme_assert actually call assert().  This lets us catch
mistakes in the unit tests more easily.

Also fix the two unit tests that currently trigger an assert:
- The I/O splitting test in nvme_ns_cmd_ut was passing an invalid
  combination of NULL payload with non-zero lba_count.
- The ctrlr_cmd test was passing an invalid number of entries to
  nvme_ctrlr_cmd_get_error_page().  This case should probably not be an
  assert but rather an error code.  However, the function does not
  return a status code currently, so it is not trivial to make that
  change.  For now, just drop the asserting test case and the code added
  to the test to work around it.

While we're here, fix the macros in the unit test nvme_impl.h so they
are usable in single-line conditionals without braces - that is the
whole point of the do { ... } while (0) pattern, so there should be no
trailing semicolon.

Change-Id: Iad503c5c5d19a426d48c80d9a7d6da12ff2c982a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-28 14:04:07 -07:00
Liang Yan
fdd17ae3ee nvme: Update nvme unit test
Cover more functions and conditions for nvme_ctrlr_cmd.
Remove unnecessary lines in nvme_ctrlr_ut.
Update nvme_qpair_ut.
Remove unnecessary header file.

Change-Id: I8c5a75573b26210ca57711b366acd55ab96614c0
Signed-off-by: Liang Yan <liangx.yan@intel.com>
2015-09-28 10:02:41 -07:00
Jim Harris
1d90157262 Fix header file dependencies.
Move dependency includes into a new spdk.deps.mk file,
then include it at the end of Makefiles that build
source files.

Also add a test to autobuild.sh to confirm that
binaries are regenerated if we make after touching a
header file.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If6a1905706a840f92cbdf3ace7fbdb27fe2de213
2015-09-28 09:07:04 -07:00
Daniel Verkamp
766afaaacc nvme/test: avoid clang warnings in nvme_ns_cmd_ut
Initialize the full nvme_namespace structure in prepare_for_test() so
that e.g. ns->id is not used uninitialized.

Also check for request allocation failure - if the request is NULL, we
can't run the rest of the tests that dereference request without
crashing.

Change-Id: I3010ca3e81f153a4d0201498a14a963c2b9e960d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-25 14:03:48 -07:00
Jim Harris
4ba47234f3 Add pci_device_has_non_null_driver().
This helps enable FreeBSD, where pciaccess pci_device_has_kernel_driver()
is not functional.  The function will return 0 if there is no driver
attached, or the Linux uio or FreeBSD nic_uio driver is attached.  It will
return 1 otherwise.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I0921e61c9040b1e0411b5dc40b36fc7f2721c8c5
2015-09-25 12:45:04 -07:00
Jim Harris
004e4f6b59 Fix off-by-one errors in log page fetching.
Signed-off-by: Jim Harris <james.r.harri@intel.com>
Change-Id: Iab15a1cef4ebcf4f217cbc70d716141af95367f8
2015-09-25 12:43:25 -07:00
Daniel Verkamp
325b7db392 nvme: use rte_memcpy() to submit commands
GCC generates a series of 64-bit MOV instructions for the memcpy() into
the submission queue.  We can do better with 128-bit SSE2 instructions.

DPDK already has a memcpy implementation that is optimized for small
inline copies, so use it instead of memcpy.

Change-Id: I5f09259b4d5cb089ace4a8ea6d2078c03fee84f3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-25 09:33:42 -07:00
Daniel Verkamp
36eea2e1c2 nvme/test: simplify struct zero initializations
Use {} consistently rather than {0} when initializing structs as part of
definitions.

Fixes warnings about initializing subobjects when compiling with clang.

Change-Id: I507fdf47e7c41455033d6c3d5edc563ec4667dee
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-24 10:48:46 -07:00
Daniel Verkamp
0a92b40bb8 nvme/test: stub out missing ctrlr_cmd function
nvme_ctrlr_cmd_set_async_event_config() is called from within nvme_ctrlr
but was never stubbed out in its unit test.

Change-Id: I44002540e74ee010f21d0cf2d089d1dc51217a2f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-24 10:48:46 -07:00
Daniel Verkamp
ed24b97159 nvme/test: remove unused variable
Fixes warning about unused variable req.

Change-Id: Ic192c6f10d59f579755b3d84d5686c6cbf36ffe0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-24 10:48:46 -07:00
Daniel Verkamp
2d95465379 nvme/test: set phys_addr in stub nvme_malloc()
This prevents warnings about unused phys_addr variable in the unit
tests.

Change-Id: I022483735ba92eb112e541e6de37dc9a8c5d2b8e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-24 10:48:46 -07:00
Daniel Verkamp
b177c56881 nvme: clean up test_nvme_ctrlr_fail
Replace unnecessary allocation with a stack variable.

Clears up a potential NULL pointer dereference indicated by scan-build.

Change-Id: I81a7591729b0f1630bab9ce378716bd2369d6b85
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 16:15:48 -07:00
Daniel Verkamp
84cfc97fdf nvme: fix allocation in test_nvme_qpair_destroy
act_tr is supposed to be allocated with the system allocator
(malloc/calloc) rather than nvme_malloc.

Additionally, the size was incorrect - act_tr is an array of pointers,
not a single struct nvme_tracker.

Change-Id: I2c66b4891d11d0a8a32e3740c27fcfb42b1db2d7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 16:06:37 -07:00
Daniel Verkamp
25f0056e9b nvme: clean up test_nvme_completion_is_retry
Remove unnecessary allocation (which was missing the corresponding free
call).

Simplify code to avoid unnecessary ret_val variable.

Change-Id: I267e90d8744bf04907c610f0ff6899de7dddca71
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 15:58:35 -07:00
Daniel Verkamp
8217814218 nvme: remove dump_command and dump_completion
nvme_dump_command is totally unused aside from the unit test.

nvme_dump_completion was used in qpair, but it can be replaced with the
equivalent nvme_qpair_print_completion.

Also added the missing nvme_completion fields to nvme_qpair_print_completion
that had been printed by nvme_dump_command.

Change-Id: Ia5ee66f3553df06febe8f465d42e49a84c555dd2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 15:48:12 -07:00
Daniel Verkamp
a6cf458c9d nvme: tweak unit test PCI config space accessors
Make nvme_pcicfg_read32 set the referenced variable and make
nvme_pcicfg_write32 appear to read it so that the compiler doesn't warn
about unused/uninitialized data.

Change-Id: I4f06c0cca2fc11a8c6c5a60543c1c50a2f6a412d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 12:37:21 -07:00
Daniel Verkamp
7f9d22a494 nvme: clean up nvme_ctrlr_cmd_ut
Replace a bunch of allocations with stack variables.

Remove many unnecessary variables.

The actual tests are unchanged (and still not testing very much), but
this removes a lot of cruft that should make it easier to see what the
tests are actually doing.

Change-Id: I2c4810391cbf4d8edde88d5bc1c0dddcba3ae175
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-22 11:10:14 -07:00
Daniel Verkamp
1010fb3af1 SPDK: Initial check-in
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2015-09-21 08:52:41 -07:00