Commit Graph

238 Commits

Author SHA1 Message Date
Ben Walker
63da8147ed nvmf: Remove nvmf_*_cmd.c files
They each only had 1 function left that belonged
in the session.c file.

Change-Id: I405902b02e9316d2dc02d3732d8bc085c2b84d31
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 11:31:18 -07:00
Ben Walker
d7fbeda710 nvmf: Move process_*_cmd functions to request.h/c
Change-Id: I16481463a8735f71387c69dd9ca4e187d743d8fc
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 11:30:59 -07:00
Ben Walker
eb705f0da1 nvmf: Add a request.h/c
Only move nvmf_request definitions from nvmf_internal.h
for now. Subsequent patches will move more.

Change-Id: If47472542515fd050cc78d95540eb25beee59d2a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 11:29:58 -07:00
Ben Walker
631f5f27ac nvmf: Simplify connection poller.
Remove an extra layer of function calls.

Change-Id: I0699258439a731b85f8d145db9189e89b8590626
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 10:59:18 -07:00
Ben Walker
2a2615ec6e nvmf: Unify completion path of fabric and other commands.
Fabric commands were skipping a step, so unify all
types of requests through the same completion path.

Change-Id: I5f38a7e1cdcdf33baf71486d5ddae9f5a6157fac
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 09:25:19 -07:00
Ben Walker
c917957bff nvmf: Remove rx_desc pointer from tx_desc
The nvmf_request structure holds the pair of pointers
for rx_desc and tx_desc.

Change-Id: I3e735979bbdcdc0e70ad78762e289849d41158ba
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 09:25:17 -07:00
Ben Walker
6b10df3576 nvme: Update nvme_spec.h to 1.2.1
This moves some definitions from nvmf_spec.h to
nvme_spec.h based on the latest publication.

Change-Id: I51b0abd16f7d034696239894aea5089f8ac70c40
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 09:18:14 -07:00
Daniel Verkamp
ae17467ecf nvme: check BAR map return code before using addr
Swap the order of checks in the failure check - if rc is not 0, addr may
be garbage.

Change-Id: I110710efd00397c777d59ac8b219ba3cc2156596
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 16:48:08 -07:00
Daniel Verkamp
81d9213894 nvmf: use nvmf_request instead of rx_desc in trace
The nvmf_request object is generic and is mapped 1:1 with rx_desc.

Change-Id: I397224a3859c3c93d6eca99f7ba7c53ce7963f57
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 14:36:30 -07:00
Daniel Verkamp
90c28166c0 nvmf: use cm_id context to store conn pointer
Instead of searching the global list of connections to find a matching
cm_id, we can just store the pointer back to the spdk_nvmf_conn in the
rdma_cm_id context field.

Change-Id: I39ea16be6a633a1136d65743747b63b600f20e63
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:54:54 -07:00
Daniel Verkamp
f086365392 nvmf: make conn.c globals static
All of the variables are private to conn.c, so they don't need global
visibility.

Change-Id: I7c24cfc6249a9f8164b162b4b8de0e24c452e0df
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:20 -07:00
Daniel Verkamp
1d3ee6c5f1 nvmf: remove nvmf_request cb_fn field
It is always set to nvmf_process_async_completion and is only used
within the library.

Also rename nvmf_process_async_completion to spdk_nvmf_request_complete
to clarify its purpose.

Change-Id: Ie737fb60688329bfe329a8553c4a40ff2e5f8f1d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
85ee88979d nvmf: move SGL processing to a generic function
Create spdk_nvmf_request_prep_data(), which handles SGL processing and
data transfer for all command types, and spdk_nvmf_request_exec(), which
executes a command after data transfer has completed.

Change-Id: I51c2196260dd0686db8acca4d8f7c93e17618c2f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
a9282085c9 nvmf: remove nvmf_request pending field
The pending type can be determined based on the command opcode.

This also moves the "issue pending RDMA reads" case out of the I/O queue
handling into the generic continuation code; this should not make any
difference for the current case, since the Fabrics Connect command is
the only other continuation case currently, and there cannot be any
pending RDMA reads in that case.

Change-Id: Idddfa496b6e5b7e6da772aa3ab1b9d1a5344771f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
855e11e990 nvmf: pass nvmf_request to nvmf_io_cmd_continue()
Change-Id: Ib73510376c3af558b88d5c29a131df931a1a9eda
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
0b672d8e63 nvmf: pass nvmf_request to nvmf_connect_continue()
nvmf_connect_continue() no longer needs the RDMA-specific tx_desc.

Change-Id: I95f6938063e9853aa7dcd419f488b91422ff9b60
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
326a15a7ff nvmf: simplify nvmf_connect_continue() cleanup
Let the calling function handle the tx_desc if nvmf_connect_continue()
fails.

Change-Id: I25a8cbc4c3be0608bcec8db2fb8c50e55fbe3e8c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
8836a17f80 nvmf: drop redundant nvmf_process_admin_cmd params
Everything necessary for processing an admin command is now stored in
nvmf_request.

Change-Id: I74e75a5b7bb3b406ad167c2b31cab1af7a1f270a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
2f5ccef310 nvmf: remove redundant nvmf_process_io_cmd params
Everything necessary for processing an I/O is now stored in
nvmf_request.

Change-Id: I3f390707ebe83ea66a116dcfda4d0388a6823629
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
8c6fa80874 nvmf: add data field to nvmf_request
Keep a pointer to the local bounce buffer in the transport-agnostic
struct nvmf_request rather than groveling in tx_desc/rx_desc to get it.

Change-Id: Ic328d8e2b3a15759ccb149a89fb3562e928ca500
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
07c73a5860 nvmf: fill out nvmf_request length in all cases
Now that we have xfer to track data direction, the length field can be
populated correctly for all transfers (including in-capsule data).

Change-Id: I7b2228f3fac80aab983a4103ba095c7bc38e0b21
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
7426aa8bb8 nvmf: add xfer to nvmf_request for data direction
This field is used to decide whether data needs to be transferred back
to the host after a command is completed.

Previously, this was determined using the length field, and length was
cleared to 0 after a transfer was completed.  However, length will be
used in future patches after a host to controller transfer completes, so
we need some other way to tell what kind of data transfer is required.

Change-Id: I6b27cf7816908394735fc95c15bd5eb40a7c0157
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-23 11:12:19 -07:00
Daniel Verkamp
4db1b420f4 vtophys: fix usermode address range check
vtophys() was checking for out-of-range addresses incorrectly: vfn_2mb
is already shifted to account for 2 MB hugepages, but it was being
compared with a mask that did not account for the shift.  This would
allow out-of-bounds access to the 128tb map array for certain invalid
addresses (it had no effect on addresses within the valid userspace
range).

Change-Id: Ida7455595e586494c9025f9ba65d050abb16b1b9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-22 16:41:29 -07:00
Ben Walker
bb125a6f55 rpc: Add an RPC subsystem
Other subsystems can depend on this one and then use
SPDK_RPC_REGISTER to register RPC functions.

Change-Id: I557f774331ce7146d299d06b3f81426e2103a11f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-22 15:45:50 -07:00
Cunyin Chang
d6865b82d1 nvmf: update conn.h include guards.
Change-Id: If73cc67e343e093d3387f8be76320e8d12d76a6e
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-06-22 11:56:13 -07:00
GangCao
c65210d034 nvme: return error immediately when enabling controller failed
Change-Id: Id9cf6873cc831bd5099df49db95ef5073badf461
Signed-off-by: GangCao <gang.cao@intel.com>
2016-06-21 16:37:15 -04:00
Ziye Yang
450bb7605b nvmf: replace all malloc with calloc in nvmf library
Change-Id: Ibf6719996ef683d8efc82068b2294ce0f75c54f9
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-06-21 17:01:25 -07:00
Ziye Yang
7991eb1957 Create a utility and enable WRR arbitration mechanism
Change-Id: I2194863ae812ece72c17b78e003ccf7895b8a812
Signed-off-by: GangCao <gang.cao@intel.com>
2016-06-21 16:35:04 -07:00
Changpeng Liu
389fcba814 nvmf: fix the error caculation for reactor mask
Since we used u64 to mask CPU cores, the available number of CPU
is 64, for default RTE_MAX_LCORE in DPDK, the value is 128, in some
cases(e.g.: when nr_io_queues > 4) we can get the wrong lcore ID.

Change-Id: Icc334b1bf5b068a310839118be341e61071cff65
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-06-23 07:19:43 +08:00
Daniel Verkamp
84d16c8501 nvmf: simplify bounce buffer SGL adjustment
A transfer using less than the total bounce buffer size is a normal
occurrence and not worthy of a tracelog.  Also drop the pointless
conditional.

Change-Id: Ibcdcf693fea439d5034fa51b08b3fbd8fd7df8f2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-20 14:24:47 -07:00
Daniel Verkamp
29d914e84e nvmf: get connect command from nvmf_request
Remove one use of RDMA-specific rx_desc.

Change-Id: I6d2999fe8c725d3bc831eabc82133cf62bea970b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-20 14:24:47 -07:00
Daniel Verkamp
444712900f nvmf: convert property get/set to use generic req
Avoid using the RDMA-specific tx_desc when the transport-agnostic
nvmf_request will suffice.

Change-Id: Id35bbdfb353cb72e0feb4f5af19e5bd5c86d3ff4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-20 14:24:47 -07:00
Daniel Verkamp
7b4d5de0d6 nvmf: remove unused enum nvmf_cstate
Change-Id: I40fa6c6f6ef2d3c64c77bf14d6b4b5fd028ae5aa
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-20 14:24:47 -07:00
Daniel Verkamp
54b538d1cb nvmf: move RDMA resource defaults to rdma.c
Change-Id: I98e92b4351b64ce87117341d86b1d39d8a826e72
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-20 14:24:47 -07:00
Changpeng Liu
9ab12243ef nvmf: process NVMe admin commands submission error
Change-Id: I88d393ceb3f69d6dd83b259b322c6ce80e7c1a84
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-06-20 10:06:33 -07:00
Ziye Yang
6ec18cd05b nvmf: add nvmf_ibv_send_wr_init and nvmf_trace_ibv_sge
The purpose is to reduce duplicated code.

Change-Id: I84b14fd3d0286f358cc1877250477a4cc538d210
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-06-20 09:20:46 -07:00
Ziye Yang
78b69710f3 nvmf: Make tx_desc free correct in nvmf_recv
Should set tx_desc=NULL here. If not,When
nvmf_post_rdma_recv(conn, rx_desc) fails,
we would make tx_desc deactive again, and
this is wrong.

Change-Id: Ieabc7e3864b7f124b003d052f66ab8799a1d632e
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-06-20 09:18:01 -07:00
Changpeng Liu
8be572ef20 nvmf: process the submission error code for NVMe I/O commands
Change-Id: I4e91ebea1b96f09bafa1fb23f2d9c5d9f79125af
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-06-20 09:13:17 -07:00
Changpeng Liu
e42e4e8056 nvmf: print the error log information when error happens
Change-Id: I12f089a0cb4b93997499a917884c94bd238a47d6
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-06-20 09:12:20 -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
Ben Walker
422b147499 nvmf: Standardize names in init_grp.h
Prefix with spdk_nvmf_host.

Change-Id: I053030febf5b7157cc2c7075ac6170bc59ce0ced
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-17 13:31:05 -07:00
Ben Walker
6eb1bee64b nvmf: Rename spdk_nvmf_init_grp to spdk_nvmf_host
Host is the term used in the specification.

Change-Id: Ie9a06e3ff176e00e2fdcdc5bede701fe768d4b35
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-17 13:31:05 -07:00
Ziye Yang
e87e3df674 event: fix null pointer issue in spdk_subsystem_fini
The variable cur could be null, so if we use do while
will cause a segment fault

Change-Id: I19ec26e88948a0c3fd957e03e717b68750f40c62
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-06-15 16:33:55 -07:00
Minfei Huang
f0b20026d7 nvme: Return negative errno for failure (#24)
The conventional rule for returning errno is negative, hence there is no
need to modify caller's code to adjust this NVMe library.

Signed-off-by: Minfei Huang <mnghuan@gmail.com>
Signed-off-by: Minfei Huang <minfei.hmf@alibaba-inc.com>
2016-06-14 15:19:10 -07:00
Ben Walker
ba37804100 nvmf: Don't allocate our own RDMA protection domain
If we just pass NULL to rdma_create_qp, it will do
the right thing.

Change-Id: I9621a5110ace6237a1e47c6e5defb4cac3afc4ae
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-10 11:19:33 -07:00
Ben Walker
309a97f782 nvmf: Use RDMA CM wrappers for registering memory
The wrappers are much simpler to use than the low
level ib verbs calls.

Change-Id: I4b09a96a60020bc27df9396d40d955733f618837
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-10 11:19:33 -07:00
Ben Walker
1b17e4ee35 nvmf: Combine nvmf_rdma_conn_init and nvmf_rdma_qp_init
They are only ever called in sequence and do related
operations.

Change-Id: I825abe08deba1dafb405757bb4f2d52062a801ca
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-10 11:19:33 -07:00
Daniel Verkamp
90b6ad1f36 nvmf: move internal APIs out of nvmf.h
Change-Id: I94425fc4e394bb5033237ddc9002cd464c3f621f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-09 14:25:26 -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
d3bbbfeea2 nvmf: move private #defines to nvmf_internal.h
SPDK_NVMF_BUILD_ETC will be cleaned up in another commit; it is
currently used both in the lib and in nvmf_tgt.

Change-Id: Ibc5f15cc4341f9d52b29c84defcd332bec4a4d09
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-09 14:25:26 -07:00