Commit Graph

855 Commits

Author SHA1 Message Date
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
Daniel Verkamp
4ace96533d nvmf_tgt: build even if RDMA is disabled
Build the now-generic nvmf_tgt app regardless of whether the RDMA
libraries are available.

The nvmf_tgt app Makefile still has to add the RDMA libraries to the
linker command, but otherwise it does not need to know anything about
the avilable transports.

Change-Id: Ibeeac5ed998be1eb12a673a1340893dbb53110b7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-19 09:47:51 -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
Ben Walker
5d21943624 nvmf: Allow cores not handling subsystems to go idle.
Use the event framework's new delay parameter to allow
for idle cores to sleep for up to 1ms at a time.

Change-Id: I665f38e590c07338418892afe0e75b0b2c79706e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-19 09:46:45 -07:00
Daniel Verkamp
c16ca1ade7 nvmf: remove app framework subsystem from library
It is no longer needed, since the nvmf_tgt app handles initialization
and shutdown.

Change-Id: I051afe2b4fcbd09b32998386c63f591a0ab343c2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-19 09:26:02 -07:00
Daniel Verkamp
8c931adaa4 nvmf: move shutdown cleanup to nvmf_tgt app
Change-Id: Ie1f5869dbbea3300d0aeb32e60a95d9a3c7ea535
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-19 09:17:38 -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
Daniel Verkamp
9a4d6d54b8 iscsi: include sys/socket.h for inet_pton()
Fix FreeBSD build of tgt_node.c.

Change-Id: I73ec536227d58d6e36d11a4e6c925e330860d4b4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-18 09:33:10 -07:00
Daniel Verkamp
cf700d8d4b iscsi: remove unused #include <libaio.h>
Change-Id: Ifff4a29ec06477bd7c4f69d426feb98bd2790bde
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-18 09:25:03 -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
4179c0acc5 nvmf: expose subsystem poll as a public API
This will be used in future patches outside the library.

Change-Id: I1fcf5709944a884e161e5a6a9eaec033a995a812
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-17 10:01:37 -07:00
Daniel Verkamp
4c6e4d4963 nvmf: move acceptor poller into nvmf_tgt app
The NVMe over Fabrics target library now exposes a simple function call
that polls the acceptor once, and the application handles registration
of the poller.

Also rename the transport function pointers related to the acceptor so
they better reflect their purpose.

Change-Id: I5fa0d516586bf17e73afeb88ff3c2d5b0d46794d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-17 10:01:37 -07:00
Daniel Verkamp
47dde07521 nvmf: allow target to start without RDMA devices
This will become more important when other transports are added.

For now, it is also useful to be able to start nvmf_tgt on systems
without RDMA hardware.

Change-Id: I6b9002cc7711f928c4e6b73adcd9b677349ebdd6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-17 10:01:37 -07:00
Daniel Verkamp
0c00baf9bc nvmf: move conf file parsing to nvmf_tgt app
Change-Id: Iaf09d39046bceae023739d49e31804e150bb19d4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-17 10:01:37 -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
ab7deee952 nvmf: fix double subsystem list removal
spdk_shutdown_nvmf_subsystems() was removing the subsystem from the
list, but nvmf_delete_subsystem() also wants to remove it, so drop the
extra removal.

Also rewrite the shutdown loop as a TAILQ_FOREACH_SAFE() to make the
static analyzer happy (and make it more obvious that the loop will
terminate).

Change-Id: Iccadafa77d9cd3e26be21c0f11e62cfc1ef0197c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-17 09:30:37 -07:00
Daniel Verkamp
574a801941 nvmf: check Connect command RECFMT field
Verify that the record format is the one we support (only 0 is defined
by the spec for now).

Change-Id: Iddf038b381e540134abf572e0545c97a0ef71d5f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-17 09:12:48 -07:00
Daniel Verkamp
975362d236 nvmf: verify that Connect NQNs are null terminated
The spec requires that NQNs are null terminated and maximum of 223 bytes
long, despite the Connect command fields being larger (256 bytes), so
add checks for both subsystem NQN and host NQN before using them as null
terminated strings.

Change-Id: I343d9e44a09ab4d0f6654feba460b31e976c4e56
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-17 09:12:33 -07:00
Changpeng Liu
dcf49aa018 nvme: disable the controller from generating INTx# interrupts
Since we bind the NVMe device to UIO driver to protect against native
NVMe driver, but for Admin queue, there are still INTx interrupts
exist, as all the completion for Admin queue will be processed in
user space, so we don't need INTx anymore.

Change-Id: Ife5b3e410ae95690ed0f3f9a2f2dfaf55a7797b5
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-08-17 09:08:33 -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
Daniel Verkamp
c3162ca0fb readme: add C++ compiler to dependency list
A C++ compiler is required to build the trace app. Add it to the list of
packages to install.

Change-Id: Ia30a42721d10a07a1b7949a815eb5616f575d878
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-16 15:44:12 -07:00
Changpeng Liu
8a23223e1b nvmf: Allow users to configure which lcore each subsystem runs on
Users can specify the core for each subsystem and the acceptor listen routine
to run on different cores for performance consideration.

Change-Id: I4bd1a96f39194c870863b4b778e6ea7cf8fc1a2d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-08-16 09:20:42 -07:00
Cunyin Chang
077fe1da65 nvmf: Add nvmf subsystem dependence on bdev
prepare for the virtual controller.

Change-Id: I022e2c88cf8332c035b51e843d6b3ced4716df9c
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-08-16 08:54:25 -07:00
Daniel Verkamp
33dde51f83 doc: organize Key Functions into tables
Change-Id: I21ff868ddbea4e6819f74b7b01c344abe532ee19
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-15 16:07:26 -07:00
Daniel Verkamp
25d331b21f nvmf: add Doxygen title to spec header
Change-Id: I43e6646d756684f0f34e49f64a86444cb43f44c0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-15 16:07:26 -07:00
Daniel Verkamp
0d8aaedba6 doc: replace another "NVMf" with NVMe over Fabrics
Change-Id: I70ce4d61539b5c27d7672b2bac04c6b33a7ca51b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-15 16:07:26 -07:00
Daniel Verkamp
0b252a7000 Revert "nvmf: only poll admin queue once every 10 ms"
This is causing issues during shutdown because the poller removal is not
synchronized with the rest of the cleanup path.

This reverts commit 7dfc5e922d.

Change-Id: If95c4b72c5d120f18bdc3db6d7d532ad1aada642
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-15 15:49:19 -07:00
Daniel Verkamp
0022304275 iscsi: track conn lcore for informational purposes
The lcore_id field in the get_iscsi_connections RPC was removed in
commit 5d8c94536a7d1d4c1f0ee3349188bf0e7e8c9e74; add a field to
spdk_iscsi_conn to track the lcore so this can be re-added.

Change-Id: I6c9574829466b168880728f4620401987fc7dd3c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-15 10:22:04 -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
GangCao
9dfc65b081 nvme: Create Proc Type for primary and secondary processes
Change-Id: I283ce03ed50fd12b9da906b0e09b4559b41776ef
Signed-off-by: GangCao <gang.cao@intel.com>
2016-08-15 09:21:20 -07:00
Daniel Verkamp
7dfc5e922d nvmf: only poll admin queue once every 10 ms
This should enhance performance, since the hardware admin queue poll
function takes a mutex and should not be in the performance path.

Change-Id: I7e4acde0337aaf7079811612cba5348acf0a467d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-12 10:55:04 -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
Daniel Verkamp
5c9d560b5a Work around DPDK 16.07 FreeBSD rte_zmalloc() bug
Replace other critical rte_zmalloc() sites that actually depend on the
memory being zeroed.

Change-Id: If6856ad44a4c50869811d3ce9411c993ce88018d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-11 17:59:38 -07:00
Changpeng Liu
17dbcf58c1 scsi: fill BLOCK LIMITS VPD page filed with suitable value
Linux block layer driver will use the maximum transfer length field to
split IOs larger than this value. We should set the field according to
iSCSI target limitation.

Change-Id: I03ee35bb96f0949418bb976a6c8013f88622a324
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-08-11 09:23:22 -07:00
Daniel Verkamp
bd2a3a0998 iscsi: make param tables const
Allow the tables to be in the read-only data section.

Change-Id: I58199a86d4d44dbad7baed397b2e148c45b3a3de
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-10 22:21:22 -07:00
Daniel Verkamp
dd2e6164c9 nvme: replace rte_zmalloc() with rte_malloc() + memset
rte_zmalloc() is broken and does not actually return zeroed memory on at
least DPDK 16.07 on FreeBSD, so do it ourselves.

Change-Id: If8da93ead0b3911c8bca24aa27ed90dc00b8a9a4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-10 16:12:59 -07:00
Cunyin Chang
fcc97846fa iscsi: Return check condition if the IO size exceed the maximum value.
Change-Id: Ibd36dda002559dbbf050253eb06ca24a179dbb66
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-08-10 11:32:26 -07:00
Changpeng Liu
3c5eac6bfb scsi: return correct data length of VPD page 0xB1 and 0xB2
For VPD page 0xB1 and 0xB2, the scsi target did not return correct
value to the initiator, so return the length with correct value.

Change-Id: Ic17d804ca00d490fd6a2f833db5c9b73ce8dc160
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-08-11 09:56:36 +08: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
0fc7daffe5 Replace "NVMf" with "NVMe over Fabrics" in docs
Use the final official spec name rather than a non-standard
abbreviation.

Change-Id: I4d797294be35b2fbf7b39570ea3246eb71c8d8ce
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 16:35:11 -07:00
Daniel Verkamp
181e568e7f iscsi: factor out epoll-based idle conn management
Change-Id: I16a2c268a646f859000eee3168656f5d39f951ad
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 15:53:57 -07:00
Daniel Verkamp
542664e032 iscsi: remove unused g_epoll_idle_cnt
This value was incremented and decremented, but it was never used
otherwise.

Change-Id: I6e83a504cf2ef4043363ca04b77556c612068658
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 15:53:57 -07:00
Daniel Verkamp
3c8183956e iscsi: use spdk_app_get_current_core() for events
Change-Id: I3758c147b9aed291ecd5a1361e20786d4d377e19
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 15:53:57 -07:00
Daniel Verkamp
e2d622e0aa iscsi: replace RTE_VERIFY() where possible
In files that don't otherwise use DPDK, switch to the standard C library
assert().

Change-Id: I79756908ecf9a2e141b036321e42309db30b5e0f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 15:53:57 -07:00
Daniel Verkamp
c320f79aa6 iscsi: replace uses of sprintf() with snprintf()
Change-Id: Iafee68ca24e330208539a4d0a61596b1dc9f6dd9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 15:53:57 -07:00
Daniel Verkamp
cd1377c636 iscsi: remove uses of strcpy()
Change-Id: Ia1e8c639655462d0218e7465c046cf604c1443fe
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 15:53:57 -07:00