Commit Graph

537 Commits

Author SHA1 Message Date
GangCao
f75fe7394a nvmf: add an outstanding admin IO tracker in direct mode
Change-Id: I06e0de6dc28115f0cb53151d67138f9271093687
Signed-off-by: GangCao <gang.cao@intel.com>
2017-03-15 08:02:39 -07:00
GangCao
7224a42d9d nvmf: add a periodical admin poller for AER event in direct mode
Change-Id: Ib8cba61fe3d531f9228d0c385913d63914ba8093
Signed-off-by: GangCao <gang.cao@intel.com>
2017-03-15 08:02:39 -07:00
GangCao
89d10dd80e nvmf: add support of default subsystem identifier
Change-Id: I607e800fea00c21dfd28c8fee0a981ae59e46a5c
Signed-off-by: GangCao <gang.cao@intel.com>
2017-03-14 15:33:25 -07:00
Cunyin Chang
e58e56c9c6 nvmf: Add support of hotplug for nvmf virtual mode.
Change-Id: I941d119e6b74eadfccd7eb7675b2f7b46d2b5907
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-14 14:53:56 -07:00
Cunyin Chang
39b386a5c5 nvmf: Add interface for transport layer to check if one connection is idle.
Change-Id: I094d5adb85af8279c9823528f40190fa28801b7b
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-14 13:29:32 -07:00
Daniel Verkamp
50947d5557 nvmf/rdma: use SPDK_COUNTOF to count SGL elements
This clarifies the relation between the values assigned to sg_list and
num_sge (no functional change).

Change-Id: I8e81d47dd97a033b17cd3b813b06e4887127146c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-14 09:53:53 -07:00
Ben Walker
8fefa7e9ee nvmf/rdma: Match queue depth math to Linux kernel initiator
Change-Id: Iffe8c35ae76f5541aa95480f1aaaf654fcdfeffd
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-13 15:50:05 -07:00
Ben Walker
75990199ae nvmf: Remove sge log messages. The mappings are static now.
The mappings are all static, so it isn't interesting
to print them out on each I/O.

Change-Id: I85301b4518d4523a7c031f6ca9ff678d91428504
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-13 15:11:13 -07:00
Ziye Yang
5c36cd7481 nvmf/rdma: Use separate ibv_send_wr for RDMA READ/WRITE
This allows pipelining of READ/WRITE with completion.

Change-Id: Ib3ab5bffb8e3e5de8cbae7a3b2fff7d9f6646d2d
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-13 15:11:13 -07:00
Ziye Yang
0239003a72 nvmf/rdma: Initialize SGL for recv work request just once
Change-Id: I22b76cafe1a496f40cf7661daee3361ba1dee324
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-13 15:11:13 -07:00
Ziye Yang
4e74233835 nvmf/rdma: Separate cmd wr from rsp wr
This allows static initialization of the scatter
gather list as well as future optimizations
around pipelining commands with data.

Change-Id: I8af8f3e3425610bc720677c9bc84f163cfb6278a
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-13 15:11:13 -07:00
Ben Walker
b4ed77ef0d nvmf: Remove workaround for kernel initiator queue depth
The first version of the Linux kernel NVMe-oF initiator had
a bug when reporting queue size where it was off by 1. We
had a workaround to deal with this. Now that the kernel
has been fixed, remove the workaround.

Change-Id: I0ad4a5c6db68cfa9683ab93e6f5210772c713b55
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-13 14:33:42 -07:00
GangCao
360d3813b0 nvmf: add the unique subsystem id
Change-Id: I0369b7462a12aec76d52dd357d72989886de5a54
Signed-off-by: GangCao <gang.cao@intel.com>
2017-03-10 13:06:55 +08:00
Ziye Yang
d706fa417f nvmf,rdma: Remove spdk_nvmf_rdma_request_ack_completion
The sq_head handling is already done in
spdk_nvmf_rdma_request_send_completion, so do not need to
do again.

Change-Id: I527ff8adfcbdf43ac79794cb5c7777c0e8ef6973
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-09 15:04:14 -07:00
Daniel Verkamp
ed61bf79fb nvmf: ensure there is room before claiming a bdev
Previously, if the maximum number of virtual namespaces had already been
reached, adding a bdev to a subsystem would claim it without actually
adding it to the ns_list array.

Change-Id: Iab68ad1a75748c0e88232240185695aac08d71d2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-08 09:55:44 -07:00
GangCao
4cdd929b66 nvmf: introduce the global and per subsystem listen addresses
Change-Id: I276a71a3280c41b215a9cf4ca85247bd397a85e5
Signed-off-by: GangCao <gang.cao@intel.com>
2017-03-07 12:56:13 -07:00
Daniel Verkamp
b58a5d73ef util: add SPDK_COUNTOF() array size macro
SPDK_COUNTOF works like sizeof, except it returns the number of elements
in an array instead of the number of bytes.

Change-Id: I38ff4dd3485ed9b630cc5660ff84851d0031911f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-07 12:43:42 -07:00
Daniel Verkamp
88a7271315 nvmf: combine set_aer_callback and attach
Change-Id: Icb6aab97aa78862b19c1fa68fac2b7ac44feea90
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-06 17:15:31 -07:00
Daniel Verkamp
b592cf6cdf nvmf: move NVMe qpair allocation to direct.c
Change-Id: Ice167a5ec158e6e60c1c4b67bc7eeca80b262de2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-06 17:15:31 -07:00
Daniel Verkamp
cc85d7ef68 nvmf: move io_channel allocation to virtual.c
Change-Id: Ibe0464a539b7545d7f911d6af13a1bd3f7bd3cd9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-06 17:15:31 -07:00
Daniel Verkamp
7f448daaa3 nvmf: remove SPDK_NVMF_REQUEST_EXEC_STATUS_RELEASE
It is no longer used now that AER handling holds the request until it is
triggerred.

Change-Id: I71a75e86f82bc06f677cf26defa701e60b9aa1bd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-03 10:22:11 -07:00
Daniel Verkamp
776facc69b nvmf: fail AER command if AERL is exceeded
Change-Id: I5955630fb069c1aab47f38b910366a30b1d3bac5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-03 10:22:11 -07:00
Daniel Verkamp
b6c72d7b09 nvmf: move AER command handling to session.c
Change-Id: Ib2ffdc253df808547a43f7f8e52b8d4d53c09c96
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-03-03 10:22:11 -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
Cunyin Chang
77183f9722 bdev: Add support for hot plug in generic bdev layer.
Change-Id: Iac724518fb82b1b1bcafa7610210b0000c2063aa
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2017-03-02 09:48:39 +08:00
Ziye Yang
0801877b7d nvmf,direct: add AER support in direct mode.
After checking the code, aerl in our session is 0,
so there will be only 1 AER. So currently,
we will only handle 1 AER case.

When the AER event is triggered by real NVMe device owned
by the subsystem, it notifies all sessions belonging to
the subsystem.

Change-Id: Ia80fb0f03e893c20d8dd14afbed8db10db38301c
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-03-01 10:47:52 -07:00
Daniel Verkamp
effea17dad nvmf: make invalid rdma_req case into an assert
The wr_id should never be NULL - it will always correspond to a request
we previously posted.  Convert the check to an assert() so we notice if
this ever happens (which would indicate a programming error somewhere
else).

While we're here, add a more robust check to make sure the request is
actually in the correct array of requests for the connection being
polled (also in an assert, since this should never fail in normal
execution).

Change-Id: I855763d7d827fb8cf00a775c7bc2ccb579db8d0f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-28 10:52:08 -07:00
Ziye Yang
97e15fedb8 nvmf,rdma: Solve nvmf host reconnect issue.
Kernel nvmf host always tries to connect nvmf target
when we does not issue nvme disconnect command. Thus,
we face rdma_create_qp issue, the reason is that we call
rdma_listen too early, and the event retrieved from
rdma_cm_get_event is too late.

And this patch solves this issue.

Change-Id: I153a8aea7420a86a236301dad9bd54af97f60865
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-28 00:16:17 -07:00
liu-wenhua
0ccb72c6da nvmf: call spdk_nvmf_request_complete on error (#123)
Calling spdk_nvmf_request_complete to complete spdk_nvmf_request
causes some fields in completion queue entry not set correctly.
Calling spdk_nvmf_request_complete fixes the problem.
2017-02-24 16:12:40 -07:00
GangCao
c30ec061e1 nvmf: update listen_addrs after successful transport operation
Change-Id: I0b4d50d1f64076a59a7c29e2cc7fd992e09ed3f3
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-22 19:16:11 -07:00
liu-wenhua
84501695fd nvmf: Data transfer cannot be simply determined by NVMe opcode (#120)
Whether a nvme command having data transfer cannot be completely
determined by command opcode. For set features command, some features
don't require data transfer.
Change spdk_nvmf_request_prep_data to fix this issue.
2017-02-22 14:54:30 -07:00
Ziye Yang
849d140b4d nvmf,rdma: remove unnecessary memset
Reason: the 4 fields of struct ibv_recv_wr is already
set in the following 4 lines.

Change-Id: I97437ee2e4c6e944154813bb48b1740b182220df
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-21 11:17:01 -07:00
GangCao
4e4dc3999a nvmf: move g_discovery_log_page_size variable under g_nvmf_tgt
Change-Id: I87348063ea032a7a5415d07f98dca66bf572a958
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-21 11:15:24 -07:00
GangCao
905b03786c nvmf: move g_discovery_log_page variable under g_nvmf_tgt
Change-Id: Iae5234689df5c94fcf6bbef3a10aebe06b2ddd9e
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-21 11:15:24 -07:00
GangCao
50baa132e3 nvmf: move g_discovery_genctr variable under g_nvmf_tgt
Change-Id: Id035a07d8ce49b89dc120be9d073ce46b488ce95
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-21 11:15:24 -07:00
GangCao
67027a9ea3 nvmf: move the g_subsystems variable within g_nvmf_tgt as subsystems
Change-Id: I8e5aaeca29e2de13c65628d5c80846b83a23099e
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-21 11:15:24 -07:00
Daniel Verkamp
2be0162140 nvmf: factor out common AER Get/Set Features code
The direct and virtual mode code is identical; move it to session.c like
the other virtualized get/set features.

Change-Id: I0a0e2dd795197c142ad5d9d0e4ddedb2aa5c8c2a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-02-14 16:56:29 -07:00
Ziye Yang
39d5920645 nvmf,tgt: SPDK_NVME_FEAT_ASYNC_EVENT_CONFIGURATION handle
Even for direct mode, each session should use its own
async event configuration like virtual mode instead of
passthrough.

Change-Id: I9c1175f3677c672c0cad684341b8a46a575d753e
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-14 16:48: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
GangCao
fcdb601ea5 nvmf: continue rdma_poll even meets error
Change-Id: I82fc3e939cc82a696b4c0b186bbc1d6cd82b8b54
Signed-off-by: GangCao <gang.cao@intel.com>
2017-02-08 10:09:02 -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
Ziye Yang
6f8a505d23 nvmf: cleanup spdk_nvmf_rdma_close_conn
No need to return

Change-Id: I902162dfa8bc21cc160f690bb20085d56bc29a13
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2017-02-07 15:10:03 -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
cfa8a2a989 nvmf_tgt: save unmap descriptor pointer in request
Avoid accessing the internals of the bdev_io from outside of the bdev
library.

Change-Id: I01dfc38b2520353ad42bcd8587b90f197eadf101
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2017-01-30 14:23:33 -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
2ea9823c8a nvmf: use same subsystem pointer
Change-Id: I834299db8310dbaf207deee5db4c1d5034f4bedd
Signed-off-by: GangCao <gang.cao@intel.com>
2017-01-25 15:54:46 -07:00
Ben Walker
9dd801c86c nvmf: Rename spdk_nvmf_globals to spdk_nvmf_tgt
Change-Id: Iaa1cd5e2f89d82f34b5d3d9fcb914a4f51c5d1e1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-23 16:46:56 -07:00
Ben Walker
3cc3f2646a nvmf: Move trace point declarations to bottom of nvmf_internal.h
Change-Id: I805d5e150feb18bc62156b592d4052c9dbdd6f89
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-23 16:46:55 -07:00
Ben Walker
dc42663305 nvmf: Remove duplicated transport init
This just appears to be a bug.

Change-Id: Icd888fec47a392def646b388a61a1003a7b2aaac
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-23 16:46:55 -07:00
Ben Walker
06b9c46561 nvmf: Add utility functions to create/destroy listen addresses.
Change-Id: I58c21caa8f7f0b564c6d8684fe6c7501e810dfa0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-23 16:46:55 -07:00
Ben Walker
ec38ec127c nvmf: Handle wrap-around for global cntlids
64k sessions over the lifetime of a single target is something
that really could happen, so handle this case.

Change-Id: Iaed92b9ff6cd078fcd7c1efe88cf0c860c77c4ac
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-23 16:46:55 -07:00
Ben Walker
765173a7ca nvmf: Make RDMA private data required.
This is not actually optional - it contains required
information for setting up the connection.

Change-Id: I21136de12794a0f4f5c14c5d3e2e3f2306c5c102
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-20 10:02:32 -07:00
Ben Walker
4ef419305e nvmf: Add function to get subsystem by id
This isn't used anywhere yet, but it will be for
NVMe-oF 1.1.

Change-Id: Ieae0688e6ad5b7a44568e5760382b5716b02e6f0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-01-20 10:02:32 -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
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
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
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
Ben Walker
b2a86421f4 nvme/rdma: Fix specification of R/W queue depth
The meaning of the parameters was swapped.

Change-Id: I3f4938c446fd06afd1852bcf08e779b7b988855d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-12-15 16:35:00 -07:00
Ziye Yang
01529c676b nvmf: get correct len for the get log page command
Change-Id: I58aa594d5ef75f7440e99371b1d97f171f3a9a6e
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-12-15 11:37:21 -07:00
Daniel Verkamp
de1b00657c nvmf_tgt: implement log page offset for discovery
Generate the full discovery log page in a memory buffer, then copy just
the requested part of it for each Get Log Page call.

Change-Id: I12730c59c0395cdac57aaab96337e938952e3011
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-14 12:15:19 -07:00
Daniel Verkamp
03be4c1c59 nvmf_tgt: extract offset from Get Log Page command
Note that the offset is not actually used yet, just sanity checked.

Change-Id: I9464dc934e94e3d38ac0d474fce876552650f92b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-14 11:01:51 -07:00
Daniel Verkamp
86fc646fac nvmf_tgt: update the discovery generation count
This allows hosts to determine when the discovery log page has changed
when reading it across multiple Get Log Page calls.

Change-Id: I3c3459959c6246a88938e4f82e3e0046419e7d00
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-14 11:01:51 -07:00
Daniel Verkamp
ec591eaf41 nvmf_tgt: insert new subsystems at end of list
This keeps the existing subsystem list (and therefore the discovery
service log page) in order when new subsystems are added dynamically.

Change-Id: I071639be0fef4139f8f017b433185c786ae55378
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-14 11:01:51 -07:00
Daniel Verkamp
8fac961254 nvmf_tgt: don't report vendor ID for virtual mode
The emulated NVMe controller exposed by virtual subsystems does not
provide the Intel vendor-specific commands and behaviors, so it should
not use the 0x8086 vendor ID.

Change-Id: Iab4f0513d30f610feb62b1899da1b6316f11691c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-12-08 17:00:40 -07:00
Daniel Verkamp
efca92b85b nvme/rdma: partly remove CC.EN = 1 hack
The generic NVMe library controller initialization process already
handles enabling the controller; the RDMA transport should not need to
set EN itself.

For now, the discovery controller is cheating and not using the normal
initialization process, so move the EN = 1 hack to the discovery
controller bringup until it is overhauled to use the full
nvme_ctrlr_process_init() path.

The previous code where CC.EN was set to 1 before going through the
controller init process would cause an EN = 1 to EN = 0 transition,
which triggers a controller level reset.

This change stops us from causing a reset during the controller
startup sequence, which is defined by the NVMe over Fabrics spec as
terminating the host/controller association (breaking the connection).

Our NVMe over Fabrics target does not yet implement this correctly, but
we should still do the right thing in preparation for a full reset
implementation.

This patch also reverts the NVMe over Fabrics target reset
handling hack that was added as part of the NVMe over Fabrics host
commit to its previous state of just printing an error message.

Change-Id: I0aedd73dfd2dd1168e7b13b79575cc387737d4f0
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 16:34:41 -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
2bfb991e42 nvmf: share Get/Set Features - Number of Queues
The code in virtual.c and direct.c was identical - move it to session.c
to share it.

Change-Id: Ic6e4e9238e8ffacb212e76293c440109aa839f8c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 09:46:31 -07:00
Daniel Verkamp
48631ef2b9 nvmf: add Set Features - Keep Alive Timer to Direct mode
Move the current Virtual mode implementation to session.c and use it for
Direct as well.

Change-Id: I3f0ac93b4247b93d158b0dcb77e257b4b91be129
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 09:46:22 -07:00
Daniel Verkamp
4be1cd85f0 nvmf: use bdev_io NVMe status code if available
Change-Id: If7003bf5c6a6fa0a4d1c6b8fda4cc19b6dc77482
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 09:46:09 -07:00
Daniel Verkamp
ff898d9e9a nvmf: implement Get/Set Features - Host ID
Store the host identifier from the Connect command and report it via Get
Features.

Change-Id: I79bc27e05c5944549e7986aadb919c19748e7474
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 09:13:02 -07:00
Daniel Verkamp
b2678a5246 nvmf: return Invalid Log Page for unsupported pages
Change-Id: I27cbdf06caf66e5a23ec2b7e836915f2e386cea2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 08:50:49 -07:00
Daniel Verkamp
7a06e80143 nvmf: report unsupported Get/Set feature IDs
Also return Invalid Field rather than Invalid Opcode to be more
accurate.  The spec doesn't seem to define any more specific error code
for this case.

Change-Id: I992c6cca3020ff80b8495c71170222bc75316800
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-23 08:50:30 -07:00
Daniel Verkamp
5e5a3851c3 nvmf: zero out Get Log Page buffer
None of the log pages are actually implemented yet, but at the very
least, we don't want to leak random bits of uninitialized data.

Change-Id: Ic889260eb18d49122f2f250b645bdc5be3561dc5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-22 16:33:56 -07:00
Daniel Verkamp
fd36d11e17 nvmf_tgt: stub out Async Event Config feature
Record the user-provided asynchronous event configuration set via Set
Features, and return it in Get Features.

This value is not actually used, since AER is not implemented yet in the
virtual controller model, but it at least implements the mandatory
Set/Get Features.

This allows the hack in the NVMe host code that ignored the Set Features
failure to be reverted.

Change-Id: I2ac639eb8b069ef8e87230a21fa77225f32aedde
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-11-21 17:02:12 -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
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
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
Changpeng Liu
f903336eed nvmf: fix the wrong cleanup logic in the RDMA initialization process
Print the error information when the kernel RNIC driver did not load
properly, and fix the cleanup logic for the exceptional exit.

Change-Id: I97a45e73d830280b994818f3defc491bc2b6b020
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-02 10:30:39 -07:00
Changpeng Liu
30b5285c4f nvmf: fill Controller ID field according to the specification
As we can support multiple sessions now for each Subsystem, the Host
will use cntlid field to create IO queues, if 2 different Hosts
connected to the same Subsystem, for IO queues' creation process, it
will use cntlid field with 0 for current code logic.

Change-Id: I6fd437892e8eb3146f62f4b211c0baadd70b505e
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-11-02 10:29:45 -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
1290f02f78 nvmf/rdma: add event_channel NULL check in fini
If the RDMA transport failed to initialize, g_rdma.event_channel may be
NULL.

Change-Id: I4510ee5893389f244f0fbaa1cd4a182868939b25
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-31 10:15:36 -07:00
Ben Walker
20dc7f7d19 nvmf: For iWARP, register buffers with IBV_ACCESS_REMOTE_WRITE
For iWARP devices, buffers that are intended to be the
target of an RDMA read initiated by the target must additionally
have IBV_ACCESS_REMOTE_WRITE permission. This is because iWARP's
RDMA read path essentially requests the remote side to do
an RDMA write.

This is unfortunate because there is no way to differentiate between
memory that the remote side can do an RDMA write to and memory
that will only be the target of RDMA reads initiated by the
target. There is nothing we can do about this serious deficiency in
the specification, however, so we have to live with it.

Change-Id: I3d2f2814ce0cb1df4e5347296ef371db4d16be21
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-31 08:58:40 -07:00
Ben Walker
f64690d49a nvmf: Handle NICs that don't report RDMA initiator_depth
I believe this is required for NICs to report, but handle
the case where it isn't reported.

Change-Id: I38d10c3590d1df8bb902ab312af0f9e01b9e5032
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:06 -07:00
Ben Walker
a1a085cf6b nvmf: Transports now allocate sessions
This makes it consistent with the way connections and
requests work.

Change-Id: Ifb97499ba72f7dfd02ac54ba1b622726d266262c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Ben Walker
8b487155fa nvmf: Fail when sessions span RNICs
The shared memory pool for a session is associated with
a particular RNIC via the protection domain. New connections
attempting to join a session that came in on a different RNIC
can't use that memory, so must be rejected.

Change-Id: Ibd79fe90566a231f76b7472e5e9b484c3e528454
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Ben Walker
349295caf2 nvmf: Rearrange rdma file to match callback order
Rearrange the functions in rdma.c to match the order
of the function pointers in the transport. No other
code changes.

Change-Id: I9dbc68912ecd5dfdf53f20b4807d4116933a3c3a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Ben Walker
b0c1149953 nvmf: Replace rdma_reg_* with ibv_reg_mr
Use the lower level registration functions. The RDMA-CM
examples use the ibv_* versions, so who knows if the
rdma_reg_* wrappers are even well tested.

Change-Id: I8e8250ab09a1401e636aebe2fc04a60806f7a827
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-21 09:09:05 -07:00
Ziye Yang
379ebca018 nvmf,rdma: only call spdk_nvmf_rdma_conn_destroy to free rdma_conn
Previously, we mixed use free and spdk_nvmf_rdma_conn_destroy to
free allocated spdk_nvmf_rdma_conn structure, which sounds not
exactly free all the resources.

Change-Id: I2917b442c34d63ba5c014add58f429ae4b831595
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-10-20 16:24:38 -07:00
Ben Walker
769468fc52 nvmf: Allocate RDMA wr on heap instead of stack.
The RDMA API doesn't say whether the wr is copied, so be
safe and allocate it on the heap.

Change-Id: I091af50aa031e1861333f19d864eb52335d6b756
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-20 16:22:58 -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
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
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
0aa2986475 Replace rte_get_tsc calls with spdk_get_ticks
Change-Id: I809b900321433693ff9f2498183ad0dcdbb15030
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-11 13:34:09 -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
d4652fd37f nvmf: Share completion queue channels
All completion queues for the same listen address
now share a common completion queue channel.

Change-Id: I42c149fe7e221951e8a3826b1713482c37a265b8
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-07 09:15:11 -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
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
Daniel Verkamp
bcd1edeae4 nvmf: replace off_t with uint64_t
The offset variable is used to store the result of a uint64_t * uint32_t
multiplication; a signed integer is not the correct type for the result.

Change-Id: If1fb22314ba7e3cec91808cc051678f809c9e58b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-29 13:27:39 -07:00
Ben Walker
1ad2c3ea73 nvmf: Add support for multiple sessions per subsystem.
This feature should only be used if clients are coordinating
with one another.

Change-Id: I89a437441a7e3fbcc1e5f6efa1c8e970ade7c2ec
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-29 11:04:15 -07:00
Ben Walker
a17ad921e2 Replace RTE_VERIFY with assert
We already require the assert header from the C standard library,
so use that instead of RTE_VERIFY to further isolate DPDK
dependencies.

Change-Id: I4a718af858c88aff6080e33e6c3dd533c077b8f4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-28 10:15:56 -07:00
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
Ziye Yang
b1e3279ae0 nvmf: change nvmf_session to spdk_nvmf_session
Make the structure definition consistent

Change-Id: If147066cee041a2a357bc7efcb1f882f914e5b42
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-27 09:57:17 -07:00
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
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
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
Ben Walker
f3d90c9165 nvmf: Reap entire batches of completions for RDMA at once
Instead of polling for only 1 completion at at time,
poll for batches of 32.

Change-Id: I5ef99a270489e7b3d2a58cb765915f187775a93e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-23 10:08:10 -07:00
Ziye Yang
b0b59a356f NVMf: add spdk prefix for two funcs defined in session.h
Purpose: To make the function definition style consistent

Change-Id: I7ade943881aa5076fdd419958e386ae3c3661da6
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-23 10:07:41 -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
Ben Walker
4bf7878521 nvmf: Combine nvmf recv and send cqs
ibv_poll_cq is actually an expensive call to make, so take
steps to begin to minimize the number of times it is called.

Change-Id: I6fc64979604220eb8cacd612b46e3a3b1bca0924
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-22 09:11:38 -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
Liang Yan
5c8f4f180e nvmf: Update status code for discovery command
Set status code to invalid opcode when opcode is not supported
in nvmf_process_discovery_cmd.

Change-Id: Ibab8097e536f26f16c322d5f539277688906cfc3
Signed-off-by: Liang Yan <liang.z.yan@intel.com>
2016-09-14 09:19:34 -07:00
Daniel Verkamp
df70bc1559 nvmf: use case-sensitive comparison for NQNs
The spec does not define NQNs as case-insensitive, so replace the
strcasecmp() matching of NQNs with strcmp().

Change-Id: I5946d9ee8e1d0aa5966e9b1b3c6f14f3f5119aec
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-13 11:28:54 -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
Cunyin Chang
b3ca958328 nvmf: Make the function spdk_nvmf_rdma_acceptor_init() reentrant.
Change-Id: Ie715affe7e451fc517c5f57f1597d0bc70f69947
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-09-13 09:49:25 -07:00
Roland Dreier
4c0aab3f2a nvmf: Correct log messages when polling recv CQ
Fix copy-and-paste errors - when polling the recv CQ, we should print
"Recv" instead of "Send" in log messages.

Signed-off-by: Roland Dreier <roland@purestorage.com>
2016-09-13 08:26:31 -07:00
Ben Walker
4fb468e0df nvmf: Remove memcpy from completion path
This can just directly assign the completion instead
of calling memcpy.

Change-Id: I07819c824eba45245b00fa3538a99bc81bcb9fcc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-12 15:33:43 -07:00
Ben Walker
af8b5732d3 nvmf: Optimize nvmf_ibv_send_wr_init
This function always shows up as one of the hottest functions when
profiling. I believe it is the memset that is expensive, so instead
use default initialization when the wr is declared on the stack
and just set the members that need to be updated in the function.
Also make the function inline for good measure.

Change-Id: I29e24cdd375311fa033b5a6df772ff4f73e35302
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-12 15:33:43 -07:00
Ziye Yang
e8be2f64d7 nvmf: fix the error handling in spdk_nvmf_session_connect
We need to free the session resource, if there is error
for creating a new session

Change-Id: I7c4f3e779e0b30e213e02b8676d93bd2fe9bf851
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-12 10:18: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
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
Ziye Yang
1c5093358e nvmf,rdma: update spdk_nvmf_rdma_conn_destroy
Merge two if judge statements into one.

Change-Id: I72f7e4a936bc0b628c06a9ebb7c816150805f495
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-06 13:19:02 -07:00
Ziye Yang
2628a7a4dd nvmf, subsystem: update spdk_nvmf_subsystem_poller
Remove RDMA in comments.

Change-Id: Ice9d310e73cd953b4c7a494e1b4e7a13335649e7
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-06 13:18:41 -07:00
Ziye Yang
1675e153fb nvmf: Update get_rdma_conn and get_rdma_req
The "+" is not correct, should be "-". Currently,
the issue doest not happen since the offset is 0,
then both + and - is OK. But if we adjust the location
of spdk_nvmf_conn or spdk_nvmf_request, we can find
this bug.

Change-Id: Ib358dc729da901a69442d0402a6089989f49b05c
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-06 13:18:26 -07:00
Daniel Verkamp
11c5620ae4 nvmf: add bounds checks to RW and DSM commands
Check that the number of blocks/ranges in the command fits within the
length specified by the SGL.

Change-Id: I21aded797dc1f1e752fe0bc9cec27310a4fb106a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-30 09:28:15 -07:00
Daniel Verkamp
a1d83c72bc nvmf: treat DSM attribute as bitfield
The Dataset Management command allows several operations to be specified
at once; the virtual controller only supports deallocate for now, but it
should just ignore the other bits in order to be spec compliant: "If the
Dataset Management command is supported, all combinations of attributes
[...] may be set".

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

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

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

Change-Id: I62c7a1ea5529366ff2ae4723b62f24ea78aa8193
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-30 09:27:32 -07:00
Daniel Verkamp
b58995588c nvmf: replace htobe* with spdk/endian.h
Change-Id: I75a66ff4d554c7cd3fb607cbef7cd0da02ab9031
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-25 15:49:00 -07:00
Cunyin Chang
b4d9cca109 nvmf: Add support for virtual controller.
Change-Id: I413553fcf7315038b4ce4ac9ebea70fffbec9a3d
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-08-25 15:02:21 -07:00
Daniel Verkamp
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
a5be12c376 nvmf: check validity of SQSIZE in Connect
Change-Id: I8185ed25a3067bb8882bf47ce7a6d2cd0361c597
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-23 09:21:16 -07:00
Daniel Verkamp
39cda18718 nvmf: rename trsvc -> trsvcid for spec consistency
Change-Id: I5f73ef20ba231a7b1721562964dfd50de9b2c735
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-23 09:03:28 -07:00
Daniel Verkamp
32a046d7b8 nvmf: fill out SUBNQN field in Identify Controller
SUBNQN is a UTF-8 null terminated string according to the NVMe base
spec, so pad it with zeroes using strncpy().

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

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

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

Change-Id: Idb6d37c422e442fc70a8673bd3fcfb9c27b57828
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-08-19 15:34:01 -07:00
Ben Walker
5d21943624 nvmf: Allow cores not handling subsystems to go idle.
Use the event framework's new delay parameter to allow
for idle cores to sleep for up to 1ms at a time.

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

Change-Id: I051afe2b4fcbd09b32998386c63f591a0ab343c2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-19 09:26:02 -07:00
Daniel Verkamp
8c931adaa4 nvmf: move shutdown cleanup to nvmf_tgt app
Change-Id: Ie1f5869dbbea3300d0aeb32e60a95d9a3c7ea535
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-19 09:17:38 -07:00