Commit Graph

1038 Commits

Author SHA1 Message Date
Ben Walker
b9fbdd189a env: Move malloc/free wrappers into env
Change-Id: Ief591f5e23c4ae06cb77fab647a7afd082450a73
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-05 11:51:52 -07:00
Ben Walker
a4747c6048 env: Make the environment library configurable.
This allows users to swap out SPDK's third party
libraries for an implementation based on their own
framework.

Change-Id: Ia0b7384ce5e31acba5ad0d7002dec9e95b759c52
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-05 11:51:37 -07:00
Ben Walker
a30b5532cb memory: Rename to env
The new env library will wrap all third-party library
calls and be easily swappable with alternate implementations
at build time. For now, it's just the memory library
renamed.

Change-Id: I26a70933289f8137107208ba75f7520fd7a33da0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-05 09:49:35 -07:00
Krzysztof Jakimiak
25749728b6 spdk: tweak tracedump
Increased printed data width, added data offset indices.

Change-Id: I44f81396e33870109c2bece5e152657f8a24a56a
Signed-off-by: Krzysztof Jakimiak <krzysztof.jakimiak@intel.com>
2016-10-05 09:40:21 -07:00
Krzysztof Jakimiak
46b7d49af0 spdk: add iov buffers to struct spdk_scsi_task
Preparation for SGL support (readv/writev).

Change-Id: I14a116d764ebc582ea0a0077cc5a0d0bac638cb0
Signed-off-by: Krzysztof Jakimiak <krzysztof.jakimiak@intel.com>
2016-10-05 09:40:13 -07:00
Daniel Verkamp
04d5f47f7d iscsi: convert subsystem startup timer to event
Change-Id: Iae21b07b152b439ae55fc30fb525a3e3a126b0ed
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-05 09:11:58 -07:00
Ben Walker
6b1e4e732d Drop libpciaccess and switch to DPDK PCI
This patch also drops support for automatically unbinding
devices from the kernel - run scripts/setup.sh first.

Our generic pci interface is now hidden behind include/spdk/pci.h
and implemented in lib/util/pci.c. We no longer wrap the calls
in nvme_impl.h or ioat_impl.h. The implementation now only uses
DPDK and the libpciaccess dependency has been removed. If using
a version of DPDK earlier than 16.07, enumerating devices
by class code isn't available and only Intel SSDs will be
discovered. DPDK 16.07 adds enumeration by class code and all
NVMe devices will be correctly discovered.

Change-Id: I0e8bac36b5ca57df604a2b310c47342c67dc9f3c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-04 15:59:00 -07:00
Ben Walker
f4140ad023 nvme: Change the deallocate interface to generic dsm
Provide a convenience wrapper for general purpose dataset
management commands. The previous wrapper for deallocate
was difficult to use correctly and only for deallocate.

Note that the name is "dataset_management" as opposed to
"data_set_management" to match the NVMe specification.
It's questionable whether "dataset" is valid English, but
it is best to match the specification.

Change-Id: Ifc03d66dbabeabe8146968cf8a09f7ac3446ad68
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-04 14:36:09 -07:00
Ben Walker
d7bbac146c nvme: Add asserts to nvme_ns_cmd unit test.
Change-Id: I3295cf9a44fb6818bc8afe7dbdabbbdfa0003ee1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-04 14:34:07 -07:00
Daniel Verkamp
2105a33b43 iscsi: convert global shutdown timer to poller
Change-Id: Ib2005dbc8e384052659e3f10360432d81c339d26
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-04 14:12:11 -07:00
Daniel Verkamp
d19d17b398 rpc: convert rte_timer to spdk_poller
Change-Id: I7bea4382fc8d46579a2b5c5b066dcef881541b02
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-04 14:12:11 -07:00
Daniel Verkamp
6b566ff11d changelog: document nvme request_mempool change
Change-Id: I397a5a7871545e5e401bce0926c3f3a4365aab05
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-04 14:10:43 -07:00
Daniel Verkamp
1085e6fd40 autotest: only delete partitions on NVMe namespaces
Don't try to delete partitions on NVMe block devices that are already
partitions.  For example, clean up nvme0n1 but not nvme0n1p1.

Change-Id: I1f642abd7f6ff6b9b6c08d65afee04b9bc9a3430
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-04 12:20:44 -07:00
Daniel Verkamp
2f777920c9 test: run more unit tests under Valgrind
Where possible (for tests that don't require DPDK), run the unit tests
under Valgrind to check for memory leaks and out-of-bounds accesses.

Change-Id: Ic7b3cdd39a6d59f4e41b4a161be3363f6b076f65
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-04 09:38:34 -07:00
Daniel Verkamp
7e69966975 test/jsonrpc_server: allocate large structs on heap
Avoid putting the large JSON-RPC server structs on the stack in the unit
test code, since it confuses Valgrind.

Change-Id: I598530810aa23e802d07cd1bb94de16920f33dac
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-04 09:38:34 -07:00
Daniel Verkamp
c20aa93181 doc: add README.md for Doxygen and online docs
Change-Id: I9af8a77ac1faccf950669f8e61c6ea4d596209c7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-03 14:23:15 -07:00
Ben Walker
db69cad95c nvme: Handle inactive but allocated namespaces
Namespaces can be allocated but inactive, which causes
the identify namespace command to fail. Handle this
case so that attaching to the controller does not fail.

Change-Id: I9d692f8e7841a9315a737b0a5e44d9b4e4484a13
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-03 13:55:56 -07:00
Daniel Verkamp
d31df7042a test/cpp_headers: autogenerate header test files
Rather than requiring changes to a static list of header files, use the
GNU Make wildcard function to generate a .cpp file per header.

This also tests whether each header includes all of the system headers
for the types it uses.

Change-Id: I05b82510b194533672568019e138d7d1aad2e86b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-03 10:24:18 -07:00
Daniel Verkamp
b827279285 net: include stdint.h for uint*_t types
Change-Id: Iceda29ed5ee7b8c9a41fd4f3ab8b3aa52b596339
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-03 08:41:37 -07:00
Daniel Verkamp
59955a12d2 event: allow unregistering a poller within its poller fn
Modify the spdk_poller_unregister() function so that it works correctly
when unregistering a poller from its own callback function.

Change-Id: I57fa5ebd8a8bad522e34f597b406a4726f1b76ad
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-03 08:41:26 -07:00
Jim Harris
08a6cba2f0 util: add stdbool.h include to io_channel.h
A previous commit added use of 'bool' but did not add
a stdbool.h include.  All files including io_channel.h
already were including stdbool.h, but adding it here
so that we do not depend on that for future usages.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaa88a0747889fe02f327059c99bc751c9ab326f7
2016-09-30 15:30:25 -07:00
Ziye Yang
c1341b0718 bdev: Add RBD support in lib/bdev
This patch will add a new bdev module, rbd.
It can make ceph rbd as the backend of iSCSI
target.

Change-Id: Id5eb3b159ee607052e3c33a2e59d721739fd9977
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-30 15:26:28 -07:00
Ziye Yang
6c4a07ecbe scsi: change spdk_put_task to spdk_scsi_task_put
Change-Id: I2598627523b2a78b68d7e7fdadbb7d8ef44592b9
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-29 15:42:29 -07:00
Daniel Verkamp
19dff91a1b scsi: replace off_t with uint64_t
These offsets are passed to the bdev I/O functions, which take uint64_t
offsets.

Change-Id: I1d597d066dfb64b6c7658906e7ee8e6fb2f8e4db
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-29 13:32:34 -07:00
Daniel Verkamp
bcd1edeae4 nvmf: replace off_t with uint64_t
The offset variable is used to store the result of a uint64_t * uint32_t
multiplication; a signed integer is not the correct type for the result.

Change-Id: If1fb22314ba7e3cec91808cc051678f809c9e58b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-29 13:27:39 -07:00
Daniel Verkamp
a87d8a45a2 iscsi: replace incorrect off_t with ptrdiff_t
This code calculates the difference between two pointers and then stores
it in an off_t, which is intended for file offsets.

In this particular case, the offset will never be large enough to
overflow off_t, but use the correct ptrdiff_t type anyway.

Change-Id: I6b159bf0286a7f5962d08b9894538f4d99c8647b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-29 13:25:32 -07:00
Daniel Verkamp
d5dffc0596 bdev: replace off_t offsets with uint64_t
off_t is problematic for use as a file/block offset: it is signed, and
on 32-bit platforms, it can be 32 bits (depending on the settings of
_FILE_OFFSET_BITS and _LARGEFILE_SOURCE).

The blockdev layer already uses uint64_t to represent offsets; replace
the blockdev module uses of off_t in internal functions with uint64_t
to match.

Change-Id: I77a2e594572c56f1cd8a7a080f985ea5b27c35f3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-29 13:13:32 -07:00
Ziye Yang
aa5c7d54d7 util: fix dev not free issue in spdk_io_device_unregister
The free function is missed for dev in spdk_io_device_
unregister function.

Change-Id: Id212344dfcde2ae4780c631e3443f530ef25cfd1
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-29 11:04:44 -07:00
Ziye Yang
8c00dca640 iscsi: add parameter to simplify process_task_completion
For process_read-task_completion, add a
new paramter and remove the duplicated code
since this function is the critical path

Change-Id: I6a56327def717ee965c701383f01d6745a8c6988
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-29 11:04:31 -07:00
Ben Walker
1ad2c3ea73 nvmf: Add support for multiple sessions per subsystem.
This feature should only be used if clients are coordinating
with one another.

Change-Id: I89a437441a7e3fbcc1e5f6efa1c8e970ade7c2ec
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-29 11:04:15 -07:00
liupan1111
0bde77082d Fix some cppcheck errors on lib/iscsi & lib/scsi. (#41)
Fixed error types:
 1 nullPointerRedundantCheck;
 2 unsignedLessThanZero;
 4 invalidPrintfArgType_sint;
 5 arrayIndexThenCheck
2016-09-28 13:55:56 -07:00
Daniel Verkamp
e445f16bac unittest.sh: build log library earlier
Now that the NVMe and I/OAT libraries depend on the log library, log
needs to be built earlier in the Travis-CI unit test script.

Change-Id: I189800934007fe8365cdfd5eb4cd797eed252b73
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-28 13:38:53 -07:00
Daniel Verkamp
109fc9561e test/io_channel: fix one more NULL fatal assert
This was added after the previous SPDK_CU_ASSERT_FATAL change was
merged.

Change-Id: I9d26fcd78157b6c9b232ac1e7484d0939cc90612
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-28 10:28:08 -07:00
Ben Walker
a17ad921e2 Replace RTE_VERIFY with assert
We already require the assert header from the C standard library,
so use that instead of RTE_VERIFY to further isolate DPDK
dependencies.

Change-Id: I4a718af858c88aff6080e33e6c3dd533c077b8f4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-28 10:15:56 -07:00
Ben Walker
29004b6738 ioat: Use log library instead of ioat_printf
Change-Id: I10a71b5c83f60d3ef1bbf83b464813405edd1938
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-28 10:15:56 -07:00
Ben Walker
b0e349a804 nvme: Use log library instead of nvme_printf
Change-Id: Ic9b2db9bff3a914b3e5021695287157f1e076f9f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-28 10:15:55 -07:00
Daniel Verkamp
9e33504370 test/bit_array: add a few more tests
Add some checks to hit paths not covered by the current tests.

Change-Id: If8e7977ab8327eacfa33657d0a167f3b935b0113
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-28 08:32:42 -07:00
Daniel Verkamp
326a0224b2 readme: convert list of features into doc links
Change-Id: I01fa93ca51576c5b356fc2193f81e210ef411908
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-28 08:20:09 -07:00
Jim Harris
32aa4fa0a3 util: add context parameter for unique I/O channels
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I296992b2e03b9b516cfd26726405e49616ad08a5
2016-09-28 07:53:47 -07:00
Jim Harris
c1e3a87bf7 util: add 'unique' parameter to spdk_get_io_channel
Some subsystems may wish to create unique I/O channels
which are not shared across all users of the same I/O
device on the same thread.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3ade3675d57338cf85b6a301285e6f392bd6cd2e
2016-09-28 07:53:47 -07:00
Ziye Yang
ff38547d80 iSCSI: change return value of spdk_iscsi_conn_free_tasks
We need to return -1, when there is still tasks. From the
usage, return 1 is wrong.

Change-Id: Ibf1b53e0be92818c73590c0b4211d34332073c74
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-27 16:34:37 -07:00
Daniel Verkamp
634786e583 test/io_channel: add to autotest and unittest.sh
Also remove libspdk_util.a from the io_channel_ut linker command, since
it already includes the tested C file directly and doesn't depend on any
other util library functions.

Change-Id: I4b3fc4d57b5af4524b53664365f6ba52686e4b80
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-27 16:32:36 -07:00
Daniel Verkamp
93c986865f test/io_channel: use SPDK_CU_ASSERT_FATAL for NULL checks
The test can't continue if a NULL pointer would be dereferenced.

Change-Id: If857057c69679de3be08c4605d15bc2b3892210a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-27 16:32:36 -07:00
Daniel Verkamp
a8cfc54e14 test/lib/scsi: add init_ut gitignore
Change-Id: I0b25963bdb2249c46aa51fb447998a185eb9368d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-27 16:25:14 -07:00
Daniel Verkamp
c85360da36 build: warn about old-style C function definitions
Fix the existing cases (all missing void in parameter lists) and enable
the warning to prevent new ones from being introduced.

Change-Id: Ieaf00b3dfd5daf1e21fcbefb124514882e8996c9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-27 16:23:07 -07:00
Daniel Verkamp
db8b791f9b build: check for warn_unused_result violations
Change-Id: I217d23b31e67752a621d6f66d601f1457fb2bc94
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-27 15:55:01 -07:00
Daniel Verkamp
bb817900c9 test/nvme_impl.h: restore posix_memalign() check
If posix_memalign() fails, it may not have updated buf, so set it to
NULL explicitly.

Change-Id: I756bdc59ec1e31987ad3e6754eec4e2194b95074
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-27 15:34:34 -07:00
GangCao
372942e569 nvme: move global request_mempool allocation into nvme_impl
The user no longer needs to create the request pool.

Change-Id: I83bb8948143d4cc961d232f9f30df3106d5e0eab
Signed-off-by: GangCao <gang.cao@intel.com>
2016-09-27 14:25:39 -07:00
Cunyin Chang
d7734d165b test: Use rpc methods to create nvmf subsystem.
Change-Id: I5db50a2db0b7096a10fb97406d51410c1678dc92
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-09-27 12:04:05 -07:00
Ziye Yang
b1e3279ae0 nvmf: change nvmf_session to spdk_nvmf_session
Make the structure definition consistent

Change-Id: If147066cee041a2a357bc7efcb1f882f914e5b42
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-27 09:57:17 -07:00