Commit Graph

408 Commits

Author SHA1 Message Date
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