Commit Graph

249 Commits

Author SHA1 Message Date
Daniel Verkamp
f0242ce745 nvmf: remove bb pools and replace with rte_malloc
The mempool functionality is never used at runtime - all bounce buffers
were immediately assigned to a rx_desc.

Change-Id: Ie2195059858e34b30b07e104739f046c13abc335
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 09:13:34 -07:00
Daniel Verkamp
31d2a116c8 nvmf: remove rx_desc and tx_desc mempools
The RDMA tx_desc and rx_desc pools were only used at startup; all
descriptors are immediately allocated and put into a queue, and the
mempool functionality was never used at runtime.

Change-Id: I2882274962550191a555c8483b8f7be2854b32ec
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-06-27 09:12:42 -07:00
Ben Walker
e7dce1cfc0 nvmf: Move tx/rx descriptor management to rdma.c
This is an implementation detail of the RDMA layer.

Change-Id: Ib97d6fbd593789eed0b6e746972b8882a3320995
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 12:42:26 -07:00
Ben Walker
41aadf1591 nvmf: Move processing of pending RDMA reads into rdma.c
This code is operating on a list owned by the RDMA
connection, so move it to rdma.c

Change-Id: I8b81f9d1ffc1df489c9b698969725ed0d1db6a06
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 12:40:20 -07:00
Ben Walker
5677fe3c8d nvmf: Move *_desc lists into nvmf_rdma_conn
These are an implementation detail of RDMA, so move
them into the RDMA portion of the connection.

Change-Id: I68d146019c5d78fbf5e9968abfd7baed2a54a2ed
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 12:26:43 -07:00
Ben Walker
0216e537f7 nvmf: Add spdk_nvmf_rdma_conn structure
Separate out the RDMA connection from the
NVMf connection. For now, the RDMA connection
is just embedded in the NVMf connection, but
eventually they will have different lifetimes.

Change-Id: I9407d94891e22090bff90b8415d88a4ac8c3e95e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 12:04:41 -07:00
Ben Walker
1fe2ab57d6 nvmf: Simplify acceptor
Remove an extra layer of functions.

Change-Id: Ic08628031d9055d973af4aed12ab245f5ff6887b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 11:57:43 -07:00
Ben Walker
1b9cc2a9bc nvmf: Group rdma globals into a structure
This structure will be expanded in future patches.

Change-Id: Ibb04917134243560e09a2a255844739eb33fab65
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 11:44:10 -07:00
Ben Walker
68ba9e1f86 nvmf: Move fabric command handlers to request.c
Now all request processing is in request.c

Change-Id: I27db190f566a4134e5c09566f87c3d0922b3f569
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 11:31:28 -07:00
Ben Walker
744dd009c0 nvmf: Remove unused conn arguments from several functions.
Change-Id: I2c1df9e649dad9c5a74aca0e9ce9fca68068017f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 11:31:27 -07:00
Ben Walker
a4cbf50037 nvmf: request struct now has a pointer to conn
The request needs to know which connection specifically
it is associated with.

Change-Id: I492b9968b4d2e307b5af44edee0778478b32d2ba
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-06-24 11:31:27 -07:00
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