Commit Graph

459 Commits

Author SHA1 Message Date
Ben Walker
25270f1d7c Rename instance_id to shm_id and make it default to pid
By default, all SPDK applications will not share memory.
To share memory, start the applications with the same
shared memory id.

Change-Id: Ib6180369ef0ed12d05983a21d7943e467402b21a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-15 17:16:37 -07:00
Ben Walker
dd16a7277d rpc: Decouple RPC config from instance ID
Instance ID is too overloaded and the uses are beginning
to conflict. Separate the RPC configuration out.

Change-Id: I712731130339fee4fc8de4dc2d0fea7040773c58
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-14 14:47:25 -07:00
Daniel Verkamp
e5798096a2 gpt_spec: add casts to avoid undefined shifts
Make sure the SPDK_GPT_GUID() macro parameters are treated as unsigned
integers of the right sizes to avoid shifting into the sign bit or
beyond the size of an int.

Change-Id: I1638022692b09b179ffc770f845b053a96a8260f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-14 10:31:55 -07:00
Daniel Verkamp
4404793d09 string: make spdk_parse_ip_addr() params non-const
The host and port output parameters point into the (non-const) char *ip,
so it makes more sense for them to be non-const as well.

This allows the flexibility to pass non-const char pointers as the
output parameters, which will be used in the nvmf_tgt/conf.c parsing
code.

Change-Id: I1d5b102fc389c06d36432904e4fda944437b659e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-14 10:28:29 -07:00
Daniel Verkamp
84d904841f util: move common helper functions to util.h
These were repeated a few different places, so pull them into a common
header file.

Change-Id: Id807fa2cfec0de2e0363aeb081510fb801781985
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-10 09:38:52 -07:00
Daniel Verkamp
4a1d47ebea barrier: add compiler barrier and use it in MMIO
spdk_compiler_barrier() prevents the compiler from moving pointer
dereferences across the barrier.

Use this in the MMIO helper functions to ensure that the compiler can't
reorder operations around e.g. hardware register access.

Specifically, this fixes the compiler optimizing out writes to
g_thread_mmio_ctrlr in the NVMe hotplug handling code.

Change-Id: I6b9cec48da0e6d8d75825c28b12ece5251110080
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-08 09:20:41 -07:00
Ben Walker
08238af7ee util: Add a function to parse ip addresses.
This function parses in place by inserting null terminators.

Change-Id: I61cb97b87ec05d0183fbaa993fd3d7580a188bde
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-07 17:12:38 -07:00
GangCao
200217a47e nvmf: poll the NVMe subsystem once under more sessions case
Change-Id: Ie13a787eb0ff3b6b95fb6796871ac0b747b992ad
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-07 14:54:28 -07:00
Daniel Verkamp
ad063db506 nvmf: apply const to several char * arguments
These strings are not modified by the functions they are passed to, so
they can be const char *.

Change-Id: I11532f232990a305d706c14aac1b0f8f93b8f576
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-02 09:45:29 -07:00
Daniel Verkamp
b71c31335d event: move component descriptions to doc/ and rewrite
Change-Id: I53b061933319204f9153423fa18532712676287a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-31 14:50:29 -07:00
Daniel Verkamp
47eec4329e env: add API to get NUMA socket ID of a PCI device
Change-Id: Ic13298752bd5c68e3449d7dc004bd466ef468085
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-31 14:50:18 -07:00
Daniel Verkamp
2c0bc38754 bdev: add "split" virtual blockdev example
This virtual block device takes an underlying block device and splits it
into several smaller equal-sized block devices.

Change-Id: I6f6e686c1177b2e4885f7e88809ad329caae55bd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-30 13:51:18 -07:00
Daniel Verkamp
b809cdd3ab env: add spdk_mempool_create() socket_id parameter
Change-Id: I8ab0bb2c6e1fdf1681fbd049a096c1768e54dc27
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-30 13:05:30 -07:00
Daniel Verkamp
4c55092882 env: add a name for special "any socket ID" value
Change-Id: I1f339ee5ff80eee9cf7d6378daa71e2f59c158b2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-30 13:05:30 -07:00
Jim Harris
59408ad2ef test/event: rename event to event_perf
While here, make it clear this is a benchmark that
tests internal APIs.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie5a57fdcee12b47568542721095c49d28ece5529
2017-01-24 16:42:12 -07:00
Ben Walker
d77c030172 nvmf: NVMe-oF 1.1 adds cntlid to RDMA private data
Change-Id: I44ec5264fc93fa85706750cb23bbd0ed0587db81
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-23 16:46:55 -07:00
Daniel Verkamp
76977232ca nvme: mention TRID parsing function in struct docs
Change-Id: I9509155cd4400334e6a1b5c1fdff8546fe5266d5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-20 15:10:58 -07:00
Ben Walker
1cbbfb86fa nvmf: Make cntlid globally unique.
The code doesn't actually use this property of cntlid
for anything yet, but we will need it later.

Change-Id: I5fd514d75b903cc8769e7b9f196a4624e9cf876c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-20 10:02:32 -07:00
Daniel Verkamp
be8a9d6966 nvme: add transport ID string parsing function
Change-Id: I33c15c8a56c25667567b373d21a117cca1f756c7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-19 14:05:57 -07:00
Daniel Verkamp
5eacff59cd ioat: add Skylake Xeon device ID
There is only a single device ID for all channels on the SKX
implementation of I/OAT.

Change-Id: I90ee79b1b673a199754f1ca4c9e38e934294e261
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-19 09:39:59 -07:00
Daniel Verkamp
a53f617423 bdev: add API to translate to and from NVMe status
This prevents the need for bdev users and modules to manipulate the
internal bdev_io error.nvme fields.

For now, all non-NVMe error types are treated as a generic device error,
but translation from SCSI to NVMe could be added in the future.

Change-Id: I4e831b26a2f41bf2f405c7576d5019bb898d4d1b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-19 09:39:26 -07:00
Tsuyoshi Uchida
950b48de61 log: use facilitynames to set/get log facility (#81)
* log: use facilitynames to set/get log facility

Define our own facilitynames[] instead of defining SYSLOG_NAMES
2017-01-17 11:20:34 -07:00
Daniel Verkamp
2138676573 bdev: defer completions from within submit_request
If a blockdev module calls spdk_bdev_io_complete() within its
submit_request function, and the user's completion callback issues a new
I/O, it is possible to cause infinite recursion, consuming all available
stack space.

To avoid this, track whether a bdev_io is being processed by
submit_request, and if io_complete() is called in this case, defer the
completion via an event.

Change-Id: I6ccdb8ed4ee0d5738e6c9840d35431de52bd5fa2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-13 12:37:54 -07:00
Daniel Verkamp
249a68e92b bdev: add API to claim block devices
Claim the block devices used by iSCSI LUNs and NVMe-oF subsystems so
they can't accidentally be reused.

This will also be used by virtual block devices to allow layering of
bdevs.

Change-Id: I5384923fbf24f13f4ce720a797c5a628053d49f4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-11 16:49:39 -07:00
Daniel Verkamp
a96dc2592e bdev: remove event dependency from I/O callback
Use a plain function pointer + callback context for the bdev I/O
completion callback.  This is possible now because each I/O channel will
be polled on the core that submitted the I/O.

Change-Id: I29ee8e4a3430df11c74845adab840395b9bc5010
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-09 12:09:36 -07:00
Ziye Yang
ae07bdf125 scsi: make the io channel of scsi lun free correct
Previously, we did not calculate the ref for the LUN.

Change-Id: If2b7bc7d129e7efd994a7987ae2c421048969acb
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-01-06 09:50:22 -07:00
Daniel Verkamp
7ac9a4ecbb event: remove spdk_event_allocate() next parameter
The 'next' event pointer was never used in the entire code base (always
NULL).

Change-Id: I75f999d3a2e10512d86edec1a5a46ef263e2635b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
c3ede774c7 event: remove spdk_event_t typedef
Use 'struct spdk_event *' directly for consistency with the rest of the
API.

Change-Id: Ib41a9bf47f5b18f4aebf5f4dee055455cb12ef7d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
9d90154537 event: move definition of spdk_event to internal
Change-Id: I63ab7fe99b76e810543cff5962a6d535b0ddb203
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
44ef085bed event: pass arg1 and arg2 directly to event fn
This allows the elimination of the spdk_event_get_arg1() and
spdk_event_get_arg2() macros, which accessed the event structure
directly; this was preventing the event structure definition from being
moved out of the public API header.

Change-Id: I74eced799ad7df61ff0b1390c63fb533e3fae8eb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
3d528833d5 event: move default opt values out of public API
The public API user is supposed to retrieve the defaults via the
spdk_app_opts_init() function.

Change-Id: Ie2bd6e809b2d47dbd5d62d396e8715f89f4052d9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
2931a3efef event: remove 'complete' parameter from poller_register
The spdk_poller_register() function provides a way to pass an event to
call once the poller is registered, but it is always NULL in the current
code base.

Change-Id: I459bf40ae4d050589577d113b7984f1563aaa9cc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
7b01af8fd2 event.h: split non-public API into spdk_internal
Change-Id: Ie783df6cf387286ab882107fb9d4ce12358602e2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
f99eb85595 event: remove spdk_event_get_next() from API
The event->next field can be accessed directly from within the event
library implementation, and public API users should not be using it.

Change-Id: I98a1f0017e03e951d0c4eee3c7989b04324e57d1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
66f4dce74a bdev: remove spdk_bdev_io_submit() from API
It is only used within bdev.c and can be static.

Change-Id: Id6e2cd9e5dd61a3ef1e1a27993d7a5ea7728bff2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
1e85d9ef32 bdev_module.h: move to spdk_internal/bdev.h
This is consistent with the other internal-only API headers.

Change-Id: I2c4748977d38a6c173311d26197d6273c168da7d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
c5582f2720 barrier.h: add some minimal docs
Change-Id: Icd8af783713f80fd560092411782fe68f89b0d9a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
c720c8a342 assert.h: document SPDK_STATIC_ASSERT
The Doxygen build does not define static_assert, so the doc comment
needs to be on the definition under the #else branch.

Change-Id: Ib05ddc729c274810d2963716995ac7c9ce68896b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Daniel Verkamp
f1a9afa9fc assert.h: split UNREACHABLE into internal header
The definition of SPDK_UNREACHABLE uses the build-time DEBUG definition,
which is not available in the public API.

Change-Id: I1862c99fa5c85ccd3483f94e9c35de531da57f3c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-05 11:57:18 -07:00
Ben Walker
df46c41a4c nvme: Unify spdk_nvme_discover and spdk_nvme_probe
They were very close to the same already, so finish the job.

Change-Id: Ifba9e3b2d11a3e70cbfbe46f57a67552db2757ed
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-19 11:22:57 -07:00
Daniel Verkamp
6854710d6d likely.h: fix spdk_likely condition
The __builtin_expect(), as written before, would have generated the
right branch taken/not taken condition, but the return value was the
opposite of the cond value.

We need to double-not the value to convert it to a 0/1 value while
preserving its original 0/non-zero sense.

Change-Id: I38101ff3ed8e89fc6516cfcdf7d642651545e4ff
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-15 13:01:08 -07:00
Daniel Verkamp
d24ea9009a nvme: add offset to spdk_nvme_ctrlr_cmd_get_log_page()
Change-Id: I1af4950995062f892062f29db85da2a8dd793d85
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-15 11:16:14 -07:00
Daniel Verkamp
e6d1a5ac36 jsonrpc_server: allow user to specify socket type
Change-Id: I811d8c4e3659775519ca61dae31c1fe17cd7142a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-15 08:06:33 -07:00
Daniel Verkamp
0346dd775e nvme: add ADRFAM (address family) to transport ID
This isn't used yet in the NVMe library, but it will be necessary later
for supporting non-IPv4 addresses.

Change-Id: I167ce63ad25b0e0c9aa192b12d764c8d078e67f9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-14 10:14:10 -07:00
Daniel Verkamp
92ee5fc4be nvme: rename queue_size option to io_queue_size
This better describes what the field controls (it does not affect the
admin queue size).

Change-Id: I851ae46fb4ed0fce819af07ae235824e0fc817e6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-13 15:23:13 -07:00
Tsuyoshi Uchida
b28125b9de bdev/nvme: add CSTS in blockdev_nvme_dump_config_json (#85)
* bdev/nvme: add CSTS in blockdev_nvme_dump_config_json

* bdev/nvme: delete shst

- delete shst
- change from spdk_json_write_string_fmt to spdk_json_write_uint32
2016-12-12 16:57:20 -07:00
Ben Walker
32e838af3c nvme: Remove probe_info, just use transport_id
The probe_info was reduced to just containing a
transport_id, so remove probe_info entirely.

Change-Id: Ica9a22d126cd14e282decd3eea1a0afe0460f099
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-12 10:49:17 -07:00
Ben Walker
6c2e170dc7 nvme: Remove pci_id from probe_info
This can be obtained by parsing traddr into a pci_addr,
then getting a handle to the pci_dev and asking for all
of the pci information.

Change-Id: I1948cbd3ec65611293192ef5558ace19dd444d4c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-12 10:49:13 -07:00
Ben Walker
3da43e64e4 nvme: Remove pci_addr from probe_info
This can be obtained by parsing the traddr.

Change-Id: Idaf35066cbf900c87e771a44934de99fb5420001
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-12 10:46:50 -07:00
Ben Walker
9511b2a20b env: Add spdk_pci_get_device
This function will return a device handle from a pci
address.

Change-Id: I323d92c71014ef571f3df9f19c2ec887844707e8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-12 10:13:16 -07:00
Isaac Otsiabah
7c60aec01e nvme: add I/O timeout callback
Change-Id: Ie6220590467b88fe1e63b4b0f8a01221fc0c1206
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-10 16:17:18 -07:00
Ben Walker
4caf3c563a env: Add a function to convert pci addr to string
Convert an spdk_pci_addr to a string.

Change-Id: Idab0a16822cc37d7095d19f062dfca65356211e8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-09 14:39:51 -07:00
Ben Walker
5f78155fde nvme: Embed a transport_id in the discovery_info struct
Instead of repeating the fields, just embed a transport_id.

Change-Id: I282704c9d59784abd5f7c93be4e47c673fcf6dde
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 11:48:21 -07:00
Ben Walker
4af9f06c73 nvme: Rename discover_info to transport_id
This is a small step toward making discovery more like
scanning a local PCI bus.

Change-Id: Ie7149ad060f2eeb56939b1241187bdf09681f2aa
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-08 11:48:21 -07:00
Daniel Verkamp
f93fd72680 env: split PCI drivers into individual files
Change the PCI enumeration API to individual functions per device type
so that only the drivers that are actually in use get linked into the
final executable.  All of the common code is still shared internally in
the env_dpdk library.

Change-Id: I2ba83afe59202a510f999a0674e23e60b6581221
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-06 09:30:55 -07:00
Daniel Verkamp
13827a74a8 nvme: do not detach automatically on hot remove
The user's remove_cb should detach the NVMe controller when it can
ensure that it is no longer in use.  In the interim (between remove_cb
and spdk_nvme_detach()), the controller will remain in a failed state,
so any new I/O submissions will return an error code but not crash.

examples/nvme/hotplug is not yet updated for this change, but that will
be done in a separate patch.

Change-Id: I8827ba36f9688ccb734e7871f20f11ec11e88f96
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-05 11:13:16 -07:00
Daniel Verkamp
9d025383eb nvme: rename nqn fields in public API to subnqn
The discover and probe 'nqn' fields are subsystem NQNs, so name them
subnqn to be consistent with the spec and the rest of the code and to
distinguish them from host NQNs.

Change-Id: I4a80fbc1f4b037c8a4f91c8f28d2a96e47c66c47
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-01 08:08:19 -07:00
Daniel Verkamp
89136259ec nvme/rdma: add hostnqn to spdk_nvme_ctrlr_opts
Allow the host NQN to be overriden when connecting to NVMe over Fabrics
controllers.

Change-Id: I8fcf2e89ae7d9722677e834f76a8fe805c52f91b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-01 08:08:19 -07:00
Ziye Yang
2e6ec373bf nvme/rdma: fix the I/O qpair creation issue
Change-Id: I357f4a83736977d319175445b4d65443f57b2c6f
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-11-30 16:57:18 -07:00
Cunyin Chang
56765aa39f env_dpdk: Add spdk_pci_device_[attach|detach]
These functions will attach or detach from a PCI device. Attaching
typically means mapping the BAR.

Change-Id: Iaaf59010b8a0366d32ec80bb90c1c277ada7cfe7
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-11-30 14:10:52 -07:00
GangCao
73e926f087 nvme: add thread safety comment for spdk_nvme_probe()
Change-Id: I8460a6fddcf383781c520f36a08df1b0a802a709
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-29 12:52:50 -07:00
Daniel Verkamp
c454900960 log: print trace flag names in SPDK_TRACELOG()
Change-Id: I962ee098818f48563e67f9b4214bc3519eee48b4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-28 13:15:08 -07:00
Daniel Verkamp
6ca517d460 nvmf: split subsystem lookup from host check
This allows us to print better error messages when connecting to a
subsystem that exists but does not allow a specific host.

Additionally, we can now return the correct error code for a host that
is not allowed.

Change-Id: I16cd4ac2745cf50bb54601b464b0d23954f86fda
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 16:34:13 -07:00
Changpeng Liu
a3ed1795cd nvmf: add subsystem check on creation and cleanup for nvmf rpc
Change-Id: I85826c99c450426c26870ae261a7b7c8daeba031
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-23 10:27:54 -07:00
Daniel Verkamp
1cb7e396a7 json: add printf-style spdk_json_write_string_fmt()
Change-Id: I9ea18072d4e54344f145a0b2d16aa6ab7f4d5e03
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 16:32:35 -07:00
Daniel Verkamp
7d5bcb4893 nvme: remove spdk_nvme_transport_type from API
Use the NVMe over Fabrics spec definitions for TRTYPE rather than the
internal library transport type.

Change-Id: Idead559a8f8d95274fc580d10e82033822e6eda8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 13:42:00 -07:00
Daniel Verkamp
9a40113a19 nvme: convert probe strings into char arrays
These need to be available for the lifetime of the probe_info structure,
so they can't be pointing at e.g. temporary buffers on the stack.

Change-Id: I5aaa898acf9314aab51600dd756f966965d37fd0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 13:42:00 -07:00
Daniel Verkamp
b4bd76bc63 util: add vsprintf version of spdk_sprintf_alloc
-Wformat-nonliteral needs to be disabled since clang triggers it on the
call to vsnprintf() now that it is nested two calls deep.

Change-Id: I228b9d099cfc2b65181941cbb4798b7f8eae3baa
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 11:52:00 -07:00
Daniel Verkamp
ae6fbf1d2d util: add spdk_strlen_pad() function
This is a counterpart to spdk_strcpy_pad() which determines the length
of a string in a fixed-size buffer that may be right-padded with a
specific character.

Change-Id: I2dab8d218ee9d55f7c264daa3956c2752d9fc7f7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 11:36:34 -07:00
Daniel Verkamp
635602718b nvme: clean up Doxygen comments in API header
Change-Id: I16548628fa4eebc7ebd1d24f2775d38135d26822
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-21 17:02:12 -07:00
Daniel Verkamp
cf3fb7bb7d bdev/rpc: add driver-specific data to get_bdevs
Change-Id: Ieb37c9fdb55b36b62adcb421ab1d0426052d23a4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-21 12:35:57 -07:00
Pawel Wodkowski
a1948352a3 lib/scsi: handle scattered input/output buffers for non IO commands
Fix buffer overflow/underflow for commands with alloc length scattered
into multiple preallocated buffers (eg. INQUIRY)

Change-Id: If6f7cabc7a6a7fb384bb015e14dc38548f484d0f
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-11-21 10:52:35 -07:00
Ziye Yang
246c39a7ee nvme: Add nvme over fabrics support
Change-Id: I6f6259e77baa5dc5861f31ec4a9034e15297d333
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-11-18 13:58:44 -07:00
Daniel Verkamp
cbc83c85db assert.h: remove unused SPDK_CONCAT macro
Change-Id: Ib0cff3720ae3f0dc20df655923acfa2dd70ced13
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-17 12:46:45 -07:00
Daniel Verkamp
5b63b8a448 copy_engine: rename spdk_copy_module_get_max_ctx_size() to spdk_copy_task_size()
Make the public API clearer - if the user wants to allocate a
spdk_copy_task directly, they need to allocate spdk_copy_task_size()
bytes.

Also change the return type to size_t for consistency.

Change-Id: I0f3757056757c510421d680c5b4532edd9bc2561
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 15:04:40 -07:00
Daniel Verkamp
945217d2b2 copy_engine: split internals into spdk_internal
Change-Id: I3102e9761888c5afdc20d1a1abc9abf50484233d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 14:44:35 -07:00
Daniel Verkamp
ee64969a7b copy_engine: add spdk_ prefix to types
Change-Id: I060718887950ee7f890e76d7e041e70db39974a2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 14:14:50 -07:00
Daniel Verkamp
d27b24c94b log: split internal TRACELOG macro into new header
The SPDK_TRACELOG macro depends on a CONFIG setting (DEBUG), so it
should not be part of the public API.

Create a new include/spdk_internal directory for headers that should
only be used within SPDK, not exported for public use.

Change-Id: I39b90ce57da3270e735ba32210c4b3a3468c460b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 13:33:51 -07:00
Daniel Verkamp
396c32c48f conf: move structures out of public API header
Change-Id: Id2a7f083d959c9bbe493c383e6c9578de34c5eae
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 10:33:16 -07:00
Daniel Verkamp
04c48172b9 conf: add accessors for section name and num
Remove usage of the conf structs so they can be moved out of the public
API header.

Change-Id: I1c7375ec7708b323f50af09aeb7b2b2c9c770df4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 10:33:12 -07:00
Daniel Verkamp
9df6675ebf endian: constify from_* functions
Change-Id: I8ee39258ce0ba759347ff0a9cec7c70a1495f8af
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 10:30:04 -07:00
Daniel Verkamp
5a5f25d6cd endian: add little-endian helpers
Change-Id: I38b910e90f567460443d44bbe3adef740c63d88c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 10:30:04 -07:00
Jim Harris
3d1b60557c env: add spdk_vtophys_register/unregister
These APIs can be used to register/unregister regions
of pinned, huge page memory that are separate from
huge page memory allocated by the default DPDK
allocations.  These APIs will be used by an upcoming
SPDK vhost-scsi target to enable SPDK to target
NVMe DMA operations directly to VM memory that has
been allocated by QEMU using pinned huge pages.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I649a4adeeb758b29bd29cd42c8872eed3d5d6ce9
2016-11-16 09:21:57 -07:00
Daniel Verkamp
e2abf192c7 env.h: fix coding style
Only function definitions should have a line break between the return
type and function name, not prototypes.

Change-Id: Ic547a6c6541e31bbf95e3d95a28077c9e6510ba6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 08:44:21 -07:00
Daniel Verkamp
fc9983b638 env: drop spdk_pci_device_get_class()
Now that the env PCI framework already requires enumerating devices
based on an enum of specific device types, it is not useful to query the
class code of a PCI device handle.

It is currently unused and does not work in its current form on FreeBSD
(it reads a file from /sys).  This lets us drop a big chunk of file
reading and parsing code.

Change-Id: I1d720398416ba3d6f91e077b807ec11a6de562cf
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-16 08:44:21 -07:00
Ben Walker
b43db69a44 nvmf: Remove spdk_nvmf_transport from public API
The details of the structure were removed earlier, but
now remove all references even to a pointer to the
structure. The user can refer to transports by their
string name.

Change-Id: I273356f46329ea5372dcd951eda6f14767477d69
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-11-16 08:11:46 -07:00
Ben Walker
bb5d8e506c nvmf: Combine nvmf_tgt_init and nvmf_transport_init
Change-Id: I6d0f92842f3b8626bc2c25b38bfa7f7ddea5e7cc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-11-16 08:11:46 -07:00
Ben Walker
3cbed2ed86 nvmf: Add some accessors for subsystem data
This is a step toward abstracting away the definition
of the subsystem.

Change-Id: I88b2aa107b27152620f51a1ca2a153792b4c85e9
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-11-16 08:11:46 -07:00
Ben Walker
f1017d7769 nvmf: Remove num from subsystem
It wasn't used for anything.

Change-Id: Ifc8c97481490f6389a739a37df03dea6c88ec692
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-11-16 08:11:46 -07:00
GangCao
47214fa6c2 API: add new comment to spdk_memzone_reserve API
Change-Id: Ia6ba71776de638636efa703d132a863424900d3c
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-14 10:38:12 -07:00
GangCao
621f96f7aa util/bit_array: use spdk_realloc for process sharing
Change-Id: I8fe49388e7bec9306474f27de7c17e767dfa19e8
Signed-off-by: GangCao <gang.cao@intel.com>
2016-11-09 15:04:20 -07:00
Pawel Wodkowski
f30f0c76f1 scsi: refactor usage of iov from spdk_scsi_task
This patch is preparation for fixing alloc_len overrun in SENSE 6/10 and
READCAP 6/10. To simplify code forbid usage of iov outside of
scsi/task.c.

This also drop SPDK_SCSI_TASK_ALLOC_BUFFER flag that obfuscate code. As
a replacement assume that if field alloc_len is non zero it mean that
iov.buffer is internally allocated. Functions
spdk_scsi_task_free_data(), spdk_scsi_task_set_data() and
spdk_scsi_task_alloc_data() manage this field.

Change-Id: Ife357a5bc36121f93a4c5d259b9a5a01559e7708
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-11-09 10:19:53 -07:00
Daniel Verkamp
1f3d48b22d bdev: move spdk_bdev_fn_table into bdev_module.h
The bdev function table should not be part of the public API.

Change-Id: I5d6f40d1b37c4471041c1c9d6253a3f92e9e9701
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-09 09:59:39 -07:00
Daniel Verkamp
0aec36be1f nvme: return virtual address in SGL callback
Instead of the next_sge callback returning the physical address
directly, make it return the virtual address and convert to physical
address inside the NVMe library.

This is necessary for NVMe over Fabrics host support, since the RDMA
userspace API requires virtual addresses rather than physical addresses.
It is also more consistent with the normal non-SGL NVMe functions that
already take virtual addresses.

Change-Id: I79a7af64ead987535f6bf3057b2b22aef3171c5b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-09 08:57:40 -07:00
Daniel Verkamp
3aaa9a5eb7 nvme: use canonical "spdk/" path in include
Change-Id: I05ab1781b04a23ecec8f31bf0f1492eb4627ac9d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-08 08:58:02 -07:00
Tsuyoshi Uchida
6583441f54 bdev: add members for SCSI sense information in spdk_bdev_io (#59)
Custom bdev modules can return any SCSI status and SCSI sense
information to a host by this patch. This is usefull when a custome bdev
module detect an error in the module and need to return meaningful
information to a host.
2016-11-07 13:14:47 -07:00
Daniel Verkamp
1ffec5d53a nvme: convert transport type to an enum
Function pointers will not work for the DPDK multi-process model (they
can have different addresses in different processes), so define a
transport enum and dispatch functions that switch on the transport type
instead.

Change-Id: Ic16866786eba5e523ce533e56e7a5c92672eb2a5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-07 10:42:18 -07:00
Pan Liu
fa5206c416 env: add wrapper to call function without thread affinity (#60)
Make a wrapper that spdk can call a function without thread affinity, and
call this wrapper to open rbd image.

Change-Id: Iadc87a948f43632abf497f88165483a0e269ba54
2016-11-07 10:32:16 -07:00
Jim Harris
3266d7dbcc app: add spdk_app_start_shutdown()
This enables using SPDK within a larger process that
is SPDK-centric.  In this case the process may start
SPDK and then wish to stop it explicitly (without a
signal).

While here, remove an incorrect comment - DPDK mempools
can be used from non-DPDK threads.  Also set the
g_shutdown_event to NULL after it is called.  After the
event executes, the event is freed and is no longer valid.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie4f07bee7d05fae683c72f6680cb3bcce2d4a119
2016-11-07 09:59:59 -07:00
Daniel Verkamp
52bbb267d8 event: process events in batches
Since we are usually going to be removing multiple events from the queue
at once, use the DPDK burst dequeue interface to improve efficiency.

Also rework the event queue runner to always process a fixed maximum
number of events per timeslice for simplicity.  This removes the
rte_ring_count() call from the hot path and improves fairness between
events and pollers.

Now that events are dequeued in bulk, we can also put the event objects
back into the mempool in bulk.  Add an env wrapper around
rte_mempool_put_bulk() and use it to free all of the events at once.

Basic performance benchmark using test/lib/event/event/event -t 10
is improved: previously ~40 million events per second, now ~46 million
events per second.

Change-Id: I432e8a48774a087eec2be3a64c38c339608af42a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-07 09:32:25 -07:00
Daniel Verkamp
dca887b7d8 env: remove spdk_pci_device_get_device_name()
It always returns NULL in the current DPDK env implementation and was
not used outside of a few ioat examples where it is not particularly
informational.

Change-Id: I14b237c33bc25ddebc6b36bfbd6a4edf6762e3ca
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 15:58:03 -07:00
Jim Harris
1732eeb4bb env: add spdk_malloc
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ieaca9fdded2231c6d01101b345ac6c9a01608eef
2016-11-02 14:15:15 -07:00
Daniel Verkamp
fcb00f3780 nvme: expand probe information to a struct
spdk_nvme_probe() will now provide a struct spdk_nvme_probe_info to the
probe and attach callbacks in place of the PCI device pointer.

This struct contains the useful information that could be retrieved from
the PCI device during probe.

The goal of this change is to allow expansion of the probe information
in the future when other transports (specifically, NVMe over Fabrics)
are added that do not necessarily use PCI addressing or device IDs.

Change-Id: I59a2a9e874e248ce5fa1d7f4b57c8056962ff3cd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 14:15:02 -07:00
Daniel Verkamp
bbd7e1c4da env: add spdk_pci_addr_parse()
Add a helper function that converts a PCI address from a string into a
struct spdk_pci_addr and use it in place of the various sscanf()
invocations throughout SPDK.

Change-Id: Id2749723f76db741567e01b4bcb0fffb0e425fcd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 14:15:02 -07:00
Daniel Verkamp
d921d9ed9f json: add spdk_json_write_[u]int64()
Change-Id: I29c2c8f8546774842adf7e77e7bb550735c6fccc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 09:10:54 -07:00
Daniel Verkamp
e912a90f77 env: pass PCI address when claiming devices
The PCI device claim function does not need the whole spdk_pci_device
structure, just the address.

Change-Id: If59df512043ee062cf9f759bdc104fc522625ba8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 10:07:30 -07:00
Daniel Verkamp
fd6ebca7a8 nvmf: only save PCI address in direct ctrlr data
The NVMe over Fabrics target was storing the PCI device pointer for each
direct-mode controller, but it only really needs the PCI address, which
is exposed via the get_nvmf_subsystems RPC.

Also update the same code path to use the new spdk_pci_device_get_addr()
function for brevity.

Change-Id: I0708b3331b7c279c1a86f0d7459b5deb40dd7c89
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 09:40:36 -07:00
Daniel Verkamp
ed1e7ca2d7 env: add struct spdk_pci_id and getter function
Use the new public PCI ID structure in the NVMe library to replace the
previously private struct pci_id.

Change-Id: I267d343917f60bdae949a824bc0fe67457cbbc0d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 09:40:36 -07:00
Daniel Verkamp
c0527befc5 env: clean up PCI address comparison function
- Split the part that gets a PCI device's address into its own function,
  spdk_pci_device_get_addr(). This is useful outside of the comparison
  function and is orthogonal to comparing addresses.
- Make the comparison function take two addresses instead of a device
  and an address.  The more general form will be useful with addresses
  that are not directly associated with a device.  Because of this, also
  rename the function from spdk_pci_device_compare_addr() to
  spdk_pci_addr_compare().
- Return a signed value similar to strcmp() so that addresses can be
  ordered, not just compared for equality.

Change-Id: Idf304454af09ea57f1e1d5dc3a39b077378cecad
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-01 09:40:36 -07:00
Daniel Verkamp
93de96b412 nvme: add Keep Alive Timeout feature support
Add a field to struct spdk_nvme_ctrlr_opts that allows the user to
specify a keep alive timeout, and add automatic submission of Keep Alive
commands to spdk_nvme_ctrlr_process_admin_completions().

Change-Id: Ib282299a571d8edc59c7933418751bc3a6c98b40
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 10:28:55 -07:00
Daniel Verkamp
c56b53a89e json: add flag to format when writing
Specify SPDK_JSON_WRITE_FLAG_FORMATTED when creating a write context to
output more human-readable JSON.

Change-Id: Ie1f0451496aae7e36e4cdb1f05edb4bc4963be17
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 10:23:13 -07:00
Tsuyoshi Uchida
a5f0327897 scsi: translate nvme error to scsi error (#54)
This patch translates NVMe status code to SCSI sense according to NVM
Express: SCSI Translation Reference.

http://nvmexpress.org/wp-content/uploads/NVM_Express_-_SCSI_Translation_Reference-1_5_20150624_Gold.pdf
2016-10-28 13:06:45 -07:00
Wenbo Wang
c257e5b4ad nvme: add quirk to delay checking device readiness (#56) 2016-10-28 11:26:31 -07:00
Piotr Pelplinski
a2d0fa5351 spdk: add support for readv and writev in scsi layer
This patch adds support for spdk_bdev_readv in scsi layer.
It also fixes write so that it uses multiple iov's instead of one.
Currently we should use only task->iov (for single vector operation)
or task->iovs (for multiple vector operations).

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Ia3b2f6d18fd212b11d7b63b11dc46ec5bbc74788
2016-10-26 04:24:08 -07:00
Wenbo Wang
8bf37ee769 nvme: change nvme_intel.c to nvme_quirks.c
Make the quirks mechanism generic in preparation for quirks for devices
from other vendors.

Change-Id: Ic003b020a38f1b966021db30e3f2bce9cf6a1a0d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-24 17:01:26 -07:00
Piotr Pelplinski
074b6d2430 spdk: remove iobuf from spdk_scsi_task
This patch removes reduntant field in spdk_scsi_task and
fixes all logic to use iov.iov_base

Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Change-Id: Ie2fa1e2357b6383c118d05aec9206d1c60537d40
2016-10-24 09:11:05 -07:00
Ziye Yang
51b9664203 scsi: Make scsi sense data build more clear
Change-Id: I072abaae2d00ab84d7322f3dadd8dd30608b1a1c
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-10-21 08:54:01 -07:00
Ben Walker
cfafcc3edd nvmf: Init transport before adding listeners
Change-Id: I1fbaca75c6b95127ff2b6ac7c0ea0f0a918b9405
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-20 16:22:58 -07:00
Ben Walker
93ab45d68c nvmf: Add an accessor for transport name
This allows the entire transport structure definition
to become private.

Change-Id: I9ca19edbfc3cfb75b9b113a89bb2b90bc499ab16
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-14 15:26:45 -07:00
Ben Walker
1e6ffa0394 nvmf: Add a public API header
This changes as little code as possible while still creating
a single public API header. This enables future clean up
of the public API and clarification of the exposed
concepts.

Change-Id: I780e7a5a9afd27acf0276516bd71b896ad301c50
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-14 15:26:31 -07:00
Pawel Wodkowski
113f8e23a7 bdev: enable IO vector operations
This patch enables vector operation for bdev drivers aio, malloc and
nvme.
The rbd driver still handle only one vector.

Change-Id: Ie2c1f6853bfd54ebd8039df9a0305854ca3297b9
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-10-14 16:21:24 +02:00
GangCao
f81888b2f9 nvme: add PCI BDF in spdk_nvme_ctrlr to check whether same ctrlr
Change-Id: Ic8eb395bbfcc688e9c999a6d0026b70c24d386e3
Signed-off-by: GangCao <gang.cao@intel.com>
2016-10-13 09:50:32 -07:00
Ben Walker
535827c559 env: Eliminate remaining usage of rte_memzone
This was only used for debugging. Everywhere else
used the spdk_memzone abstraction.

Change-Id: I8a828ea3c7abccb66c8a027cb13de43c560ff7a1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-12 09:53:32 -07:00
Jim Harris
81b3d6c9fc Revert "bdev: enable IO vector operations"
This reverts commit 422eab7106.
2016-10-11 15:52:10 -07:00
Ben Walker
bfdc02ab48 nvme: Eliminate nvme_impl.h and use the swappable env lib.
Change-Id: Ibbc557b732d5b0858a2922a7a442c4b17a0d579a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-11 13:34:09 -07:00
Ben Walker
c0f04cedd0 env: Move memory pool into env library.
Change-Id: I8f384f4571a7b1936ff0388bb0c9fba8dcff8cc3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-11 13:33:41 -07:00
Pawel Wodkowski
422eab7106 bdev: enable IO vector operations
This patch enables vector operation for bdev drivers aio, malloc and
nvme.
The rbd driver still handle only one vector.

Change-Id: I5f401527c2717011ecc21116363bbb722e804112
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-10-11 12:17:47 -07:00
Ben Walker
898c10147c env: Move memzone wrappers to env
Change-Id: Iaa4f4a1a1eefb8bed262e1167f13cb7eacd5edaf
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-06 09:07:42 -07:00
Ben Walker
7c3a6d8c43 env: Move tsc functions to env.
Change-Id: Ieb1caabd76b1af9fdc7a95698ae09c86dce134bd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-06 09:07:41 -07:00
Daniel Verkamp
3e8487f88e bdev: shuffle spdk_bdev_io members for packing
Change-Id: Ia4264615b004d2dbfc9d6238cdacf6e987f2a207
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-05 16:47:01 -07:00
Ben Walker
0dd80395f3 env: Move pci.c from util to env
This allows users to swap their PCI library from
libpciaccess/dpdk to another mechanism using the standard
method for swapping out the env library.

Change-Id: Ib2248f8b43754a540de2ec01897e571f0302b667
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-05 11:53:24 -07:00
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
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
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
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
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
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
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
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
Jim Harris
0babf8ce81 bdev, copy: move all I/O paths to use I/O channels
bdev and copy modules no longer have check_io functions
now - all polling is done via pollers registered when
I/O channels are created.

Other default resources are also removed - for example,
a qpair is no longer allocated and assigned per bdev
exposed by the nvme driver - the qpairs are only allocated
via I/O channels.  Similar principle also applies to the
aio driver.

ioat channels are no longer allocated and assigned to
lcores - they are dynamically allocated and assigned
to I/O channels when needed.  If no ioat channel is
available for an I/O channel, the copy engine framework
will revert to using memcpy/memset instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I99435a75fe792a2b91ab08f25962dfd407d6402f
2016-09-26 14:02:07 -07:00
Jim Harris
06ef766bc0 scsi: add spdk_io_channel support
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I189ea68c8550bbaeab79be36cb3c4faba7cd2f69
2016-09-26 14:02:07 -07:00
Jim Harris
746a54bef8 bdev: create new get_channel/put_channel function pointers
Also implement these functions for all of the bdev drivers in
the tree.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Idea97743d601150044b1fe2d9d76e922d46d3ee1
2016-09-26 14:02:07 -07:00
Jim Harris
eb605a8203 copy_engine, ioat: add spdk_io_channel support
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I40db1b39882b68147aee4520cbd056f99901cfe4
2016-09-26 14:02:07 -07:00
Jim Harris
ee66e58e0a util: add spdk_thread and spdk_io_channel
This patch adds a basic framework for creating I/O channels
for I/O devices.  An spdk_io_channel represents a one-to-one
mapping between a calling thread (represented by spdk_thread)
and an I/O device that the thread will perform I/O operations
on.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I658ab7f995cc962f4e2a204e058cdd3ad3fd735d
2016-09-26 14:02:07 -07:00
Daniel Verkamp
f0fb6c6d4a event: return status code from spdk_app_fini()
Change the return type from void to int so that the result of
spdk_subsystem_fini() can be reported.

Change-Id: I811c25513e41573ca0c9cb111512d7705d107f66
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-23 12:31:47 -07:00
Daniel Verkamp
53ec54c929 ioat_spec.h: rename xor to avoid C++ keyword collision
Change-Id: I4b51b8adf273b12794e0c98dd99e7f29cdf689c1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-21 09:37:43 -07:00
Daniel Verkamp
5962499740 Add likely/unlikely branch prediction annotations
Change-Id: Id20b7c646735178349de8c4c2095bb0e8865d6c7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-16 15:20:35 -07:00
Daniel Verkamp
6c5f05f177 util: add bit array data structure
Change-Id: Idab4473fa23486e72334ec07d0853c6325197c20
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-15 15:47:56 -07:00
Jim Harris
f93bb8a32d Switch spdk_bdev_read/write arg order for length and offset.
This matches the general order (LBA start then LBA count) for
the NVMe API.

While here, fix a copy/paste error in a debug message (write
instead of writev).

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ice326af5d6025867dffed4d1f6c7b81fb9eba5eb
2016-09-14 10:51:25 -07:00
Jim Harris
edbed73064 Rename and move fd related helper functions to fd.c.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ieccdd778348e8709ca4ef6cdf4f58f40021638db
2016-09-14 10:51:25 -07:00
Jim Harris
8aa5539ee4 nvme: silence conversion error in spdk_nvme_opc_get_data_transfer()
Including nvme_spec.h in a C++ source file and compiling with -Wall
results in an invalid conversion warning when implicitly casting
from int to enum spdk_nvme_data_transfer.  So add an explciit cast
to silence the warning.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I54fefeb03b13ff47baa2bcff830330c2b2963493
2016-09-08 15:49:58 -07:00
Daniel Verkamp
7bdba4437d bdev: make fn_table a const pointer
The table of bdev function pointers should not need to be modified at
runtime.

Change-Id: I3e8876fc83df9296ce528231269b1a905c96072c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:30:28 -07:00
Daniel Verkamp
02ccb0f791 bdev: make check_io callback optional
If a bdev doesn't need to be polled, allow it to specify NULL for the
check_io function pointer to indicate that no poller needs to be
registered.

This will be useful for virtual blockdevs that don't have any associated
hardware to poll.

Change-Id: I0ef8f848587b0c200296805ccc710340dde683b5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:30:15 -07:00
Daniel Verkamp
97020b7ab6 bdev: fix type of spdk_bdev_io::parent field
It is always a spdk_bdev_io pointer, so avoid the need for casting back
and forth between that and a void pointer.

Change-Id: I41ac8801d6bec555a264ab66ddb72390ad879c01
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:29:33 -07:00
Daniel Verkamp
ffbc120d3e bdev: remove unused children counter
Change-Id: I0255c09d6fa46f8d02f30d77f1d8b330e388d375
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:29:32 -07:00
Daniel Verkamp
efa06a2bab bdev: remove free_request bdev backend function
This callback was only used for freeing buffers, but the buffers are now
managed by the bdev core, so none of the free_request callbacks actually
do anything.

Change-Id: Icfe2e6169e829159dda5e3d75a27d8f040de07c6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:29:32 -07:00
Daniel Verkamp
78b83fd7b2 copy_engine: add fill (memset) function
Change-Id: I626edcdaef8bd7a700fce5853fc2f85fc5b93ef7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:24:47 -07:00
Daniel Verkamp
ee13fe30de bdev: remove unused child_bdevs fields
Change-Id: Idd88503908bf3e5ec7ab39c2ae618cf890fbfa50
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-30 10:33:35 -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
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
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
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
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
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
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
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
Tsuyoshi Uchida
0d2330c2df nvme: Add some status codes specified in NVM Express 1.2b (#37) 2016-08-19 08:52:31 -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
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
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
ab90ab3cda iscsi: split spec definitions into iscsi_spec.h
Change-Id: Ia41f2e87f8bbfbcfc93ef6f4f2fa53893511c6a4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 15:53:57 -07:00
Daniel Verkamp
8cbf609982 net: remove unused #defines
Change-Id: Ifd84fc620cfec6302882bc967c3c135e896c70ac
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 13:46:20 -07:00
Daniel Verkamp
040c0193f4 bdev: change blocklen from uint64_t to uint32_t
This is the size of a logical block in bytes; 4 GB is more than plenty.

Also allows cleaning up casts to uint32_t in the SCSI translation layer.

Change-Id: I3ec2e2f41fd378f1a83f31aac25c46ef780f63e9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-05 09:03:15 -07:00
Daniel Verkamp
ac7151b161 app: add function to get current core ID
Change-Id: I3428fc9944f7117facc6488489187dcf8b6ed825
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-04 15:43:07 -07:00
Ben Walker
b91c6e0e4a scsi: Make OBJECT_SCSI_TASK public
Change-Id: Icb4a5532dffe671aaa8e2b1b619de17ead66d3b4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-04 13:15:23 -07:00
Ben Walker
d3090c8455 Add a network stack abstraction layer.
This is a useful abstraction when you want to plug in
a userspace networking layer instead of using the kernel.

Change-Id: I7039d2987e6abad9dcd1987fa105282b1598e2f5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-03 13:30:27 -07:00
Ben Walker
01d13145c9 scsi: Flesh out the public header file
The public header file was missing some required definitions.

Change-Id: Ic4f8028367b1e21ea00c02660ca36be28da54e37
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-03 09:47:28 -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
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
921bf34289 event: replace poller rte_ring with TAILQ
The rte_ring used for pollers is already single-producer and
single-consumer, so it is not providing any thread safety guarantees.
ALl modifications to the active_pollers ring are done from the core that
is running the reactor (via events).  This means the rte_ring can be
replaced with a simpler intrusive linked list.

This simplifies the removal of pollers in the middle of the list and
avoids extra allocations for the ring.

Change-Id: Ica149b7a1668a8af1e6ca8f741c48f2217f6f9bf
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-01 12:40:34 -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
Daniel Verkamp
201843a9eb nvmf: report virtualized NVMe version 1.2.1
The NVMe over Fabrics 1.0 spec corresponds to the NVMe base spec version
1.2.1, so we should pretend to be at least that new.

Change-Id: I36fc44c780de01d6c666e87b803cd47dba0e74c5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-26 09:23:38 -07:00
Daniel Verkamp
27c38d2c0c nvmf: merge NVMf ctrlr data into nvme_spec.h
Change-Id: I4c88986b5eebcb30b4b209240df813f91087e4de
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-25 09:55:34 -07:00
Cunyin Chang
43123aedbc spdk: Add ctratt field in identify controller data structure.
Add controller attriutes according spec.

Change-Id: I3fa7639b848da83832c3760f05833d44a5af1686
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-07-22 13:29:39 -07:00
Daniel Verkamp
c943e9ff4f trace: hard-code lcore history array size
Make sure the trace history that is exported via shared memory is always
the same size, regardless of DPDK configuration.

Also removes the necessity of including DPDK headers from spdk/trace.h
(so we have to fix up other files to include what they use).

Change-Id: I32f88921fd95c64a9d1f4ba768ae75e2ca5d91da
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-22 12:50:44 -07:00
Cunyin Chang
6cd40b9946 nvme: Add definition for keep alive timer feature.
Change-Id: I31259ab6d8656cbc5b1369ed4062ce3a7bde6dc5
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-07-22 08:45:13 -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
08ac16c978 subsystem: add explicit symbol reference in DEPEND
Make SPDK_SUBSYSTEM_REGISTER export a symbol that
SPDK_SUBSYSTEM_DEPEND will reference as an extern.

This makes sure that dependencies are included by the linker without
needing -Wl,--whole-archive around the subsystem libraries.

Change-Id: Id2e3c589d5a49bba1df6603a8e27dd2a7e7b44b7
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-20 13:34:51 -07:00
Daniel Verkamp
c61efe3950 scsi: add SCSI specification definitions
Change-Id: Ib34aef3be57219820aa05051eedbaba3808672ce
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-20 10:22:47 -07:00
Daniel Verkamp
746dc47d62 copy_engine: add memory copy offload engine layer
Change-Id: I1aee004d6e0938972ece16eba6317d02ba3b0042
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-20 09:57:22 -07:00
Daniel Verkamp
77cb78fadf nvme: add enumeration of Identify command types
Change-Id: I2f8dc3de48c2e5dc06ccc9d007373e361bffcf63
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-19 13:31:06 -07:00
Daniel Verkamp
543b6d0932 nvmf: remove definitions that duplicate NVMe
These NVMf spec structure definitions are the same as the equivalent
NVMe structs.

Change-Id: I21c45973b7843e3767c48f97ec42e7b446df296f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-15 16:34:48 -07:00
Daniel Verkamp
70601d5e0e nvmf: add Doxygen comments to discovery log page
Also add the missing ASQSZ field.

Change-Id: I67e67a6b4076de226d30882aa40afd78bc8be2af
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-15 16:34:46 -07:00
Daniel Verkamp
baf523b5d8 nvmf: add _subtype to TSAS structures
Fix the naming to match the spec.

Change-Id: I5e2fba54c796f8d1f11d61fb3d131aabc5c90503
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-15 10:23:46 -07:00