Commit Graph

1005 Commits

Author SHA1 Message Date
Ben Walker
365db9ee48 sock/posix: Deal with hung I/O with MSG_ZEROCOPY and interrupt
suppression

When all of the following conditions are met:
- non-blocking socket
- zero copy is enabled
- interrupts are suppressed (i.e. busy polling)
- NIC tx queue is full at the time sendmsg() is called
- epoll_wait sees there is already an EPOLLIN event
then we can get into a situation where data we've sent is queued
up in the kernel network stack, but interrupts have been suppressed
because other traffic is flowing. This makes the kernel miss the
signal to flush the software tx queue. If there wasn't also already
a pending EPOLLIN event, then epoll_wait would have been sufficient
to kick the system out of this state. But when all of this aligns,
it hangs.

We deal with this by detecting the scenario and calling poll(), which
will force the kernel to issue the pending transmits.

Change-Id: Ifb247159b7de16c8fc72a90f0333f5b421c8bd07
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6750
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-04-23 18:31:07 +00:00
Liu Xiaodong
2d36f6f11c bdev_aio: add set interrupt mode to poller
Change-Id: I089241bbb42c047e8ae4f206f2dad72c4a69f1d9
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5789
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-04-23 18:09:54 +00:00
Ziye Yang
467148fce5 bdev/rbd: Refactor the parameters in bdev_rbd_init.
Only passing rbd pointer is enough.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I652581879c9ba228f9af0aa3f5353915a286c6c8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7548
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-22 15:42:53 +00:00
Ziye Yang
3df11166e7 accel_engine: fix the bug while computing chained crc32c via hardware engine.
This patch is used to fix the chained crc32c computing when users pass
a vector. Since we use a union in spdk_accel_task structure to differentiate
the usage on "src" and "the vector info" (iovs and iovcnt). So we cannot
directly write the src field while users pass a vector.

And I verified it in the hardware platform.

Change-Id: I85d6e86fa689b261782f80a2f89d908a5d4db84f
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7471
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-04-19 21:27:21 +00:00
Ziye Yang
3727f6ea4a bdev/rbd: Fix the I/O channel leak in bdev_rbd_resize function.
The original code does not free the I/O channel
in bdev_rbd_resize.

Change-Id: I8e48616bea37ba7cece5a179c0f1ca03b3f5cb53
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7466
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-19 19:21:43 +00:00
Ziye Yang
741abc3c8b bdev/rbd: Add the missing "rados_shutdown" call.
Add the missing rados_shutdown call in
bdev_rbd_init function.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I0222d2453d1547cfd735f15237eca124cbc23479
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7430
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-04-19 19:21:43 +00:00
Sudheer Mogilappagari
2974f8d676 posix: replace usage of recv() with poll()
Busy pollng using recv() is dependent on kernel socket buffer being
empty. Instead poll() function busy polls hw queues with no such dependency.

Signed-off-by: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>
Change-Id: I1cb101848d51f7778cdf3d4c015d2d03201bdb37
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7014
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-19 19:13:41 +00:00
Ben Walker
4e347038a8 sock: Maps hold group_impls instead of groups
Since the maps are unique to modules, they can store the group_impls
directly.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I7f11db558e38e940267fdf6eaacbe515334391c2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7222
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-19 12:54:54 +00:00
Ben Walker
5379aa95e7 sock: Each module now maintains its own sock_map
This allows for different policies per module, as well as overlapped
placement_id values.

Change-Id: I0a9c83e68d22733d81f005eb054a4c5f236f88d9
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7221
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-19 12:54:54 +00:00
Ben Walker
6b86039fd9 nvme/tcp: Ensure qpair is polled when it gets a writev_async completion
There was a fix for this that went into the posix layer, but the
underlying problem is the logic in the nvme/tcp transport. Attempt to
fix that instead.

Change-Id: I04dd850bb201641d441c8c1f88c7bb8ba1d09e58
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6751
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-19 12:54:24 +00:00
Ben Walker
6d6959e989 sock/posix: Rename pending_recv to pending_events
This list will hold any socket that has some event pending and needs to
be part of the set returned during polling of the group.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I5acf01677e59c1026f93671c7b7b3dc458075bf7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6748
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-04-19 12:54:24 +00:00
Ben Walker
fc551b3a62 sock/posix: Make pending_recv shuffle more efficient
Instead of iterating the list, we can just manipulate the list
in a single step.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I0172cdbce9af35a62d62dbccfac573e5d723f43a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6747
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-04-19 12:54:24 +00:00
Jin Yu
2f600ca75e virtio-blk: add hotplug rpc
Change-Id: I4ed583d91ae9e820be1ee6f4553f29d6650c4922
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5791
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-16 19:21:13 +00:00
Jin Yu
ebea4dd660 virtio_blk: add hotplug support
It can divide to two parts:
1, UIO driver - sigbus error handling and uevent
process.
2, VFIO - request notify handling.

sigbus error process is in previous patch.

Change-Id: Idc09754b83ae9ddcaea1f2afcbc13e528ead9863
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5768
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-04-16 19:21:13 +00:00
Ben Walker
e8bcf36a81 sock: Don't cache placement_id in generic sock struct
Instead, move it down to the modules. This allows modules
to potentially change the value, if they are able.

Change-Id: I08f5fbadf5d1e96b489ddaaca72aa051ce2cb85c
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7212
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-16 05:04:29 +00:00
Ben Walker
1d2613fe36 sock/posix: Eliminate so_priority
This value is already available in the options structure.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I140dc79da1fa5f155a39f1f9e2f54f46d93b6c1c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7211
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-16 05:04:29 +00:00
Monica Kenguva
a89ea97204 bdev/error: properly initialize value of num for inject_error RPC
Updated to represent default value of number of errors injected.

Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: If3f7a5f4a222fa1180635beb671d9479eede0435
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7246
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-15 21:41:05 +00:00
Alexey Marchuk
558be98fd3 nvme/pcie: Add statistics per poll group
Check if qpair has a poll group during the connect process,
use poll group's statistics or allocate own structure per
qpair. That is done due to not all applications use poll
groups and we want to avoid "if (qpair->group)"
conditions in data path.

Admin qpair always allocates its own statistics
structure but the statistics are not reported
since this qpair is not attached to a poll group.

Statistics are reported by spdk_nvme_perf tool
if --transport-stats and in bdev_nvme_transport_statistics
RPC method.

Change-Id: I58765be161491fe394968ea65ea22db1478b219a
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6304
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-13 21:30:52 +00:00
Alexey Marchuk
5c33437b99 bdev_nvme: Add RPC to dump transport statistics
The new RPC bdev_nvme_get_transport_statistics is added.

Change-Id: Ic13d096717c041fd3e0b77eaebca6ae09239698b
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6303
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-13 21:30:52 +00:00
Shuhei Matsumoto
e5cb3d3fba bdev/nvme: Factor out getting admin path into a helper function
Factor out the operation to get ctrlr pointer to submit an admin
command into a helper function bdev_nvme_find_admin_path().

This will make the following changes transparent.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Idabfa5874ad95414f24d414702205b0cdbc98ddb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7105
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-12 09:51:03 +00:00
Shuhei Matsumoto
42ae4267b6 bdev/nvme: Merge completing reset_io into _bdev_nvme_reset_complete()
reset_io is stored into nvme_bdev_ctrlr->reset_bio now. Hence we can
merge completing reset_io into _bdev_nvme_reset_complete() easily.
i
As a few minor changes, to reduce the size of the following patches,
clear reset_bio before calling spdk_bdev_io_complete(), and call
spdk_bdev_io_complete() after completing ctrlr reset.

The following patches will retry pending reset_ios if reset is internal,
abort reset_ios if reset is external and fails, or succeed reset_ios
if reset is external and succeeds.

This clean-up will be helpful for such enhancement.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5e0b4e04b19f4f4f3b21b2db4dc6a2b948b29c67
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7241
Community-CI: Broadcom CI
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-12 09:51:03 +00:00
Shuhei Matsumoto
888def105f bdev/nvme: Further clean-up of bdev_nvme_reset()
nvme_bdev_ctrlr->reset_bio is accessed only by the thread which called
spdk_for_each_channel() and the callback to spdk_for_each_channel()
is called after unwinding stack via message.

Hence bdev_nvme_reset() can call _bdev_nvme_reset() rather than
_bdev_nvme_reset_start() and store bio into nvme_bdev_ctrlr->reset_bio
after _bdev_nvme_reset() returns zero.

Then inline _bdev_nvme_reset_start() into _bdev_nvme_reset() because
_bdev_nvme_reset_start() has only a single caller now.

The following patches will introduce subsystem and bdev_nvme_reset()
will reset all controllers of a subsystem sequentially. These further
clean-ups will be helpful for such enhancement.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I25abaa5be511c967ce20c92e4caa7dfeb3e09dd1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7240
Community-CI: Broadcom CI
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-12 09:51:03 +00:00
Ben Walker
28b3889c8e sock: Use an enum for placement modes
Easier to read than integers.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ie9b8b16e1916b393a257e9ed0180ef9837f20cd2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7205
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
2021-04-09 17:15:57 +00:00
Shuhei Matsumoto
b3f998e58b bdev/nvme: Get current thread simply by spdk_get_thread() to set bio->orig_thread
These are not performance critical and we can get the current thread
simply by spdk_get_thread().

This change will make the following changes a little simpler.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ide79b1275ec0122f7f9812fe53c08a83d0aafeda
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7162
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
48cf3e9bbd bdev/nvme: Factor out deleting nvme_bdev_ctrlr into a helper function
This change will make the the upcoming changes a little easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I51776c8ab91a0dfd9150f17e567f8be795b9f4b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7046
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
61532e08ed bdev/nvme: Rename nvme_bdev_ctrlr_do_destruct() by nvme_bdev_ctrlr_unregister()
Probably nvme_bdev_ctrlr_unregister() is more appropriate name.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3a0d3622c084df909e5daeb548726cd9bd826ad8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7045
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
1a0144b7c4 bdev/nvme: Deleting OPAL and OCSSD after completing unregistration of io_device
Deleting OPAL device and OCSSD ctrlr after completing unregistration
of io_device will be safer and be helpful for the upcoming patches
to introduce subsystem.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7eb11d5c19bf50903496a7fb936c77aa05089046
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6889
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
68a8502f1c bdev/nvme: Remove nvme_ns->ref and use nvme_ns->populated and nvme_ns->bdev instead
As said in the previous patches, nvme_ns->ref is 2 at most, and
first is for populating namespace and second is for nvme_bdev.
On the other hand, nvme_ns->populated is for populating namespace
and nvme_ns->bdev is for nvme_bdev.

Preparation was done by the preceding patches. Let's remove nvme_ns->ref
and use nvme_ns->populated and nvme_ns->bdev instead.

We have unit tests for both normal case and shutdown case now.
So regression will be avoided.

These changes will be helpful for the following patches to support
multipath.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I279ca21a41d6ee2c07bbbeb62866e28423fcc6d0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7097
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
2bed9983e2 bdev/nvme: Merge clearing nvme_ns->populated into nvme_ctrlr_depopulate_namespace_done()
Merge setting nvme_ns->populated to false into
nvme_ctrlr_depopulate_namespace_done(). This will simplify the
further changes.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4bb8347b085ec5855690f6dbde243269cedee706
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7136
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
b1d6c2f3cb bdev/ocssd: Add ocssd_ns->depopulate_pending to complete pending depopulation
The following patches will remove nvme_ns->ref and use nvme_ns->populated
and nvme_ns->bdev instead because nvms_ns->ref is two at most and
each count of nvme_ns->ref corresponds to nvme_ns->populated or
nvme_ns->bdev.

To do that, we need to ensure nvme_ns->populated is cleared after
spdk_bdev_unregister() is called, otherwise nvme_bdev_ctrlr_destruct()
is called twice.

However OCSSD namespace had used nvme_ns->populated to free resource
after getting log page completes.

To keep such deferral, add the depopulate_pending flag to struct bdev_ocssd_ns
and use it. Then clear nvme_ns->populated in bdev_ocssd_free_namespace()
after spdk_bdev_unregister().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I93199dbd504145bd1e5ea59f5914422c6c5bc938
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7102
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
f26d6c73e1 bdev/nvme: Set nvme_ns->populated to true just after nvme_ns is available
A few patches including this patch will remove nvme_ns->ref by
nvme_ns->populated and nvme_ns->bdev and remove nvme_ns->ref.

In this patch, set nvme_ns->populated to true when nvme_ns->ref is
incremented, i.e., nvme_ns is available. nvme_ctrlr_populate_namespace_done()
clears nvme_ns->populated if creating bdev failed by memset().
And add assert to nvme_ctrlr_depopulate_namespace_done() to ensure
nvme_ns->populated is false when nvme_ctrlr_depopulated_namespace_done()
is called.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I536933abb516c0a29231149ab564dc8b84245b10
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7096
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
8cc81fa07a bdev/nvme: Inline nvme_bdev_ns_detach()
The nvme_ns->ref was added to nvme_bdev_ns to support both multipath
and OCSSD range. OCSSD range was to split a namespace into multiple
partitions.

However, OCSSD range was not used and removed to simplify multipath.

When namespace is not split, nvme_ns->ref is 2 at the maximum. First is
for populating namespace and second is for nvme_bdev. nvme_ns->populated
is for populating namespace and nvme_ns->bdev is for nvme_bdev.
Hence we can use nvme_ns->populated and nvme_ns->bdev directly instead of
nvme_ns->ref.

A few patches from this remove nvme_ns->ref and use nvme_ns->populated
and nvme_ns->bdev instead.

dThis patch inlines nvme_bdev_ns_detach() into the callers and remove it.

The following patches will adjust the locations to update nvme_ns->populated
and nvme_ns->bdev and then remove nvme_ns->ref.

Removing nvme_ns->ref will be helpful to associate multiple namespaces
into a single nvme_bdev for multipath.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I87581d39769681adc5e1fdf0b33680e31d958e47
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7095
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
2b8661d6ac bdev/nvme: Move nvme_ctrlr_depopulate_namespace_done() to common.c
Moving nvme_ctrlr_depopulate_namespace_done() to common.c removes the
stub from bdev_ocssd_ut.c and will simplify the upcoming changes.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia94a88ca77518c7df08b52aa9298cdea5997ca1e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7135
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
610dd86b8c bdev/nvme: Inline nvme_bdev_ns_to_bdev() and remove it
nvme_bdev_ns_to_bdev() was introduced because nvme_ns->bdev may be
removed to support multipath. However, it is unlikely now.

Hence it is easier to read to stop using nvme_bdev_ns_to_bdev() and
access nvme_ns->bdev directly.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iaf35455218761bafd03060a21110ad1c4098b1db
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7098
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
45d8309e52 bdev/nvme: Factor out deleting secondary trid into a helper function
Factor out deleting secondary trid from bdev_nvme_delete() into a
helper function bdev_nvme_delete_secondary_trid().

This will make the following changes simpler.

Besides, fix a typo, the case should be not 1B but 2B.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iba21efa0d8036ed15d2743a2548df05e866089d6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7123
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
08e2210ace bdev/nvme: Merge callback and spdk_nvme_detach() into bdev_nvme_add_trid()
This change separates failover case more clearly, and will make
the following changes simpler.

Merge spdk_nvme_detach() and populate_namespaces_cb() into
bdev_nvme_add_secondary_trid(). Then change the return type of
bdev_nvme_add_secondary_trid() to void and move the comment to the
head of it.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0eb706728cf1b9ad7031eb66e11880a47e2ba767
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7044
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
0e3de45def bdev/nvme: Refactor add_trid() and rename it by add_secondary_trid()
Clean up bdev_nvme_add_trid() by factoring out comparison of namespaces
and comparison of trids into helper functions, bdev_nvme_compare_namespaces()
and bdev_nvme_compare_trids(), respectively.

Then rename bdev_nvme_add_trid() by bdev_nvme_add_secondary_trid().

Rename is for clarification and clean-up is for the next patch.
The next patch will merge spdk_nvme_detach() and populate_namespaces_cb()
into the renamed bdev_nvme_secondary_trid(). Clean-up makes the
next patch simpler.

One note is that checking if the type of trid is not PCIe is done
by holding mutex now to prioritize clean up.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Idc8652329dd2c721d101a724ec1a57a66c4174a7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7094
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-08 16:10:26 +00:00
Shuhei Matsumoto
1aa2537480 bdev/nvme: Merge populate_namespaces() and its callback into nvme_bdev_ctrlr_create()
The following changes will require nvme_bdev_ctrlr_create() to be
asynchronous. As a preparation, merge nvme_ctrlr_populate_namespaces()
and populate_namespaces_cb() into nvme_bdev_ctrlr_create().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I623f927da072d746b4bd83314c0f5bcb9cc34ef0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7043
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-30 11:43:24 +00:00
Shuhei Matsumoto
cd820331a2 bdev/nvme: Move up populate_namespaces_cb() in a file
This will reduce the size of the following patches.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I81d7c90d8676a42aff3ffe73932d5612642a4114
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7042
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-30 11:43:24 +00:00
Shuhei Matsumoto
90f434b9a0 bdev/nvme: Factor out destroy qpair operation into a helper function
Factor out the operation to destroy qpair into a helper function
bdev_nvme_destroy_qpair().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5ac9215407e0b4f4368a68bc58d8e3daac029393
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6783
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-30 11:43:24 +00:00
Shuhei Matsumoto
444677f3b4 bdev/nvme: Pass nvme_bdev_ctrlr to the callback to for_each_channel() in reset processings
Pass nvme_bdev_ctrlr to callback to each spdk_for_each_channel() call
in reset processing.

The following patches will register nvme_bdev_subsystem instead of
nvme_bdev_ctrlr as io_device. Hence we need a different way to pass
nvme_bdev_ctrlr to the completion functions of spdk_for_each_channel().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ief31dbbc145b5850e4e5b2e4c9ad7287128ce870
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6950
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-30 11:43:24 +00:00
Shuhei Matsumoto
20839ad6a0 bdev/nvme: Hold bdev_io which submits reset into nvme_bdev_ctrlr
Hold the bdev_io which submits the reset request into the nvme_bdev_ctrlr.
as reset_bio. Then differentiate the callback function between
_bdev_nvme_complete_pending_resets() and _bdev_nvme_abort_pending_resets()
to spdk_for_each_channel() in _bdev_nvme_reset_complete().

The next patch will pass nvme_bdev_ctrlr to for_each_channel() instead.

The following patches will register nvme_bdev_subsystem instead of
nvme_bdev_ctrlr as io_device. Hence we need a different way to pass
nvme_bdev_ctrlr to the completion functions of spdk_for_each_channel().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If7a3386815429e8ed44f4e9e5365a21bd97e7fb6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6913
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-30 11:43:24 +00:00
Shuhei Matsumoto
cb8aa8abc5 bdev/nvme: Not try freeing qpair when it is NULL, and add test scenario
The API spdk_nvme_ctrlr_free_io_qpair() returns immediately if the
passed qpair is NULL, but calling spdk_nvme_ctrlr_free_io_qpair()
with NULL should be avoided.

This patch cleans up the code to ensure that nvme_ch->qpair is NULL if
disconnected and spdk_nvme_ctrlr_free_io_qpair() is called only if
nvme_ch->qpair is not NULL.

Then add a test scenario that two reset requests were submitted
simultaneously and the first reset request failed and then the second
reset request also failed. This verifies the refactoring done in the
next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iae461f7f826b0e1a4607a17e528c04a642242d6e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7041
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-30 11:43:24 +00:00
Niklas Cassel
059dcf1da1 bdev/nvme: add support for zoned namespaces
Add support for zoned namespaces in the bdev/nvme module.

Query the namespace type, and if a zoned namespace is found, set the
bdev struct members needed by the bdev_zone.h APIs.

Note that while vbdev_zone_block and bdev_ocssd have zone locks,
bdev/nvme does not need any kind of zone lock, because NVMe ZNS
supports append natively.

The whole point of the zone append command is that you don't need any
locks, even when having multiple writers, since the drive will return
back the Assigned LBA where the blocks were actually written.

If a SPDK application will utilize writes instead of zone appends,
the SPDK application itself will need a per zone lock in order to
make sure that there is only one outstanding write.

Adding zone locks in bdev/nvme would reduce the performance of zone
appends, for no reason at all.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ibacdb9b6e839624aba869c9949231343db5914be
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6911
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-29 10:17:45 +00:00
Niklas Cassel
9f5852d049 bdev/zone: add support for max zone append size
Add support in bdev_zone.h for getting the maximum zone append data
transfer size.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I61203e64d51601232c6578a090fa52975364c1f3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6910
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-29 10:17:45 +00:00
Sudheer Mogilappagari
4ac5ca6558 posix: add sock to pending_recv list only if not already added
Currently there is possibility of adding a sock to pending_recv
list again if sock->pending_recv is true. Check if flag is false
before adding to the list.

Signed-off-by: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>
Change-Id: Ie23e1e8dbe1aa5594d9ddea30e7f235e3bf8ddad
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6381
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-03-29 07:43:08 +00:00
paul luse
30d83eb617 bdev/raid: remove deprecated parameter strip_size
For bdev_raid_create RPC, the deprecated parameter strip_size
was removed.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ie9b8d133e29e82e04f92e4a9336b30d8882e37cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6742
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-29 07:41:09 +00:00
Ben Walker
b67aa514a4 sock/posix: No longer remove sockets from pending_recv in poll
This seems to be cleaning up the pending_recv list to account for the
missed cases in the previous patches in this series. Now that we're
correctly cleaning up the list, don't do this.

Note that if an EPOLLIN event is received but the application never does
a read/recv, the socket will remain in the pending recv list. The next
poll will get another EPOLLIN event, but the logic already handles that
case.

Additionally, left a TODO for a performance optimization.

Change-Id: I1cdde500a5c76554401a89de766d35b7a486b207
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6746
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-29 07:28:35 +00:00
Ben Walker
8ac5f9e924 sock/posix: Fix read logic to avoid double-adding socket to pending_recv
Also write some better comments

Change-Id: I81d59307c5eacc5a71879a83e5040da667909d96
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6745
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-29 07:28:35 +00:00
Ben Walker
01aa5cb385 sock/posix: Clear sock from pending_recv even if user does large read
If there was an EPOLLIN event the socket gets adding to the pending_recv
list. But if the application then does a very large read, it will bypass
the logic that clears the socket from the pending_recv list. Fix this.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ia0ba86012f7c6dfd14eb43ba6eeed94dbbce90ce
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6744
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-29 07:28:35 +00:00
Ben Walker
8e7d559283 sock/posix: When a socket has no recv_pipe, reading should still clear
from pending_recv list

If the upper layer performs a read/recv, it should still remove the
socket from the pending_recv list.

Change-Id: I32ca8ecccbfe1e53ecc7d6f57343c2727e84b851
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6743
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-29 07:28:35 +00:00
GangCao
09a1028e0f nvme: fix double free of g_hotplug_probe_ctx
Add a check and only free g_hotplug_probe_ctx once.

This is to fix below issue:
https://github.com/spdk/spdk/issues/1849

Change-Id: I7387495890830badd06a7341d9ac4d149ca1c9f4
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7002
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-03-24 11:59:39 +00:00
Ziye Yang
d515bf739d bdev/nvme: Use the accelerated_engine
This patch really uses the accelrated engine.
Currently, we only offload the crc32c caculation,
but it can be extended.

Change-Id: If0e4c6a44b6e1e10e03f7eca355bed418d67326b
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6760
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-03-23 10:09:39 +00:00
Shuhei Matsumoto
26c5cc5259 bdev/nvme: Remove ctx parameter from _bdev_nvme_reset()
Separate bdev_nvme_reset() and _bdev_nvme_reset() by making
bdev_nvme_reset() call _bdev_nvme_reset_start(), and then
remove the ctx parameter from _bdev_nvme_reset().

This clarifies the next patch and reduces the size of the next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I76b0f2f5b83445845a313203e594dca0be150bc3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6949
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-22 09:45:53 +00:00
Shuhei Matsumoto
f84b70f6b1 bdev/nvme: Separate start and for_each_channel operations of _bdev_nvme_reset()
We need to pass bio only when the reset request came from the upper
layer. Previously, bdev_nvme_reset() called _bdev_nvme_reset() and
_bdev_nvme_reset() had the second parameter, ctx, to pass bio to
for_each_channel(). However, it was not clean.

Let's separate bdev_nvme_reset() which processes a reset request
came from the upper layer and _bdev_nvme_reset() which proesses
an internal reset request by adding a helper function
_bdev_nvme_reset_start().

The next patch will remove the second parameter, ctx, from
_bdev_nvme_reset() for clarification and further refactorings.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2bd00e3abb56fe8d540b8af55743ee92ca9cd526
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6948
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-22 09:45:53 +00:00
Shuhei Matsumoto
d22497a72c bdev/nvme: Process pending destruct ctrlr request by adding an new variable
The recent refactoring removed the destruct poller and change the
reset processing to destruct ctrlr after its completion by conditionally
sending message.

But differentiating callback function is difficult if we reset multiple
ctrlrs.

If nvme_bdev_ctrlr->destruct is set, any new reset cannot start. So we can
use an new variable and always execute the callback function.

Add an new variable pending_destruct to struct nvme_bdev_ctrlr, and set
pending_destruct if ctrlr->ref is zero and ctrlr->destruct is true, and
then start destruct ctrlr if ctrlr->destruct_after_reset is set after
clearing pending resets.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9f34c42a40c5a5da54611e7871aef8c58117a56a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6714
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-22 09:45:53 +00:00
Shuhei Matsumoto
21bff99197 bdev/ocssd: Get spdk_nvme_ctrlr from not nvme_bdev_ctrlr but spdk_nvme_ns in I/O paths
The following patches will cache and use spdk_nvme_ns pointer rather than
nvme_bdev_ns pointer in I/O paths. As a preparation, change a few cases
to get spdk_nvme_ctrlr pointer from spdk_nvme_ns.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ief5f01f85f46e2ad822af5b5abb13a14f28a0c6a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6834
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-22 09:45:53 +00:00
Shuhei Matsumoto
929a207b37 bdev/ocssd: Get nvme_ns from not nvme_bdev but nvme_ch for callback to get zone info
This will make the following changes a little easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I97ce4fb03d02679f5be152b04c33650bf5164f2a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6833
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-22 09:45:53 +00:00
Ziye Yang
6153b4aa8f nvme: Add a new parameter in spdk_nvme_poll_group_create
Purpose: To setup an accelerated function callback
for created spdk_nvme_poll_group. In this patch,
we just create the interface. The real usage of this
call back will be provided in the other patch.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I0d936aa4eba4dbfcc0137942156b9f2919eb5b78
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6758
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-18 14:42:35 +00:00
Shuhei Matsumoto
9937ba0b5f bdev/nvme: Fix the RPC bdev_nvme_send_cmd to pass the registered io_device, nvme_bdev_ctrlr, correctly to get io_channel
Previously, not nvme_bdev_ctrlr but spdk_nvme_ctrlr pointer had been
passed to spdk_get_io_channel() in nvme_rpc_io_cmd_bdev_nvme().

There was no unit test for bdev_nvme_get_io_qpair(), and so add
unit test for it to guard us from degradation.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I00fdc14ea6467162c5fb90d04389883d7c409a17
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6920
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-18 14:41:13 +00:00
Rafal Stefanowski
5bdaec6322 ocf/rpc: Add bdev_ocf_set_cache_mode method
This method allows to dynamically switch cache mode on OCF bdev

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
Change-Id: I933273e35bb9f29528657f8f6800c6b52dde32e5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6547
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-18 14:39:09 +00:00
Rafal Stefanowski
37028231db bdev/ocf: OCF 20.12.1 requirements
OCF now includes on its own only small part of env, that is crucial for
compiling headers for casadm - an OCL management tool. The idea behind
this is to reduce the amount of included stuff when it is not needed.

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
Change-Id: I58fef2be3ccb1cce743093ed973ba54cdbb605e1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6413
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-18 14:33:55 +00:00
Ben Walker
09b0c84f1b event/nvmf: Remove use of spdk_app_stop()
This is the only reason the event.h header is included here
and it isn't necessary.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I4c0a9828cfede1ccd1c9263ad66b354ba167f434
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6919
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-18 13:18:29 +00:00
Jacek Kalwas
6e2c2306f9 build: install generated pkg-config files
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I191ad5e3b153fb563256eba1aa695716f66db788
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6377
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-17 11:10:45 +00:00
Ziye Yang
0731c2273d bdev/rbd: Change some function type from int to void
Purpose: Make the code clean and remove duplicated code.

Change-Id: I6cc8b94af24f89301531bd38d766afb53898e0ed
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6811
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-03-12 08:36:11 +00:00
Shuhei Matsumoto
2c436c00a0 bdev/ocssd: Get io_channel from not nvme_ch but bdev_io when processing pending requests
The next patch will add nvme_bdev_channel and we will not be able to
io_channel from nvme_ch anymore.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8ba93e66657d21da58df63f3ad6dde4b155fc174
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6612
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-12 08:20:46 +00:00
Shuhei Matsumoto
e1489743ed bdev/nvme: Add mutex per nvme_bdev_ctrlr
Add mutex per nvme_bdev_ctrlr and replace g_bdev_nvme_mutex by it
for possible cases. These are just drop-in-replacement.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib1d5eebd65e514cfe96ad60a9004d9bace7b4f6b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6693
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-12 08:20:46 +00:00
Shuhei Matsumoto
83f27434d3 bdev/nvme: Merge bdev_nvme_remove_trid() into bdev_nvme_delete()
This will make us easier to maintain the operation to delete
nvme_bdev_ctrlr and its trids. The added unit test cases guard us
from degradation.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I400d4092020e89bacaebc7be045a456b8760ed8d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6688
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-03-12 08:20:46 +00:00
Shuhei Matsumoto
3eb0b6b167 bdev/nvme: Factor out the common part of remove_cb() and bdev_nvme_delete()
By adding the second parameter, hotplug, factor out the common part
of remove_cb() and bdev_nvme_delete() into a helper function
_bdev_nvme_delete().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5becbc7a7a94e852510e6a2745afb9c533d21713
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6692
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-12 08:20:46 +00:00
Tomasz Zawadzki
99935996f2 lib/bdev: move to spdk_bdev_part_base_construct_ext()
spdk_bdev_part_base_construct() is deprecated so this patch
moves remaining instances to spdk_bdev_part_base_construct_ext().

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Iccd4b15933bec41885adfaf4fc4ce2abedd2d6c7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6627
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-09 08:54:53 +00:00
Richael Zhuang
201aa63471 sock: introduce SO_INCOMING_CPU to get placement_id
Leverage SO_INCOMING_CPU to get the CPU affinity of connections
(sockets). And allocate the connections to specific poll groups,
which aims to utilize cache locality.

From our test:
6 P4600 NVMe on target,target uses 8 cores, NIC irqs are bound to
these 8 cores, and initiator side uses 24 and 32 cores,
we can get 11%~17% randwrite performance boost for posix, and 8%~12%
for uring.

Change-Id: I011e0a21502c85adcccd4a14fbe9838b43f54976
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5748
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-09 08:53:52 +00:00
Shuhei Matsumoto
e8cde79560 bdev/nvme: Return the created ctrlr directly from nvme_bdev_ctrlr_create()
This also simplifies the code.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I32ca5e24779dc60e0ff4cf2610951cce55d06c75
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6622
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-08 10:49:54 +00:00
Shuhei Matsumoto
949b21f143 bdev/nvme: Add nvme_bdev_ctrlr parameter to nvme_ctrlr_populate_namespaces_done()
nvme_bdev_ctrlr is valid while populating namespaces of the
nvme_bdev_ctrlr regardless of the result. nvme_bdev_ns holds
nvme_bdev_ctrlr by its pointer, ctrlr. Hence it is not necessary for
nvme_ctrlr_populate_namespaces_done() to use nvme_bdev_ctrlr_get_by_name()
to get nvme_bdev_ctrlr.

To simplify the code, add nvme_bdev_ctrlr parameter to
nvme_ctrlr_populate_namespaces_done() and remove the
nvme_bdev_ctrlr_get_by_name() call from nvme_ctrlr_populate_namespaces_done().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ic2013842fad16ea0de49c18b5b853d147c23a6b2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6621
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-08 10:49:54 +00:00
Shuhei Matsumoto
4fa4e4cc3f bdev/nvme: Use bdev_nvme_find_io_path() to a remaining case, no_pi_readv()
bdev_nvme_no_pi_readv() had not been used for bdev_nvme_no_pi_readv() yet.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9bf815b36ef0daa2f1248f618a9c7e2f1ea62346
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6603
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-08 10:49:54 +00:00
Tomasz Zawadzki
739d541362 lib/bdev: move to spdk_bdev_open_ext()
spdk_bdev_open() is deprecated, so this patch moves
remaining instances to spdk_bdev_open_ext().

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I7e8648efbf166665bf1c3700a11a6dc81fd051c3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6625
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-05 08:33:45 +00:00
Tomasz Zawadzki
3e15b356f3 module/blob: remove deprecated spdk_bdev_create_bs_dev/from_desc()
spdk_bdev_create_bs_dev was deprecated in SPDK 19.10
spdk_bdev_create_bs_dev_from_desc was deprecated in SPDK 20.10

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1290958923f7833579d098a693454e7ab7656307
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6624
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-05 08:33:45 +00:00
yidong0635
a497ee9b56 splite/vbdev_split: Free base part bdev on the error path.
spdk_bdev_part_base_construct_ext is called by spdk_bdev_part_base_construct.
there's already an example if a base bdev is an abnormal case we need to do
spdk_bdev_part_base_free to close the base bdev.

From constructing a successful part base bdev util finishing vbdev_split_create.
there're except failure cases to exit.

if a bdev is open and when runs into bdev_unregister_unsafe, it's in an EBUSY
state, bdev will not finished from the list. That spdk_io_device_unregister
will no be executed in spdk_bdev_unregister.

That a subsytem with it callback which is app_reactors_stop can't be finished.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: Idc156557f936da5f2618421ede2619f1f2e29c51
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6599
Community-CI: Broadcom CI
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-02 08:02:58 +00:00
Changpeng Liu
b5fe146a9c bdev/malloc: check block size when creating a new block device
Fix #1808

Change-Id: Iee2ca197ecfd096ffda9ea067bd13f8995792ff3
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6578
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-01 12:07:09 +00:00
Ziye Yang
2f1cd867f3 sock/uring: Refactor the code in uring_sock_close
Use the same style compared the code in posix_sock_close.
Thus if we cannot close sock->fd, i.e., we leak the fd,
but we can still free the memory related with uring sock.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Id2f0e8a2c7065f100c2b009e76a49b528fd221b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6539
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-25 10:26:08 +00:00
Nick Connolly
e7c019874c module/bdev/nvme: improve portability
In nvme_bdev_ctrlr_create, calloc will be called with a zero size
allocation request if the number of namespaces is zero. The behaviour
is implementation defined if the size of the space requested is zero -
calloc will either return a pointer that mustn't be dereferenced, or
NULL. If NULL is returned, the nvme_bdev_ctrlr_create will fail.

Only call calloc if there are a non-zero number of namespaces.
Otherwise, leave the namespaces pointer with a NULL value. All
references to namespaces[] are either known to be safe, or occur
in the context of looping through the namespaces which will be
skipped if the count is zero. The exception to this is in
vbdev_opal_create, where an assert has been added to match
equivalent code in bdev_ocssd_create_bdev.

Tested by running unit tests on a system that returns a null pointer
for a zero size allocation.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I058b0683fd9b3a20bf90e54db93ca48b9bb4e40e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6551
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: sunshihao <sunshihao@huawei.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-25 10:25:20 +00:00
Ziye Yang
d5cd0b13b6 sock: Fix the "sock remove assert bug" in spdk_sock_group_remove_sock
The statement causes this issue is:

assert(group_impl->num_removed_socks < MAX_EVENTS_PER_POLL);

The call trace is:

The previous solution is:
commitid with: e71e81b631

But with this solution, it will always add the sock
into the removed_socks list even if it is not under polling
context by sock_group_impl_poll_count. So it will exceed the size of
removed_socks array if sock_group_impl_poll_count function will not be
called. And we should not use a large array, because it is just a workaround,
it just hides the bug.

So our current solution is:

1 Remove the code in sock layer, i.e., rollback the commit
 e71e81b631. This patch is
not the right fix. The sock->cb_fn's NULL pointer case is
caused by the cb_fn of write operation (if the
spdk_sock_group_remove_sock is inside the cb_fn). And it is not
caused by the epoll related cache issue described in commit
"e7181.." commit, but caused by the following situation:

(1)The socket's cb_fn is set to NULL which is caused by
spdk_sock_group_remove_sock by the socket itself
inside a call back function from a write operation.

(2) And the socket is already in the pending_recv list. It is
not caused by the epoll event issue, e.g., socket A changes Socket B's
cb_fn. By the way, A socket A should never remove a socket B from a polling group.
If it really does it, it should use spdk_thread_sendmsg to make sure
it happens in the next round.

2 Add the code check in each posix, uring implementation module.
If sock->cb_fn is NULL, we will not return the socket to the active socks list.
And this is enough to address the issue.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I79187f2f1301c819c46a5c3bdd84372f75534f2f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6472
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-24 13:06:50 +00:00
Rafal Stefanowski
80b80d2482 bdev/ocf: Handle memory error properly
When there is not enough memory needed to start cache, print
relevant message and inform about possible solutions.

Fixes #1763

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
Change-Id: I911dcb4e86ad7e3f2e2b051678736d4e88869db5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6078
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-24 13:06:12 +00:00
Shuhei Matsumoto
847d0a4ec0 bdev/nvme: Get nvme_bdev from standard ns via helper function for configuration
When multipath is supported, nvme_bdev will be got via bdev_subsystem.
To make such change transparent, add a helper function
nvme_bdev_ns_to_bdev() and use it for some cases.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia5ad0b87178bc739ba0a75789f9f26b860241a04
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5801
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-24 13:01:44 +00:00
Shuhei Matsumoto
eacea084f8 bdev/nvme: Replace linked list, nvme_ns->bdevs, by pointer, nvme_ns->bdev
By the recent changes, the linked list nvme_ns->bdevs has only a
single bdev at the maximum. Hence replace it by the pointer
nvme_ns->bdev, and remove the linked list pointer nvme_bdev->tailq.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib976e15bb128ba8479070b58e5f4c43fb9dcf479
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6230
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-24 13:01:44 +00:00
Shuhei Matsumoto
613d441364 bdev/nvme: Process only the head of linked list, nvme_ns->bdevs
By the last changes, not only standard namespace but also ocssd
namespace has only one nvme_bdev, and standard namespace processes
only the head of nvme_ns->bdevs.

This patch changes the common and standard namespace specific
part to process only the head of nvme_ns->bdevs.

The following patch will replace the linked list nvme_ns->bdevs
by the pointer nvme_ns->bdev.

Add a particular error case that nvme_bdev is failed to create even
if ctrlr has one namespace. If ctrlr has one namespace but the
corresponding bdev is failed to create, nvme_ns->populated should
be false and hence nvme_ns->bdevs should not be accessed. However
the code had not assumed such case.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5495882fad8c8a012305177179a46d4373ba75f5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5800
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-24 13:01:44 +00:00
Shuhei Matsumoto
9772b58082 bdev/ocssd: Remove range from struct ocssd_bdev
Remove range instance from struct bdev_ocssd_range, and additionally
remove range pointer from struct bdev_ocssd_create_ctx.

Then remove the definition of struct bdev_ocssd_range.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5cb38d17ff2ec852878b481b8974983922fe25d2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6225
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-02-24 13:01:44 +00:00
Shuhei Matsumoto
56d8cc8d72 bdev/ocssd: Process only the head of nvme_ns->bdevs
The range parameter was deprecated from bdev_ocssd_create(), and
hence one ocssd_bdev can be created per one ocssd_ns now.
Hence process only one ocssd_bdev per one ocssd_ns. The following
patches will replace a linked list nvme_ns->bdevs by a pointer
nvme_ns->bdev.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I824d26f4d2f73326238a6426634e28cfd655a04d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6224
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
2021-02-24 13:01:44 +00:00
Konrad Sztyber
8aa989e2ba bdev/ocssd: fill in offset_blocks in append callback
The user only specifies the starting address of a zone to which to
append to and the actual location is expected to be returned in
bdev_io->u.bdev.offset_blocks.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Icc2e9f5461a746d19686d5288075f03d09bf1b19
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6441
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-19 11:33:49 +00:00
Nick Connolly
a1ae47f34f module/sock/posix: improve portability
Default to using epoll unless __FreeBSD__ is defined. Add macros SPDK_KEVENT
and SPDK_EPOLL to indicate whether epoll or kevent is present. The macros
match the naming convention for SPDK_ZEROCOPY which controls zero copy
in a similar way.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I4c46fb94b254cb075427bfe07a8085887254c45a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6466
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-19 11:30:32 +00:00
paul luse
9a70b6375d idxd: update low level lib and poller to indicate busy/idle
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I0acb74bd679e924977fb058a29ee947734e7aa83
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6287
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-02-19 11:29:53 +00:00
Shuhei Matsumoto
894ef450a5 bdev/ocssd: Remove ocssd_bdev parameter from from/to_disk_lba() and to_chunk_info_offset()
Remove ocssd_bdev_parameter from bdev_ocssd_from_disk_lba(),
bdev_ocssd_to_disk_lba(), and bdev_ocssd_to_chunk_info_offset()
including unit tests.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iaf52e3e33609e9f1fe13050e95020bad688dc6ae
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6223
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-19 11:28:53 +00:00
Shuhei Matsumoto
49a7346e0a bdev/ocssd: Remove range parameter from translate_lba()
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I0ebed08814ce4011a64a18a832603348c1f5ab08
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6222
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-19 11:28:53 +00:00
Shuhei Matsumoto
c9096ce712 bdev/ocssd: Get number of parallel units directly from ocssd_ns->geometry
Remove helper functions, ocssd_range_num_parallel_units() and
bdev_ocssd_num_parallel_units(), and get number of parallel units
directly from ocssd_ns->geometry.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2b8c4765442aff4642ad1eaa38df6694ee7ed43d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6221
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-19 11:28:53 +00:00
Shuhei Matsumoto
20f1cf632b bdev/ocssd: Remove range parameter from bdev_ocssd_create RPC
It has been confirmed that there is no affected use case in
the SPDK community when we remove the range parameter from
the bdev_ocssd_create RPC.

Hence, remove the range parameter from the bdev_ocssd_create RPC,
remove range parameter from bdev_ocssd_create_bdev(), remove range
info from ocssd_bdev_config_json(), and then update unit tests
accordingly.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1b0a541b61bf26732fd028dc43becb7ca2384f8e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6220
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-19 11:28:53 +00:00
Shuhei Matsumoto
bd8de45801 bdev/ocssd: Fix the bug that no media event is pushed to the target bdev
Recent refactoring added a critical bug that no media event is pushed
to the target bdev.

Fix the bug by changing return to break.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia674ea2c9c21d08dd23b50a0f726da55011d4be4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6455
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-19 11:28:53 +00:00
Alexey Marchuk
0d3ad99929 sock/posix: Don't return if zcopy is disabled
When socket is being created and zcopy is disabled
by the config, we can return from posix_sock_alloc
function before we try to set quick_ack

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I6670b8337e70ec12b18a5e6753674fbef9e95648
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6382
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-02-17 10:18:16 +00:00
Ziye Yang
0e9ee17642 posix: Fix the NULL pointer issue of group.
A single sock connection can call posix_sock_flush,
and this sock may not belong to a polling group.
So add the check in sock_check_zcopy to avoid such issue.

Fixes #1788

Change-Id: Id0a2f80ad0f3cdb7fc736a3be3211e49513751b1
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6334
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-02-10 08:40:25 +00:00
Alexey Marchuk
05aeb9db27 bdev/nvme/rpc: Add params to enable TCP hdgst and ddgst
Function bdev_nvme_create accpets new parameter - ctrlr
opts which is passed and filled by RPC handler. That
will allow us to add config parameters for other ctrlr
options with minimal changes.

Change-Id: I96ac1b21e7a3816c652765cddade75423eb843ca
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6023
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-02-09 11:26:51 +00:00
Tomasz Zawadzki
e4070ee0e0 so_ver: increase all major versions
To allow SO_MINOR updates on LTS for the whole year it is supported,
the major version for all components needs to be increased.
This is to prevent scenario where two versions exists with matching
versions, but conflicting ABI.
Ex. Next SPDK release adds an API call increasing the minor version,
then LTS needs just a subset of those additions.

Increasing major so version after LTS, allows the quarterly releases
to update versions as needed. Yet allowing LTS to increase minor
version separately.

Disabled test for increasing SO version without ABI change, as
that is goal of this patch. This check shall be removed with SPDK 21.04
release.

This patch:
- increases SO_VER by 1 for all components
- resets SO_MINOR to 0 for all components
- removes suppressions for ABI tests

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I44d01154430a074103bd21c7084f44932e81fe72
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6167
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-02-05 14:43:47 +00:00
Jin Yu
b924daec88 virtio_blk: add segment number and segment size flags
Our userspace driver already supports the SIZE_MAX
and SEG_MAX features so add these two flags in supported
features.

Change-Id: Ibcbe423dbc1e2e8a31a53b34650c59243d35ba04
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6232
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-02-05 13:46:45 +00:00
Ziye Yang
48b2ac7a13 sock/posix: fix the zero copy enabling in initiator.
When zero copy is enabled in initiator, there could
be the case that a socket connection does not belong
to a polling group, i.e, the application does not use
socket polling  group. Then we should actively call
_sock_check_zcopy in posix_sock_flush function when zero
copy policy is enabled.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Idceaa7557eb265daa878db40c922494c3de35ea8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5423
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
2021-02-05 13:45:15 +00:00
paul luse
6edaae0fb8 module/accel/idxd: stop submitting queued tasks as DSA batches
This was experimental code.  Besides being simpler it makes perf
analysis easier and gives complete control of whether batching
is used to the application.  The framework will now not use
DSA batches for internal operations.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ic3139c40371dad64c3bc77818f0ad3f8c31d9af6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5849
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
2021-02-05 13:42:32 +00:00
paul luse
8a1a845053 idxd: simplification in re-balancing channels
For flow control reasons we have to resize the bit arrays we
use to manage flow as channels come and go.  However since
channels are assigned to devices, until the channel count
reaches the device count there's no sharing so no resize of
the array is needed. So, when we use a device for the first
time there's no need to run through the rest of the channels
and re-balance.

Same thing is done on destruction. The code to free idxd
specific resources was moved from the rebalance function to
the idxd put channel function which is a much more logical
place for it as well.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ib4df163286906f413dd6429dc6833af7b68e208c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5846
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-05 13:42:32 +00:00
Alexey Marchuk
8015386885 sock/posix: Enable zero copy send
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Ic21e7ba1b090b4d24ef8ae0c1b0a9c5b1909da3b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6193
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-02-04 08:36:50 +00:00
Alexey Marchuk
2ae4adc342 sock/posix: Add sock to pending list on zcopy event
In NVMF TCP initiator when zero copy is disabled,
all requests are completed when we receive EPOLLIN event
for socket, add socket to pending_recv list and call socket's
callback which calls qpair_process_completions. As part of
completions processing on NVME level we receive the number
of completions and resubmit the same number of queued requests.

When zero copy is enabled, some transport requests can be
completed when we receive and process EPOLLERR event, it
happens out of qpair_process_completions context. So part
of requests can be completed, transport level contains
free requests but NVME layer don't have info about it
until it calls qpair_process_completions. And there is
a chance that on posix level when we poll sockets we
receive only EPOLLERR flag without EPOLLIN. In this
case we can complete several requests but don't call
qpair_process_completion so we don't resubmit queued
requests. It may lead to a hang in the end of test run
when there are no mo requests to be completed on transport
level (no EPOLLIN event) and we receive EPOLERR only,
so we can't resubmit queured requests.

This patch fixes this problem, it add a socket to
group's pending_recv list if we received EPOLERR
event and completed at least 1 socket request.
So socket's callback can be called even without
EPOLLIN event.

Fixes issue #1685

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I21d5c2fe6eb0787aab9531925a7f0e2fe18bafaa
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6162
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-04 08:36:50 +00:00
sunshihao520
613f82f547 moudule:bdev_nvme fix the error cb function in bdev_nvme_writev
In bdev_nvme_writev function convert the bdev_nvme_writev_done as
cb instead of bdev_nvme_readv_done.

Signed-off-by: sunshihao520 <sunshihao@huawei.com>
Change-Id: If2e43cf6e5a67b694ef3cfa8f5c61ace3beab48e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6094
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-01-26 16:30:00 +00:00
yidong0635
2d3f8b7cb2 bdev_malloc_rpc: Remove unnecessary code.
Remove unnecessary codes of free_rpc_delete_malloc.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: Ieb83e2df7f4e0cd7c0eee0d2629e2116c87c64c3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6017
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-01-22 08:16:17 +00:00
Jim Harris
79f9a7f572 build: generate pkg-config files for SPDK
Users can now generate the necessary linker args for their
own applications using something like:

PKG_CONFIG_PATH=build/lib/pkgconfig pkg-config --libs spdk_nvme

Dependencies between libraries are included in the generated
.pc files, so the user only needs to pass the top-level subsystems
or individual SPDK libraries they are using in their application.

Modules will automatically be added to the output if the associated
library is specified.  For example, specifying "spdk_bdev" will include
the libraries not only for spdk_bdev, but also all of the bdev modules.

Users still need to supply the -Wl,--no-as-needed or -Wl,--whole-archive
flags. They cannot be added to the .pc files without increasing the length
of the argument string by a factor of 15x to 20x.

Modify the test/external_code/hello_world Makefile to use pkg-config to
ensure this gets tested at some level in our autotest environment.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie48a75f11969d5d775d514cf10bcb82d197eabfd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4371
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-01-21 09:46:32 +00:00
sunshihao520
1572882a7f lib/nvme: add function spdk_nvme_bytes_to_numd to calculate number of dwords
According to kernel, use an inline function spdk_nvme_bytes_to_numd
to transfer paload_size form bytes to numer of dwords.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Change-Id: I8b9ded122bbf4a3c8e46988993ea52404783c0b0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5926
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-01-20 08:45:43 +00:00
Liu Xiaodong
021ff6edff bdev: add function to return aio's errno
This helps user to locate whether bdev_io fails in
spdk bdev layer or inside Linux AIO.
SPDK_BDEV_IO_STATUS_AIO_ERROR indicates bdev_io fails
due to Linux AIO or its lower layer's failure.

New functions spdk_bdev_io_complete_aio_status and
spdk_bdev_io_get_aio_status can be used to report out
the errno from Linux AIO.

Change-Id: I32640e4a0459cca057278c02ea5a7522f3408a02
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5690
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-01-20 00:13:49 +00:00
Jin Yu
d0657f3230 bdev_null: add null bdev resize rpc
Usually null bdev is used in testing.
The resize function provides flexibility

Change-Id: I603db0b85ff13a86d38ccc8dd6f260807393df93
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5797
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-01-18 13:03:02 +00:00
paul luse
ec2e6e2b91 modules/crypto/compress: changes to support DPDK mbuf changes
Need to manage how we store IO context based on DPDK updates
made in 19.11.

Fixes issue #1671

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: If1183808cd30987b6c999912f563949b7ade7fcb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5799
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-01-15 08:30:01 +00:00
yidong0635
64739a7a24 module/bdev: Remove unnecessary code.
Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I95a804f94ad6dac02243a029858ffae2d0ae26e7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5883
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-01-14 16:20:05 +00:00
Jim Harris
da5e62782f bdev/nvme: detect failed async probe
Track whether we attached a controller while
polling the probe ctx.  If we didn't when the probe
ctx is done, then it means the controller failed to
attach and we need to free the ctx.

Fixes issue #1723.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia7f040a073e4c824c29c0ed493f8391b69f94174
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5818
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-01-13 10:07:11 +00:00
Shuhei Matsumoto
60601e8cfb bdev/ocssd: Get nvme_ns from nvme_bdev via helper function for configuration
Use nvme_bdev_to_bdev_ns() for configuration.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I33ff9889a3677d96f714256542d1959e879542e5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5872
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-01-13 10:06:48 +00:00
Shuhei Matsumoto
d86477bff3 bdev/nvme: Get nvme_ns from nvme_bdev via helper function for configuration
When multipath is supported, nvme_bdev_ns will be got via bdev_subsystem.
To make such change invisible, add a helper function
nvme_bdev_to_bdev_ns() and use it in bdev_nvme_io_type_supported()
and bdev_nvme_dump_info_json().

Inline the function and locate it in common.h to use for ocssd_bdev
too.

ctrlr can be got from ns using spdk_nvme_ns_get_ctrlr().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If85c86737e8194b8e34ed62df04a3968443f23bb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5795
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-01-13 10:06:48 +00:00
Shuhei Matsumoto
e995690fbc bdev/nvme: nvme_bdev remembers if opal is enabled or not
This is helpful to simplify bdev_nvme_dump_info_json() when supporting
multipath.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7cf7712b8ee8ac6f15354a46dee2edbacbdeafcf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5794
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-01-13 10:06:48 +00:00
Shuhei Matsumoto
885dd11225 bdev/ocssd: Factor out finding I/O path, nvme_ns and qpair, at I/O submission
Use bdev_nvme_find_io_path() for ocssd_bdev too.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9e7169821fb03f397a6ff240e704cd1c425eaeeb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5820
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-01-13 10:06:48 +00:00
Shuhei Matsumoto
bfef6cdb21 bdev/nvme: Factor out finding I/O path, nvme_ns and qpair, at I/O submission
Fctor out getting nvme_ns and qpair pointers in _bdev_nvme_submit_request()
into a helper function bdev_nvme_find_io_path().

bdev_nvme_find_io_path() will be used for ocssd_bdev, and hence
locate it in common.h, inline it because it is used in I/O paths.

ocssd_bdev needs not spdk_nvme_ns but nvme_bdev_ns pointer in I/O paths,
and bdev_nvme_find_io_path() returns nvme_bdev_ns.

Besides, move inclusion of likely.h from bdev_nvme.c and bdev_ocssd.c
to common.h.

The next patch will apply bdev_nvme_find_io_path to ocssd_bdev.

By the following patches, bdev_nvme_find_io_path() will take ANA
state into consideration.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3817c9f56606021ebea90fdfbcf0656df9faba82
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5528
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-01-13 10:06:48 +00:00
Shuhei Matsumoto
e946792fc4 bdev/ocssd: Get ctrlr from not nvme_ch but nvme_ns to get zone info
A nvme_ns is associated with a nvme_bdev_ctrlr, and hence we don't
have to pass nvme_ch to bdev_ocssd_get_zone_info().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia58d335721c87d70ad2544d483dbc8767464c287
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5819
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-01-13 10:06:48 +00:00
Liu Xiaodong
7f6afb7bc0 bdev_aio: allow value of efd to be 0
Previously, value '0' is used to reflect efd's
invalidation. But it is possible that efd is 0
if STDIN is closed. So change related condition
checking, and assign efd to be '-1' in initializing

Change-Id: Iffea09b1f094617ab2edd3fe3b98336ec9084b8a
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5781
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-01-08 15:14:17 +00:00
Jim Harris
acf116c6d5 bdev/nvme: run poller more frequently while probe in progress
When we do detect new devices, we would like to get them
attached as quickly as possible. Controller initialization
requires a non-trivial number of admin commands, and when
using async probe, it means that after we have detected
a new device, it will take many iterations of calling
spdk_nvme_probe_poll_async() before the controller is
fully attached.

So when we are actively probing a probe_ctx, create
a new poller that is solely responsible for probing
that context at a much higher frequency.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I72fbe3faef2d72608edb163bd87907902d7c3adc

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5646
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-01-07 13:38:18 +00:00
Shuhei Matsumoto
7c9a81a2b6 bdev/nvme: Inline detach_bdev_from_ns() and attach_bdev_to_ns()
Object structure will be different after introducing subsystem.
Let's inline nvme_bdev_attach_bdev_to_ns() and
nvme_bdev_detach_bdev_from_ns() as a preparation.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I93fd43db231780b9e86ebaec1a9fb40f8511dab9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5756
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-01-05 09:43:09 +00:00
Shuhei Matsumoto
060495b140 bdev/nvme: Factor out decrementing ref. count of nvme_bdev_ns
Factor out the common operation of nvme_ctrlr_depopulate_namespace_done()
and nvme_bdev_attach_bdev_to_ns() into a helper function nvme_bdev_ns_detach().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8efa8bc2c2d455d0fd9e0865ff85fd265d14ee06
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5613
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-01-05 09:43:09 +00:00
Shuhei Matsumoto
723d9443f9 bdev/nvme: Separate ref. count between nvme_bdev_ctrlr and nvme_bdev_ns
Separate reference count of nvme_bdev_ctrlr between nvme_bdev_ctrlr
and nvme_bdev_ns.

Set ctrlr->ref to 1 when creating ctrlr, increment ctrlr->ref when
populating ns, decrement ctrlr->ref when destructing ctrlr or
when ns->ref becomes 0, and destruct ctrlr actually when ctrlr->ref is 0.

Set ns->ref to 1 when populating ns, increment ns->ref when
adding bdev to ns, decrement ns->ref when depopulating ns or removing
bdev from ns, and decrement ns->ctrlr->ref when ns->ref becomes 0.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7810384d97a174d8f55d316e5cdf2a9ef4a11432
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5608
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-01-05 09:43:09 +00:00
Shuhei Matsumoto
528cec83fb bdev/nvme: Merge decrementing ref. count into nvme_bdev_ctrlr_destruct()
For further simplification, merge decrementing reference count of
nvme_bdev_ctrlr into nvme_bdev_ctrlr_destruct().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I604039c3f38a60b316ae465d4649e9eb11bfb6cc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5573
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-01-05 09:43:09 +00:00
Shuhei Matsumoto
2caff467ea bdev/nvme: Remove destruct_poller and process deferred destruct request after completing reset
destruct_poller had been used to destruct ctrlr after completing reset, but
we can remove destruct_poller and change reset processing to destruct ctrlr
after its completion by itself.

spdk_io_device_unregister() may fail spdk_for_each_channel(). Hence call
nvme_bdev_ctrlr_do_destruct() as the completion function of spdk_for_each_channel().

The first idea was to always run destruct_poller at nvme_bdev_ctrlr_destruct(),
but this patch will be simpler and more intuitive.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I43a400bdb67ab015d707fb9679693bd3d5bfb070
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5607
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-01-05 09:43:09 +00:00
Ziye Yang
590b6e7507 nbd: Use async manner to stop nbd device.
Purpose: In order to free all the allocated resources.

Our current code uses sync behaviour, and it will not wait for all
the resources are freed if there is active I/Os, and thus we will
not free some resources, e.g., some fds will not be closed.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Iaf9a606da2049ffd0096860c46d89d094038a5ff
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5601
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Sun Zhenyuan <sunzhenyuan@baidu.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
2020-12-28 14:05:15 +00:00
Shuhei Matsumoto
b2c29e91c5 bdev/nvme: Change parameter of nvme_ctrlr_depopulate_namespace_done() from ctrlr to ns
The following patches will need to update nvme_bdev_ns at
nvme_ctrlr_depopulate_namespace_done(). nvme_bdev_ctrlr can be
got from nvme_bdev_ns, and so this change will cause no issue.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I7cbfe0d936a3a757a8792fdf842e1228b2df05e6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4531
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-28 13:28:11 +00:00
Shuhei Matsumoto
5f523c44f0 bdev/nvme: Consolidate exit paths of connect_attach_cb()
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ife0bc6575697dee5a470793361502a852b132191
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5651
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-12-28 13:28:11 +00:00
Shuhei Matsumoto
b2d785ee48 bdev/nvme: Move attach_bdev_to_ns() into bdev_create()
Move nvme_bdev_attach_bdev_to_ns() into nvme_bdev_create() and
change the return type of nvme_bdev_create() to int.

These refactorings are necessary to share a single nvme_bdev among
multiple nvme_bdev_ns.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I81c702bfec15f14c6b4a6588d1d3dfa28a9e3e6d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5650
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2020-12-28 13:28:11 +00:00
Shuhei Matsumoto
01541c31fb bdev/nvme: Factor out creating spdk_bdev from creating nvme_bdev
This will make us a little easier to understand nvme_bdev and clarify
the difference between nvme_bdev and ocssd_bdev.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: If6e93bcc315612ec88c452cf9ae87a3db8ec7855
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5649
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-28 13:28:11 +00:00
Shuhei Matsumoto
6a76176a67 bdev/nvme: Refer controller's flag directly when setting acwu of disk
This is a preparation for the next patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I20f7b03e15fe8cc74b22ff46040a4eba9cc63231
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5648
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-28 13:28:11 +00:00
Shuhei Matsumoto
17a4826687 bdev/nvme: Log if reconnecting I/O qpair failed by WARNLOG
We do not know if reconnecting I/O qpair succeeded or failed now.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I030c3d8553efac7878da0fe358a624a502dd8656
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5699
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-28 13:28:11 +00:00
Shuhei Matsumoto
2de5aabd92 bdev/nvme: Insert new failover trid before failed trids
Add an new variable is_failed to struct nvme_bdev_ctrlr_trid, and
set it to true when starting failover or when failover failed, or
set it to false when initializing or failover succeeded.

Then add an new failover trid before all failed trids.

The test log showed that many failover failed because new trid was
added after failed trids.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I220839245c6414b5d3ef69a2fa1b97904d88d8bd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5698
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-28 13:28:11 +00:00
Shuhei Matsumoto
ea2d4bb501 bdev/nvme: Hold mutex while adding failover trid
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4e4aa1a9ed8e18a279b8d7aa7b90361df8fddc26
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5697
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2020-12-28 13:28:11 +00:00
Shuhei Matsumoto
1f14fea3b4 bdev/nvme: Get failover path information by NOTICELOG
We do not know failover is attempted from which path to which path.
Get these information by NOTICELOG.

Failover or reset is serialized by the flag ctrlr->resetting and
ctrlr->failover_in_progress.

Hence it is enough to add such information only to start.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I97400c048b39dc1b70e6aeb71643b5ed1ca23e72
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5695
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2020-12-28 13:28:11 +00:00
Shuhei Matsumoto
92d2ad357c bdev/nvme: Remove duplicated nvme_poll_group_remove() calls
spdk_nvme_ctrlr_free_io_qpair() calls spdk_nvme_poll_group_remove()
inside.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4068a7a099a30e4fdc98e6771331ec29e1361125
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5693
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-28 13:28:11 +00:00
Rafal Stefanowski
3048a49c29 bdev/ocf: Fix initial force flag
Force is not supported in loading-existing-cache scenario,
so it is set to true only when initializing cache as new.
There is already patch in OCF waiting to be merged, that
addresses this problem by creating completely separate
pipelines to load and attach scenarios, thus ignoring the
force flag when cache is being loaded.

Fixes #1708

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
Change-Id: I72269e2eacab6dffbecb725592af555e2f3702de
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5595
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2020-12-28 13:19:26 +00:00
Shuhei Matsumoto
b8c15b044c bdev/ocssd: Pass nvme_bdev_ns to each I/O submit functions
This change clarifies and simplifies the code when we support ANA
multipath because nvme_bdev and nvme_bdev_ns are not associate
directly and nvme_bdev_ns is got from nvme_bdev_subsystem instead.

As a result of this change, remove bdev_ocssd_get_ns_from_bdev()
because it is not used anymore.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I17a6eb4c63aa99e3537d7ad6ce134277c32e8d3e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5562
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-15 10:44:14 +00:00
Shuhei Matsumoto
a9d2ef69c5 bdev/ocssd: Add a helper function to get zone_size from ocssd_bdev
Add a small helper function bdev_ocssd_get_zone_size() to get zone_size
directly from ocssd_bdev. We do not need to cache nvme_bdev to get
zone_size by this helper function.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8a6fffac6efaff2cb4cc872c19d85e8e504c5622
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5561
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-15 10:44:14 +00:00
Shuhei Matsumoto
dd3297bf57 bdev/ocssd: Pass qpair directly to I/O submit functions
I/O submit functions need only qpair, and so let's pass it directly.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I11634f16ddec9371f3857587014e20312234fff8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5560
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-15 10:44:14 +00:00
Shuhei Matsumoto
6fdc0a5346 bdev/ocssd: Call read() directly when buffer is already allocated
Call bdev_ocssd_read() directly when buffer is already allocated
to improve performance and support retry in the bdev module as done
for the standard NVMe bdev.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Icf18148e09b61df7effc84535bea60f49d1c15b3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5559
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-15 10:44:14 +00:00
Shuhei Matsumoto
c885010fbf bdev/ocssd: Add nvme_bdev_ns to struct create_ctx and use it
Add nvme_bdev_ns pointer to struct bdev_ocssd_create_ctx and use it.
This will be helpful for the upcoming patches because nvme_bdev will
not hold nvme_bdev_ns directly and will have to be got via nvme_bdev_subsystem
instead.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8417ecb049fe7a3f50793db1d570733227f4f6b1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5556
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-15 10:44:14 +00:00
Shuhei Matsumoto
15f29bbe83 bdev/ocssd: Add ocssd_ns to fill_zone_info() as additional parameter
The next patch will add nvme_bdev_ns to struct bdev_ocssd_create_ctx.
This patch is a preparation for it.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I37c35e0d89a088dbc5f0a9896c5fd03e22bfa6a5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5555
Community-CI: Broadcom CI
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2020-12-15 10:44:14 +00:00
Shuhei Matsumoto
ac15e16b8b bdev/ocssd: Clean up verify_range()
We can pass nvme_bdev_ns directly to bdev_ocssd_verify_range() and
actually we don't need to check if bdevs are created on the same
namespace.

For the former, change parameters of bdev_ocssd_verify_range() from
nvme_bdev_ctrlr and nsid to nvme_bdev_ns. For the latter, remove the
check but add assert to nvme_bdev_attach_bdev_to_ns() instead.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I23c3a0ad02fa2b9f4c8149d9b02660140b2d3951
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5554
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2020-12-15 10:44:14 +00:00
Shuhei Matsumoto
d15198098f bdev/ocssd: Change lba_in_range() to take ocssd_ns as additional parameter
As same as the last patch, change bdev_ocssd_lba_in_range() to take
ocssd_ns as an additional parameter.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id8ceffa8ccaa279d6036408b8730e7b896b23b1a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5539
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-15 10:44:14 +00:00
Shuhei Matsumoto
ace9f6d1c0 bdev/ocssd: Change to_chunk_info_offset() to take ocssd_ns as additional parameter
As same as the last patch, change bdev_ocssd_to_chunk_info_offset()
to take ocssd_ns as an additional parameter.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I05eae4206cad0511029b9b5c97b4e87facf109ab
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5538
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-15 10:44:14 +00:00
Shuhei Matsumoto
62ac42cc13 bdev/ocssd: Change from_disk_lba() to take ocssd_ns as additional parameter
As same as the last patch, change bdev_ocssd_from_disk_lba() to take
ocssd_ns as an additional parameter.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2612df739137f687cf9aa8699c54885836742b88
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5537
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-15 10:44:14 +00:00
Shuhei Matsumoto
dad1be9761 bdev/ocssd: Change to_disk_lba() to take ocssd_ns as additional parameter
As same as the last patch, change bdev_ocssd_to_disk_lba() to take
ocssd_ns as an additional parameter.

In unit tests, get ocssd_ns from not ocssd_bdev but nvme_bdev_ctrlr
because direct association between nvme_bdev and nvme_bdev_ns will be
removed when supporting ANA multipath.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8e86b43bfe435fb2732e29e0fb6926d7572b29e2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5536
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2020-12-15 10:44:14 +00:00