Commit Graph

899 Commits

Author SHA1 Message Date
Daniel Verkamp
a1d83c72bc nvmf: treat DSM attribute as bitfield
The Dataset Management command allows several operations to be specified
at once; the virtual controller only supports deallocate for now, but it
should just ignore the other bits in order to be spec compliant: "If the
Dataset Management command is supported, all combinations of attributes
[...] may be set".

The spec also explicitly states that it is acceptable for controllers to
choose to take no action based on information provided, so not
implementing the other attributes is fine.

Change-Id: Ia989dc1faa9c852660bf1299ea18fa8e7bdf4053
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-30 09:28:15 -07:00
Daniel Verkamp
3e9ddce6f3 test/nvmf: add virtual subsystem to nvme-cli test
Change-Id: I4880e227b90949a26670900baed6f6bcf836a66e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-30 09:28:15 -07:00
Daniel Verkamp
6ac8caf09f nvmf: fix log page ID extraction
Also add a diagnostic message if the requested log page ID is not
supported.

Change-Id: I7551b5905d5ebc29356839f0f9153dc86f237106
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-30 09:28:15 -07:00
Daniel Verkamp
a74ca147bb nvmf: split Identify command into functions for readability
Change-Id: I912e98e9e06e149365c425b1729bb8fcb6dc2887
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-30 09:28:15 -07:00
Daniel Verkamp
bc86133ecc nvmf: add notice for virtual namespace additions
Match the direct NVMe device backend by printing out each block device
that is added as a namespace to a virtual subsystem.

Change-Id: I5c2762ca1fbab3529c19c822c95c73b72e9dabbc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-30 09:28:15 -07:00
Daniel Verkamp
5e54cc4dba nvmf: enable dataset management based on unmap support
Rather than comparing the bdev name against "NVMe", use the new I/O type
supported API to query whether the unmap operation is supported.

Change-Id: I62c7a1ea5529366ff2ae4723b62f24ea78aa8193
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-30 09:27:32 -07:00
Daniel Verkamp
7d7f73d064 unittest.sh: temporarily disable scsi_bdev test
The scsi_bdev code now depends on lib/util, which needs additional
dependencies (libpciaccess or DPDK) to build beyond what is normally
installed on the Travis-CI system.  Drop that test from the Travis-CI
unittest.sh script until this is resolved.

Change-Id: Ic2c90b765d2812f485553db77b7a433a50861f7b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-29 09:53:26 -07:00
GangCao
dcd19bdb23 nvme: add the shared mutex init function for g_spdk_nvme_driver
Change-Id: Ib2a89beffb58004fdfd5a308feb6de2307dd5b81
Signed-off-by: GangCao <gang.cao@intel.com>
2016-08-26 14:34:21 -07:00
Ben Walker
6e09a48e42 bdev: Separate the module header from the public header
Bdev modules need a separate interface than public
consumers of the blockdevs.

Change-Id: I581ee493570c114f7e96b31a425bc077a791c71e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-26 09:40:06 -07:00
Ben Walker
ecb6e49d09 scsi: Include spdk/bdev.h from scsi_bdev.c
This compilation unit depends on bdev.h definitions, but
was only getting them due to #include ordering elsewhere.

Change-Id: I4fcbdb2582a40836bcabc3539cc558614fbfacfd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-26 09:40:01 -07:00
Ben Walker
b6e94ef17c bdev: Remove unecessary include from bdev.h
Change-Id: Ie8bfe32edd10f2e85bf1bc5e694853a7d6624310
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-26 09:40:01 -07:00
Ben Walker
0ea0a4e646 bdev: Use the reset enum type instead of an int
Change-Id: Ia1b6503b707d71d6e2687800e750f3c07634f8f3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-26 09:40:01 -07:00
Daniel Verkamp
9272088d93 bdev: add API to query supported I/O types
Some block devices do not support the unmap operation, and we may add
other optional I/O types in the future.  Add a method to check which I/O
types a specific block device supports.

Change-Id: I6e6414bf6b6482ea0224022d8326b252bd363c7f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-26 09:16:36 -07:00
Daniel Verkamp
1b957fa58e nvme/identify: print out controller data VER field
Dump both the MMIO region VS register and the Identify Controller VER
field, which should match.

Change-Id: I4c0eaa512424d85169a0f21ee86dbaedbfbc051f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-26 08:48:17 -07:00
Daniel Verkamp
1efc92c7f8 nvme_spec: define OAES bits in Identify Controller
Add bitfields for Optional Asynchronous Events Supported.

Also add it to the nvme/identify example.

Change-Id: Ifeb1cf8af94286a6cf437ec4b6f9e8b752c7d2f9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-26 08:48:17 -07:00
Daniel Verkamp
84812653be nvme/identify: interpret CMIC bitfields
Print out the multi-path I/O features in a human-readable way.

Change-Id: If1302933eff7649c31e21188f71cc361cc90ff01
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-26 08:48:17 -07:00
Daniel Verkamp
060ffe8dee nvme/identify: fix max data transfer when MPSMIN != 0
Correctly calculate the maximum data transfer size as defined in the
spec - MDTS is a power of two in units of the minimum memory page size.

Change-Id: Ifd517d3051a28d404246c5a5d342147aa69ceedc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-26 08:48:17 -07:00
Daniel Verkamp
76af27c0fc nvme/identify: fix Error Recovery Timeout spacing
Change-Id: I4c2f04d72ab80c5341d6d2e5390e9d835c4a67be
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-26 08:47:36 -07:00
Daniel Verkamp
b58995588c nvmf: replace htobe* with spdk/endian.h
Change-Id: I75a66ff4d554c7cd3fb607cbef7cd0da02ab9031
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-25 15:49:00 -07:00
Cunyin Chang
b4d9cca109 nvmf: Add support for virtual controller.
Change-Id: I413553fcf7315038b4ce4ac9ebea70fffbec9a3d
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-08-25 15:02:21 -07:00
Daniel Verkamp
d2ea70cafd iscsi: use spdk/endian.h functions
Switch from the non-portable <sys/endian.h> functions (htobeXX/beXXtoh)
to the SPDK endian conversion functions.

Change-Id: Id49b87f2e536c68f0d5d567e78e1990c0a37ef14
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-25 13:29:56 -07:00
Changpeng Liu
d7120a3ee8 nvme: Fix max I/O size enforcement when no stripe size is specified
Intel DC P3*** NVMe devices specify a desired stripe size, which was
used for splitting I/O. Not all devices, however, specify a desired
stripe size (such as the Intel DC D3*** line), and for only these
devices there was a logic mistake that overwrote the maximum I/O
size with a 2MB default. This patch corrects that error.

Change-Id: I94b72a3a3dd1dfa18bd638daf7e01a592eb6ed17
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-25 08:51:16 -07:00
GangCao
c4afe2804b nvme: change global pointer g_nvme_driver to g_spdk_nvme_driver
Change-Id: I6fcd2d61ab896ef52f430a5cce1f2fd44b809725
Signed-off-by: GangCao <gang.cao@intel.com>
2016-08-24 15:46:09 -07:00
Daniel Verkamp
c04b2968a6 nvmf: enforce NQN validity at creation time
Move the NQN validation into the subsytem creation function, and fix the
allowed size to match the spec.

The spec is not clear about the allowed NQN size; for now, interpret it
as 223 bytes, including the null terminator (222 bytes of actual NQN
plus one terminator byte).

Change-Id: If9743ab2fe009d9d852e8b03317d9b38d8af18dc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-24 13:34:47 -07:00
Daniel Verkamp
fd1ba17c16 nvme: match devices by class code with DPDK PCI
DPDK 16.07 introduced a new PCI ID field for matching by class code
instead of vendor/device ID. Use it to match all NVMe devices instead of
explicitly listing vendor and device ID pairs.

Change-Id: Ib2a5cc6833bf2b793d37d77caab97207f365df8f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-24 09:47:23 -07:00
Daniel Verkamp
bfe434fd88 Add GPT (GUID partition table) spec header
Change-Id: I14652412dc3ad45f83de8579b64ccefed1ca43c0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-24 09:41:05 -07:00
Daniel Verkamp
80d30bf903 app/nvmf_tgt: rename conf.h to nvmf_tgt.h
This header will be used as the general NVMe over Fabrics target app
include file.

Change-Id: Ia26ff6d97fb3fd3f2c55b43c15abbb0e58998e30
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-24 09:19:47 -07:00
Daniel Verkamp
467ea9e0a8 iscsi: add 'iscsi_top' monitoring app
Change-Id: Ief4efbc45f81ec59c75de28be701778e403b9f67
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-24 09:10:44 -07:00
Liang Yan
d66600ebf8 nvmf/test: update subsystem unit test
Change-Id: Icf5a1def906baf783853337b9e030a76ac40292a
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
2016-08-23 09:57:05 -07:00
Daniel Verkamp
1cac214f53 iscsi: remove unused header includes
Change-Id: I4ce69ad4a714ba0a1dadb6897fad68582e14307d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-23 09:32:19 -07:00
Daniel Verkamp
a5be12c376 nvmf: check validity of SQSIZE in Connect
Change-Id: I8185ed25a3067bb8882bf47ce7a6d2cd0361c597
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-23 09:21:16 -07:00
Daniel Verkamp
39cda18718 nvmf: rename trsvc -> trsvcid for spec consistency
Change-Id: I5f73ef20ba231a7b1721562964dfd50de9b2c735
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-23 09:03:28 -07:00
Daniel Verkamp
20bee521a6 log: dynamically generate usage for -t option
Change-Id: I8c709b507c4cb00092d5dc9b1e8ca1c0fe880b02
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-22 16:57:19 -07:00
Daniel Verkamp
32a046d7b8 nvmf: fill out SUBNQN field in Identify Controller
SUBNQN is a UTF-8 null terminated string according to the NVMe base
spec, so pad it with zeroes using strncpy().

Change-Id: I486161b26d91f3ea1fd17428e220b9f20a874732
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-22 12:58:59 -07:00
Daniel Verkamp
37402f490e nvmf: pad discovery TRSVCID and TRADDR with spaces
These are specified as "ASCII string", which means they should be
left-aligned and padded with spaces, according to the NVMe base
specification.

Change-Id: I25babe0ca417c2e16137b0bfc41fc7834277114e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-22 12:58:59 -07:00
Daniel Verkamp
98c8867e5a scsi: move spdk_strcpy_pad() into util/string.c
This will be useful outside of the SCSI code, so put it in the common
string utility file.

Also reorder the parameters so they match the order used in strncpy().

Change-Id: I9e25a59b64e4bedf04e5a96de463b1d8aa0ddac3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-22 08:58:07 -07:00
Daniel Verkamp
759dbf46d8 nvmf: unregister subsystem poller on shutdown
Clean up the poller and only then free the associated subsystem's
memory.  This prepares for future dynamic subsystem creation/deletion.

Change-Id: I9e56cbf8822814930fdbb662095c51b6ad40fbc4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-22 08:47:51 -07:00
Changpeng Liu
2641c31af2 nvmf: Listen for incoming connections only on addresses specified
Currently the NVMf target listens for new connections on any address.
Instead, listen only on the addresses specified by the user.

Change-Id: Idb6d37c422e442fc70a8673bd3fcfb9c27b57828
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-08-19 15:34:01 -07:00
Daniel Verkamp
f36f4a7985 test/iscsi: add a sleep before detecting device
Allow some time for the iscsiadm login command to finish before trying
to find the attached SCSI disk. This makes the reset test consistent
with other uses of iscsiadm.

Change-Id: I9521a41b51956643a437fcaccceefd256fb4b609
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-19 13:18:20 -07:00
Daniel Verkamp
5f9fe92a9b test/ioat: shorten test times to 1 second
Change-Id: I1eb513446b80681c801d4e9588e670cbd2e4b5a2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-19 13:17:54 -07:00
Ben Walker
a9f1988ed6 nvmf: Use nvme-cli to connect inside tests
Change-Id: I953a41a54e8eddcf07a8fa607c9a1e1a34e2b20c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-19 10:53:06 -07:00
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
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