Commit Graph

81 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Cunyin Chang
fc75d2a282 nvmf: Add nvmf controller operation structure.
Change-Id: I3f8c0cea7fbbf443b13ed336a786d0e14927131e
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-08-09 15:50:40 -07:00
Daniel Verkamp
184984603f nvmf: use Connect command SQSIZE to manage SQHD
The NVMe submission queue head wraparound point can be determined in the
generic NVMe over Fabrics layer; it should not be using the RDMA
connection queue depth.

Change-Id: I9da8f09e4f057f8fdc1ff4c6cc5f48cea7123e11
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-08 08:45:38 -07:00
Ben Walker
f1a584a9f7 nvmf: Use a shared memory pool for large data buffers.
Change-Id: Iab66335cee2a1e6c1774edd34978735be6763ce1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-29 15:36:10 -07:00
Ben Walker
d7b8da3b81 nvmf: Add a transport specific session
This is useful for holding session-wide buffer pools.

Change-Id: I7024da24b210a2205bf1e159d5935e0093b81120
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-28 09:00:47 -07:00
Ben Walker
296add8bb1 nvmf: Add config options for inline and max I/O size
These don't actually work quite yet, but pipe the
configuration file data through to where it will
be needed.

Change-Id: I95512d718d45b936fa85c03c0b80689ce3c866bc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-26 14:23:25 -07:00
Ben Walker
a6135981e8 nvmf: Add a req_release callback to the transport layer
This can be used to release requests that don't
require a completion to be sent.

Change-Id: I8fb932ea8569bf3c45342d9fa4e270af5510c60c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-26 09:40:25 -07:00
Daniel Verkamp
201843a9eb nvmf: report virtualized NVMe version 1.2.1
The NVMe over Fabrics 1.0 spec corresponds to the NVMe base spec version
1.2.1, so we should pretend to be at least that new.

Change-Id: I36fc44c780de01d6c666e87b803cd47dba0e74c5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-26 09:23:38 -07:00
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
594c19bf69 nvmf: set CAP.CQR as required by the spec
CAP.CQR indicates whether contiguous queues are required; this is
meaningless in NVMe over Fabrics, since queue creation is handled
implicitly for each connection, but the spec requires it to be set to 1.

Change-Id: I6b05954eefa6928beecd7a640bbbdbd835c6b69a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-25 09:55:39 -07:00
Daniel Verkamp
27c38d2c0c nvmf: merge NVMf ctrlr data into nvme_spec.h
Change-Id: I4c88986b5eebcb30b4b209240df813f91087e4de
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-25 09:55:34 -07:00
Daniel Verkamp
447cee868e nvmf: drop NVMF_{H2C,C2H}_MAX_MSG #defines
Use the size of the applicable structs directly.

Change-Id: I4a65de548d409c9962b11a75d3fde2bfe434a3ec
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-25 09:21:01 -07:00
Ben Walker
3a4c101b2d nvmf: Move detection of 0 connections on a session to session layer
This logically belongs inside the session handling code, not
in the transport-specific layer.

Change-Id: I93b2271f38dbfc742162c98c40acb153c7e9022a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-22 16:29:12 -07:00
Ben Walker
207e6a604e nvmf: Set minimum and maximum on allowed queue depths
Change-Id: I72988b0691154165757201f5f5bc89d199249660
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-22 10:37:02 -07:00
Daniel Verkamp
163127a65e nvmf: fix ioccsz (in-capsule data size)
Temporarily set the in-capsule data size to the maximum data transfer
length.  This should actually be updated by the transport layer, but for
now, the only transport (RDMA) supports the full bounce buffer size.

Also drop the check that prevents admin connections from using
in-capsule data; the host may send in-capsule data for the Connect on an
I/O queue, and we don't know the type of connection until after Connect
is processed.

Fixes: 828dca7 ("nvmf: Move some stray session init code to the right place")

Change-Id: I369ee5497247d7e875ad0b6f0aaf6c47c1d3887c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-22 09:13:59 -07:00
Ben Walker
88245ea26b nvmf: Rename MaxConnectionsPerSession to MaxQueuesPerSession
Change-Id: I9891f9ed481b93312152c2a59f4263003167f1d6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-20 07:26:58 -07:00
Daniel Verkamp
2d1c3419ad nvmf: verify correct IOSQES and IOCQES on connect
The NVMe spec requires that the I/O queue entry size values in CC are
set before any I/O queues may be created.

Change-Id: I4f0c9a9c20411223d281993745c85a8431197961
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-19 09:20:20 -07:00
Daniel Verkamp
43510e1292 nvmf: fail attempts to modify reserved bits in CC
Track each individual bit in the Set Property handler for CC, and fail
the request if any unhandled bits are modified.

Also add handlers for IOSQES and IOCQES (I/O submission and completion
queue entry size).

Change-Id: I374dc3c15197e029ba07fd9ee1cff0e38a0a884d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-19 09:20:20 -07:00
Daniel Verkamp
c53c5c6a9b nvmf: stub out CC.EN reset path
It is not implemented yet, but add a message to remind us to write it
later.

Change-Id: Ic1c35a0d35f728bc63b38c334d9c622493bee967
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-19 09:20:20 -07:00
Daniel Verkamp
b9a67e983a nvmf: remove nvmf_property_set() shutdown flag
Property Set of CC.SHN is not supposed to terminate the session - remove
the commented-out code that was attempting to do this.

Change-Id: I1db230df9be549764287a8fd45ccdebea1d22a8b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-19 09:20:20 -07:00
Daniel Verkamp
8a2395d0e6 nvmf: update CSTS when host writes CC.SHN
Set CSTS.SHST = 10b to indicate that shutdown is complete, and
CSTS.RDY = 0 to match the state of CC.EN.

Change-Id: Ia651c34427526a38f22cba3910df2cf7d4bedd92
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-19 09:20:20 -07:00
Daniel Verkamp
543b6d0932 nvmf: remove definitions that duplicate NVMe
These NVMf spec structure definitions are the same as the equivalent
NVMe structs.

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

Change-Id: I67e67a6b4076de226d30882aa40afd78bc8be2af
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-15 16:34:46 -07:00
Ben Walker
677a2dc5d7 nvmf: Merge conn.[ch] into session.[ch]
There was only one function and a structure declaration
left.

Change-Id: I63277b4182120e7a76a925ed0bf7378ec7c23f20
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-15 14:45:26 -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