Commit Graph

1597 Commits

Author SHA1 Message Date
Cunyin Chang
1fad9da400 bdev: add public function spdk_bdev_nvme_create().
Add public function which could be used by rpc method.

Change-Id: Id9d2938801e0acdf0f9827ef2990a54c75aec22a
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-10-14 01:53:31 +08:00
Ziye Yang
89b216a2a1 bdev, rbd: Add flush support
Change-Id: I779d52b1af868c7e614faf37a50fecba65757536
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-10-13 09:09:31 -07:00
Ziye Yang
9dd0f89486 bdev, rbd: Remove the lock and introduce polling strategy
This patch removes the lock in RBD module. And it requires
the librbd library supports rbd_poll_io_events function.

Change-Id: I040a7d8369ab4f69f41d1d0233115f885168f019
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-10-13 09:09:30 -07:00
Ben Walker
18a2cc11c1 env: Remove unused DPDK headers.
Remove #includes for all DPDK headers that weren't
necessary.

Change-Id: Ib02522e0f04e64a1c98afceb7508cc0e8d931a9d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-12 09:53:32 -07:00
Ben Walker
7f5b671db7 env: Convert some rte_mempools to spdk_mempools
This converts some, but not all, usage of rte_mempool
to spdk_mempool. The remaining rte_mempools use features
we elected not to expose through spdk_mempool such as
constructors, so that will need to be revisited.

Change-Id: I6528809a864ab466b8d19431789bf0f976b648b6
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-12 09:53:32 -07:00
Jim Harris
81b3d6c9fc Revert "bdev: enable IO vector operations"
This reverts commit 422eab7106.
2016-10-11 15:52:10 -07:00
Ben Walker
2224ff2162 env: Replace rte_malloc with spdk_zmalloc
Use the env library to perform all memory allocations
that previously called DPDK directly.

Change-Id: I6d33e85bde99796e0c85277d6d4880521c34f10d
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-11 13:34:09 -07:00
Daniel Verkamp
1a37acda67 eofnl: check for extra trailing newlines
Enforce exactly one trailing \n, and fix all of the existing cases.

Change-Id: I6218e4700e90aeb647eaee78089530c79993c8c8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-11 13:30:33 -07:00
Pawel Wodkowski
422eab7106 bdev: enable IO vector operations
This patch enables vector operation for bdev drivers aio, malloc and
nvme.
The rbd driver still handle only one vector.

Change-Id: I5f401527c2717011ecc21116363bbb722e804112
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
2016-10-11 12:17:47 -07:00
Daniel Verkamp
624ade2814 bdev: add unmap descriptor count check
Validate the number of unmap descriptors in the generic bdev layer
before calling the blockdev-specific unmap function.

Change-Id: Ib24e7ec63f782f23f2ee3e63393aa8463123fdb4
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-10-06 10:53:13 -07:00
Ben Walker
0dd80395f3 env: Move pci.c from util to env
This allows users to swap their PCI library from
libpciaccess/dpdk to another mechanism using the standard
method for swapping out the env library.

Change-Id: Ib2248f8b43754a540de2ec01897e571f0302b667
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-05 11:53:24 -07:00
Ben Walker
a4747c6048 env: Make the environment library configurable.
This allows users to swap out SPDK's third party
libraries for an implementation based on their own
framework.

Change-Id: Ia0b7384ce5e31acba5ad0d7002dec9e95b759c52
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-05 11:51:37 -07:00
Ben Walker
6b1e4e732d Drop libpciaccess and switch to DPDK PCI
This patch also drops support for automatically unbinding
devices from the kernel - run scripts/setup.sh first.

Our generic pci interface is now hidden behind include/spdk/pci.h
and implemented in lib/util/pci.c. We no longer wrap the calls
in nvme_impl.h or ioat_impl.h. The implementation now only uses
DPDK and the libpciaccess dependency has been removed. If using
a version of DPDK earlier than 16.07, enumerating devices
by class code isn't available and only Intel SSDs will be
discovered. DPDK 16.07 adds enumeration by class code and all
NVMe devices will be correctly discovered.

Change-Id: I0e8bac36b5ca57df604a2b310c47342c67dc9f3c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-04 15:59:00 -07:00
Ben Walker
f4140ad023 nvme: Change the deallocate interface to generic dsm
Provide a convenience wrapper for general purpose dataset
management commands. The previous wrapper for deallocate
was difficult to use correctly and only for deallocate.

Note that the name is "dataset_management" as opposed to
"data_set_management" to match the NVMe specification.
It's questionable whether "dataset" is valid English, but
it is best to match the specification.

Change-Id: Ifc03d66dbabeabe8146968cf8a09f7ac3446ad68
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-10-04 14:36:09 -07:00
Ziye Yang
c1341b0718 bdev: Add RBD support in lib/bdev
This patch will add a new bdev module, rbd.
It can make ceph rbd as the backend of iSCSI
target.

Change-Id: Id5eb3b159ee607052e3c33a2e59d721739fd9977
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2016-09-30 15:26:28 -07:00
Daniel Verkamp
d5dffc0596 bdev: replace off_t offsets with uint64_t
off_t is problematic for use as a file/block offset: it is signed, and
on 32-bit platforms, it can be 32 bits (depending on the settings of
_FILE_OFFSET_BITS and _LARGEFILE_SOURCE).

The blockdev layer already uses uint64_t to represent offsets; replace
the blockdev module uses of off_t in internal functions with uint64_t
to match.

Change-Id: I77a2e594572c56f1cd8a7a080f985ea5b27c35f3
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-29 13:13:32 -07:00
Ben Walker
a17ad921e2 Replace RTE_VERIFY with assert
We already require the assert header from the C standard library,
so use that instead of RTE_VERIFY to further isolate DPDK
dependencies.

Change-Id: I4a718af858c88aff6080e33e6c3dd533c077b8f4
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-28 10:15:56 -07:00
Ben Walker
b0e349a804 nvme: Use log library instead of nvme_printf
Change-Id: Ic9b2db9bff3a914b3e5021695287157f1e076f9f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-09-28 10:15:55 -07:00
Jim Harris
32aa4fa0a3 util: add context parameter for unique I/O channels
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I296992b2e03b9b516cfd26726405e49616ad08a5
2016-09-28 07:53:47 -07:00
Jim Harris
c1e3a87bf7 util: add 'unique' parameter to spdk_get_io_channel
Some subsystems may wish to create unique I/O channels
which are not shared across all users of the same I/O
device on the same thread.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3ade3675d57338cf85b6a301285e6f392bd6cd2e
2016-09-28 07:53:47 -07:00
Daniel Verkamp
c85360da36 build: warn about old-style C function definitions
Fix the existing cases (all missing void in parameter lists) and enable
the warning to prevent new ones from being introduced.

Change-Id: Ieaf00b3dfd5daf1e21fcbefb124514882e8996c9
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-27 16:23:07 -07:00
GangCao
372942e569 nvme: move global request_mempool allocation into nvme_impl
The user no longer needs to create the request pool.

Change-Id: I83bb8948143d4cc961d232f9f30df3106d5e0eab
Signed-off-by: GangCao <gang.cao@intel.com>
2016-09-27 14:25:39 -07:00
Jim Harris
0babf8ce81 bdev, copy: move all I/O paths to use I/O channels
bdev and copy modules no longer have check_io functions
now - all polling is done via pollers registered when
I/O channels are created.

Other default resources are also removed - for example,
a qpair is no longer allocated and assigned per bdev
exposed by the nvme driver - the qpairs are only allocated
via I/O channels.  Similar principle also applies to the
aio driver.

ioat channels are no longer allocated and assigned to
lcores - they are dynamically allocated and assigned
to I/O channels when needed.  If no ioat channel is
available for an I/O channel, the copy engine framework
will revert to using memcpy/memset instead.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I99435a75fe792a2b91ab08f25962dfd407d6402f
2016-09-26 14:02:07 -07:00
Jim Harris
746a54bef8 bdev: create new get_channel/put_channel function pointers
Also implement these functions for all of the bdev drivers in
the tree.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Idea97743d601150044b1fe2d9d76e922d46d3ee1
2016-09-26 14:02:07 -07:00
Cunyin Chang
f030bea134 bdev: Fix the misuse of pointer.
Change-Id: I072793e5322da4ec3ed16a392e556d729b003648
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
2016-09-22 15:41:48 -07:00
Jim Harris
2029c9faf9 bdev_nvme: pass nvme_qpair to nvme_queue_cmd()
This enables some future changes which will use per-thread
nvme_qpairs.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I1efcacfa6aedc970656633c9ce1393dc9b4fdbcc
2016-09-22 09:12:36 -07:00
Jim Harris
a30b59fa33 aio: create blockdev_aio_io_channel abstraction
This breaks out the resources needed to perform
aio-based I/O into a separate data structure, as a steps
towards some future patches that will enable per-thread
resources to enable parallel I/O without synchronization.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I84b95713133f9c411863ff0aeef8f886a08e0857
2016-09-22 09:12:36 -07:00
Jim Harris
f93bb8a32d Switch spdk_bdev_read/write arg order for length and offset.
This matches the general order (LBA start then LBA count) for
the NVMe API.

While here, fix a copy/paste error in a debug message (write
instead of writev).

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ice326af5d6025867dffed4d1f6c7b81fb9eba5eb
2016-09-14 10:51:25 -07:00
Jim Harris
edbed73064 Rename and move fd related helper functions to fd.c.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ieccdd778348e8709ca4ef6cdf4f58f40021638db
2016-09-14 10:51:25 -07:00
Daniel Verkamp
7bdba4437d bdev: make fn_table a const pointer
The table of bdev function pointers should not need to be modified at
runtime.

Change-Id: I3e8876fc83df9296ce528231269b1a905c96072c
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:30:28 -07:00
Daniel Verkamp
02ccb0f791 bdev: make check_io callback optional
If a bdev doesn't need to be polled, allow it to specify NULL for the
check_io function pointer to indicate that no poller needs to be
registered.

This will be useful for virtual blockdevs that don't have any associated
hardware to poll.

Change-Id: I0ef8f848587b0c200296805ccc710340dde683b5
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:30:15 -07:00
Daniel Verkamp
70ba1ba7cc bdev: clean up child I/O in bdev core
When an I/O with children is being freed, also free its child I/O
requests that were allocated via spdk_bdev_get_child_io().

Change-Id: I2d44aed845c1035ae8f8cb07c5992da855f1dc99
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:29:33 -07:00
Daniel Verkamp
ffbc120d3e bdev: remove unused children counter
Change-Id: I0255c09d6fa46f8d02f30d77f1d8b330e388d375
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:29:32 -07:00
Daniel Verkamp
efa06a2bab bdev: remove free_request bdev backend function
This callback was only used for freeing buffers, but the buffers are now
managed by the bdev core, so none of the free_request callbacks actually
do anything.

Change-Id: Icfe2e6169e829159dda5e3d75a27d8f040de07c6
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:29:32 -07:00
Daniel Verkamp
398ba3b19d bdev/malloc: add unmap support
Add unmap support to the ramdisk block device for testing purposes.

Change-Id: Ibeb5530b2b5a31603d09d2d1de07760f32dea0f8
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-09-02 09:24:47 -07:00
Daniel Verkamp
46a52cee67 bdev: drop "iSCSI" from blockdev name strings
The bdev layer can be used independently of iSCSI, so fix the
misleading names.

Change-Id: I3fd5b113403acdd7578ce93234dde0fd4f148e96
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-30 10:19:48 -07:00
Ben Walker
6e09a48e42 bdev: Separate the module header from the public header
Bdev modules need a separate interface than public
consumers of the blockdevs.

Change-Id: I581ee493570c114f7e96b31a425bc077a791c71e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-26 09:40:06 -07:00
Ben Walker
0ea0a4e646 bdev: Use the reset enum type instead of an int
Change-Id: Ia1b6503b707d71d6e2687800e750f3c07634f8f3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-26 09:40:01 -07:00
Daniel Verkamp
9272088d93 bdev: add API to query supported I/O types
Some block devices do not support the unmap operation, and we may add
other optional I/O types in the future.  Add a method to check which I/O
types a specific block device supports.

Change-Id: I6e6414bf6b6482ea0224022d8326b252bd363c7f
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-26 09:16:36 -07:00
Daniel Verkamp
d2ea70cafd iscsi: use spdk/endian.h functions
Switch from the non-portable <sys/endian.h> functions (htobeXX/beXXtoh)
to the SPDK endian conversion functions.

Change-Id: Id49b87f2e536c68f0d5d567e78e1990c0a37ef14
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-25 13:29:56 -07:00
Daniel Verkamp
5d8c94536a event: hide struct spdk_poller internals
This leaves more flexibility for future changes to the poller
representation without requiring API changes (after this one).

It also prevents the user from accidentally using poller fields in a
non-thread-safe way, since they can't be accessed directly anymore.

Change-Id: I7677d5b93668665d29ae39c5e0ba74333ad3f878
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-12 10:42:12 -07:00
Daniel Verkamp
5c9d560b5a Work around DPDK 16.07 FreeBSD rte_zmalloc() bug
Replace other critical rte_zmalloc() sites that actually depend on the
memory being zeroed.

Change-Id: If6856ad44a4c50869811d3ce9411c993ce88018d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-11 17:59:38 -07:00
Daniel Verkamp
021be6df16 bdev: add Linux AIO (libaio) backend
Change-Id: I6e7de4330f0c792514df21557a3010adef08c670
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-05 09:08:23 -07:00
Daniel Verkamp
c41ab41c17 event: add timer-based pollers
Allow pollers to be scheduled to be run periodically every N
microseconds instead of every iteration of the reactor loop.

Change-Id: Iaea3e98965d81044e6dc5ce5f406bcb7a455289e
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-08-03 09:00:54 -07:00
Ben Walker
d95d6822f9 scsi: No longer mark a bdev claimed when getting it by name
Just getting a reference to a bdev should not claim it.

Change-Id: I21e07160662490ec95b52fa31ea1d2ae93a21f09
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-02 10:07:34 -07:00
Ben Walker
e648950f89 bdev: Delete bdev_db
Combine the necessary functionality with the main bdev file.

Change-Id: I96d796bc87ac2a8688cdf1fd3c16d2a7c8aef730
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2016-08-02 09:08:51 -07:00
Daniel Verkamp
861e78bf48 bdev: add block device abstraction layer
Change-Id: I235cf146a52714756c9782c03b118f518c5f5182
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
2016-07-21 10:35:03 -07:00