Commit Graph

272 Commits

Author SHA1 Message Date
Piotr Pelplinski
1dbf53eebf vhost: add a library and app for userspace vhost-scsi processing
This patch adds a library, application and test scripts for extending
SPDK to present virtio-scsi controllers to QEMU-based VMs and
process I/O submitted to devices attached to those controllers.
This functionality is dependent on QEMU patches to enable
vhost-scsi in userspace - those patches are currently working their
way through the QEMU mailing list, but temporary patches to enable
this functionality in QEMU will be made available shortly through the
SPDK github repository.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Krzysztof Jakimiak <krzysztof.jakimiak@intel.com>
Signed-off-by: Michal Kosciowski <michal.kosciowski@intel.com>
Signed-off-by: Karol Latecki <karolx.latecki@intel.com>
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>

Signed-off-by: Krzysztof Jakimiak <krzysztof.jakimiak@intel.com>
Change-Id: I138e4021f0ac4b1cd9a6e4041783cdf06e6f0efb
2017-03-06 12:44:35 -07:00
Cunyin Chang
6da9e1792a nvmf: move the virtual mode related code to the virtual.c.
Change-Id: Ia68ffdd2019adba3a37295ee455e93f8e0427fa2
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-03 10:06:46 -07:00
Ziye Yang
bfe2897da3 nvmf,target: solve shutdown coredump issue
It is caused by this commit:
4163626c5c

nvmf_tgt_delete_subsystem registers the poller
with function subsystem_delete_event.
subsystem_delete_event is called asynchronously,
the deletion should happen in this function.
Otherwise, with the current code,

g_subsystems_shutdown = true
TAILQ_EMPTY(&g_subsystems) = true
when subsystem_delete_event is firstly called.

If there are multiple subsystems, the logic is wrong.
Thus other subsystem will never be delete. since
we already execute shutdown_complete().

Also add related test scripts.

Change-Id: I3823563fc9e8611c11a6d798685ff64e2939842e
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-02 09:39:48 -07:00
GangCao
fde3041296 app/nvmf_tgt: correct the parsing of listen addrs
Change-Id: I77ececd69884e58019e038096ebdcac8e87ede3a
Signed-off-by: GangCao <gang.cao@intel.com>
2017-03-01 12:26:48 +08:00
Daniel Verkamp
affd815c0e nvmf/conf: remove dead store of num_hosts
Change-Id: I0e129f1102f8a5925626fbeed3a5bf2341873874
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-24 16:13:47 -07:00
kaox2
2343b2ce22 conf.c: update num_hosts after parsing. (#125)
The number of hosts are not updated after parsing.
2017-02-24 16:07:02 -07:00
Tsuyoshi Uchida
f401557392 nvmf_tgt: modify removal timing of nvmf_tgt_subsystem from the list (#117)
subsystem_delete_event():
Delete TAILQ_REMOVE because nvmf_tgt_shutdown_subsystem_by_nqn has
already called TAILQ_REMOVE.
shutdown_subsystems():
Add TAILQ_REMOVE according to the above change.
nvmf_tgt_delete_subsystems():
Add TAILQ_REMOVE.
2017-02-24 15:08:44 -07:00
GangCao
6e8b6aea28 app/nvmf_tgt: rename spdk_nvmf_parse_subsystem_for_rpc
Change-Id: Ie07b8e593b757bcd1c796a2892292bffce2b77d7
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-22 19:13:05 -07:00
Ben Walker
18d26e42a3 env: Move DPDK intialization into the env library.
Change-Id: Ie3a324f1523ffa0ddb0bd6a24a9a3cd0acbf64b0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-15 17:16:37 -07:00
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
GangCao
222bac51e8 app/nvmf_tgt: delete subsystems for invalid AcceptorCore
Change-Id: Id88b6edb3c1e6ee8b06c6357c91a13c04891faa2
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-15 14:46:33 -07:00
Daniel Verkamp
3403d59522 nvmf_tgt: unify subsystem config parsing code
Use the construct_nvmf_subsystem RPC call handler code from the
nvmf.conf parser to factor out some of the duplicated code.

Change-Id: I1b8f9af03f4a774cbb5c06dda7c57286e8968204
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-14 11:27:14 -07:00
Daniel Verkamp
4f8ab58ac1 nvmf_tgt: add cross-socket warning to subsystem RPC
This is the same check as the subsystem configuration file parsing uses.

Change-Id: Id301a929e06f51b060256a3038e0c24120ccd308
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-14 10:28:29 -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
Ziye Yang
0456bd08cd nvmf/conf: call spdk_nvme_probe_cb via trid
Change-Id: Iae11ebd2c565d8f0d806bcca3615147fe3261e91
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-10 12:51:13 -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
Ben Walker
4baf5962e9 nvmf_tgt: Use new ip parsing utility function
Change-Id: Ia6575f8d7fb8be8002a5c1fec0abf04f837a0545
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-02-07 18:06:08 -07:00
Ziye Yang
38980dedfa nvmf,tgt: fix issue while shutting down nvmf tgt with CTRL + C
The phenoemon is that we can not shutdown the nvmf tgt.
The solution is that we need to adjust the shutting down orders of
nvmf tgt subsystem and rdma trasport layer.

Change-Id: Ie39657370b1574960e0ee7cf604cc5872db0bed3
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-07 17:43:45 -07:00
Daniel Verkamp
b3d229e02a iscsi_tgt: add modules to dependency list
Make sure iscsi_tgt gets rebuilt when a blockdev or copy module is
modified.

Change-Id: Ia10cfbb4b71b686e9a97c68be1d50ae1eebac21f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-03 15:15:38 -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
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
Ziye Yang
4440cd8d28 nvmf: Solve subsystem add/delete issue
When we do frequent same subsystem add/delete,
we will face the adding issue. For example,
1  Add subsystem A
2  Delete subsystem A
3  Add subsystem A  (Fail in this step).
The reason is that we did not correctly free
the listener resources of subsystems, and this patch
can solve this issue.

Change-Id: I6765a306a3f10c9a0f38c95dbba12e2a4073e705
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-01-30 11:14:38 -07:00
GangCao
4f752e1d75 nvmf_tgt: assign different core for subsystems under RPC mode
Change-Id: Ib751c45f916f66b682d3011397f1f8fe794b08d8
Signed-off-by: GangCao <gang.cao@intel.com>
2017-01-25 15:56:24 -07:00
Daniel Verkamp
d946f92079 nvmf_tgt: check existence of bdev in construct_nvmf_subsystem RPC
Change-Id: Ic1232e901ecea18dcf2f68b94ef966c343757618
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-18 16:08:04 -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
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
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
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
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
liupan1111
47f13f5eca iscsi_tgt: add daemon mode for iscsi target (#69)
* iscsi: add daemon mode for iscsi target

* change the default daemon mode of iscsi tgt to false
2016-12-06 17:15:19 -07:00
Daniel Verkamp
dfe9fa9bea env: do not link env lib with --whole-archive
It is not necessary, and it prevents the linker from removing unused
object files.

Fix the iscsi_tgt Makefile's library order so that env is added at the
end after the libraries that use it.

Change-Id: I241eb46703c12691444037a350be65143259e82e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-06 09:30:55 -07:00
John Kariuki
64fc291291 nvmf_tgt: add socket ID to NUMA warning message
Added the socket ID to the NVMe over fabrics target warning messages.
This will help during troubleshooting to check that the NVMe device, Subsystem and NIC are on the same NUMA node

Change-Id: Id750a5a7694c898bb61ea26089ea3098611d530a
Signed-off-by: John Kariuki <John.K.Kariuki@intel.com>
2016-12-01 16:12:23 -07:00
Ziye Yang
5f3761cf7e nvmf: change default AcceptorPollRate from 1 ms to 10 ms
If AcceptorPollRate is configured in configuration
file, the default value used will be given by
ACCEPT_TIMEOUT_US. So change the default value, it
can solve the performance degradation issue of
nvmf target.

Change-Id: I867bb03dd8b2b81b86911130babd0334d9857de8
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-11-28 12:17:17 -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
72054c70f6 nvmf/rpc: use spdk_json_write_string_fmt()
Change-Id: I7cf36201125a59637b43d4966d8f63e17947bc68
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 16:32:35 -07:00
Jim Harris
407b550ff4 build: define SPDK_LIB_LIST to simplify building dependencies and linker args
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia969f9e5ed01f4b58cec2559133347d836118131
2016-11-22 11:45:48 -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
Changpeng Liu
74c4833229 conf/nvmf: exit the process if we got invalid AcceptorCore input
Change-Id: Ib23ffb608de1c50c29207673958c55a3ef4c3850
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-18 12:53:01 -07:00
Daniel Verkamp
44e60dc47d build: consolidate library outputs in build/lib
Make it easier to use SPDK libraries by putting them all in a single
directory that can be added with -L rather than scattered around the
source tree.

Change-Id: I5c0f5dd6e7058b5f92fa9bc41548190ffc064761
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-17 13:15:09 -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
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
Daniel Verkamp
6c56bfa67a nvmf_tgt: remove uses of SPDK_TRACELOG in app
Change-Id: I28b50c71658e497ef723c908b1a896b941897d54
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-08 08:58:14 -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
e1baabee4a bdev: add get_bdevs RPC
Add an RPC interface to list all blockdevs and their properties.

Change-Id: I50db730d5eff8cffcbe8fe5df6b3461457e8581e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 09:10:54 -07:00
Daniel Verkamp
3c3824a3d2 nvmf_tgt: add list of libs that need whole-archive
Some of the SPDK libraries only expose constructor functions, so they
would normally be eliminted by the linker.  Add a new list in the
Makefile of libraries that must be linked with --whole-archive (while
still being added to the dependency list for the app).

Change-Id: I7e41a807c945468730fa84f1bdee23dfd6b59358
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-02 09:10:54 -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
Tsuyoshi Uchida
f78bcc4821 iscsi_tgt: modify usage (#55)
- Delete -v and -V from usage because they are not implemented.
- Add -q to usage.
2016-10-27 13:37:13 -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
Jim Harris
2848c8d1d3 nvmf: defer start of subsystem until fully initialized
Starting the subsystem consists of firing an event
to the subsystem poller's lcore and performing
I/O channel initialization (for virtual NVMe
subsystems) before starting the poller.

Previously the subsystem would be started immediately
when created, which was before the subsystem's
mode and other parameters (such as a virtual subsystem's
bdevs) have been set.  This resulted in no I/O channels
being allocated in virtual subsystem mode.

So break out the start code into a new
nvmf_tgt_start_subsystem() function, which clients
must call after fully initializing a subsystem created
with nvmf_tgt_create_subsystem().

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I56534668887ef99d2e892844acd12194920c3245
2016-10-13 09:12:21 -07:00
Daniel Verkamp
5ec0b3227d nvmf/rpc: make sure NVMe device is found in create
Extend the check added in commit
7552ee5512 ("nvmf_tgt: fail if NVMe
controller is not found") to the RPC interface.

Also remove the default PCI address from rpc.py, since it is not a
useful default - the user must specify a PCI address, which will vary
depending on the configuration of the machine.

Change-Id: If9a4e19ef2a84c9d839b467abc011046613f7168
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-13 08:50:03 -07:00
Daniel Verkamp
4afe9d1acb nvmf/rpc: make hosts parameter optional in create
Instead of a magical "All" value for allowing all hosts, allow the
caller of construct_nvmf_subsystem to omit the "hosts" parameter.

Change-Id: I97c7ae806a0be7142fb59708d47023e42e127fcc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-13 08:50:03 -07:00
Daniel Verkamp
45c041449f nvmf/rpc: don't allow namespaces in direct mode
create_nvmf_subsystem should not allow the user to specify any
namespaces in direct mode.

Also remove the default Malloc0 namespace in rpc.py; the user
should be required to specify the list in virtual mode.

Change-Id: I3aaf7c64b9ceee89a3f7db15760a669527adb29d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-13 08:50:03 -07:00
Daniel Verkamp
0c8a5d8ce6 nvmf/rpc: rename listen_addrs -> listen_addresses
Change the output of get_nvmf_subsystems to be consistent with
construct_nvmf_subsystem.

Change-Id: I6987f6cbd916a870e9b15f0faa3cce2ed6d49795
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-13 08:50:03 -07:00
Daniel Verkamp
b94e0dfdb2 nvmf/rpc: represent pci_address consistently
The get_nvmf_subsystems RPC reported the PCI address of direct-mode
NVMe devices as individual integers, but the construct_nvmf_subsystem
call requires pci_address in a string format (%x:%x:%x.%x).

Change get_nvmf_subsystems to format the PCI address in the same way
that construct_nvmf_subsystem takes as a parameter for consistency.

Change-Id: I6e55e9a9e73dd425fd560d609b86a2f839c53c61
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-13 08:50:03 -07:00
Ben Walker
18a2cc11c1 env: Remove unused DPDK headers.
Remove #includes for all DPDK headers that weren't
necessary.

Change-Id: Ib02522e0f04e64a1c98afceb7508cc0e8d931a9d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-12 09:53: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
Ben Walker
7f5b671db7 env: Convert some rte_mempools to spdk_mempools
This converts some, but not all, usage of rte_mempool
to spdk_mempool. The remaining rte_mempools use features
we elected not to expose through spdk_mempool such as
constructors, so that will need to be revisited.

Change-Id: I6528809a864ab466b8d19431789bf0f976b648b6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-12 09:53:32 -07:00
Ben Walker
2224ff2162 env: Replace rte_malloc with spdk_zmalloc
Use the env library to perform all memory allocations
that previously called DPDK directly.

Change-Id: I6d33e85bde99796e0c85277d6d4880521c34f10d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-11 13:34:09 -07:00
Ben Walker
8c5a2b0823 nvmf: Rename some uses of virtual to virt for C++ compat
'virtual' is a keyword in C++, so avoid using it in variable
and structure names in case any files are eventually
included from a C++ project.

Change-Id: I2122750445def63038af68a3000758e33b937f9d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-07 09:15:12 -07:00
Ben Walker
882b790bfa nvmf: Make the poll rate for the acceptor configurable.
Change-Id: I6517220ef3f1a76938313c566f4ba642805ba1c5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-07 09:15:12 -07:00
Ben Walker
a0a92ff4c2 nvmf: Combine acceptor_init/fini with transport init/fini
These 4 callbacks can be condensed into two callbacks, which
simplifies the API.

Change-Id: I069da00de34b252753cdc8961439e13a75d1cc68
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-07 09:14:53 -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
a4747c6048 env: Make the environment library configurable.
This allows users to swap out SPDK's third party
libraries for an implementation based on their own
framework.

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

Change-Id: I26a70933289f8137107208ba75f7520fd7a33da0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-05 09:49:35 -07:00
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
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
Changpeng Liu
f07a666646 nvmf: check the user's Subsystem configuration is optimal or not
For NUMA architecture, you may get performance drop if your NVMe
devices and transport devices located in different socket, with
this patch, the NVMf target will print a warning message to remind
the user that your configuration is not optimal.

Change-Id: Ia6013ef95984f0ce8c7f1ca86b89c0375686a188
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-09-28 17:51:11 +08:00
Cunyin Chang
d20b90b21e nvmf: Add support for RPC interfaces.
Change-Id: I6f0fe35bf2876df181ad11294b62d64d97dcac2c
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-09-26 16:07:30 -07:00
Jim Harris
06cf905c9a nvmf: allocate I/O channel for bdevs in virtual mode
I/O channels are not actually used for I/O yet however.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iaa3774ecacc7ec206c7c0c66e6b2f2d10c8fa785
2016-09-26 14:02:07 -07:00
Daniel Verkamp
884d076451 iscsi_tgt: report errors from spdk_app_fini()
Change-Id: Iae671fb7f7b3ac249256c70e8fc93b46e008219d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-23 12:31:47 -07:00
Ziye Yang
5dcf922cda nvmf: fix tgt subsystem delete related operations.
1 In our nvmf tgt implemention, we use the async
mode to delete the nvmf subsystem. However, when
we parse nvmf subsystem, we need to use the sync
function to delete the nvmf subsystem. Since if
there is error, we will call spdk_app_stop, thus
async functions will not be executed. It is
approved in my local test.

2 Add debug info in spdk_nvmf_delete_subsystem

Change-Id: Ia8ecd6eee1bbd25cb3e1ceeb0e2146f3f03be228
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-22 15:33:26 -07:00
Daniel Verkamp
7552ee5512 nvmf_tgt: fail if NVMe controller is not found
For subsystems in Direct mode, make sure the NVMe controller specified
is actually located during the probe call.

Change-Id: I7d5212ea628eadba3e720172a5ead8902eaaf6d0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-21 11:17:27 -07:00
Ziye Yang
6a6ef0d7e0 nvmf: update nvmf_disconnect to spdk_nvmf_session_disconnect
1 Rename this function and make it more meaninful, since
we have spdk_nvmf_session_connect which is used to link a
connection to the session
2 split spdk_nvmf_session_destruct.

Change-Id: I150df7ccdf4de3428d8cecbb286d5f7944510a8c
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-13 09:50:46 -07:00
Daniel Verkamp
bc0867dcaf nvmf: move subsytem poller to nvmf_tgt app
The application is now entirely responsible for scheduling subsystem
pollers and sending events between threads.

Change-Id: I88da1f53b5e8852c7c4acd6f0a7a1e2219fbed41
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-12 10:10:27 -07:00
Ziye Yang
9f2fc78e3f NVMf: Handle the memory leak issue of nvmf tgt
Reason: In acceptor_poller_unregistered_event, we
directly call spdk_nvmf_check_pools and spdk_app_stop,
it will fail the memory check.

And function nvmf_delete_subsystem_poller_unreg will
not be called since we already call spdk_app_stop.

Change-Id: I3ffa30c87b149a66cee1d87d1bb81d4dc8cc96b9
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-09 07:58:29 -07:00
Ziye Yang
dafac529a6 nvmf: fix bdev null pointer issue in spdk_nvmf_parse_subsystem
Need to check bdev != NULL, otherwise there will be a segment
fault later

Change-Id: I8aa74e7716decc3166f9f2abbbb0c8ff73816f84
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-09 07:57:58 -07:00
Cunyin Chang
9e501ce2fe nvmf: Remove the data structure spdk_nvmf_controller.
Change-Id: Ie6e8d0f60abc16216b8c95f12c658ba7cbb3aba0
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-09-06 13:54:58 -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
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
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
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
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
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
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
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
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
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
b8e5fbe688 iscsi: move g_flush_timeout into iSCSI globals
Change-Id: Ib77db9c4f0f1487fa8eb9e46409c7661dbb08cbc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 15:53:57 -07:00
Daniel Verkamp
31bb40dcf9 iscsi_tgt: print net framework name during startup
Change-Id: I5ae4d6605fcc1b5777fff6a73f2edcb9851ce805
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 14:01:50 -07:00
Daniel Verkamp
40c874105e iscsi_tgt: remove outdated comment blocks
Change-Id: I2173bd1920f54c55feb4956a3f78b173ca4f7f93
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-04 16:31:33 -07:00
Daniel Verkamp
5dbe2299cc iscsi_tgt: remove unused headers
Change-Id: Ie35a1c6bf54c484a94314112b85ea43d459b13dc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-04 16:31:14 -07:00
Daniel Verkamp
c48df8950a iscsi_tgt: add missing #include <stdlib.h>
Change-Id: I8dd467057d8de8b3f1888a6995c3ffe9d4969b8b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-04 14:59:37 -07:00
Ben Walker
1e92d78a10 iscsi: Add an iscsi target application
Similar to our NVMf target, this is an iSCSI target that
can interoperate with the Linux and Windows standard iSCSI
initiators.

Change-Id: I6961c5ef99f7b161c396330ed5b543ea29b0ca7b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-04 13:15:33 -07:00
Cunyin Chang
8c094266ac nvmf: Adjust the data structure of spdk_nvmf_subsystem.
Move the ctrlr and io_qpair out of spdk_nvmf_subsystem, package them
as a new data structure. Union the direct and virtual mode namespaces.

Change-Id: I839aee3372c6c57aa03a0be76f8aaeb5045ecdaf
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-07-25 13:56:00 -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
Ben Walker
2b9d85c448 nvmf: Remove host.[ch] and port.[ch]
These can be simplified and merged into the subsystem.

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

Change-Id: Ib3786acb40a34b7e10935af55f4b6756d40cc906
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-15 14:35:24 -07:00
Daniel Verkamp
21c450e187 nvmf: add transport function pointer table
Make the core NVMf to transport interface generic and allow for multiple
transport types to be registered.

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

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

Change-Id: I8cd90a9aaa85dcefcc9b0f8f2e7b6af21958b2a8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-14 12:58:17 -07:00
Daniel Verkamp
fdc1278440 nvmf: simplify session and connection cleanup
The whole cleanup process is now started by
spdk_shutdown_nvmf_subsystems().  Each subsystem will clean up its
session, if any, and each session will clean up its connections.

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

Change-Id: Ia471b2b88a711f05738cf93068c4f3a8c9a3039d
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-07-01 10:07:42 -07:00
Ziye Yang
88669436f9 nvmf: remove unnecessary nvmf.h
The function call of spdk_nvmf_check_pools can be
directly put in nvmf.c.

Reason: This pool is created by nvmf subsystem,
it should be recycled by this subsystem.

Change-Id: I49e49bcb56079fc25d26b1f5078a1808c2f8e189
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-06-28 12:45:33 -07:00
Daniel Verkamp
39cc59635a build: include -lrt and -lpthread in LDFLAGS
Simplify the build rules so that common libraries are always linked.

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

Change-Id: I4c50fa3aa59cae013d3385e38fbb830794299f6e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 09:04:02 -07:00
Ben Walker
dc6a0a2bd2 nvmf: Rename init_grp.h/c to host.h/c
Match the names in the specification.

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

Change-Id: I10d1145881f9a0358d7effe2d2d9851899413e1b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-09 14:25:26 -07:00
Daniel Verkamp
9b00a03a24 nvmf: drop spdk_nvmf_check_pools() parameter
There is only a single global g_nvmf_tgt that can be passed to this
function, so remove the parameter and use the global directly.

Change-Id: Ia1a2a1e6cd3801101ddeb4de5526dd115fa7ef8f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-09 14:25:26 -07:00
Cunyin Chang
f7ccfc6160 nvmf: Remove unused start_fn in spdk_app_opts.
Change-Id: I8f54612305af419ccc19356c09fe5053d52cd59e
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-06-08 09:13:14 -07:00
Daniel Verkamp
0f912a0eaf nvmf: add NVMe over Fabrics userspace target
Change-Id: I739916824d033bd1a8f8b7f5def09e58f23d13cb
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-06 15:21:25 -07:00
Daniel Verkamp
22f741d539 trace: update shm name to match event lib
Add the '/' prefix to the trace shm name.

Change-Id: I4cf1011b639f299314ea379ba3fb626f5c2c787a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-01 10:14:46 -07:00
Daniel Verkamp
bdece622f5 trace: add tracepoint library and app
Change-Id: I472fb7e7a82e1337c6c06b1d3bb4e8a2a13d884a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-05-11 10:43:09 -07:00