Commit Graph

835 Commits

Author SHA1 Message Date
Changpeng Liu
3c96acb4f4 nvmf: fix double free of session structure when exit the NVMf process
Change-Id: Iea34ca82898e58633c6f7edd2ab8ff04f5484220
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-07-15 10:15:03 -07:00
Daniel Verkamp
49e0054f18 nvmf: clean up redundant function name in TRACELOG
Change-Id: I87a01e0fe8c1437c084757e66377ac50ca83a0c2
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-14 13:32:33 -07:00
Daniel Verkamp
eca013c2e1 nvmf: simplify RDMA queue depth calculation
Pull out the duplicated min checks against the ibdev_attr values.

Change-Id: I774c355ba669486afde5c05c55a4ed653723db98
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-14 12:58:17 -07:00
Daniel Verkamp
c3ed14d3a0 nvmf: refactor Connect command handling
Set a status code in the response capsule for each possible error case.

Also enforce CC.EN == 1 before I/O connect.
The NVMf spec requires that the controller is enabled before any I/O
queue Connect commands are allowed.

Change-Id: If56d6b4d6bedad00e9e845e77f05f715e3969f8b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-14 12:58:17 -07:00
Daniel Verkamp
31965a7021 nvmf: don't store connection QID
Drop the debug print in conn.c that was the only user.

We still have the connect data structure when determining the connection
type, and after that point, the queue ID is not needed.

Change-Id: Ida9e170099f977ec6b84478874863c40d6f7d8a1
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-14 12:58:17 -07:00
Daniel Verkamp
3f80d55199 CONFIG: rename CONFIG_NVMF to CONFIG_RDMA
The NVMf target is being refactored to split the RDMA transport-specific
code into its own file.  Once this is complete, we should be able to
plug in other transports and build the NVMf target without any RDMA
dependency if desired.

To enable this, change the CONFIG option to RDMA; it still controls
whether the whole NVMf target is built for now, but once the RDMA
dependency is actually made optional, we will be able to build the
generic NVMf target code without libibverbs installed.

Change-Id: I8cd90a9aaa85dcefcc9b0f8f2e7b6af21958b2a8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-14 12:58:17 -07:00
Daniel Verkamp
51701f0053 nvmf: add headers for in6_addr
Fix build on FreeBSD.

Change-Id: I2f50e79b71ebbe2bba98722be092a7a4c06c8f19
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-14 12:58:17 -07:00
Ben Walker
c253f18656 nvmf: Move subsystem parsing to conf.c
Move the configuration file parsing for subsystems
into the configuration file parsing file.

Change-Id: Ie16e73cdc65fae7f2f3c3b22f9cba7f167024fa1
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-14 10:36:54 -07:00
Ben Walker
1c603c11db nvmf: Move parsing of NVMe section to conf.c
Change-Id: Ie178d1cc393e36dfbd7dbfa5d5f6aad7327c10ba
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-14 10:35:22 -07:00
Ben Walker
f20727afbb nvmf: Rename init_grp to host in config parsing
The code for parsing the configuration file still
referred to a host as an init_grp, so fix it.

Change-Id: Ifa250b09de495dd7d393ccc3557fd6d56a54e790
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-14 10:35:22 -07:00
Ben Walker
32a70c1ffc nvmf: Remove subsystem groups
This never really made sense, so replace it with a list of
subsystems.

Change-Id: Ie7a9400083c091ac7142d01c23948200f515bdf7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-14 10:35:21 -07:00
Ben Walker
cf199a3f0f nvmf: Move map from subsystem group to subsystem
Change-Id: I8961f0a3f93a2c088819d207bf70c64147a68533
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-14 10:34:04 -07:00
Ben Walker
b531f5914e nvmf: Remove NodeBase. Each Subsystem now defines its own NQN
This is just extra complication for no real benefit.

Change-Id: I528af98e799d0641e753390fe35ff561fa3d7d76
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-14 10:34:04 -07:00
Dave Jiang
175b12e813 nvme: detect all uio drivers instead of just uio_pci_generic
This allows the custom UIO hotplug driver to be used as well as the
uio_pci_generic driver.

Change-Id: Ica3316ed716827ad305eb4a146d0864d61ff190f
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
2016-07-13 10:34:47 -07:00
Ben Walker
35b3091eba event: Add a lib to configure with rpc
Linking this new library allows applications using
the framework to be killed via an RPC call.

This only works if the RPC subsystem is loaded.

Change-Id: Ifcf91c212add620fe410589eba5490337c635776
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-13 10:13:49 -07:00
Ben Walker
44d131105e log: Add a lib for integrating the log lib with event framework.
Linking this library into an application makes the log
configurable via RPC. This only works if the rpc subsystem
is also loaded.

Change-Id: If1340cf2a845ef159290232c26f341150c98fb9a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-13 10:13:48 -07:00
Ben Walker
548ab005af nvmf: Remove duplicated nqn from subsystem group
The nqn is in the subsystem.

Change-Id: I101dc45b7958d1e9148a09e85604a90936498d8c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-13 09:57:53 -07:00
GangCao
cd393178ca nvmf: replace the LU string with Subsystem string
Change-Id: Ib4f99a680c4b6994ad7744a3e81ce9b5ff1e4a8b
Signed-off-by: GangCao <gang.cao@intel.com>
2016-07-13 09:30:27 -07:00
Daniel Verkamp
cd066abb54 gitignore: ignore .kdev4 (KDevelop) files
Change-Id: Ie493371f53b009b44c4c7fbab24e2a52b8a9c837
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-12 09:08:01 -07:00
Daniel Verkamp
5da444122e nvmf: remove arbitrary 4 RDMA device limit
Use the number of devices returned by ibv_get_device_list() instead of
stopping at 4.

While we're here, drop the unused MAX_SESSIONS_PER_DEVICE definition
too.

Change-Id: I21ca6c6c95b7f2cccc1de4d0a34b95217a522bfc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 17:20:26 -07:00
Daniel Verkamp
82ea261126 nvmf: move nvmf_complete_cmd to request.c
This is the only file that calls it, so it can be static.

Change-Id: I47573b7b38b40ad37e758234245eedbe94ae0a12
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 17:13:53 -07:00
Daniel Verkamp
f6d8e3d421 nvmf: drop nvmf_initialize() and nvmf_shutdown()
These were internal-only APIs; initialize just checks to see that the
pool was initialized (which is already checked internally), and shutdown
just called spdk_nvmf_shutdown_nvme(), which we can call directly.

Change-Id: I95e1b912d61a38fa9934f58df7b1512678303452
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 17:09:49 -07:00
Daniel Verkamp
6dfbcfa883 nvmf: mark debug string array as static
It is not used outside rdma.c.

Change-Id: Ic32aff4e07d6a430688e76b2dd223d5a5a61964e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 17:00:51 -07:00
Daniel Verkamp
411df9ad9b nvmf: make request_release and free_req private
These can be isolated in rdma.c rather than being part of the generic
transport API.

Change-Id: Idc2b969a2f7685420cda2f7c4aa12495ffc3fcbc
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 16:58:17 -07:00
Daniel Verkamp
353533e229 nvmf: drop pool size macros
Just calculate the required number of requests once and store it in a
global variable.

Change-Id: Iffeb637a3ac5f69ec89989b84f03699bac483b6e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 16:25:05 -07:00
Daniel Verkamp
6d49820adc nvmf: remove MaxSessionsPerSubsystem config option
There can be only one session per subsystem.

Change-Id: I8ba85a5ebd11dd71fda2a4bafa97a0935609379f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 15:52:02 -07:00
Daniel Verkamp
6e415c4411 nvmf: drop global nvme_request_pool
It is just a duplicate of the NVMe library request_mempool.

Change-Id: I2a5484e5d515b965503b2cfcd8d85ccfcb0dee05
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 15:33:55 -07:00
Daniel Verkamp
dcc055e31f nvmf: move RDMA internal structs into rdma.c
Clean up everything that isn't strictly necessary in rdma.h.

Change-Id: Ied9acbed5f5b64860eae39816cdcb74620009a79
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 15:24:49 -07:00
Daniel Verkamp
1ade6e1dc0 nvmf: nest NVMf conn inside RDMA conn
This essentially turns the current nesting (of RDMA conn inside NVMf
conn) inside out.  Now the transport owns the connection structure and
allocates it when necessary.

Change-Id: Ib5ca84e2a57b16741d84943a5b858e9c3297d44b
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 15:03:26 -07:00
Daniel Verkamp
f542245706 nvmf: move conn allocation to transport layer
This sets up the RDMA layer to be able to embed the NVMf conn inside the
RDMA conn.

Change-Id: I5e3714ac8503826504d78d06fb5eaafabd025bb8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 15:02:34 -07:00
Daniel Verkamp
fdc1278440 nvmf: simplify session and connection cleanup
The whole cleanup process is now started by
spdk_shutdown_nvmf_subsystems().  Each subsystem will clean up its
session, if any, and each session will clean up its connections.

Change-Id: I9915d4547751ed4ffc4baa2c45c628698dd0b881
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 15:01:34 -07:00
Daniel Verkamp
9903050dc1 nvmf: remove unused session tailq entry
Change-Id: Iaa8f9281fd448f0f48752aa4ae147756f3462406
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 13:04:12 -07:00
Daniel Verkamp
58f62ad5b1 nvmf: remove unused g_num_connections array
The per-lcore connection counter was incremented and decremented, but it
is no longer actually read.  The lcore allocation should happen at the
session level instead.

Change-Id: I7bdf1b521bfda4892304338d43fad3ed5123c494
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 12:51:20 -07:00
Daniel Verkamp
2eff92ab88 nvmf: drop connection shm and use calloc() instead
Nothing actually maps the shared memory region, so there is no need to
allocate the array of connections that way.

Change-Id: I3d5eca748f892e37fbb0ec52942f1c510e9f9dc8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 12:50:21 -07:00
Ben Walker
1fc4a182bd nvmf: Subsystem now has a pointer to the session
There is only one controller per subsystem, so therefore
there can be 0 or 1 sessions. Change the list of sessions
to a pointer that can be NULL if no session exists.

Change-Id: I2c0d042d9cecacae93da3e806093faf0155ddd6e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:19 -07:00
Ben Walker
40b0248602 nvmf: Remove cntlid from session
Subsystems only have one controller, so cntlid
is always 0.

Change-Id: I690a1793ad3a696adbaefca856e559dd0177b11a
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:19 -07:00
Ben Walker
a35de42e5d nvmf: Remove max io queue tracking from session
This was intended to track the number of NVMe device
queues per session, but there is only one hardware
queue per session. It was conflated with the number
of RDMA queues in several places as well.

Change-Id: I74a1c56a5d395dea8bee4778882821e904cebcf9
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:19 -07:00
Ben Walker
a644cacb56 nvmf: Remove is_valid from session
Unused.

Change-Id: I992d4cea9b03f6dfe923f4d5ebc4c467d4ab01e5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
Ben Walker
d028fb6956 nvmf: Eliminate two stage initialization of sessions
Everything can be done when the session is created.

Change-Id: I7cb38c093b2b1b69460cabba465828eed0cec432
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
Ben Walker
49441a5835 nvmf: Don't set reserved fields in vcprop
Change-Id: Iab46cf7d34938d8b07c5480f778eedd1ba455d57
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
Ben Walker
011c0a24df nvmf: Remove cntlid from spdk_nvmf_conn
The cntlid is inside the session, so no need for
duplicate data.

Change-Id: I5669ee6393807959506dfec36a7583af77386fc4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
Ben Walker
a9c7af9d83 nvmf: Simplify conn lcore allocation
Since we only allocate workers to the master lcore,
remove the logic that places I/O conns on the same
lcore as the admin conn.

The "right" logic would be to place the I/O conn
on the same lcore as the whole session, and this
patch builds toward that.

Change-Id: I8983b56de41062ec834b0a169ba0fa61326c466d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
Ben Walker
72a7fd3cff nvmf: Only run on the master lcore.
Temporarily, only run on the master lcore. This makes
some temporary refactoring possible that is required
to move to a truly scalable threading model.

Change-Id: I13a2e03107a27f8ec18b023b15f653d374a137b5
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:20:18 -07:00
Ben Walker
9113e6a949 nvmf: Sync before unloading the NVMf initiator
This is a bit heavy handed, but really make sure all
activity has ceased.

Change-Id: Iaa1ce16fd9e059f9eaec6712226344d69075b243
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 11:19:54 -07:00
Ben Walker
828dca7351 nvmf: Move some stray session init code to the right place
A connection function was initializing some session data, so
move that code to the function that initializes the session.

Change-Id: I5f2d4349585cb97985a7bbd9fb8d6c66eeaa7d4e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 09:41:48 -07:00
Ben Walker
64f6abea9c nvmf: Sessions now contain a list of connections.
There was an extra layer of indirection complicating
things for no reason. This removes it.

Change-Id: I8d4e654eb17f8f6ec028d775329794f0745fb0f7
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-07-11 09:41:48 -07:00
Changpeng Liu
2cb8321a35 nvmf: make admin queue has the same size of bounce buffer as IO queues
The NVMf target set the maximum data transfer size(MDTS) to the default value
of 128KB now, and the initiator driver will read the value and set it to the
block layer, so each command sent from initiator will not runoff 128KB.

Change-Id: I1d4f259e887b2fc70c7f1c5406c07c58f7fc9b8d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
2016-07-11 09:13:38 -07:00
Daniel Verkamp
c9090beffe test/nvmf: remove redundant process_core calls
This is handled by autotest.sh already.

Change-Id: I2210df16fc10f36507c469318b278d6f5568e48f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 09:13:00 -07:00
Daniel Verkamp
b6af6bc6c1 test/nvmf: leave modules alone if already loaded
There's no benefit of reloading the NIC drivers (unless the drivers
themselves are buggy), so save some time by skipping the rmmod of
drivers we are about to load.

Change-Id: I05c3fd06042a2e06333d0cac123d24e6cce65b23
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 09:13:00 -07:00
Daniel Verkamp
176856c92b test/nvmf: don't try to unload nvme module
Only nvme-rdma should be loaded as part of the NVMf testing.

Change-Id: I232363bf0988ea9bd99a37df27c39cc8e9732ad5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-11 09:13:00 -07:00