Compare commits

...

740 Commits

Author SHA1 Message Date
3d0d559dbd update dpdk commit 2022-05-27 04:30:06 +08:00
e8a1bac9a1 update dpdk submodule 2022-05-17 01:32:44 -04:00
38644662be update submodules & refs 2022-03-08 04:16:31 +08:00
1edb07ac50 fix build system 2022-03-08 04:08:39 +08:00
Krzysztof Karas
7dc38f83f7 spdk_top: reduce number of global thread data structures
Deletes g_thread_history and g_thread_info to use g_threads_stats
across the whole application to simplify spdk_top code.
Now instead of separate struct, fields last_busy and last_idle are
being used.

get_data() function now uses local structure to get RPC data instead
of filling global one. This has been changed so that g_threads_stats
keeps its last_busy and last_idle fields unchanged.
free_rpc_threads_stats has been moved down so that in future patches,
when multithreading is implemented, there is no need to lock
g_threads_stats during RPC call.

Changes places of allocation/deallocation of g_threads_stats, since
we want to save last_idle and last_busy fields instead of zeroing them
out each application loop.

Changes show_thread() function to use local copy of threads array
instead of pointers to global struct. This is for the convenience
in the future patches implementing multithreading to avoid the need
to lock the global struct for details display.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7587 (master)

(cherry picked from commit 081a4a0943)
Change-Id: I0dc87eac4c1b89fa16f14f5387d94ee176dfdf43
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8110
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-06-04 22:52:37 +00:00
Krzysztof Karas
464ddc03b6 spdk_top: change where get_data() and free_data() are called
Move part of code with get_data(), refresh_tab() and free_data()
inside show_stats() upwards to make sure data structures are
up to date for pop-up details windows.

Delete get_data(), free_data() calls from show_thread(), show_poller()
and show_core functions.

Add data freeing right before rpc calls inside get_data() to let
pop-up details windows to use updated data before freeing it.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7953 (master)

(cherry picked from commit 22edbe9626)
Change-Id: I0d78eb7a48b0cdff4284815afc1a214b0effd7fc
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8109
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-04 22:52:37 +00:00
Krzysztof Karas
b20db89532 spdk_top: move sort_threads function
This function is going to be needed in get_data() in the next patch.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7947 (master)

(cherry picked from commit e2b6cf2f96)
Change-Id: I9368b4567a92ca20d830c3475e3120ee691b84c1
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8108
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-06-04 22:52:37 +00:00
Michal Berger
10b7805b0f scripts/rpc: Make sure address argument is properly interpreted
In case the addr argument was not an existing unix socket file the rpc
client would consider it to be an actual ip address. As a result
connect() would be called with improper set of arguments. This could
cause the rpc.py to block for undesired amount of time until connect()
finally decided to return (seen on some fedora33 builds).

This was affecting sh wrapper functions like waitforlisten() which
use rpc.py to determine if given app is ready to be talk to blocking
execution of the tests for way too long then intendent.

To avoid such a scenario determine the format of the address and use
routines proper for given address family.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7777 (master)

(cherry picked from commit 6c1a1a3dca)
Change-Id: Iaac701d72c772629fa7c6478ff4781b0c5d485d5
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8018
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-31 07:11:13 +00:00
Karol Latecki
fb67ea5148 autobuild: update patches for mainline DPDK
Patches stopped applying cleanly because of dpdk/dpdk changes:
7d5cfaa7508de0fd248b05effbf421a98317006a
4ad4b20a79052d9c8062b64eaf0170c16a333ff8
Needed to rebase custom patches.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7903 (master)

(cherry picked from commit 7908736c22)
Change-Id: I1006f7f6ba21a3cee5b607cfc44adedb4c1d5830
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8017
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-05-31 07:11:13 +00:00
Tomasz Zawadzki
48f6cd39c9 version: 21.04.1 pre
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ic08e163c2b37843297dd1b45f341aa8377be8acb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7686
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>
2021-04-30 09:19:37 +00:00
Tomasz Zawadzki
8016710153 SPDK 21.04
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id0e3688cf81f2dac4de4ab6c5212f986776ade2f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7685
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>
2021-04-30 07:11:44 +00:00
Liu Xiaodong
67fab31304 test: add functional test for reactor_set_intr
test script 'test/interrupt/reactor_set_intr.sh' will
do various reactor set intr operations on interrupt_tgt
without spdk_thread and with spdk_thread.

Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7348 (master)

(cherry picked from commit ac0c36d72a)
Change-Id: Ie5af1dc68b0272c34a91e8a66b78088c3794907c
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7678
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-30 07:11:44 +00:00
Tomasz Zawadzki
0fdf94cf77 lib/blob: force execution of queued persists
When performing snapshot creation the I/O is frozen
during the process. The blob persists for extent page
allocation is delayed until snapshot creation is finished.

This results in multiple blob persists executing one after
the other, with only intent of writing out updated extent table
pointing to new extent pages.
Since blob->state is marked DIRTY before issuing each persist,
but a single persist completion marks state CLEAR.

Blob serialize correctly expects each persist to contain
dirtied metadata, in order to avoid unnecessary md writes.
Since all other instances of marking blob DIRTY is explicit,
assert in blob serialize is left as is.

Instead when running the queued up blob persists, the blob
state is marked DIRTY.

Side effect is that it will write out same md in some cases.

Fixes #1909

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7640 (master)

(cherry picked from commit 50935184c8)
Change-Id: I39f37299f3f0ebfccbdd4063781b5ecce286e993
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7677
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-30 07:11:44 +00:00
Nick Connolly
00df37cbb6 ut/nvme_ctrlr_cmd: add missing mutex init
Add missing mutex init for ctrlr ctrlr_lock.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7613 (master)

(cherry picked from commit 0fdd826a00)
Change-Id: Ib3d665a28e91a72d1f1f6d09c374583ff731fb6f
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7676
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Nick Connolly <nick.connolly@mayadata.io>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-30 07:11:44 +00:00
Jim Harris
4f8b83cf51 nvme: reset mapping_length correctly for contig SGL
spdk_vtophys() takes a mapping_length parameter, so
it can return the length for which the returned
virtual address is valid.

But spdk_vtophys() will only return the max
between the valid length and the input mapping_length
parameter.

So the nvme SGL building code for contiguous buffers
was broken, since it would only set the mapping_length
once, before the loop started.  Worst case, if a buffer
started just before (maybe 256 bytes) before a huge page
boundary, each time through the loop we would create
a new SGL for only 256 bytes at a time, very quickly
running out of SGL entries for a large buffer.

Fixes #1852.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7659 (master)

(cherry picked from commit 5354d0c63f)
Change-Id: Ib1000d8b130e8e4bfeacccd6e60f8109428dfc1e
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7675
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-30 07:11:44 +00:00
Jim Harris
35d003dfed nvme: remove IDENTIFY_CNS quirk from normal QEMU SSDs
The IDENTIFY_CNS quirk was applied as part of QEMU
OCSSD handling in commit 6442451b.  But it was applied
not only to the OCSSD dev ID, but also the dev ID
for non-OCSSD NVMe controllers.

Starting with QEMU 5.2, QEMU will allocate a default
256 namespaces, but only some are active (associated
with the backing disks specified by the user).  QEMU
supports IDENTIFY_CNS, but since this quirk was set,
we wouldn't send a real IDENTIFY_CNS and instead
would just populate a fake list where all namespaces
were considered active.  This causes breakage in
a few places - mainly where we iterate through
the active namespaces, and then are surprised that
calling spdk_nvme_ns_is_active() returns false.

It was also breaking bdev_nvme_attach_controller RPC,
since by default we can only support returning 128
names, but since all of the namespaces were deemed
active, it was trying to return 256.

Fixes #1916.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7658 (master)

(cherry picked from commit 6fd1cc3716)
Change-Id: I4fdd27e0e36f0ac07a95f9f29aa83357e8505a45
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7674
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-30 07:11:44 +00:00
Alexey Marchuk
e6e51ea9a2 sock: Deprecate enable_zerocopy_send in sock_impl_set_options RPC
This deprecated parameter will be removed in SPDK 21.07

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7608 (master)

(cherry picked from commit 2fd97e28bf)
Change-Id: I2b2fbcc798bb50fa6f9dfe35045f66e41c1ceaa9
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7639
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-04-27 16:25:00 +00:00
Alexey Marchuk
d9efb8f004 sock: Add new params to configure zcopy for server, client sockets
When zcero copy send is enabled and used by initiator,
it could significantly increase latency in some payloads.
To enable more fine graing configuration of zero copy
send feature, add new parameters enable_zerocopy_send_server
and enable_zerocopy_send_client to spdk_sock_impl_opts to
enable/disable zcopy for specific type of sockets.
Exisiting enable_zerocopy_send parameter affects all types
of sockets.

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7457 (master)

(cherry picked from commit 8e85b675fc)
Change-Id: I111c75608f8826980a56e210c076ab8ff16ddbdc
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7638
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-27 16:25:00 +00:00
Niklas Cassel
0859db6b69 bdev/zone: add support for get num zones
There are three modules implementing the bdev-zone API:
bdev_nvme, bdev_ocssd, and vbdev_zone_block.

For all three modules, the number of zones can be calculated using:
block_count / zone_size.

To avoid this calculation being performed everywhere, create a helper
function in bdev_zone.h, together with the other zone APIs, such that
a user can easily get the number of zones.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I2967b15a604ab8bf4420588e7510b9820762f925
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7451
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-26 16:16:42 +00:00
Niklas Cassel
d69349af6b nvme/fio_plugin: fix zone_append option with multiple files per thread
Each fio thread can have multiple files that it writes to.
Which is why the per thread spdk_fio_setup() fio callback does
for_each_file() {...}.

One of these files can be e.g. a zoned namespace with append support,
another file could be a zoned namespace on another controller without
append support, and a third file could be a conventional namespace
(which never supports the zone append command).

Right now, we will return a fatal error if a thread has e.g. a zoned
namespace (with append support) together with a conventional namespace.

Instead of returning a fatal error, enable zone append only on the
namespaces that support zone append, and allow namespaces that do
not support zone append to continue as usual (using regular writes).

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ic6456d408cbe91563acd337a4b70c6e871fe34c6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7611
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-26 16:16:42 +00:00
Niklas Cassel
09dd961b35 nvme/fio_plugin: fix report_zones
Commit f69367c788 ("fio_nvme: defer qpair allocation to file_open
callback") moved the qpair allocation from spdk_fio_setup() to
spdk_fio_open(). This broke spdk_fio_report_zones(), which needs a
qpair in order to get the initial state of the zones.

setup_files() in FIO calls td->io_ops->setup() (spdk_fio_setup()),
followed by zbd_init_files(), which calls zbd_init_zone_info(),
which calls zbd_create_zone_info(), which calls parse_zone_info(),
which calls zbd_report_zones(), which calls td->io_ops->report_zones()
(spdk_fio_report_zones()).

i.e. spdk_fio_report_zones() will always be called directly after
spdk_fio_setup(). .report_zones() is even called before the per
thread ioengine .init() callback.

Therefore, spdk_fio_report_zones() is called before the ioengine
.open_file() callback.

This is done in order to ensure that all threads will share the same
zbd_info struct, which contains the per zone locks.

Since SPDK nvme ioengine no longer initializes the qpairs in .setup(),
create a temporary qpair in .report_zones().

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ic376ac7844e40fceff092900ae7e4714bccf38e6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7590
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-26 16:16:42 +00:00
Niklas Cassel
e9e97cb620 nvme/fio_plugin: fix initial_zone_reset
Commit f69367c788 ("fio_nvme: defer qpair allocation to file_open
callback") moved the qpair allocation from spdk_fio_setup() to
spdk_fio_open(). This broke --initial_zone_reset, which needs a qpair
in order to perform the initial zone reset.

While at it, move the initial zone reset from spdk_fio_setup() to
attach_cb(), as this is where all the other fio options are verified.
By placing it in attach_cb(), after the duplicated file check, we
avoid the need to loop through the whole fio_thread->fio_qpair list.

Since SPDK nvme ioengine no longer initializes the qpairs in .setup(),
create a temporary qpair, if the --initial_zone_reset option was used.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I7950304c58aef3ec783f7cd99cfb1e7d7817a197
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7589
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>
2021-04-26 16:16:42 +00:00
Sudheer Mogilappagari
2cbc9d4dff posix: Group connections of sock group on host side based on placement_id
On host side the connections are created and then added to thread's
poll group. Those connections could use different NIC queues underneath.
To route all connections of poll group through single queue a unique
placement id is chosen as group_placement_id and each socket of poll
group is marked with group_placment_id using getsockopt(SO_MARK) option.

The driver could use so_mark value of skb to determine the queue to use.

Change-Id: I06bda777fe07a62133b80b2491fa7772150b3b5d
Signed-off-by: Sudheer Mogilappagari <sudheer.mogilappagari@intel.com>
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6160
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-26 15:33:03 +00:00
Karol Latecki
c06df11513 autobuild.sh: restore patches for older DPDK versions
Commit e9ebbdaefc updated
custom patches for mainline DPDK, but did not keep their
previous versions. We still need the old patches to build
with older DPDK versions.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: Ibe222a444bed2fdee63c8dcfcebc8402bb991fbe
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7610
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-26 14:23:15 +00:00
Ed rodriguez
b1144ce304 nvmf:Return cdw0 over tcp transport for retrieve cmd
tcp transport doesn't send a response capsule when
c2h_success is set even if cdw0 or cdw1 are non-0.

Signed-off-by: Ed rodriguez <edwinr@netapp.com>
Signed-off-by: John Meneghini johnm@netapp.com
Change-Id: Ieba81fcc50342a2009f7931526e6f8392e26b6a5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6808
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: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-26 14:22:38 +00:00
Tomasz Zawadzki
a8d700419d examples/interrupt_tgt: mark reactor_set_interrupt_mode RPC private
The RPC is for testing purposes, as such does not need to provide
documentation in SPDK proper.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia153ad326e4c2ac43b511f9c2fba4aa95f1e3295
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7607
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-26 08:39:59 +00:00
Liu Xiaodong
74db63dcda interrupt_tgt: add RPC to set interrupt mode
Plugin RPC method 'reactor_set_interrupt_mode' is added
to set specific reactor run in interrupt mode or back
to poll mode.

Based on this RPC, scenarios later can be implemented
to verify interrupt mode functionality.

Change-Id: I9785e6942299bab7c949780faf18216e293f0b1d
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7347
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-26 06:58:36 +00:00
Liu Xiaodong
6c9b7d0896 reactor: call callback if no need to set intr
When do spdk_reactor_set_interrupt_mode, if reactor
already runs in the specific mode, directly call
callback function before return 0;

Change-Id: I1fd8b753e9881755aa128aabe6d1e2749e58b39b
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7549
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-26 06:58:36 +00:00
Jim Harris
0e4690236b sock/posix: return error immediately if epoll_ctl fails
We do not want to do any further work on adding
the sock to the group if the epoll_ctl (or kevent)
fails.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I44b6dc86ce5676aa1b8d6c50b86f22758e4e37fa
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7594
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-26 06:55:48 +00:00
Jim Harris
b9563518c6 thread: do not ignore read() return
This fixes unused-result warning which prevents
building with -Werror.

Fixes: 924d4bf ("poller: add busy wait mechanism for intr")

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I074949b65e68405033322af34d90e96a896c8b8c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7593
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-26 06:55:48 +00:00
Tomasz Zawadzki
9a3877213e deprecation: add a file to gather all deprecation notices
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I66e442c4d10c1d40f4d9240f4f48374fc6966f29
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6591
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-26 06:55:03 +00:00
Tomasz Zawadzki
ea31575578 CHANGELOG: added missing entries for SPDK 21.04
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia43952bbdc5efed7bf009810ff2a5fc5c7026604
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7583
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>
Community-CI: Mellanox Build Bot
2021-04-26 06:55:03 +00:00
Krzysztof Karas
02614b0db3 CHANGELOG: refactor initial changelog entries
Fix typos, add highlighting, sort entries alphabetically,
merge two nvme entries into one, improve document spacing.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I18261326fcdb6f82f8e52e29d123c19136bbb9e3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7530
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-26 06:55:03 +00:00
Ben Walker
03a3a5c02d scripts: Add check_format test for JSON-RPC documentation
All JSON-RPCs must be documented in jsonrpc.md

Change-Id: Iec9119a01433fd0cbe4df4477ce94cc2feeb0d54
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4074
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Community-CI: Mellanox Build Bot
2021-04-26 06:55:03 +00:00
Jim Harris
d80267cc17 net: deprecate library
The net library isn't needed - everything these RPCs
do can be done externally to the SPDK application.

This library will be removed in the 21.07 release.

As part of the deprecation, mark the net RPCs as
private.  This will prevent an upcoming patch from
complaining that these RPCs are not documented.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I61118820fd29e410dca763595c3d9fd01a57373d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7592
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-26 06:55:03 +00:00
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
Konrad Sztyber
97b0c5d327 doc/nvmf: add note about the issues with RDMA on E810 NICs
Added note to the nvmf documentation about an issue [1] with destroying
qpairs on E810 cards in RoCE mode.  The note needs to be removed once
the issue is resolved.

[1] https://github.com/spdk/spdk/issues/1840

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ie03a7a662391bd738848f71e582748a334a6ffd5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7577
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-23 18:10:57 +00:00
Liu Xiaodong
5a7d428d0f nbd: add set interrupt mode to poller
Change-Id: I76561561b245f42795fa9eb28967cd486163c589
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5790
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-23 18:09:54 +00:00
Liu Xiaodong
db8ac562b3 vhost-blk: add set interrupt mode to poller
Change-Id: Ie599e445aca8241cf2f71e152ea92a5f92dd4dc5
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5788
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-23 18:09:54 +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
Liu Xiaodong
924d4bf32d poller: add busy wait mechanism for intr
For pollers that don't natively support interrupts, using
a busy wait mechanism temporarily.
An interrupt falicity for busy wait will
be registered for non-periodic poller.
Internally, an eventfd is created to each busy wait
poller. Write the eventfd when set interrupt mode,
and only read the eventfd when set back to poll mode,
then the busy wait poller will be called repeatly
in interrupt mode.

Change-Id: Iaeae14d1ff69fd9ef7d606a0b0a70193764513e9
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6711
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-23 18:09:54 +00:00
Liu Xiaodong
c74421c1c0 poller: rename timerfd to interruptfd
In next patch, if poller doesn't have a period, eventfd
will be created which's always busy automatically.
This eventfd can be combined with timerfd. So rename
timerfd to interruptfd.

Change-Id: Ibffa30ecfcaa73e55f47e97fac854641b74f2dfb
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7546
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-23 18:09:54 +00:00
Liu Xiaodong
c7cf48ddbe poller: add register interrupt function
Defined callback for spdk_poller to adapt itself to
set interrupt or poll mode. The callback can
be registered to spdk_poller by new function
`spdk_poller_register_interrupt`

Interrupt callback operations for period poller are implemented,
so period pollers now are interruptable.

Change-Id: I2aa6ebfdd75f76b85a70af7e42530be4131ddc8a
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5752
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-23 18:09:54 +00:00
Liu Xiaodong
39527e93d8 thread: refine period poller intr function
These refined functions are prepared to adapt period
poller to following poller switchable API.

Change-Id: I34d2a785fa0e757b97b0dac5ccf24819d75e0184
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7156
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-23 18:09:54 +00:00
Liu Xiaodong
b763ebfe1d reactor: apply spdk_thread_set_interrupt_mode
The interrupt mode of spdk_thread can be operated
by reactor based on reactor's interrupt mode when
the spdk_thread is scheduled or the reactor is set
into interrupt mode.

Change-Id: Ibeef7ffb759589a7b372bd78e59e3410be061383
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6709
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
Liu Xiaodong
2d52c6a15b thread: add spdk_thread_set_interrupt_mode func
spdk_thread_set_interrupt_mode can get spdk_thread run
between intr and poll mode. It is only valid when thread
interrupt facility is enabled by
spdk_interrupt_mode_enable(). Currently, this function
is limited that no poller is registered to the spdk_thread.

Change-Id: Iba54accd5976beb6f6e155014903928ce2858e36
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6708
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-04-23 18:09:54 +00:00
Konrad Sztyber
7ae061d1ea event/rpc: replace spaces with underscores in framework_get_scheduler
All the other RPCs use underscores in the names of their fields, so
`framework_get_scheduler` should also use them instead of the spaces.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I0e9edd7c59a4ab61643a7b558a2359e1805ed0b4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7557
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-23 18:09:23 +00:00
Karol Latecki
e9ebbdaefc autobuild: Update patches for mainline DPDK
Previous patches stopped applying cleanly at DPDK
21.05-rc1, needed to update.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: If276f608c8394439064e9dfe30fed6d5531805d2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7538
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-04-23 08:16:24 +00:00
Jim Harris
6c75f0a266 env_dpdk: save hotplug timeout timestamps separate from rte_devargs
DPDK recently clarified some semantics on the rte_devargs 'data'
and 'args' fields.  This actually breaks our use of the 'data'
field to store the 2 second timeout timestamp for delaying
attach to newly inserted devices.  Investigating this further,
it does not seem our use of the 'data' field was valid - it just
happened to work until now.

We could use the 'args' field now.  But knowing whether to use
'args' or 'data' would then be dependent on the DPDK version.
We cannot use RTE_VERSION_NUM to decide, because this is a
compile time decision, and it is possible in shared library
use cases that we could actually link and execute against a
different version of DPDK than we built against.

So instead we will create our own env_devargs structure that
will store these allowed_at timestamps. Currently it's just
a linked list (which is exactly how DPDK does it) - we could
make it more optimal with a hash table down the road, but this
code only executes when we are doing PCI enumeration so it is
not performance critical.

Fixes #1904.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3ee5d65ba90635b5a96b97dd0f4ab72a093fe8f7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7506
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: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-04-23 08:16:24 +00:00
Monica Kenguva
204e6278d4 nvme/fio_plugin: fix nvme fio always reporting success
status code and type is inspected and reported
Fix issue #1893

Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: I6f181d8c9464182b23c658f4c268b900398fd751
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7567
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-23 07:58:25 +00:00
Jim Harris
1f5364e821 test/blob: verify number of extent page writes
New UT verifies number of extent page writes for
thin provisioned blobs.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I6b52195d26c3c1414ca862b03e8a3043bbe29b42
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7017
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-04-23 07:52:25 +00:00
Tomasz Zawadzki
ae10cf633c lib/blob: do not write extent pages during md sync for thin blobs
Before this patch blob persist wrote out all allocated extent pages.

Intended design was to write out extent pages in two cases:
1) Thin provisioned blobs to write out extent pages when necessary
during cluster allocation.
2) Thick provisioned blobs to write extent pages during blob persist
when the blob was resized

This patch implements 1) by inserting extent before issuing blob persist
in cluster allocation path.
See blob_persist_extent_page_cpl() and blob_insert_new_ep_cb().
Blob persist might have to rewrite the last extent page after blob resize.
See blob_persist_start().

Meanwhile 2) was incorrecly implemented since it always re-wrote all
extent pages starting from 0. This was addressed by limiting number
of extent pages written, only to ones that were resized.
Some considerations were needed:
a) blob resize happen on cluster granularity, it might be needed to re-write
last extent page if resize was not large enough to change number of extent pages
b) first extent page to write should be based on the num_extent_pages from
active or clean, depending on resize direction
See blob_persist_start().

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ibba9e3de3aadb64c1844a462eb0246e4ef65d37f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7202
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>
Community-CI: Mellanox Build Bot
2021-04-23 07:52:25 +00:00
Tomasz Zawadzki
a512214517 lib/blob: update extent pages during snapshot deletion
When both clone and snapshot had already extent pages
corresponding to the same region in cluster map,
the clone extent page was replaced with one from snapshot.

This was incorrect and would result in loss of clusters
from clones extent page. It did not occur in practice
because all extent pages were rewritten anyway during
md sync. Cluster map was correct so updated extent pages
were too.

Cluster map correctness is verified in UT _blob_inflate_rw(true),
at the very end when checking data consistency of inflated blob.

This patch writes out the updated extent page explicitly.
So it would be possible to skip wirting out extent pages
during md sync later in the series.

Note 1)
At this point in series the extent page is written here,
and in blob persists. The later will be removed later in
series.

Note 2)
Errors during updating extent pages are not accounted for,
but neither does syncing them in blob persist.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I7deac3c64299f33f8df49e860af1a16295c074e6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7438
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>
Community-CI: Mellanox Build Bot
2021-04-23 07:52:25 +00:00
Tomasz Zawadzki
bc9da1c66c lib/blob: rename blob_insert_extent to blob_write_extent_page
The blob_insert_extent() name was confusing, since the function
was actually responsible for writting out the extent page to disk.
Changed to a more fitting name.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ia312b0ef152100f30d5a1bfe123e55135c8afa6e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7561
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>
Community-CI: Mellanox Build Bot
2021-04-23 07:52:25 +00:00
Tomasz Zawadzki
9c3895b6bc lib/blob: refactor extent page updates during snapshot deletion
This patch does not change functionality. It separates
three stages of updating clone during snapshot deletion:
- updating cluster map
- updating extent pages
- removing backing device from clone

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I44869f3be596d9d0f06db4acedfdd7e1500516ff
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7437
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-04-23 07:52:25 +00:00
Tomasz Zawadzki
0aed63f0e2 ut/blob: avoid modifying blob state in simultaneous sync test
This patch addresses couple issues:
1) Before issuing the md syncs the previous steps in test left
blob state in dirty state already. The resize never had a chance
to apply. This patch adds a proper md sync and polls for completion.

2) Changing blob state is something that should be done via API.
In order for dirty state to apply immidietly set_xattr is now used instead.

3) Verify test state in callbacks to make sure not only the number of
completions is correct, but their order.

This patch is introduced because of the test originally worked
only because of the extent pages always writing out its pages.
The second sync always was delayed because of this.
Meanwhile that should not be the case, since no MD or EP modification
was done.

Later in the series Extent Pages are fixed, but this test remained incorrect.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Iac17c27f6ff83f2b79835aa6e48472d5293c44d0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7233
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>
Community-CI: Mellanox Build Bot
2021-04-23 07:52:25 +00:00
Monica Kenguva
0fcf6541f6 rpc: fix formating to enable the framework_get_scheduler rpc
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: I50947df022301b955332aad87e41f128f31fce07
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7568
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-22 23:47:43 +00:00
Jim Harris
4ccc9ea3e0 configure: check if liburing is installed
When user specifies --with-uring without a directory,
check that liburing is actually installed on the system.
If it isn't, instruct user to build and install liburing
and exit with error.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7542
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-22 20:28:37 +00:00
Jim Harris
9d2f6f861d configure: wait to configure ISA-L until all deps are checked
Configuring ISA-L takes a bit of time, so it is better
to check dependencies early and bail, rather than
waiting 10-15 seconds to configure ISA-L, only to then
fail because some dependency isn't found.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7541
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-22 20:28:37 +00:00
Krishna Kanth Reddy
e04da24cf6 examples/pmr_persistence: Add PMR example application
Added tests to verify the PMR support.

Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: I63f0a18647bfb8b16b8a5fbedb902c2f28b1d36d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6562
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: Jim Harris <james.r.harris@intel.com>
2021-04-22 20:10:21 +00:00
Krishna Kanth Reddy
c821049d2f examples/identify: Get PMR size
Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: Id0dc422eefc6aa143e63d4630e6e74757df50e6e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6561
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-22 20:10:21 +00:00
Krishna Kanth Reddy
f98b792db2 lib/nvme: Expose APIs to Access PMR
APIs to get PMR size, enable, disable, map and unmap the PMR.

Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: If6ec7f3e2f19bc13b3cbb2def622a41a3d84dc4e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6560
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: Ben Walker <benjamin.walker@intel.com>
2021-04-22 20:10:21 +00:00
Krishna Kanth Reddy
89858bbf5d nvme/pcie: Add support for Persistent Memory Region (PMR)
Implemented functions to enable, disable, map and unmap the PMR.

Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: I580e0b5060cefe1230c3db1361aee1957db457b2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6559
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>
2021-04-22 20:10:21 +00:00
Karol Latecki
8d506e8056 autopackage.sh: clean after rpmbuild
"make clean" after finishing rpmbuild. Otherwise leftover
"./configure" options and libraries tend to fail the
next in line "--enable-lto" build.

Fixes #1905

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I6a04028bfdfeb03b089c86afe7f81489fd6976f2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7562
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-22 17:52:46 +00:00
Maciej Wawryk
4503500e49 scripts/perf: fix measure_bandwidth failed to open outfile error
Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I9b9f8c9e407425fdab1e84050354481ad76c19c2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6655
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>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
2021-04-22 15:53:34 +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
Krzysztof Karas
ea05f19304 spdk_top: add core frequencies to cores pop-up
Resizes cores pop-up to fit new field - core frequency.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I571ed92ea68a6c42f214caa80bbfab2b2fb3b03a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6766
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>
Community-CI: Mellanox Build Bot
2021-04-22 15:40:30 +00:00
Krzysztof Karas
bc656341b7 spdk_top: add core frequency to CORES tab
Modifies functions and data structures to allow for
core frequency display in CORES tab.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Ie3c6eadb090b8e0a6e57968b79d4852f1957b0fc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6583
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>
Community-CI: Mellanox Build Bot
2021-04-22 15:40:30 +00:00
Krzysztof Karas
8673a27b46 lib/event: modify RPC to get core frequencies from governor
Modifies RPC "framework_get_reactors" to get core frequency for current
core and insert it into JSON response.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Ibb9c25e6e1d28ddb4cde42baa20a7e9808652ae8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6582
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>
Community-CI: Mellanox Build Bot
2021-04-22 15:40:30 +00:00
Krzysztof Karas
84c349e1d8 dpdk_governor: refactor _get_core_curr_freqs
Currently _get_core_curr_freqs returns an index from the array
of available frequencies for given core. This change aims to
make this function execute what its name suggests.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I1143f692e7bbbf2f8f9e1cd4943f8e3ecd70ddea
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7452
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:40:30 +00:00
ChengqiangMeng
dbef0cfd02 app/spdk_top: fix SEGV on unknown address
The index of g_thread_info is equals to the thread ID.
When the thread ID is not continuous, but index of ABC is continuous,
so some elements of g_thread_info array will be empty.

fixes #1899

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: Ib90a26dcc2d47792a098b163746906f34043453a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7493
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-22 15:40:19 +00:00
Karol Latecki
7db06707f5 doc: add link to SPDK 21.01 NVMe Bdev performance report
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I197e03fdd11a7b2beda8ca301857debfb56a8f18
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7555
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 14:51:08 +00:00
Jim Harris
de9f4857d0 env_dpdk: add allowed_at helpers for PCI hotplug timeout
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I5265f99fc12e134bf156de75de433a739b9ef1ef

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7505
Reviewed-by: Ben Walker <benjamin.walker@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>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-22 07:31:07 +00:00
Ben Walker
2f9271b818 sock: Add sock_map_find_free
This function finds a placement_id that does not have a group
associated with it.

Change-Id: I1306690e980fd4661f46dba9fb283f048a962eba
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7223
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-22 07:29:26 +00:00
Mao Jiang
d88ccda689 test/nvme_fabric: build nvme fabric unittest file
Include cases for setting/getting nvme fabric properties.

Change-Id: I4757cc38b8e1fe7d6af287b21f02539540a28de9
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6552
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-04-22 07:27:41 +00:00
Changpeng Liu
29f46e1c85 libvfio-user: update submodule
Also use debug log when the memory region isn't 2MiB aligned,
The QEMU may only use one page for a memory region, we are sure
these memory regions will not be used as NVMe data buffers.

Previously libvfio-user will help us to round up these memory
regions to 2MiB alignment, and it doesn't do it anymore, this
isn't an error case so change it to debug log.

Change-Id: I6c397f50407d4f2a14f78d9f99fffc2e4054ff51
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7545
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-04-22 07:20:22 +00:00
Jim Harris
836565edb4 dpdk: move submodule to eb167868
This picks up:

eb167868: eal/windows: fix debug build with MinGW
3f84d847: bus/pci: set Windows device class and bus

Both of these have been merged into DPDK upstream/main,
but adding them to our spdk-v20.11 branch until we
are ready to upgrade our submodule to a DPDK version
that includes them.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7543
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-22 07:20:02 +00:00
Jim Harris
10feaff299 nvme: only process io_msg in primary process
The io_msg qpair is allocated and managed by the
primary process, so don't try polling it from
secondary processes.

This fixes a bug where an SPDK target has configured
cuse, and we try to run fio (for example) as a
secondary process.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7482
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-22 01:06:02 +00:00
Jim Harris
f69367c788 fio_nvme: defer qpair allocation to file_open callback
All jobs are created at boot, meaning the setup callback
is invoked for all jobs before any are executed.

But it may be useful to put 'stonewall' parameters in
the job file to execute a bunch of workloads in succession,
starting one workload when the previous one completes.
But since qpairs are created currently during setup, the
total number of workloads that can be expressed is limited
since qpairs for all workloads are allocated up front.

So instead defer allocation of the io qpairs until the
file_open callback.  These don't get called until the
job associated with the 'file' (in this case, the
nvme namespace) is ready to execute.

Note that we cannot free the qpairs in the file_close
callback, since fio may 'close' the file before all
I/O have been completed.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3c60cf27c3660a3c94042c0de719f5bebdb9b417
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7481
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-22 01:06:02 +00:00
Karol Latecki
9bacb8629d scripts/nvmf_perf: rename remote_nic_ips
Rename to target_nic_ip to better match NVMe-oF
terminology.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I0644410cfb063eeea740c54f5860aeefdb52d52d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7089
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-21 23:59:40 +00:00
Karol Latecki
ad7833591c scripts/nvmf_perf: copy SPDK from target early
SPDK directory needs to be copied to initiator systems
earlier for set_irq_affinity to run.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I0f9ade02e58c9224e0b2ddc75117baaf653be614
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6776
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-21 23:59:40 +00:00
Karol Latecki
02cb1fe86a scripts/nvmf_perf: allow ADQ for SPDK mode only
Need more investigating how to properly enable ADQ
for Kernel mode. Do not run Kernel + ADQ configuration
for now.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I700ef417b9b398c067a586a1a5ad9947a92057ad
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6566
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-21 23:59:40 +00:00
Karol Latecki
b06212cfb5 scripts/nvmf_perf: re-write nvmf perf readme file
Readme was frequently missed when adding new stuff or
updating the performance script, and it is out of date.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I1710473be576ffbcc2fa8e3701b196bd46cf6654
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6538
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-21 23:59:40 +00:00
Karol Latecki
c0fc19f36d scripts/nvmf_perf: configure adq traffic classes
Create a default traffic class (tc0) with minimum
needed number of assigned threads and a priority class
(tc1) with number of assigned threads equal to
number of application threads.
Finally run set_xps_rxqs to configure symmertic queues.

set_xps_rxqs script used from Intel ICE driver
package available at:
https://downloadcenter.intel.com/download/29746/
Intel-Network-Adapter-Driver-for-E810-Series-Devices-under-Linux-

Change-Id: Ie0f2db266621a9dabb1621344bfdc5fa64fee03c
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6537
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>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-04-21 23:59:40 +00:00
Karol Latecki
42d2e588d6 scripts/nvmf_perf: Keep track of num_cores for Initiator class
There are multiple cases for counting number of CPU threads
on Initiator side. Keep track of num_cores in all of them.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I4b8d1d79a2aa17706d206b149c1c8e8816ae2ef5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6536
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>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-04-21 23:59:40 +00:00
Karol Latecki
31c50e110c scripts/nvmf_perf: disable sysctl busy_read timeout
Set busy_poll to 0 for non-ADQ. Having it enabled with
this value results is huge latency increase.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: Ic68ed2b7dc19b8d4b274ce8622194489693863cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7480
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-21 23:59:40 +00:00
Alexey Marchuk
754de777a6 perf: Use max_completions when process poll group
Perf tool allows to specify g_max_completions
parameter but it is not used.

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Ib46aaa949ddda1b0ba25c28849a402986a7a3d8e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7373
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-21 23:57:57 +00:00
Alexey Marchuk
a3080090b0 perf: Add parameter to set IOVA mode
SPDK app framework supports a CLI parameter to
specify IOVA mode, add support for this to perf

Change-Id: Id72755d02c63c443ae3bced1823fc547d9e4b050
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7372
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-21 23:57:57 +00:00
Alexey Marchuk
a7fefe05a5 perf: Use spdk_env_opts struct to parse args
When perf tool parses CLI arguments, it saves
each argument to a global value. Later these
values are checked for non-zero and copied to
spdk_env_opts structure. It can be simplified
by saving parsed arguments directly to env_opts
structure. It is applicable to env options only,
options specific for perf are still copied to
global variables.

Change-Id: I298392348df959d8165ea72333764c6505373fc2
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7371
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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-04-21 23:57:57 +00:00
wanghailiangx
460bacc914 test/nvmf_tcp: allow tcp cases running in E810 NIC instead of virtual eth
Added nvmf_tcp_init() to run tcp through physical E810 network card.
If there is not E810 in system, tcp will still run on virtual eth.

Change-Id: I9a983c92175b27c45457682d42d72ef307fef260
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6932
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: <qun.wan@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
2021-04-21 23:55:56 +00:00
Changpeng Liu
6a3cc9140f nvme/quirks: remove NVME_QUIRK_READ_ZERO_AFTER_DEALLOCATE for Intel P55XX
The P55XX serial SSDs can support dlfeat.read_value in the identify
namespace data structure, we don't need to add this quirk for it,
just remove it.

Change-Id: I165d89085e246a570e80dbaf05f41dc331b93f0c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7526
Community-CI: Broadcom CI
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-21 23:19:59 +00:00
Changpeng Liu
b46ce57e30 example/nvme: use API to return the dlfeat.read_value
Some earlier NVMe drives don't implement Deallocate
Logical Block Feature(dlfeat) read value field, but
it can return zeroes in deallocated ranges, that's
the quirk NVME_QUIRK_READ_ZERO_AFTER_DEALLOCATE, so
here we use the API to cover earlier NVMe drives.

Change-Id: I6867618c60dd5488a5d4820d663da7f074af229c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7525
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-21 23:19:59 +00:00
balaji
a2a82087b9 NVMe: Defer the notices processing in the AER callback untill all the CQE entries have been processed.
When the format command is issued, the kioxia drives responds with "NS Attr change" notices.
In the callback function of the notice, the CQ Head Doorbell is updated twice with the same
value while issuing the Active NS list & identify NS commands.

Fixes:  #1701

Signed-off-by: G.Balaji <gbalajieie@gmail.com>
Change-Id: I8cc80fba0a226c22753e605ef3129602a9313ce7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7149
Community-CI: Broadcom CI
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-04-21 23:19:05 +00:00
Monica Kenguva
6d6870c7b6 rpc: Document zone block create and delete
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: Ib6dcfe3e9fae51266a937454703d526f621ae6d4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7425
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-21 19:50:16 +00:00
Monica Kenguva
e2a4288c3c nvmf/rpc: adding private tag to the internal rpcs
private tag added to the experimental or internal rpcs
which might be removed in future or not documented.

Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: I3e967252412f2491860eea5fa69750a7562b994a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7510
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-04-21 08:25:46 +00:00
Michal Berger
356ca94119 test/vhost: Fix typo
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I4f30f53f20563c1516ae50dea149e06f0192b8c3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7387
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-21 08:25:08 +00:00
Changpeng Liu
b03129e710 nvme: return errno instead of assertion when mapping PRPs
Also update the UT.

Change-Id: I6086bf4cafca8a917a467490955d7df0ba8930d5
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7495
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>
2021-04-20 20:24:23 +00:00
Changpeng Liu
9bfa9cb8b3 nvmf/vfio-user: report that SGL is supported
Change-Id: Ia9938a3e5a4c8e4a3080039e5e309d5d10b0b77d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7280
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI
2021-04-20 20:24:23 +00:00
Changpeng Liu
55f0d41fce UT/nvme: add map NVMe command SGL UT
Change-Id: If730a82832c675cc9b4b8da8a05dd4f1aa8e3ab6
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7316
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-20 20:24:23 +00:00
Changpeng Liu
018f6a8f21 nvme: add the support to remap NVMe command with SGL
Previously we can only remap NVMe command using PRP, now we add
the SGL support.

Change-Id: Iec352d858a07bdd3d5f261336d6fa1167ba7aa79
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7279
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-20 20:24:23 +00:00
Changpeng Liu
3a58a5f19c nvme: add spdk_nvme_map_cmd API
The API `spdk_nvme_map_prps` is used in nvmf/vfio-user to
remap VM's NVMe command data buffer to local virtual address,
and for command using PRP, there maybe multiple pages, when
parsing the PRP list to local IOVs, we need a parameter to check
that the maximum number of vectors can't exceed the IOVs, this API
can't meet the requirement, while here, we add a new API `spdk_nvme_map_cmd`
and with a new parameter `max_iovcnt` to fix this case, and it can
also cover the command using SGL in the coming patches.

Change-Id: I71063524bed16ee3434103867a556d3741e55326
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7278
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-20 20:24:23 +00:00
Changpeng Liu
3a800d19c9 UT/nvme: add map NVMe command PRP list UT
Change-Id: Ibad26dae7bb8513f2e0d317e180cf6b9c16f9cb9
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7315
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-20 20:24:23 +00:00
Changpeng Liu
1d3b01e261 nvme: refactor spdk_nvme_map_prps into two functions
Change spdk_nvme_map_prps to a internal fucntion with
a new parameter `max_iovcnt` to protect the IOVs.  Also
for the purpose to keep API compatibility, we still leave
the API here.

Change-Id: I9a638beb87aab20bba5f8a4fa0a9396110d56aff
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7335
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-20 20:24:23 +00:00
Krzysztof Karas
2fd233413b spdk_top: check if SPDK target app has been initialized
Makes spdk_top wait for SPDK target app instead of showing runtime error.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I7cb451afc87f3d21adf55a4bfc984330054711b9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7141
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-20 09:16:13 +00:00
Changpeng Liu
1f5cb5b1ae nvmf/vfio-user: failure should return -1 with errno set
This is required by libvfio-user APIs.

Change-Id: I675a3be0a9650d146c8d37e42debf1191656903b
Signed-off-by: John Levon <john.levon@nutanix.com>
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7472
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-20 09:16:05 +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
Changpeng Liu
62b9210cc5 env_dpdk/memory: don't retrun error for VFIO_IOMMU_MAP_DMA ioctl
There are cases that the valid vfio container doesn't contain
any IOMMU group, so for this case we should not return error.

Fix issue #1855.

Change-Id: I2057dc9a519a31ec16452b1e9d1c470eccfc4992
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7470
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:20:51 +00:00
Karol Latecki
dfe9cee5e3 doc: add link to SPDK Vhost 21.01 performance report
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I12a7586157bfd1c8c06d0fe2a954b03c46d5936a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7297
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-19 19:19:57 +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
Changpeng Liu
5cf9b5c52d nvmf/vfio-user: add request abort callback support
Change-Id: I068e74f5b7d078ad37572eff47e772ad6967b827
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7436
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>
2021-04-19 19:06:56 +00:00
Changpeng Liu
51c8574f01 nvmf/vfio-user: introduce request state
Unlike tcp/rdma transport, the vfio-user transport doesn't need to
wait for the data buffers, so here we add two request states for
now.

The request state will help us for coming request abort API.

Change-Id: Ibbb193fbbd358333f81aa29341493c19ab7bd108
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7435
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>
2021-04-19 19:06:56 +00:00
Changpeng Liu
7abbad3ccf nvmf/vfio-user: reset the request internal fields in the completion callback
Previously we reset them when getting a new request, but it's more
reasonable in the completion path.

Change-Id: I3dab35ce471d2a5bbd37576540d30a09dcf93410
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7434
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>
2021-04-19 19:06:56 +00:00
Changpeng Liu
c7c69c7cc1 nvmf/vfio-user: consolidate request free function
Also rename transport request and controller variables
with "vu_" prefix.

The consolidated function will be used in coming patch.

Change-Id: I5219c13d7089dfdaea4a54e0b15cc5e6ecf2eb16
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7433
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-04-19 19:06:56 +00:00
Changpeng Liu
3d0e22ce9b nvmf/vfio-user: remove unnecessary cid field
Change-Id: I0e941c88626d895e43bc3404b894f62d48d6a0cf
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7432
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI
2021-04-19 19:06:56 +00:00
Michal Berger
3a1d4786f4 pkgdep/common: Add /usr/lib64 to ld's cache
ld on some distros, e.g., ubuntu1604, doesn't include this particular
path in its SEARCH_DIR list. Add it manually to make sure linking
towards liburing is possible in such a case.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I82d7ed870ec9ff257dc72a386f950addb5476d1b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7022
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-04-19 14:15:38 +00:00
Michal Berger
3124e71569 pkgdep/git: Add optional prefix to qemu dirs
This is done in order to distinguish between different flavors more
easily.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I9740677c878a8e6ad5abb3e2b5c22b9d41d59fc6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7117
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.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>
2021-04-19 14:15:38 +00:00
Michal Berger
18ee5d7bff pkgdep/git: Add support for vanilla qemu (5.1.0)
This is done as part of a request to run tests on PMR-capable VMs
in the CI pool.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Icf64bf07cd81945e519b0d212ca126d79c3fecbc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7020
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-19 14:15:38 +00:00
Michal Berger
0cb256c03d scripts: Add helper script for looking up PMR info under qemu
Added mainly to verify if the PMR setup on the VM is correct.

Example of an output with PMR device size of 32M configured for
two nvme devices, and one nvme device with 128M CMB.

[root@fedora31-cloud-1614680581-9ba06c102 ~]# /tmp/get-pmr
nvme0:0000:00:04.0:64-bit:prefetchable:0xf0000000:0xf7ffffff:0x08000000:cmb
nvme1:0000:00:05.0:64-bit:prefetchable:0xf8000000:0xf9ffffff:0x02000000:pmr
nvme2:0000:00:06.0:64-bit:prefetchable:0xfa000000:0xfbffffff:0x02000000:pmr

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I522cebd8b5a16f8a37c6e0e01a0288fb310467fb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7019
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-04-19 14:15:38 +00:00
Michal Berger
45fc211e5f scripts/vagrant: Add support for setting a PMR device
Available in qemu >= 5.1.0. Note that since CMB and PMR share the same
BAR they cannot be used together. If both are specified, PMR setup is
skipped.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ia0c6681b5ac7563efc6c32d2fff1808814196676
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7018
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-19 14:15:38 +00:00
Michal Berger
505b507234 pkg: Add prompt about pkg/spdk.spec being deprecated
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I235c2aed92d1e4c420e61bda66043066ae82222e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7383
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-04-19 12:56:09 +00:00
Michal Berger
dc672e78a0 doc: Add doc about building RPMs
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I78c6a1f376a317bd88298f9d19034848790aa667
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7266
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-19 12:56:09 +00:00
Jin Yu
fe3869403a unit: add nvme pcie hotplug monitor unit test
Change-Id: I28080699964c10475d4ebb72446dc228cf18947c
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7230
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
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: Changpeng Liu <changpeng.liu@intel.com>
2021-04-19 12:55:17 +00:00
Jin Yu
1e58cb9e98 unit: add unit test for the pci event
Change-Id: I147834c61f19da2e61ce5d5df2f49caaf93dc8d3
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7226
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-19 12:55:17 +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
42b47742de nvme/tcp: Only flush socket if not part of poll group
If the qpair is part of a poll group, the socket will get
flushed as part of polling that group already. We only need
to explicitly flush to handle the case where the qpair is
not in a poll group.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ib2a510b6d26d1622950437d81e0a40f6b15d6b54
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7049
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>
Community-CI: Mellanox Build Bot
2021-04-19 12:54:24 +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
ChengqiangMeng
1649217a53 unittest/nvme_tcp: increase code coverage for nvme_tcp_pdu_ch_handle.
nvme_tcp_pdu_ch_handle code comprehensive coverage

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: I15c8f953b2eb444bd058b2340f66120a9d8aa9e9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6837
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>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-19 12:52:40 +00:00
Mao Jiang
dcfe4d2d91 test/nvme: cases for nvme parsing functions
Change-Id: I4291b44aabaa6dd2ef598de308dbf53a4eb45848
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7252
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>
2021-04-19 12:52:29 +00:00
Mao Jiang
41528836b9 test/nvme_qpair: cases for nvme qpair initialization
Change-Id: I327ea27805488c4824caf22d151b3d14f1df1cc1
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6894
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-19 12:49:48 +00:00
Mao Jiang
9ac73cb3b9 test/nvme_ctrlr_ocssd_cmd: check ocssd supported
Change-Id: Ic2c6dfd0f0574e49856bc79b6024596c0d49cc5d
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7380
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-04-19 12:49:35 +00:00
yidong0635
5a752ae1aa lib/vfio_user: Fix compiling warning of non-debug warning.
Logs are all changed to DEBUGLOG. If you compiles non-debug mode.
Gcc reports error. Using #ifdef DEBUG to exclude them.

Fixes #1903

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: Idcaf083e430a77845fbd8443acade4b3f0e1efc9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7445
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-04-19 12:49:25 +00:00
Mao Jiang
9d99392811 test/nvme_poll_group: cases for getting and freeing stats
Change-Id: I0901ec0317910aff633f1563de930b785bfc21cd
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7385
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>
Community-CI: Mellanox Build Bot
2021-04-19 12:48:52 +00:00
Monica Kenguva
4da33ad390 rpc: Document trace_enable_tpoint_group, trace_disable_tpoint_group
and trace_get_tpoint_group_mask

Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: I25f29fbd5e2bc425a75bce2d0131bf963df51521
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6649
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-04-19 12:48:37 +00:00
Ben Walker
823bb32026 sock: Null out sock on spdk_sock_close in all success cases
Even if the operation is deferred, null it out if it reported success.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I3cc9eaa88bdd7a2e7d13790782f4a9b0966e5585
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6892
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-19 12:48:21 +00:00
Monica Kenguva
86ef8f21c9 rpc: Document create and delete bdev uring
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: Id396872112e8fb89eadd8b72cc0f02c543153e7a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7329
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-19 12:48:03 +00:00
Michal Berger
ec632be24f check_format: Make use of shellcheck's -x conditional
-x is supported since 0.4.0 release, make a note of that.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Icc64132536c18108029f6c5fa2cbdd5b27018d8b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7417
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-19 12:47:51 +00:00
Shuhei Matsumoto
af661f7844 ut/iscsi: Add Data-OUT PDU sequence test cases
Test scenario is as follows.

Some iSCSI initiator sends a Data-OUT PDU sequence such that the size of
the data segment of any Data-OUT PDU is not block size multiples.
Test if such complex Data-OUT PDU sequence is processed correctly.

Desired Data Transfer Length is 5 * SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH / 2.
Number of Data-OUT PDUs is 4. Length of the data segment of the first two PDUs are
SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH / 2 - 4. Length of the data segment of the
third PDU is SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH. Length of the data segment
of the final PDU is SPDK_ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH / 2 + 8.

Three data buffers should be used and three subtasks should be created and submitted.

The test scenario assume that a iscsi_conn_read_data() call could read
the required length of the data and all read lengths are 4 bytes multiples.
The latter is to verify data is copied to the correct offset by using data patterns.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5e3939d07cd4f50fe3dcf659a18a9f8fcbe01e07
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6584
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>
Community-CI: Mellanox Build Bot
2021-04-19 12:47:40 +00:00
Shuhei Matsumoto
4af8b24ace ut/iscsi: Add test cases for the function iscsi_pdu_payload_read()
Test sharing data buffer among multiple Data-OUT PDUs.

Allocate real data buffers and the iscsi_conn_read_data() stub writes
data patterns into them.

The data pattern is to write offset per 4 bytes. This requires read
length to 4 bytes multiples but the requirement will be acceptable.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I87c673c3bb0ada2afebb9332af9525cd9d7388f2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6568
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>
Community-CI: Mellanox Build Bot
2021-04-19 12:47:40 +00:00
Shuhei Matsumoto
ce43ae2123 lib/iscsi: Merge multiple Data-OUT PDUs up to 64KB in a sequence
Some iSCSI initiators send a Data-OUT PDU sequence whose PDUs do
not have block size multiples data.

SPDK iSCSI target had replied SCSI write error to such initiators
because previously we had sent a write subtask per Data-OUT PDU.
SPDK SCSI library had rejected the write subtask because its data
was not block size multiples.

This patch fixes the issue.

The idea is to aggregate multiple Data-OUT PDUs into a single write
subtask up to 64KB or until F bit is set. MaxRecvDataSegmentLength
is 64KB but MaxBurstLength is 1MB. Hence one Data-OUT PDU data may
be split into multiple data buffers, but the maximum number of split
is two.

When processing the data segment of the Data-OUT PDU, save the data
buffer of the current PDU to the current task if the data buffer is
not full and F bit is not set. In this case, write subtask is not
submitted.

When processing the header of the Data-OUT PDU, if the current task
saves the data buffer from the last Data-OUT PDU, it passes the data
buffer to the Data-OUT PDU.

When reading the data segment of the current PDU, attach the second
data buffer to the current PDU if the first data buffer becomes full.

These are enabled only if DIF is disabled.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib9cfb53fe8c0807a63e58c61bed3bb52f60f4830
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6439
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>
Community-CI: Mellanox Build Bot
2021-04-19 12:47:40 +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
Jin Yu
5957f2c479 env: extend the use of event listen
struct sockaddr_nl {
    sa_family_t     nl_family;  /* AF_NETLINK */
    unsigned short  nl_pad;     /* Zero */
    pid_t           nl_pid;     /* Port ID */
    __u32           nl_groups;  /* Multicast groups mask */
};

nl_pid is the unicast address of netlink socket.  It's always 0
if the destination is in the kernel.  For a user-space process,
nl_pid is usually the PID of the process owning the destination
socket.  However, nl_pid identifies a netlink socket, not a
process.  If a process owns several netlink sockets, then nl_pid
can be equal to the process ID only for at most one socket.
There are two ways to assign nl_pid to a netlink socket.  If the
application sets nl_pid before calling bind(), then it is up to
the application to make sure that nl_pid is unique.  If the
application sets it to 0, the kernel takes care of assigning it.
The kernel assigns the process ID to the first netlink socket the
process opens and assigns a unique nl_pid to every netlink socket
that the process subsequently creates.

Change-Id: Ic0688228105ea6ba4ebae1d130b9271126c37b0e
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7367
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: 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
5ee049eeec virtio_pci: add sigbus handler
Add the sigbus handler to virtio pci device
such as virtio_blk and virtio_scsi.

Change-Id: I07f2f175a585a425ef14050e2bf83bacb6e4c3bc
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5769
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>
2021-04-16 19:21:13 +00:00
GangCao
303d670f8e Env: close the FD in failed case
Change-Id: I290571bf11ff7365fb7b56282b0e60c20871d9ff
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7428
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-16 16:00:24 +00:00
G.Balaji
391d89b873 nvme: move AER handling to a separate function
This prepares for an upcoming patch to fix issue #1701 which
requires handling async events outside of the check
completions loop.

Fixes:  #1701

Signed-off-by: G.Balaji <gbalajieie@gmail.com>
Change-Id: I4985d814903143511383172b1a443580db33a78f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7416
Community-CI: Broadcom CI
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-16 15:01:33 +00:00
GangCao
ebeac5decc event: add an assert check for obtained reactor
In the case that reactor is needed to be valid, add an
explicit assert there.

Change-Id: Ic47030d50a6a940ddf87a3744bae38c94dd7252e
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7320
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-04-16 05:05:19 +00:00
Mao Jiang
567a3da8ca test/nvmf/subsystem: cases for reservation registrant adding and removing
Change-Id: I4ea45b6a1ccfc252f2a230a7163b765b79e1e927
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7301
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>
2021-04-16 05:04:57 +00:00
Ben Walker
da831cf82a sock: Add pointer to group from group_impl
This makes it possible to traverse from the group_impl to
the group. It hasn't been necessary so far but will be in an
upcoming change.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I2bf119461bfd5ac5c8a63a3f1f4560d32e695c75
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7218
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-16 05:04:29 +00:00
Ben Walker
b77db23ef9 sock: Map operations are now part of the module API
Individual modules will need to mantain their own placement maps for
this to work correctly, especially if modules have different algorithms.
This is a step toward allowing them to do that.

Change-Id: Ie798baa50b94f1e99d6690adb606b936c7b30da0
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7217
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-16 05:04:29 +00:00
Ben Walker
b18fdef111 sock: sock_map_lookup now takes map as first parameter
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Id294ed4b25352735309bf04e83d09eb455c1b8cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7216
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-16 05:04:29 +00:00
Ben Walker
706c81e21f sock: sock_map_release now takes sock map as first parameter
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Iad82b0f263e1c8130056084145d704549a182ae7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7215
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-16 05:04:29 +00:00
Ben Walker
5a11b6a64b sock: sock_map_insert now takes the map as the first parameter
This is a step toward allowing for multiple maps. Each module may have a
different meaning for placement_id with different uniqueness rules. They
can't all be in the same map.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I608680a08b947a5d5c0818ff66505ed64e1b891e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7214
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-16 05:04:29 +00:00
Ben Walker
d3f7d076a6 sock: Add struct spdk_sock_map to hold map related globals
Change-Id: I24bb5529ea83142fc8569963365fde043c4f271e
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7213
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
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
Ben Walker
21c06bac09 sock: Release sock_map entries before shutdown
There are a small, bounded set of placement_ids that the socket layer
will ever encounter, and they remain valid for the lifetime of the
program. The association between a poll group and a placement_id is now
correctly broken when the reference count drops to 0 (in response to
sock_map_release calls), so do not free the entry when the poll group is
destroyed so that it may be reused again.

Change-Id: Iad90e2da7d0860fa8c5cff24f9699bef30cd7bc2
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7210
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-04-16 05:04:29 +00:00
Ben Walker
4ce63b9877 sock: Allow null entries in sock_map
Allow the map to have entries with a valid placement_id, but no group.
This will be useful later when the order of placement_id discovery and
group assignment may be reversed.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Ia39adb3a030135940aeb9eeadf9df78056e59c0d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7209
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-04-16 05:04:29 +00:00
Monica Kenguva
b997e957d8 rpc: Document bdev_error_inject_error
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: I42d11341df2c364b0ad0c948c195e13448426c59
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6633
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>
Community-CI: Mellanox Build Bot
2021-04-15 21:41:16 +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
Changpeng Liu
44c70f8215 scsi: return scsi error status for invalid SCSI CDB
We can return error status when processing RELEASE2 without
a reservation, also add a UT to cover this case.

Fix issue #1898.

Change-Id: I56ffa8eabfc0409307500f8740cb627aab9d2f0b
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7379
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-15 20:25:28 +00:00
Jim Harris
ba9853b9ba Revert "env: Register external memory with DPDK"
This reverts commit aaac48880d.

This patch was showing issues with SPDK vhost mappings
when handling larger numbers of VMs.

Fixes issue #1901.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I81bd311d26037dcb9340d85abcb4ea45b20a5170
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7424
Community-CI: Broadcom CI
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-15 20:22:26 +00:00
Shuhei Matsumoto
476b66614d ut/bdev_nvme: Use attach/detach ctrlr for test_pending_reset()
This is necessary to the following patches to test reset continuation.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I20e0a6b96694eb06adadfbe8e20f73380645ea43
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7326
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>
Community-CI: Mellanox Build Bot
2021-04-15 18:57:54 +00:00
Shuhei Matsumoto
f56563add2 ut/bdev_nvme: Use const variable for string array to avoid raw number
It is more readable to use const variable rather than raw number.
memset is the way to initialize variable size array.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I42f3f34422ea96e06a99bd6cc02e0e91349a4009
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7323
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: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
2021-04-15 18:57:54 +00:00
Shuhei Matsumoto
b96c0b2707 ut/bdev_nvme: Populate namespaces by default when attaching ctrlr
Previously when attaching a ctrlr, all namespaces had not been
populated. Hence we had to populate each namespace manually.

It is more normal if all namespaces are populated when attaching the
corresponding ctrlr.

This patch does such change.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I55d9c444c492ba6e44a609eac81b1ef25a7190a8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7313
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: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-15 18:57:54 +00:00
Shuhei Matsumoto
924081cec9 ut/bdev_nvme: spdk_nvme_probe_poll_async() stub processes only a ctrlr whose trid matches
Previously spdk_nvme_probe_poll_async() had processed all attaching
controllers. Hence it was not easy to attach multiple controllers in
unit tests.

Besides, add a check to exclude duplicated controllers into ut_attach_ctrlr().

If the target is any SPDK library, we should insert another patch
only to do code movement, but this is a unit test file, and so it
will be acceptable to include code movement in the same file.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9e8eba6a67b2a6d0df384214ff84aa5b0c602217
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7312
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-15 18:57:54 +00:00
Karol Latecki
4b3a60daee scripts/nvmf_perf: rename SPDK Target num_cores to core_mask
num_cores name was misleading, as the parameter actually
contained core mask (or core list). Create separate
class attributes with core mask and number of cores.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: Ibfae7770aea2f2c1c720abf567400deb50028ab4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6535
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>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-04-15 16:33:26 +00:00
Karol Latecki
128df53566 scripts/nvmf_perf: save subsystem info
Save info about subsystems created subsystems (target
side) and remote subsystems (initiator side) into
a list.

Change-Id: I7ec1c6a4d1f75060b69b68e0b8e0dd61789fc9e0
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6374
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-15 16:33:26 +00:00
Karol Latecki
696d55bf94 scripts/nvmf_perf: run set_irq_affinity
Run set_irq_affinity script after irqbalance service
is disabled and manually tune IRQs to be run only on
the CPUs local to NIC NUMA node.

set_irq_affinit.sh script must be manually downloaded
as part of https://github.com/Mellanox/mlnx-tools/tree/master/ofed_scripts
package before running tests.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I67b3c851bcf283caea29ad36f6d4bc0322ca0d27
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6534
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
2021-04-15 16:33:26 +00:00
Karol Latecki
3992eb2896 scripts/nvmf_perf: set cpu governor to performance
In performance tests always use best performance policy.
Previously this was manually managed on test systems,
but it's better to do this automatically every time.

Change-Id: Iff81863cf8d9cc713a3c4cce1d8edf7ebbf81c84
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6373
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>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-04-15 16:33:26 +00:00
Karol Latecki
2f9103304f scripts/nvmf_perf: add configure_tuned method
Modify CPU power management settings to achieve high,
consistent results.

Change-Id: I3602ae7523c5b83878238928caaeb453f7d2533e
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6372
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-04-15 16:33:26 +00:00
Karol Latecki
81ccc81dde scripts/nvmf_perf: add configure_sysctl method
Tune sysctl parameters for TCP testing. Restore previous
settings after tests have finished. For ADQ-enabled tests
also set proper value for busy_read option.
Commit includes a fix to initiator exec_cmd() method to
allow using command parameters which contains whitespace,
otherwise it's not possible to set some of sysctl params.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I3376b69b8d7c0d8a282765db4fe55824f55f9e05
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6265
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
2021-04-15 16:33:26 +00:00
Karol Latecki
a35f2b34dd scripts/nvmf_perf: add configure_services method
Disable all unnecessary services which might affect
tests performance.
Managing services implemented in a very simplified way
usign subprocess and configparser modules (because json
output is not available). Proper implementation would
need to use a proper dBus API, but this seems like an
overkill for such a script.

Change-Id: I72feec4293b77442a9d2c9b4afaa032df1c4d5e1
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6264
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-04-15 16:33:26 +00:00
Karol Latecki
2c5849c7be scripts/nvmf_perf: add adq_configure_nic method
Configure NIC settings as per ADQ configuration guide.

Change-Id: I957aada267474c2a1448c89a1b7c81d4dd261ca6
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6263
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-15 16:33:26 +00:00
Karol Latecki
3c09b2fb99 scripts/nvmf_perf: add adq_load_modules method
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: If2784b74ece6c48b81cc53e63412cd2bc618ffef
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6262
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-15 16:33:26 +00:00
Alexey Marchuk
b07a04118a ut/rdma: Fix GCC 10.2.0 warning
rdma_ut.c: In function ‘test_spdk_nvmf_rdma_request_parse_sgl_with_md’:
rdma_ut.c:1152:54: warning: array subscript 10 is outside array bounds of ‘struct spdk_nvmf_rdma_request_data[1]’ [-Warray-bounds]
 1152 |  aligned_buffer = (void *)((uintptr_t)((char *)&data + NVMF_DATA_BUFFER_MASK) &
      |                                       ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
rdma_ut.c:834:37: note: while referencing ‘data’
  834 |  struct spdk_nvmf_rdma_request_data data;
      |                                     ^~~~

The fix is to use array instead of spdk_nvmf_rdma_request_data
structure

Change-Id: I81bd311d26037dcb9340d85abcb4ea45b20a5171
Reported-by: G.Balaji <gbalajieie@gmail.com>
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7365
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-15 11:25:36 +00:00
yidong0635
278bcad4ca perf: remove unused g_tsc_us_rate.
Not only in accel_perf, but also in test event_perf.
Remove them.

Fixes #1895

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I2af1d9f6f077f3ae775af994567804633fc8f050
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7370
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-04-15 11:25:21 +00:00
Michal Berger
3bc0002511 autobuild: Add test for building SPDK RPMs
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Iea87c87367d2ed49b00e896df046e0572fecec98
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6549
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-15 11:24:57 +00:00
Michal Berger
7a5cc6cad5 rpmbuild: Add script for building .rpm packages out of the SPDK repo
For now this is kept at its very basics. Dependencies are handled
via pgkdep, they are not explicitly defined by the .rpm itself.
Currently, up to four .rpm packages are being built:

spdk
spdk-devel
spdk-libs
spdk-dpdk-lib

Together they include all binaries|libs|header files + some setup
scripts which are commonly used throughout the repo. Installation
paths are hardcoded to:

/usr/local/{bin,lib{,/dpdk},include}:
  - binaries
  - libraries
  - header files
/usr/libexec/spdk:
  - scripts
/etc:
  - configuration files

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ic5f067c4e7b8da3d697ee469bc9c794d5a0a035b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6436
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-04-15 11:24:57 +00:00
Alexey Marchuk
a6b92896ff perf: Fix memory leak when IO submit failed
When submit_io cb returns bad status, current
task is dropped and allocated memory is not cleaned.

Change-Id: Ibc33e76e6800644c29eaeb826a3401ad5d5fd582
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7376
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>
2021-04-15 11:24:21 +00:00
Alexey Marchuk
364ad5aedc perf: Cleanup ns_worker_ctx after draining IO
Function cleanup_ns_worker_ctx is only called for
ns_ctx which have outstanding IO, so when draining
phase is started and some context doesn't have
outstanding IO, it won't be cleaned properly.

To fix this problem, call cleanup_ns_worker_ctx for
every context when drining is finished.

Fixes issue #1880

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I3ce4716ed6ac1369b6f72b03cbcfd7d407f7de55
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7282
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: <dongx.yi@intel.com>
2021-04-15 11:24:21 +00:00
Michal Berger
0c78378a63 test/setup: Make sure big enough drive is selected for the tests
Look for drives with 2GB of space at minimum.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ic326229120ffc5d839bbf465855d8be857ab4f73
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7377
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-15 11:24:08 +00:00
Changpeng Liu
9c7f460f55 vfio-user: optimize notice log to debug log
Change-Id: I2e47b148209ce4c232dbdc5f20c90548be995e1a
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7334
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>
2021-04-15 11:23:47 +00:00
Changpeng Liu
b163a88715 nvmf/vfio-user: calculate MDTS based on transport iovcnt
This will ensure that we can't exceed the iovcnt when parse
NVMe PRP list to req->iov.

Also comment that the iovcnt in vfio-user transport is used to track
each gpa_to_vva map, for NVMe PRP list command, the PRP2 itself also
will use one entry, so we need add one more entry for this case.

Fix issue #1864.

Change-Id: I06c7137e2c4637c9501f82a9eb1c8e4395d819cd
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7264
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-15 11:23:47 +00:00
Changpeng Liu
bc279db48a nvmf: add one more iov entry for unaligned first page
For NVMe PRP list command, if the first PRP entry wasn't page
aligned, the number of IOV should add one more entry.

For VFIOUSER transport, a 128KiB PRP command may use 33 entries,
so we add one more entry here to address this case.

Change-Id: I9e30b301ef3ab62d7667adf336f38be9df699929
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7263
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-04-15 11:23:47 +00:00
Changpeng Liu
45aaf0db1d nvmf/vfio-user: register external DMA memory regions to SPDK
For NVMe backend device, we should use vtophys to calculate
physical address when doing DMA from/to VM to drives.

Fix #1822.

Change-Id: Ib8fbc371e19e77a20202d408340e7d65644b1eeb
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7261
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>
2021-04-15 11:23:47 +00:00
Changpeng Liu
275c5dec0f nvmf/vfio-user: apply new DMA add/remove APIs
Change-Id: I8d54b4c2e218995701efc6650b3e5fbe8c6071af
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7260
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-04-15 11:23:47 +00:00
Changpeng Liu
addfab0101 nvmf/vfio-user: start a MMIO poller to poll MMIO access
Previously we poll the MMIO callbacks in the context of ADMIN queue's
poll group, here we do some improvement to start a poller to do MMIO
poll, then the group poll will only process NVMe commands while the
MMIO poller will process MMIO access.

This is useful when doing live migration, because the migration region
defined by VFIO is a BAR region, we should stop polling queue pairs
but ack the MMIO accesses during the live migration.

Change-Id: I63bac44889cbe0c31d47599810aab8335dfd4ff5
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7251
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-04-15 11:23:47 +00:00
Changpeng Liu
342f9b985f nvmf/vfio-user: move up the code to before the caller
Just code movement for the coming patch.

Change-Id: I7e844bc27a037e086796f9659351f20cdbb517fb
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7333
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>
2021-04-15 11:23:47 +00:00
Changpeng Liu
a43a0b7798 nvmf/vfio-user: free qpair to fix the memory leak
Change-Id: I92550cfa6857aba471ac1b2afed7e8acef3453d9
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7250
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: <dongx.yi@intel.com>
2021-04-15 11:23:47 +00:00
Ziye Yang
3a093d82c3 idxd: Update the definition of register according to the new spec.
This patch is used to update the field definition related with
work queue in the header file.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I68b81d9dfc2497db89e96f0730785be03dcb8add
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7225
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
2021-04-15 04:35:09 +00:00
Michal Berger
c6eda94181 test/vhost: Make sure block devices are cleaned up after the test
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Icdfa78572e5cbf1ed14e559b450e7d9ba98c585b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7321
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>
Community-CI: Mellanox Build Bot
2021-04-14 23:41:14 +00:00
Michal Berger
c5cba2c16a test/vhost: Cleanup the way how nvmf_tgt is handled in migration test
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I7e739a4e085d150b0be73cd890f0cf85f05ab7fd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7200
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>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-04-14 23:41:14 +00:00
Michal Berger
bfdb9de3f0 test/vhost: Extend fio runtime during migration tests
Migration can take longer than 10s, hence we need to give fio more
time to spin in order to make sure it's still running on the target
vm after migration is complete.

On the other hand, reduce the timeout used to wait for fio after
the migration is done - there's no need to wait almost a minute,
half that time.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I1b53682d5c8bc72336a9eead28c395f97cd81fe7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7199
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: Karol Latecki <karol.latecki@intel.com>
2021-04-14 23:41:14 +00:00
Jim Harris
c2e0da84c6 nvme: improve comment for nvme_pcie_ctrlr_get_max_xfer_size
NVME_MAX_PRP_LIST_ENTRIES has changed over time, so let's
just remove the reference to the exact value here.  Also
explain a bit more why the max size isn't
(NUM_ENTRIES + 1) * page_size.

While here, do a small whitespace cleanup as well.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib75813788abdd3dbb43192f9fdc27f99b33aeadf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7328
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: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-14 15:35:08 +00:00
Jim Harris
17fdcd7116 test/unit/nvme: relax some nvme_ns_cmd_ut asserts
We only need SPDK_CU_ASSERT_FATAL to check for
NULL pointers.  Other checks should just use
CU_ASSERT and variants.

There are some nvme_ns_cmd_ut checks that are
using SPDK_CU_ASSERT_FATAL unnecessarily.  Let's fix
them.

Found during investigation of issue #1882.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I0b313e44e2ed05554783933e7d4bbc5f07a7e84a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7290
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>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-14 15:35:08 +00:00
Jim Harris
ba6f6c5eb0 nvmf: wait for qpair disconnect cbs when removing subsys
nvmf_poll_group_remove_subsystem_msg() disconnects all
qpairs associated with controllers in the specified
subsystem.  If it finds any controllers that need to
be disconnected, it sends a message to the running
thread to execute the same function again later.

But when it runs again later, the qpair may no longer
be in the poll group, but there could still be
outstanding messages being sent between threads.  For
example, _nvmf_qpair_destroy() needs to send a message
to the ctrlr->thread to clear the qpair mask bit.

All of this could result in the nvmf target starting
to destroy poll groups prematurely.  Destroy poll
groups results in the nvmf spdk_threads exiting. If
there are still messages being processed from
the STOP_SUBSYSTEMS target state, we can get
use-after-free errors since processing of those
messages could access freed memory associated with
the exited thread.

Fixes issue #1850.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I1e63b9addb2956495a69b5108a41e029f6f9a85d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7275
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: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-14 15:35:08 +00:00
yupeng
530646f60c nvme: add NVMe Host Behavior Support
Host Behavior Support is defined in 5.21.1.22 of the NVME spec. This
patch adds the related data structures.

Signed-off-by: Peng Yu <yupeng0921@gmail.com>
Change-Id: I99b2c1e55e23cadcd967b7adf5f8e75a2d799519
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7338
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>
2021-04-14 07:26:20 +00:00
Jim Harris
df902b1d2e include: remove util.h include from queue_extras.h
This include isn't needed in queue_extras.h itself.
There were a few places that were implicitly
depending on this include, so fix those to include
util.h explicitly.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ia962ae5a4403ee8ae15f3106d0d5e7d7412a4535
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7172
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-14 07:25:21 +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
Alexey Marchuk
331f9755cf perf: Add option to print transport statistics
Statistics are dumped in the end of perf tool work,
enabled using long option --transport-stats

Change-Id: Ice3755ba82ebcdacfa72ceb9b3d5a1caee911811
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6302
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>
Reviewed-by: <dongx.yi@intel.com>
2021-04-13 21:30:52 +00:00
Alexey Marchuk
6dd6a3cc37 perf: use getopt_long
I was trying to find a free character to add
statistics reporting and didn't fine a suitable
one. Since perf provides a lot of short options,
let's change it to also use long options.

Change-Id: I2a7fd5619e996a40b2d432017992d5f888abb656
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6301
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
2021-04-13 21:30:52 +00:00
Alexey Marchuk
e966937625 nvme: Add functions to get/free poll group statistics
These are interface functions that can be used by
an application e.g. spdk_nvme_perf or bdev_nvme
library. The next patches will add usage of these
functions.

Change-Id: I33b88e0e713c2ea5967f9241885e3257c5070577
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6300
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-13 21:30:52 +00:00
Alexey Marchuk
3fcda8e779 nvme: Add transport intrafce to get/free stats
The new 2 API function allow to get and free stats
per poll group. New function to get transport name
have been added to report not only transport type but
also the name.
For now only RDMA transport reports statistics,
other transports will be added later.

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I2824cb474fde5fa859cf8196dabac2c48c05709c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6299
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-13 21:30:52 +00:00
Alexey Marchuk
50569293ef nvme/rdma: Add poller statistics
New statistics include number of poller calls,
number of idle polls and total number of completions.
These statistics allow to estimate % of idle polls
and the number of completions per poll.

Since nvme_rdma_cq_process_completions function
returns number of completed NVMF requests and each
NVMF request consumes 2 RDMA completions (send+recv),
this function was extended to return the number of
RDMA completions.

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Ifdc1e2e467f645adb5d66d39ff2a379e161fbd77
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6298
Community-CI: Broadcom CI
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-04-13 08:41:39 +00:00
Alexey Marchuk
527f406b6b nvme/rdma: Use RDMA statistics
These statistics allow to estimate WRs batching
efficiency. The number of send WRs equals the total
number of submitted NVME commands.

Change-Id: I96c9836cd6b9070cf5f62e43b4d2738506866e94
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6297
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-13 08:41:39 +00:00
Liu Xiaodong
4e8032ab04 thread: ack msg_fd directly in intr_msg_proc
Although currently acking msg_fd inside function
msg_queue_run_batch() will also ack critical_msg's
notification, it is easier to understand the code
if moving acking msg_fd code into
thread_interrupt_msg_process().

Change-Id: I98267c5c28358334a2c1133e3dbc125788de77ab
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7265
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-13 08:41:08 +00:00
Liu Xiaodong
53429c7f44 thread: distinguish intr enabled and set
As a start of combining interrupt ability into poller,
it aims to get spdk_thread & spdk_poller runnable between
poll mode and interrupt mode with dynamic switching.

spdk_interrupt_mode_is_enabled() indicate whether interrupt
mode is enabled and dynamic switching is permitted. So
spdk_interrupt_mode_is_enabled==true leads to set up
interrupt mode related resources;
in_interrupt flag indicates whether one spdk_thread now
is running in intr mode.
It is possible that spdk_interrupt_mode_is_enabled==true
but in_interrupt==false. this means spdk_thread & spdk_poller
switched to poll mode from interrupt mode due to heavy
workload coming.

To align with spdk_reactor, use "in_interrupt" to
indicate whether one spdk_thread now runs in intr.

Change-Id: I2cd806bf4dec9969f3df88fac7f6b0c0b716d907
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6540
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
2021-04-13 08:41:08 +00:00
Liu Xiaodong
8c4c8c3967 thread: extract send_msg_notification func
Change-Id: Ib83c53b138614ba9889969c1f98e1a5bdf7fee42
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7153
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-13 08:41:08 +00:00
Liu Xiaodong
fbd6c30b8b intr: call intr_enable before thread lib init
Restrict spdk_interrupt_mode_enable must be called
once prior to initializing the threading library.

Change-Id: I833ff63fae19882e82154195d03dd7ce56ffb1de
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6707
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>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-13 08:41:08 +00:00
Karol Latecki
26d7e3d4bb scripts/nvmf_perf: use common method name for calling subprocesses
Use common method name and parameters for calling
subprocesses for local (Target) and remote systems
(Initiators) instead of using "check_output" (from
subprocess module) and "exec_command" (from paramiko)
separately.
Having these functions wrapped by a single common
method will allow to create common methods in Server
class more eaisly, instead of creating two copies in
Target and Initiator classes.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I1c10f6a88f3d7300c227e969ad6fd901763ac52c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6261
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-04-13 08:40:32 +00:00
Karol Latecki
f9dd94b515 scripts/nvmf_perf: add adq_enable option to configuration file
Parse the config file for "adq_enable" flag and enable
the option in SPDK Target and SPDK Initiator configuration.
At this point the flag has no effect on the generated
traffic, as the system and priority queues are not
configured properly. These settings will be added
gradually in following patches.

Change-Id: I5d7bc892f3aa7bbe691b7e0983294b56fcf994f5
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6260
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-13 08:40:32 +00:00
Karol Latecki
ddb4d24b1d scripts/nvmf_perf: get detailed info about NICs in servers
Get detailed info about NICs installed in servers. This
is using lshw utility to make things easier and not
implement the whole logic for parsing /sys objects and
pci.ids listing in system.

Change-Id: I97871fdc9feaae1c2485574a7b488b88ac3afc4f
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6259
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-04-13 08:40:32 +00:00
Karol Latecki
9fec8853fb scripts/nvmf_perf: re-work managing test options
The number of options for test execution grew high,
and we still need to add more. This results in a lot
of parameters to pass around in constructors, which
is hard to read and causes pylint to complain.

Instead of passing each option individually as a
separate parameter, pass them as dictionaries just
like they're defined in .json config file. This
makes managing the default values a bit harder, but
is more readable.

Change-Id: I5d88a2b7fe51d2df93edd9130678a937d34facdd
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6207
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-13 08:40:32 +00:00
Shuhei Matsumoto
3685228e72 lib/iscsi: Factor out submitting write subtask for Data-OUT PDU
This will be helpful to simplify the upcoming change.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I1f170fe48d2ec1b5ea05da6a8aa3589060c5c32d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6438
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-13 08:38:51 +00:00
Shuhei Matsumoto
b3a3e78a86 lib/iscsi: Track current offset of large write I/O to submit subtasks using current_data_offset
Use current_data_offset of task to track the current offset of
large write I/O by following the last patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iec3a371c6050fe11478b6f158259d8f4013f5238
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6424
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-04-13 08:38:51 +00:00
Changpeng Liu
ff5c19b136 nvmf: call transport abort callback when it's not empty
Custom transport may not provide the `qpair_abort_request`
callback function, so here for transport API we will just
call it when it's not empty.  We will add the callback
support with vfio-user in another patch.

Fix #1883.

Change-Id: Icd82a26bde4ed90068bc85ee04cce9642cb6135d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7291
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: Ben Walker <benjamin.walker@intel.com>
2021-04-13 08:37:57 +00:00
Maciej Wawryk
1fc0c2d8b9 test: move spdk_test_image.qcow2 to spdk_dependencies dir
Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I8d75f5fa22e79c93d1f8929b6df048b440d9fb8a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6940
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-13 05:13:50 +00:00
Maciej Wawryk
1794286d30 test/common: Update fedora version in readme
Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I27261ed2c1f2a18c06b331c226ca08617ad57077
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6939
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>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-04-13 05:13:50 +00:00
Maciej Wawryk
67dd38285f test: removal deprecated sys_sgsw user location
Replace old '/home/sys_sgsw' location by new created
'/home/sys_sgci/spdk_dependencies'
Also update readme with current user name.

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: Ifcea15f704183c7ae0044ee02bd28b6bd891b262
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6927
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>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-04-13 05:13:50 +00:00
Mao Jiang
dad0a60778 test/nvme_ctrlr_cmd: cases for adding requests abort
Change-Id: Ie0c0b4a183922bc190ebfb0dcb513cd6fb7c467d
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7003
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>
2021-04-12 22:43:24 +00:00
ChengqiangMeng
f673969dbb unittest/nvme_rdma: increase code coverage for nvme_rdma.c
nvme_rdma_validate_cm_event
nvme_rdma_register_reqs
and nvme_rdma_unregister_reqs code comprehensive coverage.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: Ia002b750319c2cb7583e2d4cd4dc30e85c694eec
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6956
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-12 22:40:33 +00:00
Evgeniy Kochetov
47a6653fdd ut/nvme: Fix uninitialized controller structure
Fixes #1882

Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com>
Change-Id: I5668f2a5d272f5260f4aaf22f5a08469ea903315
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7309
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-12 20:59:51 +00:00
Changpeng Liu
912b2116da nvmf/vfio-user: fix the race condition when creating new connection
We used the controller ready field to indicate ADMIN queue connection,
but the accept poller and ADMIN poll group may run in different
threads, this may lead vfu_attach_ctx() be called several times, so
change the 'ready' to true when a new socket connection is created.

Fix issue #1854.

Change-Id: Iab6ffd6dffb3fff5cf893e79774bc28fe0b2830c
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7073
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>
2021-04-12 19:33:24 +00:00
Changpeng Liu
8c4ac1f2ff nvmf/vfio-user: use a better input parameter for vfio_user_map_prps
This will make the code easier to understand.

Change-Id: I7112d3fd5f0d6dce9b66d44375b68ce7d1e8951d
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7072
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>
2021-04-12 19:33:24 +00:00
Changpeng Liu
e7f3142ca2 nvmf/vfio-user: eliminate unmap_q function
unmap_q is only be called in unmap_qp, so remove this function to make the
code more clear to read.

Change-Id: I627c7a1efdcb85476cb618fced8b0bfc2d8f1f62
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6886
Community-CI: Broadcom CI
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: Ben Walker <benjamin.walker@intel.com>
2021-04-12 19:33:24 +00:00
Changpeng Liu
43b63c68b9 nvmf/vfio-user: destroy controller when remote client is dead
When killing QEMU or remote client is terminated normally,
we can release current controller related data structure,
users may restart QEMU to connect the same socket file
again, for the new connection, vfio-user will create
a new controller data structure for it.

Here we add a lock in the endpoint data structure to protect
number of connected queue pairs variable, because controller
data structure is like a session, while endpoint is related
with the socket file, so it's safe here.  Moreover, we can
use this lock to protect live migration related data
structures in future.

Change-Id: Ie7060041a253604e7a2242813ec284eae46fe4e8
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6862
Community-CI: Broadcom CI
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: Ben Walker <benjamin.walker@intel.com>
2021-04-12 19:33:24 +00:00
Jim Harris
3a3eb25ebb examples/nvme/identify: remove -v from usage text
This option may have been valid at one point, but is
not any longer.  So remove it from the usage text.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I83747968085a77fb52d735026294bf5f82517ffc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7276
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: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-12 19:15:55 +00:00
Shuhei Matsumoto
67a03bc73a ut/bdev_nvme: spdk_nvme_detach() stub calls ut_detach_ctrlr() if ctrlr is attached by ut_attach_ctrlr()
bdev_nvme_delete() calls spdk_nvme_detach() in the end. However,
previously spdk_nvme_detach() stub did nothing and ut_detach_ctrlr()
was called separately if ctrlr wass attached by ut_detach_ctrlr().

This was to differentiate the two cases, ctrlr is statically assigned
or dynamically attached by ut_detach_ctrlr().

This might be a little confusing. Hence by adding a flag, attached,
to ctrlr, merge ut_detach_ctrlr() into spdk_nvme_detach(), and remove
ut_detach_ctrlr() calls.

Besides, change one SPDK_CU_ASSERT_FATAL to return NULL because the
other cases do that and the callers for ut_attach_ctrlr() already have
SPDK_CU_ASSERT_FATAL.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I2a73f57c6031819d3ae441a6874127ff5d53fc04
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7311
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
d9e3ffea48 ut/bdev_nvme: Use bdev_nvme_find_io_path() in unit tests
This will make the following change simpler and testing
bdev_nvme_find_io_path() will be good.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Iac82bdba88e4abfa41c2ce04f10ce41a6b7dbd71
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7106
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>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-04-12 09:51:03 +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
Shuhei Matsumoto
6d573781b5 lib/iscsi: Rename current_datain_offset of task by current_data_offset
The following patches will aggregate multiple Data-OUT PDUs into a
single write subtask and we will not be able to use reqh->buffer_offset
to track the current offset of large write I/O to submit write subtasks.

On the other hand, each iscsi_task or iscsi_subtask is only read or write

Hence rename current_datain_offset of iscsi_task by current_data_offset
in this patch.

The next patch will use it to track the current offset of large write I/O

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I922582c5b9474a3c512f81d0f0425158a38a9a8d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6423
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: Changpeng Liu <changpeng.liu@intel.com>
2021-04-12 09:49:31 +00:00
Shuhei Matsumoto
00508c8ef1 lib/iscsi: Add data_len to mobj and use mobj to create write subtask
The following patches will aggregate multiple Data-OUT PDUs into a
single SCSI write up to 64KB. Any variable to accumulate data length
is necessary.

Hence add data_len to mobj and accumulate read data length into
mobj->data_len, and then refer mobj instead of pdu->data and
pdu->data_segment_len to submit write subtask.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6354534769e67c0fd995bbc3c2b4a80d21a23915
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6422
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-12 09:49:31 +00:00
Shuhei Matsumoto
7a783b5b38 iscsi: Factor out getting data buffer from mempool into helper function
Wrap an operation to get a data buffer from mempool into a helper
function iscsi_datapool_get() and wrap an operation to put a data
buffer to mempool into a helper function iscsi_data_pool_put().

Use inline for both functions.

Besides, as a minor fix, remove duplicated file inclusion between
iscsi.c and iscsi.h.
7

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia3005dffaa93a6bca16f19bb467fb5b64ae1aad2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6366
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: sunshihao <sunshihao@huawei.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-12 09:49:31 +00:00
Shuhei Matsumoto
3de09f8ece lib/iscsi: Support data split case for CRC32C computation
Add crc32c to struct spdk_iscsi_pdu and initialize it by SPDK_CRC32C_INITIAL,
and then use it as the initial value of _iscsi_pdu_calc_data_digest().
Separate finalization of crc32c into _iscsi_pdu_finalize_data_digest().

Move the definition of related macro constants from iscsi.c to iscsi.h.

iscsi_pdu_calc_data_digest() is used for read too. So setting
pdu->valid_data_bytes before calling iscsi_pdu_calc_data_digest()
for read.

Data split will be supported only if DIF is disabled, and hence
DIF case is not changed.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I9d24f605fd0d452782e17695b613cd2f63d2e42f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6421
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: Changpeng Liu <changpeng.liu@intel.com>
2021-04-12 09:49:31 +00:00
Shuhei Matsumoto
acdeb53f4b lib/iscsi: Increase buffer size to 64KB at most when more Data-OUT PDUs follow
The following patches will want to aggregate multiple Data-OUT PDUs
into the same data buffer, but it will be 64KB at most.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I72eabbeae0b027c2fbff2a5837d180b06b0a1b49
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6418
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-12 09:49:31 +00:00
Shuhei Matsumoto
2ef97692bc lib/iscsi: Create subtask after reading data segment for Data-OUT PDU
The following patches will change the handler for Data-OUT PDU to
submit subtask only when 64KB data is read or F bit is set.

Previously, we had created a subtask when processing header and
before reading data segment.  Creating a subtask beforehand is not
convenient for the following changes.

Hence create a subtask after reading data segment.

If LUN is removed while processing the Data-OUT PDU, the corresponding
primary task will be terminated by iscsi_clear_all_transfer_task(),
and any subtask completion is not sent to initiator. Hence we can
reject the received Data-OUT PDU safely.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifb6d6988676080b458b31d12fef065f3c1de0cb6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6415
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: Changpeng Liu <changpeng.liu@intel.com>
2021-04-12 09:49:31 +00:00
Jin Yu
59237d22b8 lib: add a hotplug lib for device
The hotplug lib can be used for pcie devices
such as nvme, virtio_blk and virtio scsi.

For the sigbus handler, there is only one in a
process and it should handle all the devices.

And align nvme to the hotplug lib

Add the ADD uevent support for allowing the
device hotplug.

Change-Id: I82cd3b4af38ca24cee8b041a215a85c4a69e60f7
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5653
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: <dongx.yi@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-04-12 09:48:21 +00:00
ChengqiangMeng
1c3bc9d64d rdma/common.c: Fix possible memory leaks
Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: I134f3ca3dfb0c747b0ca8544068961a53470106f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7262
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: <qun.wan@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>
Community-CI: Mellanox Build Bot
2021-04-12 09:44:41 +00:00
yidong0635
35dfd3eafb memory: Fix memory leak of g_vtophys_map allocated failed.
if g_phys_ref_map allocated successfully and g_vtophys_map
allocated failed. It reports memory leaks. so add
spdk_mem_map_free(&g_phys_ref_map).

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I06149c98f158d1c679e5045e279beccbdea10e55
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7249
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Chengqiang Meng <chengqiangx.meng@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-04-12 09:44:13 +00:00
Michal Berger
f40b0b1629 pgkdep/git: Upgrade ice driver to 1.4.11
The old 1.2.1 version doesn't compile against latest 5.11.x kernels
(e.g. due to recent changes in include/net/xdp.h) so upgrade to the
latest compatible release.

Also, move the url to sourceforge since ice is released more often
there under e1000 project.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I08b7beae922addeb877fe321679151b02bd253db
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7011
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-12 09:43:31 +00:00
Michal Berger
0f8bff29f8 pkgpdep/git: Patch QAT to adjust for changes in recent kernels 5.11.x
Most notably, crypto/sha.h was split into two separate header files,
crypto/sha1.h and crypto/sha2.h.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I43ae61034f743bf4aae7f2f29919eec92d851f01
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7010
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@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-12 09:43:31 +00:00
Michal Berger
c09b139e61 test/nvmf: Use rxe_cfg to get rxe-enabled net devices
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Iafc067f880525f25363db1adf9a94a9fc9215455
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6994
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-12 09:41:20 +00:00
Michal Berger
4d52dae32a scripts/rxe_cfg: Add env switch to skip printing status header
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ibc3149b5b9591826ff9aeed38457c2aa9ff747e4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6993
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-12 09:41:20 +00:00
Michal Berger
e99cfdb6c9 scripts/rxe_cfg: Split collect_devices()
collect_devices() is split into two functions:

 - collect_net_devices(): Collect ethernet net devs from the
                          net class.
 - collect_rxe_devices(): Collect all rxe devices from the
                          infiniband class.

This is done in order to make handling of some conditions easier.
Case and point, in newer kernels, device/net link is not anymore
created for the soft roce devices, instead only ./parent attribute
is available. collect_rxe_devices() is adjusted to handle such
a condition.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Idefa39c4a62c9e650a03e237f49940461e9782a6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6992
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-12 09:41:20 +00:00
Monica Kenguva
132d80be05 rpc: Document scsi_get_devices
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: Id7febeb8e4cad2f8f7e98366e38b6117afa7d7d9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6916
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-12 09:40:19 +00:00
Monica Kenguva
039ab97c48 rpc: Document split bdev create and delete
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: I3aba1fe4420830a06c9813d224417201e6ba594d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6753
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-12 09:39:29 +00:00
Ben Walker
2ab0506ef7 test/nvmf: Don't load kernel modules for custom transports
For custom transports, skip the kernel module loading and
unloading steps.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I193c62ffa0a9a5060b4bc504b39db3b6f660e1a3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3584
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-10 03:49:40 +00:00
GangCao
01f45ecd8c NVMe: add the prefix of ctrlr identification for diagnosability
Introduce new utilities NVME_CTRLR_ERRLOG, NVME_CTRLR_WARNLOG and so
on to output the ctrlr's identification  at different log levels.

For RDMA and TCP, the subnqn will be output and for PCIe and custom,
the traddr will be ouptput.

Change-Id: I81a112463bf752999aa1fe4e0c867d88e09a2f64
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7057
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Vasuki Manikarnike <vasuki.manikarnike@hpe.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-09 17:29:21 +00:00
GangCao
415d664029 NVMe: fix the potential issue of dereference NULL pointer
Change-Id: Icb81239e64faa5e9c0daf361798b68e153effcee
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7154
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>
Reviewed-by: <dongx.yi@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-09 17:29:21 +00:00
Ben Walker
e3e8fadca4 sock: Eliminate init parameter of sock_map_insert
This can be handled in a cleaner way by having the sock group
create/close operations take an extra reference.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Id701b6dd9a19b01cd40e0d95eb870aef977eea99
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7208
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-09 17:15:57 +00:00
Ben Walker
4bcafd5b15 sock: Delay asking a socket about it's placement_id until after it is
added to a group

The process of adding a socket to a group may, in some scenarios, change
the placement id.

Change-Id: I879d9641099d86978ede5d5e2be1a72eda65a79b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7207
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: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-09 17:15:57 +00:00
Ben Walker
141a95aa36 sock: Placement Ids may only map to a single group
Change-Id: Ib917f2e95f93f4cb48d53e35f3273b0c42ba1a4f
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7206
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>
Community-CI: Mellanox Build Bot
2021-04-09 17:15:57 +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
Ben Walker
0254ef6d2b sock: Fix return code for adding a socket to a group twice
Also fix the comment. It's never going to make sense to add a socket
to a group twice.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: Id4845b77114aef32bbe4ea0e53d2e1fde8e116f4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7204
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>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-04-09 17:15:57 +00:00
Konrad Sztyber
c6b9113ba7 nvmf/tcp: use free() to release transport when create fails
Using nvmf_tcp_destroy() would destroy ttransport->lock, which hasn't
been initialized by that point yet.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ie9ced97ef520236dddaa70453b6807e8382ce534
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7235
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-04-09 17:13:57 +00:00
Michal Berger
c84ecccca3 vhost/windows: Make sure host drive is properly cleaned up
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I53ec43c62f5ab7bef2719119252eec3c7c6b90d9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7269
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>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-04-08 16:38:39 +00:00
Shuhei Matsumoto
0247a9945a thread: Add spdk_io_channel_get_io_device() to get io_device from io_channel
This will be useful as the same purpose as
spdk_io_channel_iter_get_io_device() and will be used in the
following patches.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id45f5980c65543703b91df2afeb47448232fe503
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7237
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>
Community-CI: Mellanox Build Bot
2021-04-08 16:10:26 +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
Karol Latecki
7366e569fb build/fio: disable warning for fio clang-11 builds
Fio 3.19 fails to build with Clang 11 because of
implicit-const-int-float-conversion error.
Disable -Werror checking for now.

Fixes #1848

Change-Id: I0f3922d7af412de35d9f79f3f5413af146996bf3
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6991
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>
2021-04-08 16:09:00 +00:00
Alexey Marchuk
c3853598b1 nvme/ut: Add test to cover failed split of SGL list
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Iff99d5402ffaf3a526a2ac04539672d47a0a1ccb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7093
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-05 22:58:57 +00:00
Alexey Marchuk
c7bb68aa3e nvme: Handle errors returned by submit function
When a request is submitted, it may have incorrect iov
alignment that doesn't fit PRP requirements. In the
current version an internal function fails such a request
and returns a NULL pointer. This is mapped to -ENOMEM
error which is returned to generic bdev layer where
such a request is queued in a "nomem_io" queue and
later can be resubmitted. That is incorrect and such
a request must be completed immediately. To fail the
request, we need to differentiate between -ENOMEM and
other cases, so we pass a pointer to a result to
local nvme functions

Change-Id: I7120d49114d801497a71fca5a23b172732d088de
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7036
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-05 22:58:57 +00:00
Alexey Marchuk
a1f848b057 nvme: Add a function to handle error case in IO functions
This function will be used the next patch, current
behaviour remains unchanged

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Ie74c7395f67a08b0cac018eb5114f358a6b583cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7092
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: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-04-05 22:58:57 +00:00
Monica Kenguva
90db6167ce rpc: Document enable_vmd
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: I04f58517ecae09e810d95d22bebc7215028cf016
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6852
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>
2021-04-02 08:23:05 +00:00
Michal Berger
7347f60bbc autotest: Use rpc_cmd() for rpc plugin-based tests
Also, create a common dir which will hold symlinks to all existing
plugins used in the tests. Location of the actual lib is not changed
so the relation to the given test suite is clearly preserved.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Icb70bbc61fbfa3325a357d5dd93f554ff132a3b9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7146
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-02 08:22:42 +00:00
Michal Berger
5ddb210e61 scripts/rpc: Support loading plugins in --server mode
Put plugin parser into a separate function and use it to additionally
parse arguments passed to rpc.py via stdin.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I170d762ed9f5483d92b298f4804ee4e9f227a751
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7145
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: Jim Harris <james.r.harris@intel.com>
2021-04-02 08:22:42 +00:00
Michal Berger
31f8d52d13 test/bdev: Switch to rpc_cmd()
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I01eb2e6b6da1e633278a1998ca8982ea8a132720
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7088
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: Jim Harris <james.r.harris@intel.com>
2021-04-02 08:22:42 +00:00
Michal Berger
08d4dce28c test/common: Allow rpc_cmd() to execute multiple commands
This allows to pass to rpc_cmd() sets of commands via stdin. E.g.:

rpc_cmd <<-CMDS
	bdev_malloc_create -b Malloc0 32 512
	bdev_malloc_create -b Malloc1 32 512
	bdev_malloc_create -b Malloc2 32 512
CMDS

Since rpc.py is already running in a server mode, this is slightly
faster than grouping commands and running scripts/rpc.py directly.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I29fbcf3f2751400980d35b4de2cce2da1cd2bf2a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7087
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-04-02 08:22:42 +00:00
Michal Berger
9aa3c063da test/common: Don't disable unit tests for scan|auto builds
Unittest job is now split into three smaller jobs, each of them
requires unit tests to be built.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ibc0dfbf6f7395a9dfe23242b532fb5cb1f8dd8f4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6839
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-01 11:20:35 +00:00
Michal Berger
63330f68b4 autobuild: Ignore warnings comming from doxygen 1.8.20
This particular version reports plenty of false positives causing the
test to fail. Example:

nvme.md:2: warning: @copybrief or @copydoc target 'spdk_nvme_ctrlr_alloc_io_qpair()\ilinebr' not found
nvme.md:2: warning: @copybrief or @copydoc target 'spdk_nvme_ctrlr_get_ns()\ilinebr' not found
nvme.md:2: warning: @copybrief or @copydoc target 'spdk_nvme_ns_cmd_read()\ilinebr' not found
nvme.md:2: warning: @copybrief or @copydoc target 'spdk_nvme_ns_cmd_readv()\ilinebr' not found
nvme.md:2: warning: @copybrief or @copydoc target 'spdk_nvme_ns_cmd_read_with_md()\ilinebr' not found
nvme.md:2: warning: @copybrief or @copydoc target 'spdk_nvme_ns_cmd_write()\ilinebr' not found
nvme.md:2: warning: @copybrief or @copydoc target 'spdk_nvme_ns_cmd_writev()\ilinebr' not found

This is potentially a regression in caused by the following issue:
https://github.com/doxygen/doxygen/issues/7948

The above seems to be resolved in latest releases, however, until
they are shipped as part of distros we support, similar mitigation is
in order.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I1e39c94f9f388de99e1106bcf15750e4b39384e6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7160
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-01 11:18:53 +00:00
Michal Berger
20244a18b8 doc: Disable doxygen options marked as obsolete in newer versions
Next step would be to upgrade the entire Doxyfile to meet the new
specs.  For now, prevent doxygen from generating warnings about
these opts.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I2761675a435beb49abede89bc520c12a2cdc2dff
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7134
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>
Community-CI: Mellanox Build Bot
2021-04-01 11:18:53 +00:00
Michal Berger
d58c945568 doc: Rename #index label to #mainpage
For some reason, newer versions of doxygen started to complain about
the following:

 warning: multiple use of section label 'index' for main page

To mitigate, use alternative name for the label.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I6387a7c644c6626dd646c9fdd0e9ed1d430881f2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7132
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>
Community-CI: Mellanox Build Bot
2021-04-01 11:18:53 +00:00
Jim Harris
8617ddc9d6 doc: fix bdev_nvme_cuse_register reference for bdev.md
The -p option was removed a while ago, all CUSE devices
are automatically created under /dev/spdk now.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iffc55e98957d5224bf15a435100610ce5a3cfb28
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7152
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: Changpeng Liu <changpeng.liu@intel.com>
2021-04-01 11:17:53 +00:00
Konrad Sztyber
471300a31f doc/nvmf: reorganize target configuration section
Moved the subsections on configuring SPDK's NVMe-oF target to be under
the appropriate section instead of being attached to the one on FC
transport support.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I56070fa7aec00b96b2c34cfa6f5ec0d64fd0aee5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6773
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: Aleksey Marchuk <alexeymar@mellanox.com>
2021-04-01 11:17:09 +00:00
Maciej Szulik
6497b0774e nvmf: add max_io_size validation
The max_io_size transport option should be a power of 2 and be >= 8KB.

Max data tranfer size is defined in NVMe-oF spec as 2^(mdts cmd field) * 4KB.
Mdts cmd field is calculated as spdk_u32log2(transport->opts.max_io_size / 4096),
so max_io_size < 8KB results in mdts=0, which means no size limit (according to spec).

User can set max_io_size = 0 explicitly to allow no size limit.

Signed-off-by: Maciej Szulik <maciej.szulik@intel.com>
Change-Id: Id88a77efce5f217e1fc7750f61c0bd330aaa3791
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6384
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-01 11:16:56 +00:00
Karol Latecki
201ad2f917 doc: add links to 21.01 NVMe-oF performance reports
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: Ie436a4f02f774ec9128e6e0a0b3c6639d427d5de
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7103
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-04-01 10:04:16 +00:00
Jin Yu
0ccf4a9ce6 env_pci: fix device_allow small issue
The dbdf format is xxxx:xx:xx.x and with the wrong
format the rte_devargs_parse always fails.

Change-Id: Ia34bc5e68f6401bb25907d5d07c65636b4f491b5
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7140
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: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
2021-03-31 08:55:59 +00:00
Mao Jiang
b69356a85d test/nvme_ctrlr: cases for ctrlr adding and removing process
Change-Id: Ie3a5d31e8d5da50935491804e31b2078e6893a1f
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7077
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-31 08:52:08 +00:00
Alexey Marchuk
c4a1b3431a nvmf: Fix bug when subsystem failed to pause
We can send a message to repeat subsystem pause
and free a context that will be used later

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Ia5e8b0ff43f5e38bd8e659a8a64d42926e1d3c6e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6661
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>
2021-03-31 08:49:55 +00:00
Michal Berger
d22233ac59 autopackage: Make lto build dependent only on RUN_NIGHTLY flag
This is done in preparation for the RPM tests.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I93cd0d3d7ddeff54387e2a270e9713b2415845b0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7142
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-03-31 08:49:44 +00:00
yidong0635
13cd7c597a example/abort: Fix missing optarg.
Optargs are  missed about -G and -T
which are used to trace and debug.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I3624b80f52c1b603acf1bc96126b73d1042f1b34
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7109
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
2021-03-31 08:49:37 +00:00
Ziye Yang
f0956d33fb nvmf/tcp: Move the accel_engine into the poll group.
With this change, each polling group will use one
accel_engine channel. This change will be more suitable
to utlize the underlying accelerated device.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ibab183a1f65baff7e58529ee05e96b1b04731285
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7055
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-30 11:50:20 +00:00
Michal Berger
85d48c64a9 autotest: Make sure core dumps are generated for ASAN and UBSAN
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I7d85daa3a5c90cdc250caca386a14078928df4c1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6997
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-30 11:49:17 +00:00
ChengqiangMeng
dfe8d308a1 unittest/nvme_ns: increase code coverage
nvme_ns_has_supported_iocs_specific_data and nvme_ctrlr_identify_ns_iocs_specific
and nvme_ns_free_zns_specific_data code comprehensive coverage.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: I2a3d26fbfbdd052978c7af282ce88ca4f3da83b7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6719
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-30 11:48:54 +00:00
Changpeng Liu
dc03266366 nvmf/vfio-user: unmap queue pairs when removing memory region
Actually we already do this when removeing a memory region, but
the check for it is too strict, we should unmap queue pairs when
the queue pair is in the memory region.

Change-Id: Ia646a0255e32ecdd0a70537a8011ce622eb59195
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6861
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>
2021-03-30 11:46:32 +00:00
Changpeng Liu
adfec326b6 nvmf/vfio-user: handle connect response error correctly
The error response should be processed at the beginning of this
function.

Change-Id: Id583951c82981cf58984ab68b23ad6f7ea80cd3f
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6859
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: Ben Walker <benjamin.walker@intel.com>
2021-03-30 11:46:32 +00:00
Changpeng Liu
62f54005c0 nvmf/vfio-user: optimize the error log
When starting VM, there are error logs such as:

vfio_user.c: 510:acq_map: *ERROR*: Map ACQ failed, ACQ 3ffde000, errno -1
vfio_user.c:1043:map_admin_queue: *ERROR*: /var/run/muser/domain/muser1/1: failed to map CQ0: -1
vfio_user.c:1103:memory_region_add_cb: *NOTICE*: Failed to map SQID 1 0x3ffd8000-0x3ffdc000, will try again in next poll

This isn't the error case, because when the Guest memory hot add/remove from QEMU, vfio-user
target will stop and unmap all queue pairs and remap them again, so let's use a more friendly
log instead.

Also use a notice log when adding listener.

Change-Id: Iaa4dc29e02523b5e85ec716d200ec355f8a575ed
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6650
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: Ben Walker <benjamin.walker@intel.com>
2021-03-30 11:46:32 +00:00
Changpeng Liu
5922706ccb test/nvmf_vfio_user: simplify the creation of Unix domain socket
We only need to create an empty directory for vfio-user device,
the softlink isn't required anymore, so remove it.

Change-Id: Ie3f9ce73d287be3651f4ac06483888ac0f693700
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6954
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: Ben Walker <benjamin.walker@intel.com>
2021-03-30 11:46:32 +00:00
Jim Harris
a0aa389e13 thread: cleanup Doxygen comments
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I86fc41a0d1ec31971f9c85d2b146501e338d44c8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7131
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.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-03-30 11:45:50 +00:00
Jim Harris
2dad66a16f nvmf: cleanup Doxygen comment
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3026abce2689e26f5b82c09714b114f51beae405
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7130
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.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-03-30 11:45:50 +00:00
Jim Harris
df3299113c nvme: cleanup Doxygen comments
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ib41e71d4288c03b67db37878a073ea143d369dd3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7129
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-30 11:45:50 +00:00
Jim Harris
3f858eeb38 jsonrpc: cleanup Doxygen comments
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I4d25092c37044abd7aa157342fc44e02c4a65df6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7128
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Michal Berger <michalx.berger@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>
Community-CI: Mellanox Build Bot
2021-03-30 11:45:50 +00:00
Jim Harris
45128fe64b blobfs: cleanup Doxygen comments
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I39b811a379e44faf9170892812b835f9115976e2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7127
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Michal Berger <michalx.berger@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>
Community-CI: Mellanox Build Bot
2021-03-30 11:45:50 +00:00
Jim Harris
163ce7feca blob: cleanup Doxygen comments
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I8aaca0ac0f1c1a0da1227b980d2f5a864b1077e3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7126
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-03-30 11:45:50 +00:00
Jim Harris
1d94d1cbda bdev: cleanup Doxygen comments
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Id6eb0b09297d654689714426ae6cb6baf75c2dca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7125
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-30 11:45:50 +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
Niklas Cassel
20a01a0495 nvme/fio_plugin: use calloc to allocate zone report buffer
spdk_nvme_zns_report_zones() is implemented using
nvme_allocate_request_user_copy(), which under the hood will do
a spdk_zmalloc() with the SPDK_MALLOC_DMA flag set, and will copy
over the result to our buffer.

Therefore, it is redundant for us to use spdk_dma_zmalloc(),
because it will cause us to allocate twice the amount of memory
from the precious DMA pool than needed.

Changing this zone report buffer allocation to a calloc also
has the benefit of making the code uniform with all other
spdk_nvme_zns_report_zones() call sites in the SPDK codebase.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ia354fa51c66ae07a38a9a57b07c15d145dd609f0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7005
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-29 10:17:45 +00:00
Niklas Cassel
7ce5dd62f7 nvme/identify: use calloc to allocate zone report buffer
When support for printing the zone report was added,
the zone report buffer was allocated using calloc().

This was intentionally changed to a malloc in commit
5ef79a17ec ("examples/nvme/identify: add an option to dump
the full zns zone report").

While we shouldn't need to zero the buffer, since the drive
should write  the "Number of Zones" field in zone report header,
and we should never read zone descriptors beyond this value,
the ZNS spec also states that reading beyond the last zone
descriptor has undefined results.

Considering that "Number of Zones" field in the zone report
header will only represent the number of zone descriptors
in the buffer when the partial bit was set to true,
always use calloc(), to avoid the chance that someone might
copy this code and call spdk_nvme_zns_report_zones() with the
partial bit set to false.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ia39c5235aa5c62a4ec42285f53f4bc80f7ec370f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7004
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-29 10:17:45 +00:00
Niklas Cassel
f6bbec8ba9 bdev/hello_world: for zoned bdevs, reset the zone before write
If the bdev is a zoned bdev, reset zone 0 (containing offset 0),
before doing the "Hello world!" write to offset 0.

This is done to ensure that the write pointer for the first zone
is at offset 0.

If we don't do a zone reset before doing the write, the write
would fail if there already were data written to the first zone.
(E.g. if the user ran the hello_bdev example twice.)

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I52b6fc9cf6e86fef9aeb19482eafd1f857ba1478
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6943
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 10:17:45 +00:00
paul luse
346c43edd3 doc: Add accel_fw section and RPCs to jsonrpc docs
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I4f680c5fe72312224ce6722197a70a49886c9db1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4187
Community-CI: Mellanox Build Bot
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-29 07:44:01 +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
Tomasz Zawadzki
83601f77bc CHANGELOG: add entry on iscsi_parse_params fix
Add CHANGELOG entry for
(f3fd56fc)lib/iscsi: return immediately from iscsi_parse_params if len is 0

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I96500e26dba231b4e5d60ae8f95011b071a78cd0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6778
Tested-by: SPDK CI Jenkins <sys_sgci@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-03-29 07:42:52 +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
Maciej Wawryk
0872c7edbd nvmf/perf: Fix type error
TypeError: expected str, bytes or os.PathLike object, not int

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I0b395035b43fd4ef5e10ae152889c737ccf66c03
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7054
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-29 07:40:16 +00:00
Rafal Stefanowski
25bc25b9a0 ocf: update submodule to v20.12.2
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
Change-Id: Iaadd551452f7dff75d507af158e70aa2899ff9d1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6976
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-29 07:40:02 +00:00
Changpeng Liu
04cd292237 nvme/quirk: add MDTS excludes interleaved metadata quirk
The specification for Maximum Data Transfer Size (MDTS) says this field
should include the length of metadata, if metadata is interleaved with the
logical block data.  However, some drives can support MDTS without counting
the interleaved metadata, so for this case SPDK will only use data length
without interleaved metadata length.

Change-Id: I29920a25885699e2689be043b87122367be0e416
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6813
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: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-29 07:38:37 +00:00
Changpeng Liu
075f321be8 nvme/fio_plugin: exclude PRACT&&MD=8&&Extended LBA metadata size
If PRACT is enabled, and metadata size is 8 bytes, for extended
LBA format, the controller will insert/strip the metadata, so
we don't need to pass the metadata buffer, so we should exclude
this metadata buffer from host buffer.

So here add a function to calculate host buffer size.

Change-Id: I42d8d9cbfbf7ba2bc4bf64d65260c6cfe9bd4cb1
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6789
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-29 07:38:37 +00:00
Mao Jiang
cd468b987d test/nvme_io_msg: cases for io_msg_ctrlr register and unregister
Change-Id: Icd91870712ee977c3f9d803e68e8cb4c4b2ff0e6
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6797
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-03-29 07:35:04 +00:00
Karol Latecki
b7423187a2 autotest.sh: call rdma_device_init only for RDMA tests
Check test flags before calling rdma_device_init if
it's really needed, so that we don't call it when doing
TCP tests.

Change-Id: I2675a008cf84c7c4084cb83b44c279d2a497c3cb
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6998
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-29 07:34:38 +00:00
Krzysztof Karas
8f05269572 spdk_top: fix a bug on minimal size spdk_top window
Fixes a bug that occurs when spdk_top window is just big enough
to print empty line in data area, but unable to fill the line with
actual data, resulting in application crash.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Id39267a9587b9e0ab74a43f5010927af6faff512
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6216
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-03-29 07:33:04 +00:00
Karol Latecki
de21d8f4e4 lib/nbd: fix deadStore issue in nbd_cleanup_io()
Although the value stored to 'rc' is used in the enclosing
expression, the value is never actually read from 'rc'

Fixes #1860

Change-Id: Id1001552e635968e373cad0fd27d7bda41d887cd
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7082
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-29 07:29:57 +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
Michal Berger
18020ec73b test/setup: Add tests for different block devices' setups
nvme_mount - basic test verifying if setup.sh sees mounted nvme
             devices (either partitions or the entire drive).

lvm_mount - test verifying if setup.sh sees nvme devices when
            they are part of dm setup.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Id250b4081b3e04a7f5b26401d2ae1b226fdb2d8f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5311
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-03-29 07:24:14 +00:00
Michal Berger
d69b091262 test/setup: Check if correct driver is in use
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I9023a311442c01ef18d05903bed2eb1513f58a0f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5310
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-29 07:24:14 +00:00
Michal Berger
d60bc77142 test/setup: Add tests for hugepages allocation
These tests are meant to "predict" the right number of hugepages
given setup.sh instance will set, depending on its environment
options (HUGENODE, HUGEMEM, etc.).

Change-Id: Iaf441e69d25dd59941891e1d5c3c2b0dbd77644d
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5309
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-03-29 07:24:14 +00:00
Michal Berger
ec94874c1e test/setup: Add initital tests for setup.sh
This is first commit from the series introducing funcrional tests
for setup.sh. Issues like #1689, #1691 showed that major changes
to setup.sh may result in quite unexpected behavior. thus to avoid
any regression, we should make sure  the core of its functionality
is properly tested.

For now, only Linux systems are supported tests-wise.

The tests are explicitly run after all OCSSD are put into PCI_BLOCKED
to make sure they won't be picked up by the tests.

Change-Id: Iac036e693bdbaac476faea3d2128cf4d95434cb2
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5308
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-29 07:24:14 +00:00
Karol Latecki
cd94246487 test/common: remove sed commands in vm_setup.sh
Some time ago Qemu submodules links were changed to
use https:// instead of git:// so there's no need
to sed this.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: If4b16e7b887af5028d208498da8d81c2fa2101d5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6847
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
2021-03-29 07:20:50 +00:00
Karol Latecki
253c1785e5 test/common: install vfio-user-pci capable Qemu fork
Fork needed to run Vhost tests using vfio-user.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: Iedfa85083e51c08592c9f512c6650415b49deda8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6846
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
2021-03-29 07:20:50 +00:00
Karol Latecki
5c3852713c test/vhost: add vfio-user option
Add option to connect Qemu VMs to vfio-user sockets.
This needs additional option to vhost_run to run nvmf_tgt
instead of vhost binary (currently the only way to create
vfio-user sockets) and an additional function to find
connected devices in the VMs.

Change-Id: Iaae234a11f4431a307e1da9c9a2eee123290f5a3
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6700
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-29 07:20:50 +00:00
Karol Latecki
9f5f5da819 test/vhost: use getopts in vhost_run function
Use getopts instead of using positional args. This
will be needed in future commits when more optional
parameters will be added.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: If575fd871f906de5f9d89b2f3972fa54e3208147
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6682
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-29 07:20:50 +00:00
wanghailiangx
b33da506b5 lib/iscsi: add a comment for iscsi_parse_params()
When param len > 0, param data must not be NULL.
So we add a comment to make it clearer.

Change-Id: I053c3e45ddb8fa23fb67ce899d32dadd8e286946
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6618
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-26 21:06:15 +00:00
Karol Latecki
f88416a1de scripts/ceph: load loop module explicitly
Older losetup versions loaded "loop" in background, but
with 2.36.1 this doesn't happen. We know we're going to
use this module so let's load it ourselves.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: If3364e92817ae9f09e9897872bd61ca9167184a1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7086
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-26 18:46:13 +00:00
Ziye Yang
a620cd198f nvme/tcp: Fix the zero copy enablement issue.
Remove the polling group check. Because at this moment,
the qpair is not added into a polling group. If we do
not remove it, we will never enable zcopy feature for
I/O qpair.

And in sock implementmentation, we already fixed the zero copy
handling if a socket is not in a polling group. See
posix_sock_flush function. So we can fix this issue if we directly
remove this check.

Reported by: Aleksey Marchuk <alexeymar@mellanox.com>
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I969936c4b6c7f13cbfa4d6eb479010c53f3e384a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7056
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-03-26 08:22:53 +00:00
paul luse
48c057814b test/idxd: fix allocation issue with unit test
Fixes issue #1847

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I34109935b5e8187192239fa34ff43946d0e7632f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7016
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-03-26 08:22:41 +00:00
paul luse
26fdb2d8b3 lib/idxd: remove unsed config elements and add a config print
Add print to confirm how groups/queues/engines are being
programmed based on the init RPC used.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ic9462c19c6899478a803433f90d9db9249dd5ca1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6325
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-26 08:22:33 +00:00
root
de8f3a50ee mk: Fix debug build error on ARM ThunderX2 and neoverse N1 platform
When building spdk on ARM platform like thunderx2 with --enable-debug,
there are following error:

/tmp/ccOBb4AF.s: Assembler messages:
/tmp/ccOBb4AF.s:45: Error: selected processor does not support `casp x0,x1,x2,x3,[x4]'
/tmp/ccOBb4AF.s:77: Error: selected processor does not support `caspa x0,x1,x2,x3,[x4]'
/tmp/ccOBb4AF.s:109: Error: selected processor does not support `caspl x0,x1,x2,x3,[x4]'
/tmp/ccOBb4AF.s:141: Error: selected processor does not support `caspal x0,x1,x2,x3,[x4]'

The reason is that DPDK is built with -march=armv8.1-a or -march=armv8.2-a+lse which
have these instructions while SPDK is built with -march=armv8-a+crc which does not support
them. Change spdk build machine to native can fix this.

Signed-off-by: Rui Chang <rui.chang@arm.com>
Change-Id: I759d4ce2c557ce5ff73a802d7a4b6579c4ba64f7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7025
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@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-25 08:29:09 +00:00
ChengqiangMeng
844d94b8a7 unittest/nvme_rdma: increase code coverage for nvme_rdma_req
nvme_rdma_req put/get/init code comprehensive coverage.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: I5ee5ec43410a8eef7a82f8ee304fd28393a46618
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6925
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-24 12:00:23 +00:00
Maciej Szwed
aaac48880d env: Register external memory with DPDK
DPDK has added APIs for registering externally allocated
memory regions. Use them instead of doing our own thing.

We have to postpone spdk_mem_unregister call in
memory_hotplug_cb() because SPDK mutex (g_spdk_mem_map_mutex)
and DPDK mutex (memory_hotplug_lock) may overlap
and cause deadlock when one thread is calling spdk_free()
(locks memory_hotplug_lock first and then tries to lock
g_spdk_mem_map_mutex) and another one is calling
vhost_session_mem_unregister() (locks g_spdk_mem_map_mutex
first and then tries to lock memory_hotplug_lock).


Change-Id: I547b4ffc3987ef088a1b659addba1456ad760a71
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3560
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>
2021-03-24 11:59:59 +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
Michal Berger
0968ee2fcf scripts/check_format: Run shfmt against all bash files
Currently, reference repos which are used to clone the SPDK repo in
the CI pool's systems don't provide master head refs, hence there's
no easy way to diff against it.

Instead, simply run shfmt against all the bash files in the repo.
Impact on the performance should be minimal.

Also, cleanup some related code which is not used anymore.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ie0d4e35b8ad214ceed1b4ea29b01a7423b8ff73b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6824
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-23 11:03:21 +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
Michal Berger
9239ed33f6 mk: Don't use mime-type to determine type of the lib file
Some versions of the file (e.g. 5.33) confuse the sharedlib files with
pie-executable ones when they already have the executable bit set.
Since this particular bit is already set on the .so.* when they are
built, file may report the type as "application/x-pie-executable"
instead. As a result, lib files won't have proper permissions set
when installed.

This is a bit problematic for building the RPMs since when
find-provides kicks in to determine the dependencies, said files
are not picked up at all - package ends up with empty "provides:"
data breaking the dependency lookup during installation of other
packages which may depend on the broken one.

To mitigate, don't use mime-type, simply run file against the lib
in default mode and look for "shared object" string - this should
work for most of the file versions available on the supported
distribution.

Spotted on Fedora31.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: If9974f5acbdad6eb1204b64f0ee1ac9b2e20f85b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6703
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-03-23 10:08:51 +00:00
Michal Berger
bfe83fd373 pkgdep: Add rpmdevtools package
Tools from this package are needed to handle the RPMs build.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I516341e0917998eae9c54d3194f1e091f4e5e9df
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6548
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-03-23 10:08:51 +00:00
Michal Berger
9433190fd0 scripts/vagrant: Move the proxy, tsocks and nfs setup to deploy_test_vm()
This is done in order to minimize vagrant work on the CI side. Users
may still provision given VM with full configuration includin these
pieces by running create_vbox.sh with -d argument.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I7f494958e06d4e3b047938dda0bd102da824d235
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6733
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-23 10:08:37 +00:00
Michal Berger
ca31f3c512 scripts/vagrant: Run vm_setup.sh directly from the synced repo
vagrant's shell provisioner uploads files to /tmp, however,
vm_setup.sh must be run from the repo to find all the source
files. This requires the repo by synced over to the VM as well.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Iaf16f066af10739589aa584f57c2b89f5c5202e7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6734
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-03-23 10:08:37 +00:00
Michal Berger
07596cf183 check_so_deps: Make sure number of processed .so files is updated
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ibb5a7fd6cce53a14ce4acd63085e066db32b059b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6840
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-23 10:08:37 +00:00
Michal Berger
432eb6c21d pkgdep/git: Update location of the irdma driver
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I1074c18998fc758baa2a27449d32e7a3f9538c67
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6896
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-23 10:05:00 +00:00
Ziye Yang
1e27c23d09 sock: set the default placement_id to -1
Purpose: The default value of placement_id in spdk_sock
should be set to -1 in spdk_sock_connect_ext. If we still let it to 0 and call
sock_get_placement_id for the spdk socket used in the initiator side,
we will never get the correct placement_id when enable_placement_id configuration
is configured, because we will always get placement_id = 0
instead. And the same comments in spdk_sock_accept function.

And this patch also change the judgement of placement_id in other related places.

PS: Why we need to explictly set default placement_id = -1, because when use
"enable_placement_id=2" for the socket, placment_id=0 is a valid value.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I9fcc3a1c6a5007c22d11da5aeed0022577652a76
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6955
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-03-23 10:04:36 +00:00
Alexey Marchuk
f209637c9d nvmf/rpc: Don't stop listener if it was failed to remove
nvmf_subsystem_remove_listener RPC handler may fail to remove
the listener (e.g. it doesn't exist) but in eror case we
spdk_nvmf_transport_stop_listen_async and send an error
response. In a completion callback passed to
spdk_nvmf_transport_stop_listen_async we try to send a
response again but the response handler had already been
released and we dereference a NULL pointer.

The fix is to skip spdk_nvmf_transport_stop_listen_async
in error case and continue with the subsystem resuming.

Fixes github issue #1821

Change-Id: I8d96b943cca25d9f95d19e8ea600242f019e6b21
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6699
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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-23 10:03:38 +00:00
Pawel Piatek
191e6ab8d2 test/nvmf: fix non-root mode
- pass LD_LIBRARY_PATH
- use $SUDO_USER instead $USER
- support --huge-dir param via $SPDK_HUGE_DIR environment variable

Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: Ib42fe8a10b2c5b7d8a888605da04fee98a600515
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6171
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: Ben Walker <benjamin.walker@intel.com>
2021-03-23 10:03:11 +00:00
Liu Xiaodong
b8db1af4e2 thread: criticalmsg also indicates valid event
Change-Id: I32296be76dfdde725249f43a96f5031c9c2613ae
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6721
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-22 09:50:27 +00:00
Liu Xiaodong
1bd39bb5ee thread: remove stat update in intr msg process
Updating thread stat directly in spdk_thread_poll()
will cover the time spend in msg process in interrupt
mode.

Change-Id: I9b71790281f10fb784ef4fd4059c41438bbaabac
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6722
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
2021-03-22 09:50:27 +00:00
Liu Xiaodong
3690dbbd2e thread: remove redundant set_thread in intr
thread_interrupt_msg_process is registered to thread's
fd_group, so it will be called inside spdk_thread_poll.
Since spdk_thread_poll will set/restore tls_thread,
there is no need to set or restore it again here.

Change-Id: Ida10c736ef904ff975eeb42fd0cccad9fd8317cf
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6720
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-22 09:50:27 +00:00
Liu Xiaodong
ba7aac83ed reactor: get_rusage directly in reactor_run
Move get_rusage directly into reactor_run(), then both
poll mode and interrupt mode can check rusage info.

Change-Id: Id5926752cfb19c13cb969fbfbb35f643e5d49d9a
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6718
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
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>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
2021-03-22 09:50:27 +00:00
Liu Xiaodong
ee4a83360f reactor: update tsc records in intr mode
In interrupt mode, reactor spends its valid cpu cycles
to process registered thread interrupt function. So we
can count idle_tsc and busy_tsc in it, and update
reactor's last_tsc in it.

Change-Id: I65f4ae7d3b1e5c7c5c06937d6855f5d1b5c0349f
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6716
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
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>
2021-03-22 09:50:27 +00:00
Mao Jiang
4825fce4bf test/nvme_pcie: cases for building qpair metadata
Change-Id: Ibab880df6f182439236c91e600d5bc6fc37f34d3
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6836
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
2021-03-22 09:46:56 +00:00
Mao Jiang
550a0b95f4 test/nvme_pcie_common: build nvme_pcie_common unittest file
Change-Id: I321e558ff23e1942cbf17f8cd6d3ce04eb6e58d0
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6763
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:46:48 +00:00
Nick Connolly
1b9414f8b9 ut/nvme_io_msg: Add missing mutex init
Add missing mutex init for ctrlr external_io_msgs_lock.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Id87838878b57939a949f0b8cb2dc7ff160c7a826
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6887
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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-22 09:46:26 +00:00
Mao Jiang
5ccd31aedc test/nvme_transport: cases for adding and removing poll group
Change-Id: Idd311e3e49255f4571151fb760aa06b1f5db979a
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6953
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-22 09:46:18 +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
Shuhei Matsumoto
71c0065567 ut/bdev_nvme: Add test case for SPDK shutdown
When there still exists any NVMe bdev, if the bdev subsystem starts
shutdown, spdk_bdev_unregister() is called first. To avoid regression
for this scenario, add a test case.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5f484bda2ee2f3eaca364968a79ec7bf50267980
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6936
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-22 09:45:53 +00:00
wanghailiangx
05d1130d3a test/nvme_rdma_ut: add a semicolon for DEFINE_STUB
Although this is not a mistake, it's better to add a semicolon to
be consistent with other DEFINE_STUB.

Change-Id: I5953b4612659d4115cb7735b1617eb8c13400798
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6653
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: <dongx.yi@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-19 08:30:30 +00:00
Alexey Marchuk
95fc1ac759 nvmf: Rework qpair disconnect when subsystem is removed
When we iterate qpairs that belong to a subsystem
and try to disconnect them, there is a chance that
some qpair can be disconnected on transport level,
e.g. the initiator may receive a disconnect for
the first qpair and disconnect others. That may lead
to a dead loop when we call spdk_nvmf_qpair_disconnect
with a callback, the callback is called immediatelly
and tries to disconnect the qpair again.

To solve this problem, move part of nvmf_poll_group_remove_subsystem
function to another function nvmf_poll_group_remove_subsystem_msg
which disconnects all qpair at once without any callback
and calls itself via thread_send_msg untill all qpairs are
disconnected.

Fixes github issue #1780

Change-Id: I1000cda73e6164917fc13f7f374366af90571b99
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6597
Community-CI: Broadcom CI
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-03-19 08:24:20 +00:00
Niklas Cassel
a5b784fb2a bdev/zone: add offline as a new zone action
bdev_zone.h already has support for offline in enum spdk_bdev_zone_state.

Therefore, a user can call spdk_bdev_get_zone_info() and see that a
zone is in state offline, but the user has no way of putting a zone
in that state.

Add SPDK_BDEV_ZONE_OFFLINE to enum spdk_bdev_zone_action, so that a
user can call spdk_bdev_zone_management() to put a zone in zone
state offline.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I733a815949d7db0fdce293ba0d762e75a545ba76
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6909
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>
2021-03-19 08:23:09 +00:00
Niklas Cassel
ee4868de68 bdev/zone: add support for max active zones
The NVMe Zoned Namespace Command Set Specification has, in addition to a
Max Open Resources limit, a Max Active Resources limit.

An active resource is defined as zone being in zone state implicit open,
explicit open, or closed.

Create a function spdk_bdev_get_max_active_zones() in the generic SPDK
zone layer, so that this limit can be exposed to the user.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I6f61fc45e1dc38689dc54d5649c35fa9b91dbdfc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6908
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>
2021-03-19 08:23:09 +00:00
Niklas Cassel
82d797af1a bdev/zone: add zone state explicit open
Add a new zone state to represent an explicit open zone.

Many zoned specifications like ZBC/ZAC/ZNS have two different
zone states to represent an open zone: explicit open and
implicit open.

In e.g. ZNS, a zone is transitioned to explicit open when a
Zone Management Send is sent with a zone send action of open zone.

In ZNS, writing to e.g. an empty or closed zone, without first
sending a zone send action of open zone, will instead transition
the zone to implicit open.

The OCSSD specification only has a single open zone state.
In OCSSD, you can only transition to the open state by doing a write.
There is no separate function call to transition a zone to the open
state. Therefore, the OCSSD open state is most similar to the ZNS
implicit open state.

Since we cannot remove the SPDK_BDEV_ZONE_STATE_OPEN identifier,
for backwards compatibility reasons, make the SPDK_BDEV_ZONE_STATE_OPEN
identifier an alias to the new SPDK_BDEV_ZONE_STATE_IMP_OPEN identifier.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I98f3a280cd9e595100155568a3c0332c667a834b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6907
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>
2021-03-19 08:23:09 +00:00
Niklas Cassel
409cc6ecbc bdev/zone: assign values to enum spdk_bdev_zone_state
Assign values to enum spdk_bdev_zone_state.
This change will simplify a follow-up patch that will add new
identifiers.

If the first enumerator has no =, the value of its enumeration constant
is 0.

No functional change intended.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I1dc1cbcf262a8c6384a7133042f864074e1b992c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6906
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>
2021-03-19 08:23:09 +00:00
Maciej Szulik
8dfa1067a4 nvmf: Allow transport specific statistics dumping into JSON
This change refactors the way nvmf_get_stats RPC works.
The RPC layer passes JSON write context to custom dump function defined within transport ops.
The RPC layer no longer needs to know the structure of transport poll group statictics.
Functions and structures used in the previous flow have been deprecated and will be removed.
JSON returned for RDMA transport should be the same as before this change.

Signed-off-by: Maciej Szulik <maciej.szulik@intel.com>
Change-Id: I03308c45be120793d316bf79814a1295afd9fb95
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6681
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: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-19 08:23:01 +00:00
Liu Xiaodong
e2d061fb98 reactor: update core mode from master core
Current update_core_mode is started from the next
core of the master core.
For futher's new scheduler, starting from master
core is required. This change won't impact current
schedulers' behavior.

Change-Id: Ibffd2c93a4288b5e87945ae523ccba88091c4031
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6757
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-18 14:49:41 +00:00
Michal Berger
b2ff542576 pkgdep/git: Apply pci_aer_centos patch
The latest QAT driver version which we support attempts to define
pci_cleanup_aer_uncorrect_error_status() whenever <= 5.7.0 kernels
are detected. However, in case of centos8, the latest 4.18 build of
the kernel which is available there includes patches which completely
removed use of this call.

To make sure this function is not built into the driver, apply the
patch on top of QAT which will remove this definition entirely. This
patch is meant to be applied only in case <= 5.7.0 kernel are picked
up and which are missing pci_cleanup_aer_uncorrect_error_status()
symbol definitions.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ieb09d5a1dc8936d6e266c6cadfdf9d70620a3bca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6620
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-18 14:43:22 +00:00
Michal Berger
a5fe2a6499 pkgdep/git: Update location of the ice driver
The package was moved, update the url accordingly.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Id26bc35330fe3155e33017e64fb92c98ecdc6d65
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6619
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-03-18 14:43:22 +00:00
Tomasz Zawadzki
fe8af2281b lib/nvmf: remove deprecated API
spdk_nvmf_subsystem_add_ns() was deprecated in SPDK 20.10.
spdk_nvmf_tgt_listen() was deprecated in SPDK 21.01.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I2e447a50713e71a70030d094e6cc0bf427635ef7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6631
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: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-18 14:43:08 +00:00
Tomasz Zawadzki
144eac1362 lib/fc: move to spdk_nvmf_tgt_listen_ext()
spdk_nvmf_tgt_listen() is deprecated, so moved
the remaining instance to spdk_nvmf_tgt_listen_ext().

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I32b54e99f83fa10f1074f80aad82bb0608c9ae11
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6630
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: Anil Veerabhadrappa <anil.veerabhadrappa@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-18 14:43:08 +00:00
Tomasz Zawadzki
38d13d06a8 lib/opal: remove deprecated spdk_opal_supported()
This API has been deprecated since SPDK 20.07,
see commit (b2947f52).

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Idb45906c81ea5682c6a67def0265910266d861b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6629
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
2021-03-18 14:43:08 +00:00
ChengqiangMeng
2770a5d7f8 spdk_top:fix a bug of disabled Columns.
Return the previous state of the column when we press Q or ESC.

Fixes issue #1829

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: If049c0dcebfa3d71ac9c5266541083108df1d883
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6893
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
2021-03-18 14:42:48 +00:00
Ziye Yang
f1f4f7d3bc nvme/tcp: Use the async manner to send pdu when crc32c enabled.
This patch refactor the pdu sending logic with the async manner,
then if the group contains the accel engine, we can use it.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I2d669c0a3255d7a8898441e406906add2f3a3556
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6759
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
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
Jim Harris
8f5e4bfe2e nvme: clarify required action when free_io_qpair fails
A very heinous error case is when a delete_io_sq or
delete_io_cq command fails when freeing a PCIe IO
qpair.  In that case we return an error to the caller,
and the resources are not freed.

Instead of trying to 'fix' this error case, let's
just tell the user that if freeing an IO qpair fails,
the user should reset the controller and try again.

Resetting the controller will do one of two things:

1) The subsequent create_cq/create_sq will succeed,
   at which point, trying to delete again should work
   fine.  (If it doesn't, it indicates some kind of
   horrendous SSD.)
2) The subsequent create_cq/create_sq will fail,
   at which point the entire ctrlr would fail and
   need to be detached. This could result in some
   leaked memory, but seems unavoidable.

Closes issue #716.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I218564080abec4d6b5ac0b861869ebfc7d99f2c3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6918
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>
2021-03-18 14:41:44 +00:00
Jim Harris
6156777bd4 nvme: assert if user tries to delete NULL tcp qpair
It is invalid to try to delete a NULL qpair, so do
not check for it in nvme_tcp_ctrlr_delete_io_qpair and
return an error when NULL.  Just change it to an
assert instead.  This makes it consistent with pcie
and rdma.

While here, add an assert in rdma as well.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ic2f76deecb21b78749dac85e33fb1fa0d14a1239
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6917
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: <dongx.yi@intel.com>
2021-03-18 14:41:44 +00:00
Shuhei Matsumoto
56d9683585 ut/bdev_nvme: Add test case for bdev_nvme_get_ctrlr()
There was no unit test for bdev_nvme_get_ctrlr().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ia69f0afdba2d3fb31bc38526834edcfc56a69c71
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6921
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: <dongx.yi@intel.com>
2021-03-18 14:41:13 +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
Shuhei Matsumoto
05f8643e15 bdev: Correct the bdev_io status to ABORTED when aborted in NVMe bdev module
spdk_bdev_io_complete_nvme_status() had set the bdev_io status to
NVME_ERROR even if it is aborted, i.e, sc is ABORTED_BY_REQUEST.

Fix it to ABORTED, and verify the fix by unit tests.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6b22547105a6d7986747053f93875854336959b3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6884
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-18 14:41:13 +00:00
Shuhei Matsumoto
8c6c7efe4a ut/bdev_nvme: Add test case for abort request
Add test cases for abort request. Both success and failures cases
and both NVMe and admin request cases are added.

The next patch will fix a bug that the status of the bdev_io which
was aborted was set to SPDK_BDEV_IO_STATUS_NVME_ERROR. The status
should have been SPDK_BDEV_IO_STATUS_ABORTED.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I4fa885b874507e1a4cf9d70f45e37c4aaef2134a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6883
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: <dongx.yi@intel.com>
2021-03-18 14:41:13 +00:00
Shuhei Matsumoto
5eb53691c3 ut/bdev_nvme: Add test casde for admin command passthrough
Add test case for admin command passthrough to test redirection
of completion processing.

Change the type of opc to uint16_t to cover admin commands.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Id01cb924e7778878dcfaf8766b05af1ae52623eb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6882
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: <dongx.yi@intel.com>
Community-CI: Mellanox Build Bot
2021-03-18 14:41:13 +00:00
sunshihao520
45b6720bef nvme : Add OPTPERF definition to nvme_spec.h
When ns set OPTPERF to 1, use NPWG and NPWA to set sectors_per_stripe.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Change-Id: Iaf72ba5a7f21b33c357fba8deced9616e0bfaca6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6613
Reviewed-by: Ben Walker <benjamin.walker@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-03-18 14:40:27 +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
Dantali0n
1b837766f0 docs: Improve documentation around linkage requirements
The documentation around static linking in doc/libraries.md is improved.
This is achieved using examples and explaning the requirements that arise
from the use of constructor functions. Additionally, the documentation
around the same subject is improved in doc/pkgconfig.md

Signed-off-by: Dantali0n <info@dantalion.nl>
Change-Id: I3b11db441d14d2e8d792a22de2bd17fe5c2389fd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6798
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-18 14:37:46 +00:00
Michal Berger
360fd2cc5a pkgdep/rhel: Fix typo in alternatives path
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I6d3b7c6855899e3a9d355368c41e4d585db7f382
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6767
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-18 14:36:44 +00:00
Rafal Stefanowski
ba2fed77b4 doc/jsonrpc: Add missing info about OCF cache modes
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
Change-Id: I7654bffdcbbe85dd17918575c8676a811ef77669
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6432
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:34:10 +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
Michal Berger
631cea63d0 test/scheduler: Print minimum supported frequency by given cpu
This is done in order to easier troubleshoot issues like #1784.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Icabccab92dd48aa85a505d34013181e66c89fa1a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6800
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-18 13:25:09 +00:00
Michal Berger
f58afe93b8 test/common: Don't enable werror on FreeBSD
Facing similar issue as with 9ab2855d - can't build SPDK against fio
3.19.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I4ea22e4f068a19d8d87be836454ec8deeeb2d48a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6805
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-18 13:24:50 +00:00
Pawel Piatek
1726cdfcf5 test/check_so_deps: avoid second read of config file
Proper configuration file was already read in line 20,
where it's path is passed as required first argument.

Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: I0523bd6d5ad764c13d900c4bd788a5695095c11e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6830
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 13:23:59 +00:00
Monica Kenguva
72d94ca821 rpc: Document env_dpdk_get_mem_stats
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: If66d05c14e5758f1b27000d33b4098d73c7a51b3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6851
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-18 13:23:03 +00:00
Klaus Jensen
465dbb040c test/nvme: fix e2edp tests when md_size > 8 bytes
The e2edp test `dp_with_pract_test` includes code to modify the data
length if the size of metadata is 8 bytes, but fails to set
req->use_extended_lba if we actually need to pass an extended LBA
(md_size > 8).

Similarly, the `dp_guard_check_extended_lba_test` miscalculates the CRC
when md_size is > 8. The CRC must be calculated over both data AND the
first md_size - 8 bytes of metadata.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Change-Id: I5252c1fe02908745d6aa68799859ed85f32e87ec
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6891
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>
2021-03-18 13:20:41 +00:00
Niklas Cassel
38fa9d82c8 nvme/identify: print the command set identifier per namespace
For each active namespace, print the command set identifier.
This will work on namespaces that do not support or report a namespace
type, as spdk_nvme_ns_get_csi() will return SPDK_NVME_CSI_NVM for such
cases.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I05fa7fd6bb3d9ea32dac236c98baef90347094ca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6905
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-18 13:19:16 +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
yidong0635
fd35993219 vfio_user_pci: put close(device->fd) in cleanup.
These three goto cases are using device->fd,
so put them in cleanup, it has no impact on
vfio_user_dev_setup failed.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I28028dda2977cf8158e703afa5b8af38c48f3d85
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6922
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>
2021-03-18 13:17:35 +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
Niklas Cassel
e7f161a7d6 bdev/hello_world: remove bdev_module.h include
bdev_module.h should only be included when implementing a bdev module.

hello_bdev.c is not a bdev module implementation and therefore should
not include the bdev_module.h header.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I6a8b9989b21311ae8526b13d7a58603b68a433cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6904
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>
2021-03-17 08:15:46 +00:00
Jin Yu
af2bf0ebfb env: fix a samll issue for doxygen
The space should not be there. The doxygen
will not generate proper docs with it.

Change-Id: Id7e6fb2228abf1717e7e4097a9454c7820884655
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6881
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: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-17 08:15:28 +00:00
Mao Jiang
cb6b0658b8 test/nvme_rdma: cases for constructing ctrlr
Make stub for external APIs, cases for getting lkey
and constructing ctrlr.

Change-Id: I1b453139e98b297616d839de66690947c6f19738
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6529
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-17 08:15:16 +00:00
Michal Berger
70c7114958 test/vhost: Fix SPDK cpumask for distribute_cores
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I474b6c9ac755626958bc51f491f0ce2dc63a0475
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6731
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-15 09:29:47 +00:00
Nick Connolly
a4e1d715f7 mk: support file extension for executables
Some platforms require that a specific file extension is used for
executables. Append $(EXEEXT) to $(APP) definitions to accommodate
this. The name EXEEXT has been chosen for consistency with automake
which uses the same variable for the same purpose.

Add extensions for generated files used by Windows to the 'clean' target
(.obj, .lib, .pdb) and add output files to .gitignore.

Tested using a cross compiler that forces a .exe suffix and verifying
that all LINK messages include the correct suffix and that a second
call to make does nothing (showing that the targets match the
generated executables).

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Ief012f6294d2f94b23c8b4f9747e21a0dfb91e96
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6494
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-03-15 09:29:10 +00:00
Nick Connolly
9854c138f7 mk: add support for mingw builds
MinGW builds require a thin layer above the standard libraries to
provide POSIX functionality that is missing on Windows. Add support
for building this.

MinGW cross builds are experimental and work is ongoing to integrate
them into the CI and test environment. Including the changes at this
stage is being done to facilitate that process.

The layer has been arranged in the same way as DPDK and is
accessed as an external build using ./configure --with-wpdk=<dir>.
Support has also been added for using a default ./wpdk in
preparation for reaching the required level of stability.

The help text for ./configure indicates that support for --with-wpdk
is experimental.

Further details and instructions can be found at https://wpdk.github.io.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Iff0f705789f19fb193dcb3c9090c3e90613a8d9a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6589
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>
2021-03-15 08:55:11 +00:00
Monica Kenguva
7e42c6d826 rpc: Document ocssd create and delete bdev
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: Ic1b73fbfe3c2cb6b0434422c190e16e9d40ec21b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6850
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-15 08:54:51 +00:00
Maciej Szwed
fa67893428 rocksdb: Switch default RocksDB branch to latest (6.15.fb)
!Do not merge this patch before RocksDB patches are merged:

https: //review.spdk.io/gerrit/c/spdk/rocksdb/+/6485
https: //review.spdk.io/gerrit/c/spdk/rocksdb/+/6486

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ie13ff102ddf627026013dcb8b41cb3ee205eaaeb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6761
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-03-15 08:53:39 +00:00
Ben Walker
f046750c32 event: Add return code to spdk_rpc_initialize
This is an internal API used in several places. The call can fail, so
make sure it can report that correctly.

Change-Id: Iac0ed2c8299c9dd3d2556070278a2224c3807b7b
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6640
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-12 08:38:10 +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
ChengqiangMeng
df2b5b8983 unittest/nvme_tcp: increase code coverage for nvme_tcp_qpair_send_h2c_term_req
nvme_tcp_qpair_send_h2c_term_req code comprehensive coverage.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: Ic562bf2b6f895667143f98bb504a7abef8cfda23
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6791
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-12 08:35:21 +00:00
Mao Jiang
11f119e25d test/nvme_cuse: build nvme_cuse unittest file
Include cuse_nvme_submit_io_read/write cases.

Change-Id: Id55ec798167a36a7fb6e1d9ddb032299d476962e
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6651
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-12 08:31:11 +00:00
Monica Kenguva
5678c2f472 rpc: Document bdev_nvme_apply_firmware
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: Ie022f1a6f03e58514283e37b9428670d28f68bbf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6634
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-12 08:30:34 +00:00
Mao Jiang
35a33d8c69 test/nvme_transport: cases for nvme_transport polling group
Change-Id: I2cc0ea6207de37815e88dd6aad00e43e6596b64d
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6730
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: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-12 08:30:21 +00:00
ChengqiangMeng
001afcbdb7 unittest/nvme_ns: increase code coverage for nvme_ns's several func
include test_nvme_ns_set_identify_data,
test_spdk_nvme_ns_get_values(Most functions that simply get values),
test_spdk_nvme_ns_is_active,
and spdk_nvme_ns_supports(Judge whether extended_lba and compare are supported).
The above func is completed.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: I916173a195692045ee0ee3fa408a1696e0eb5b1e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6511
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Mellanox Build Bot
2021-03-12 08:21:23 +00:00
Liu Xiaodong
22412af1d2 nbd: get nbd_stop procedure in async
It is possible that nbd pthread is created but not executed,
then spdk_nbd_stop is call before nbd_pthread's execution,
but nbd pthread starts to execute while nbd is totally stopped.

This patch can get spdk_stop_nbd aligned with nbd pthread.

Change-Id: I57cc92b94d36cd706616c9058134f716f0812892
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6278
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-03-12 08:21:00 +00:00
Liu Xiaodong
4c6c794be3 nbd: use retry_poller and retry_count
This is better naming to represent their usage.
retry_poller and count can also be used to do
async nbd_stop procedure in the following patch.

Change-Id: Ie5a74e4add3f1a6c7257df00aded8b5d52a09955
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6277
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-03-12 08:21:00 +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
Shuhei Matsumoto
620e0ea043 ut/bdev_nvme: Add test cases for bdev_nvme_remove_trid()
The following patches will refactor bdev_nvme_remove_trid() and merge
it into bdev_nvme_delete(). Add test cases for bdev_nvme_remove_trid()
to avoid degradation by the following patches.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I42da17c62843ead9a30ab9a06463df4b679e561d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6686
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-03-12 08:20:46 +00:00
Tomasz Zawadzki
13f868977e module/bdev: remove deprecated API
spdk_vbdev_register() was deprecated in SPDK 19.04.
config_text field in spdk_bdev_module was deprecated in SPDK 20.10.
spdk_bdev_part_base_construct() was deprecated in SPDK 20.10.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib795ccdf61154c168032ccf8b81ea77e5e663851
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6628
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
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
Tomasz Zawadzki
a6b1e2c57d lib/bdev: remove deprecated spdk_bdev_open()
spdk_bdev_open() was deprecated in SPDK 19.10.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I12f51a237ddc43219d35b5c647dc60d10461d429
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6626
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: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:54:53 +00:00
Alexey Marchuk
47afb9280f nvme/rdma: Use RDMA provider API to post recv WRs
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I47cc1a21af1104f681519e542edaf66e363bb214
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6296
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-03-09 08:54:12 +00:00
Alexey Marchuk
3caf2e710f nvmf/rdma: Add new statistic to count idle polls
This statistic is incremented when we don't reap
anything from the CQ. Together with the total number
of polls it can be useful to estimate idle percentage.

Change-Id: I61b51d049b0bc506fb8a896e225187e46e75a564
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6295
Community-CI: Broadcom CI
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-03-09 08:54:12 +00:00
Alexey Marchuk
36ac75b94c nvmf/rdma: Use new RDMA statistics
Change-Id: I11c7793301be9dbe9d4c92e482a97fc6146cc355
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6294
Community-CI: Broadcom CI
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-03-09 08:54:12 +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
Jim Harris
9713bfe90d rpc.py: print better message if cannot connect
We need to catch the JSONRPCException when we cannot
connect, so that the error message can be printed
more cleanly. Also suggest to the user that maybe
they don't have an SPDK application running when
it cannot connect.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I497bed86573d5bf07a2b48b3d6682a2427aa4987
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6754
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: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-09 08:53:36 +00:00
Jim Harris
38736d993d nvme: zero shadow doorbell registers when freeing qpair
The shadow registers need to be zero when the qpair is
created.  This happens automatically when a given qid
is used for the first time, since the page is allocated
with zmalloc. But if a qid is reused, we need to make
sure its shadow registers are cleared *before* we create
the qpair again with the same qid.

So clear the registers in nvme_pcie_ctrlr_delete_io_qpair,
just after the cq is deleted.

Fixes issue #1795.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I08c30d1ea248559a01b802cd132dd57199b491b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6752
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-09 08:53:36 +00:00
ChengqiangMeng
34429830bd unittest/nvmf_rdma: increase code coverage for nvme_rdma_qpair_process_cm_event
nvme_rdma_qpair_process_cm_event code comprehensive coverage.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: I15a8aef83a8919124eee89111a0134fee8853fcf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6689
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
2021-03-09 08:53:27 +00:00
Jim Harris
22e5037e0c scsi: relax spdk_scsi_task_gather_data assert
If the iov_len is 0, it is OK for the iov_base to be
NULL.

Reported-by: Yi Ren <yunye.ry@alibaba-inc.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I45c9be68fc2975bf2abd91a9d77935ce516c5210
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6706
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-03-09 08:53:21 +00:00
Maciej Szwed
24014d63bd rocksdb: Change absolut SPDK path in RocksDB build to relative path
Because of recent changes in RocksDB Makefile we cannot
use absolute path during its build any more. Change it
to relative path.

RocksDB Makefile change:
80f71b5863 (diff-76ed074a9305c04054cdebb9e9aad2d818052b07091de1f20cad0bbac34ffb52R463)

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I3a4fd010b2d9d8eb0dd3b7bf159d582aa5032669
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6735
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>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-03-09 08:50:27 +00:00
Konrad Sztyber
b665fd8672 test/external_code: out-of-tree NVMe driver tests
These tests compile the driver both as a shared object and statically
linking it to the identify application.  Additionally, in both
configurations, the app is used to list all available NVMe controllers,
as well as print information about each one indivdually.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I127caf08acad11241bf685b392617ab4b810226b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6680
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-03-09 08:28:22 +00:00
Konrad Sztyber
ae53ab2ddd test/external_code: renamed test case titles
Replaced the "_tc[0-9]+" suffix with a more descriptive title describing
the test case being executed.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Id1c2f6dcf155d8ae99dc490983ab4bb1451bfefd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6764
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-03-09 08:28:22 +00:00
Konrad Sztyber
a115aeff36 test/external_code: bind to all PCI devices
Removed the PCI_ALLOWED="NONE" line from setup.sh calls to bind to all
available PCI devices.  It'll allow the out-of-tree NVMe driver tests
from the following patch to execute properly, as they require NVMe
devices to be attachable from SPDK.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I56e89a6b853f02343803bb6ec704ea3c0a8bd12f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6679
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
183ac8884d external_code/identify: print controller identify data
The application will now print some of the fields from the identify
controller data.

The code has been copied from `examples/nvme/identify`, but, for the
sake of simplicity, trimmed down to printing reduced number of fields.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I838c47deffb0b877344f3cad0e88b6aca19790ea
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6678
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
e4d271f302 external_code/nvme: send identify controller during init
Now that it's possible to both submit the identify controller command
and process its completion, the initialization flow has been updated to
issue that command and update controller's identify data (which can be
retrieved via nvme_ctrlr_get_data()).

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Iee0e85f431275a5e6f1767db1d807de7fba6cdcc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6677
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
71c69ddfc3 external_code/nvme: process completion queue
Added function that check the completion queue for completed commands,
executes their callbacks, and puts the associated requests back onto the
free request queue.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I0f04c0d173a7058d4d4f7e59e573ce48130ff024
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6676
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-03-09 08:28:22 +00:00
Konrad Sztyber
c4d01aa5b7 external_code/nvme: identify command submission
This patch adds code required for sending identify controller admin
command.  It means allocating an NVMe request, filling spdk_nvme_cmd
structure, and submitting the command by writing the command to the
submission queue and ringing the doorbell.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I69934213a350df03852860eeaeadc2a456c7673c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6675
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-03-09 08:28:22 +00:00
Konrad Sztyber
48a89ec7d3 external_code/nvme: introduced nvme_ctrlr_get_data()
This function allows the user to retrieve the controller's identify
data.  Currently, that buffer is zeroed, but it'll be populated by the
identify command.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I91a99feef25ecf94c43cf144c12ac3c541c76cd9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6674
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
5555513653 external_code/nvme: basic controller initialization flow
Added a simple controller enablement state machine based on the CC.EN
and CSTS.RDY bits.  The admin queue registers are also filled during
this process, so it's now possible to send admin requests.

To simplify the code, there are no timeouts for a controller to
transition from a specific state to the next one or for the whole
initialization process.  This means that if a controller gets stuck, the
code will hang indefinitely too.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I93f5a5931d7b24780da242e601dcdf2bec5f6552
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6673
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
a2d3ea8cb3 external_code/nvme: initial controller initialization definitions
After enumerating and attaching NVMe controllers, they're now
initialized at the end of nvme_probe()/nvme_connect().  For now, they're
immediately marked as initialized, but subsequent patches will replace
it with an actual initialization.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I22137bb10e871c7e79c28053c8ec98a835e11147
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6672
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
07dc433a2f external_code/nvme: queue pair initialization
This patch adds NVMe submission/completion queue pair definitions.
These definitions are required to keep track of outstanding NVMe
requests.  The admin queue pair is now instantiated with the minumum
number of entries (2).

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I2ced3ce7d210408d66cc17de1e66d86b1a1dbf79
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6671
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
210e0db7e0 external_code/nvme: retrieve page size and doorbell stride
These values are needed for managing a submission/completion queue pair,
which will be added in the subsequent patch.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I80ac0d607160f06a13014b7dea95ae8172290aee
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6670
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
7da17fb378 external_code/nvme: enable PCIe bus master and disable INTx irqs
It allows the controller to issue memory read/writes (the bus master
enable bit) and disables the ability to generate INTx interrupts which
won't be serviced.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I3b041f1ea7c2bc275b609afcc3d1e4f655aee4c5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6669
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
ad9ccbbf52 external_code/nvme: controller register access functions
Added getters/setters providing access to several of the NVMe
controller's registers.  Only the registers that are needed for the
initialization are implemented.

For now all of them are unused, so they're marked as external to avoid
the -Wunused-function warnings.  The subsequent patches will make use of
them and mark as static appropriately.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I7012583f74e87720f6915afca69474ad1bb1e377
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6668
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
c2ca187c1e external_code/nvme: map controller's registers
The controller's memory register space (located in the first BAR) is now
mapped.  The functions for accessing individual registers from this area
will be added in the following patch.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ie5f88079a46152ba8d68e534d5e4c0c2bef84ef3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6667
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
86b1b71f5f external_code/identify: use nvme_connect() if an address is provided
The identify app can now be used in two modes:
 - without any parameters it'll attach to all available NVMe controllers
   and print each one out,
 - with a single parameter specifying the BDF address of the controller
   it'll only attach and print out information about that controller.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I02c7a8a072f1db5fdfd428a5ab84163f26338a09
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6666
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
5802856ece external_code/nvme: direct NVMe device connect
Added interface, nvme_connect(), for connecting an NVMe device specified
by a BDF address.  Similarly to spdk_nvme_connect(), it returns a
pointer to an NVMe controller representing requested device.

Under the hood, it uses spdk_nvme_pci_device_attach() to attach the
PCI device.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I15c7cabae07539cb97aba810385d26f223abfd6d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6665
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
29342a9ed8 external_code/nvme: device attach/detach
The NVMe devices can now be enumerated, attached, and detached.  To
simplify the driver, the probing step has been omitted - all available
controllers are attached and need to be detached later.

The driver registers itself as a PCI driver via a call to
SPDK_PCI_DRIVER_REGISTER() and then uses spdk_pci_enumerate() to
enumerate available NVMe devices and attach them.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Id03e2f4365f4f7ca98178be70278d0c4b7b34b26
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6664
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: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +00:00
Konrad Sztyber
91b30e7aec test/external_code: initial definitions for basic NVMe driver
This patch introduces initial definitions for a stripped down version of
an out-of-tree NVMe driver.  It's purpose is to showcase SPDK's
interfaces for writing user-space drivers for various types of devices.
The choice of NVMe as the example is based on the fact that it can be
emulated by QEMU and the code can be borrowed from SPDK's regular NVMe
driver.

This driver will only provide the most basic functionalities (e.g.
device probing, controller initialization, only admin queue support,
etc.) and won't have support for any device quirks.  Therefore, it's
only intented to be used with emulated devices.

In addition, an application utilizing the driver to list all available
NVMe controllers and print their identify data will be added.  It'll
be a very basic, stripped down version of `examples/nvme/identify`.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I67c748aabf75a37ca72dfb74301a610f7c4ae2bc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6663
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: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-09 08:28:22 +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
Mao Jiang
2b2a297de1 test/nvme_io_msg: build nvme_io_msg uinttest file
Cases for IO message sending and processing.

Change-Id: Id9085c016d4379401f8e203006e11a268518d0e2
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6215
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>
2021-03-08 10:49:45 +00:00
Changpeng Liu
17c5843d5a nvmf/vfio-user: don't block DSM command in vfio-user
Previously we only process Read/Write/Flush IO commands, we should
not block the DSM command in vfio-user layer if the backend block
device can support it.

Change-Id: Ia6b90397adcc36015f331f011a5bdf3e3d6562d8
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6525
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-03-08 10:49:32 +00:00
Monica Kenguva
d5bcc16d09 rpc: Document bdev_set_qd_sampling_period
Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: Ic95eb98eeafe536fe3ac74f88229bbfdcf5daccb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6632
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-08 10:49:23 +00:00
Michal Berger
9801533f8a scripts/setup: Use uio_pci_generic if it's loaded/compiled in
Also, for consistency, use check_for_driver() while checking if
igb_uio is loaded too.

Change-Id: I00302b3cab169c77032fc0cef0ea384e9e5eb5be
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5303
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>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-08 10:49:11 +00:00
Michal Berger
fcc35c86cd scripts/setup: Attempt to load uio driver only when igb_uio is picked up
Change-Id: I5c4860c69ccfdae4532498aaea8886ed3905d899
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5302
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-08 10:49:11 +00:00
Maciej Wawryk
46f5120c56 test/vhost: fix cgroup path
new fedora33 is using cgroup-v2 and old path in script give us error Permission denied

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I238c1eae0e4708003726a721c445a0b62dc0cff7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6425
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-08 10:48:53 +00:00
Krzysztof Karas
6c0cebf1c9 spdk_top: update spdk_top docs for spdk.io
Updates spdk_top documentation page to explain and present new features.
Images are being deleted to make versioning easier.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I6c3c172ed54423afc3afa4566b71ed19f0bc2e3e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6095
Community-CI: Mellanox Build Bot
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-03-08 10:48:47 +00:00
Maciej Wawryk
02da8ebd2e test/openstack: retry git clone when failed
Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: If0c814b36c29aa301a6b77a3b5e74465cccfc0bf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6195
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-03-08 10:48:36 +00:00
Maciej Wawryk
c4dfdeefdb test/openstack: clone only recent revision
Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I81581ebe46f172f0fbbeb542dfb4b513326a3566
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6166
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Community-CI: Mellanox Build Bot
2021-03-08 10:48:36 +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
Tomasz Zawadzki
a38d241cd6 lib/event: remove deprecated fields from spdk_app_opts
max_delay_us was deprecated in SPDK 19.04.
config_file was deprecated in SPDK 20.10.
master_core/pci_blacklist/pci_whitelist were deprecated in SPDK 21.01.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ie8be4c347de58044a7c3d5b1329d96e47ce084b4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6594
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-05 08:33:45 +00:00
Tomasz Zawadzki
4fb0b89625 lib/env: remove deprecated fields from spdk_env_opts
The fields were deprecated in SPDK 21.01.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: If6b946024bf1ce4c106cdf493bcb5662a3b21b13
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6592
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-03-05 08:33:45 +00:00
Nick Connolly
292b8e0c3e ut/bdev_nvme: fix 'used uninitialised' warning
On some platforms, GCC identifies that opts.io_queue_requests is used
uninitialised in bdev_nvme_create_qpair due to the stub function
spdk_nvme_ctrlr_get_default_io_qpair_opts which would normally zero the
qpair opts. Whether the warning appears is likely to be determined by
how effectively the platform garbage collects unused code.

Replace the stub with a minimal implementation that zeros the qpair
opts to avoid the warning.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I2b8c2d657ae5401c3b35ca66938a966906cdc846
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6595
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.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-03-05 08:33:30 +00:00
Changpeng Liu
2f579469b6 nvme/tcp: pass correct parameter to nvme_tcp_qpair_send_h2c_term_req_complete
Previously the callback parameter for this function is NULL, this will
cause segment fault, so pass the correct parameter here.

Fix #1817

Change-Id: Ie768b7bf4a72862d16a44742ab3032803d0939a2
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6690
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Community-CI: Mellanox Build Bot
2021-03-05 08:33:18 +00:00
Jin Yu
17a286baff pci: fix rte dev remove handling
Can not remove device in the remove event
callback as we can not unregister the remove
callback. So use the alarm_set to fix this issue.

Fixes #1809

Change-Id: Ib86bc4eeecc0fe2bc51538e28684d015405e8835
Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6553
Reviewed-by: Vasuki Manikarnike <vasuki.manikarnike@hpe.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-03-05 08:33:11 +00:00
ChengqiangMeng
6de10dfc01 unittest/nvme_tcp: increase code coverage for nvme_tcp_parse_addr
nvme_tcp_parse_addr code comprehensive coverage.
res->ai_addrlen is returned by getaddrinfo(), and it is an IPV4 or IPV6 address, so its maximum length is not more than 46.
And sizeof(*sa) is always 128,so ai_addrlen cannot be greater than sizeof(*sa).

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: Id432a39c1461c484ea871e7e9d8d3ed7a8391200
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6512
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-03-05 08:33:02 +00:00
Krzysztof Karas
6a34348219 spdk_top: fix app crashing on tab selection with TAB key
Fixes spdk_top crashing problem upon selecting a row in one tab,
then switching with TAB key to a different tab with fewer rows
and calling pop-up details window with ENTER key.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I52c5729eca0ce0eaad88767ff3add471a780140a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6367
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-05 08:02:10 +00:00
Monica Kenguva
97ef870100 nvmf/rdma: add RPC parameter to specify CQ size with RDMA transport
nvmf_create_transport rpc parameter to configure the CQ size helps
if the user is aware of CQ size needed as iWARP doesn't support CQ resize.

Fixes issue #1747

Signed-off-by: Monica Kenguva <monica.kenguva@intel.com>
Change-Id: Ia9ba2b5f612993be27ebfa3455fb4fefd80ae738
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6495
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-04 08:14:57 +00:00
Michal Berger
7ecf76e02e scripts/vagrant: Drop vagrant-cachier
There's almost no benefit coming from it CI-wise since all our VMs are
already fully provisioned. The speed up of nightly jobs, which do run
package updates, is minimal. Overall, it only slowers deployment of the
autotest VMs.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I68d9530533f0b0d7d2fb72ce82706d6bc0cf2e6e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6637
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-04 08:12:54 +00:00
Michal Berger
344cc21e69 scripts/vagrant: Drop support for FreeBSD 11.x
These releases reached their EOL already.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ic30b343b63620a2fb80870a6c192c4931936421e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6636
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-04 08:12:54 +00:00
Michal Berger
b5212f04e7 scripts/vagrant: Drop support for Clearlinux
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Idc0ca75b48cd680bacdd455206b88df6b99d0bff
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6635
Community-CI: Mellanox Build Bot
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-03-04 08:12:54 +00:00
Michal Berger
ee191fa807 test/vhost: Don't fetch .qcow2 image needed for tests
Simply fail. It's expected to have this image already installed on
the system.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ie7bbde84fe633c8b5a4d41bd6dcbee66d6f4a0c5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6375
Community-CI: Mellanox Build Bot
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-03-04 08:09:43 +00:00
Michal Berger
3e4b33ab9f test/vhost: Drop nested-lvol from the tests
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I815cdd18281b7c63aadd287cdd277bb9eb8d9489
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6596
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-04 08:09:43 +00:00
Michal Berger
e0335bb121 test/vhost: Drop support for multiple nvme controllers
This test path is currently not being run through CI, hence no need
to support it.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I9a7cc7005c4e20f25724d2a0a417656deb09abb1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6543
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-04 08:09:43 +00:00
Michal Berger
3369ef457f test/vhost: Remove tests dependent on centos image
Said image is not used by the CI at all, drop support for it.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I3493e8c5f808e56cfb0304a04cfa90ab3700018c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6542
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-03-04 08:09:43 +00:00
Shuhei Matsumoto
5261f638cb lib/iscsi: Call iscsi_reject() in return statements in iscsi_pdu_hdr_op_data()
iSCSI library had used goto label to consolidate iscsi_reject()
calls but calling iscsi_reject() in return statements will be simpler
and easier to read. This patch series focuses on Data-OUT PDU processing,
and so change goto label to function call in return statements for
Data-OUT PDU first.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5f30aff764820aab87233ea8cf22263611591a96
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6533
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-03-03 08:17:33 +00:00
Nick Connolly
b8d548911b app: exclude spdk_top from mingw cross builds
Temporarily exclude spdk_top from mingw cross builds until curses
support is resolved.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I1db9a9d592de06e45e1ec496369c629d66f0a50c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6580
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-03 08:16:54 +00:00
Nick Connolly
2a8065b554 mk: add mocking for mingw cross builds
On Windows there has to be a thin layer above the system calls to
provide POSIX functionality. When wrapping system calls, the name needs
to be prefixed with wpdk_ to ensure that the layer is called.

Re-arrange the definitions to facilitate wrapping and prefix with wpdk_
for mingw. For other compilers targeting Windows, the --wrap flag is not
supported and the layer above the system calls implements an alternative
mechanism to enable the mocking.

Tested with $(info LDFLAGS) added to spdk.mock.unittest.mk combined with
visual inspection and running the unit tests.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: If00504740229362c40bee4ae171d35489afb2e77
Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6577
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>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-03 08:16:54 +00:00
Nick Connolly
3399171388 mk: workaround for mingw stack-protector bug
Add -mstack-protector-guard=global to work around GCC bug 86832,
where -fstack-protector will attempt to use native TLS, but mingw only
supports emulated TLS. This causes a segmentation violation at the start
of any function protected by stack-protector. The issue exists in GCC
versions prior to 8.3.

Enable -mstack-protector-guard=global which uses a global variable for
the guard value. This is the behaviour with the fix, so there is no
downside to enabling it for all versions of GCC on Windows.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I85bc831043585071b0d8b0a3dd637b8d9ff26dab
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6575
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-03 08:16:54 +00:00
Nick Connolly
af17c1d44d mk: adjust options for mingw cross compilation
Check compiler target triplet for the strings 'windows' or 'mingw'
and set OS to Windows. If found, adjust basic parameters:

Set EXEEXT to indicate executables have .exe suffix.
Exclude 'relro' and 'now' flags which are not recognised on Windows.
Exclude 'noexecstack' flag which is not recognised on Windows.
Exclude -pthread flag because Windows doesn't have POSIX threads.
Include libssp.a to support stack-protector and _FORTIFY_SOURCE.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I94a45d3123ebc81f5529006fa07b05da897e5866
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6574
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>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-03 08:16:54 +00:00
Pawel Piatek
b3139d716b scripts/vagrant: change owner also on ocssd_md file
For OCSSD disk case we create two files, but only one was later
chown-ed.

Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: I411f0717f5416ba012e2e90582b60ec892d2744e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6170
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
2021-03-03 08:13:20 +00:00
Pawel Piatek
86475967d3 scripts/vagrant: create nvme refactoring
- throw error instead of silently skipping create disks on
  non-linux OS
- early return/exit from script
- add quotes around disk name
- use case/esac to check WHICH_OS
- other small syntax changes

Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: I71879bf635ecb275e805b6fcb3ec9d6bc3bc299f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6169
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-03 08:13:20 +00:00
Michal Berger
0081cfeaae pkgdep/git: Put sources installation into a separate function
This allows other entities to source pkgdep/git and safely use other
available routines.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I81c87ef124bdfc6d8cc548bc3a0ff4c19867c232
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6339
Community-CI: Mellanox Build Bot
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-03-03 08:12:26 +00:00
Michal Berger
fc7d5d4e27 scripts/rxe_cfg: Try to get status from all infiniband devices
Also, add some minor tweaks for the add|rm routines.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I39cdbec2c0aca12e7077d8db161e65fdce7ca19f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6241
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-03 08:12:26 +00:00
Michal Berger
940cd3ae37 test/nvmf: Make sure RoCEv2 protocol is used by irdma platform
This is done in order to avoid hitting issues similar to #1747
for which https://review.spdk.io/gerrit/c/spdk/spdk/+/6106 was
submitted.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I95817f63287795f438f1d392cf1fb2894226ce0e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6240
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-03-03 08:12:26 +00:00
ChengqiangMeng
8b4d6736d8 unittest/nvme_tcp: increase code coverage for nvme_tcp_qpair_set_recv_state and nvme_tcp_alloc_reqs
nvme_tcp_qpair_set_recv_state and nvme_tcp_alloc_reqs
and nvme_tcp_free_reqs code comprehensive coverage.
Except for calloc and spdk_zmalloc failed branches.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: Id300ecd0d4251603474ac934c7c38cca793b3c51
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6600
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-03-03 08:11:46 +00:00
Evgeniy Kochetov
6005775622 nvme: Move nsdata_zns to namespace structure
Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com>
Change-Id: I3f7508d14075c23d9b850da20da6d86c36e08450
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6501
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-02 08:06:15 +00:00
Evgeniy Kochetov
3a8852d384 nvme: Move nsdata to namespace structure
Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com>
Change-Id: I6083331a24dbf90170096cb98e6371ef2d4e6f9d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6500
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-02 08:06:15 +00:00
Evgeniy Kochetov
030b9f2608 ut/nvme: Add unit test for nsdata
Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com>
Change-Id: I9217eae7de8e9705052599a3f0ba0b6e4ca2be38
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6499
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-02 08:06:15 +00:00
Evgeniy Kochetov
6231798dca ut/nvme: Fix struct initializers
Signed-off-by: Evgeniy Kochetov <evgeniik@nvidia.com>
Change-Id: I345cbdb695a8f4724132e97290c2a5af4cdc3f75
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6498
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-03-02 08:06:15 +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
Nick Connolly
81525cc449 dpdkbuild: improve portability
Default to the more common Linux/GNU 'sed' edit in-place argument,
unless the platform is FreeBSD.

Tested by visually checking rte_build_config.h to confirm that the sed
in-place worked correctly.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I68be69658930fb20318ac3aa2413bbf4a358e9bc
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6531
Reviewed-by: Jim Harris <james.r.harris@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-03-02 08:02:52 +00:00
wanghailiangx
9c6548838a test/fio: add bs=4096 for fio_nvme
Since 'bs=4k' was removed from example_config.fio, although the
default bs value is 4096, but it would still be better to just
specify bs=4096 here.

Change-Id: I7c3bf10c10e42573ecb6683a371c3e81d3241cec
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6251
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-03-02 08:02:46 +00:00
Tomasz Zawadzki
f3fd56fc3c lib/iscsi: return immediately from iscsi_parse_params if len is 0
The spec does not disallow TEXT PDUs with no data.  In that
case, just return immediately from iscsi_parse_params.

This avoids a NULL pointer dereference with a TEXT PDU that has
no data, but CONTINUE flag is set.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2605293daf171633a45132d7b5532fdfc9128aff
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6319
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-03-01 14:13:48 +00:00
ChengqiangMeng
ae92e7f585 unittest/nvme_rdma: increase code coverage for nvme_rdma_poller_create
nvme_rdma_poller_create code comprehensive coverage.
Except for calloc and ibv failed branches.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: I5b308e63d12aa8d45d0268e67fd0bb98f449b79a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6275
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-03-01 12:08:40 +00:00
Jacek Kalwas
77d4cc6bef build: fix spdk_env_dpdk.pc creation
instead appending to output file (which occurs on each make execution)
sed is used to modify `Requires` section of the *.pc file

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I1a8cb1ec35bf583293c7174a413302191bbbd735
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6460
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: Jim Harris <james.r.harris@intel.com>
2021-03-01 12:08:21 +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
Jim Harris
3d9e67b07d perf: use elapsed time when test run ended early
If the test run is aborted early (i.e. Ctrl-C), we
should use the elapsed time as the divisor instead
of the originally specified time.

Fixes issue #1800.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3312cc83f3422ec46ad584e3ee2b40f3ad9ec6f5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6474
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: <dongx.yi@intel.com>
2021-03-01 12:06:59 +00:00
Alexey Marchuk
1eae58ff6d rdma: Add statistics per qpair
These statistics can help to estimate efficiency of
Work Requests batching and show busy/idle polls ratio.

Send: the doorbell updates statistics for verbs
provider are incremented per each ibv_post_send call,
for mlx5_dv per each ibv_wr_complete call.

Recv: the doorbell updates statistics for both
providers are updated when either ibv_post_recv
or ibv_post_srq_recv functions are called.

Each qpair on initialization accepts an optional
pointer to shared statistics (nvmf/nvme poll groups).
If the pointer to statistics is not provided then
qpair allocates its own structure. That is done
to support cases when NVME RDMA initiator doesn't
use poll groups, so we can avoid checks that qpair
has statistics in IO path

Change-Id: I07dea603cb870b85ea23c42e8e2c4520b1c66252
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6293
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-03-01 10:17:13 +00:00
Alexey Marchuk
d9ff7d09ed nvmf/rdma: Use RDMA provider API to post recv WRs
Change-Id: I782698bb12f8bbe9dc3bf06db8d83c9caf42a8db
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6292
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-03-01 10:17:13 +00:00
Alexey Marchuk
696e858094 nvmf/rdma: Use RDMA provider SRQ API
Change-Id: I9401efe73f7d0b39d0449b304ea2c211efb3a9f2
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6291
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-03-01 10:17:13 +00:00
Changpeng Liu
d0b2448b63 mk/libvfio-user: support --with-vfio-user=/usr/path
Users may not use SPDK libvfio-user submodule, so add a
library path for this case, users can still just use
'--with-vfio-user' without adding the path, for this case
a submodule default path will be used.

Change-Id: Ib0dd82ab6910056ff21b5b2d373c0d16916162c6
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6471
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-26 12:27:06 +00:00
Changpeng Liu
ae9f80354a mk/libvfio-user: use the install directory for the link path
Previously the libvfio-user didn't install the static library to
the install directory, with that fix in libvfio-user, we can use
the install directory now.

Change-Id: I3f232395a6dc3bf6d7d3937b245eb10c4b6a0e26
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6470
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-02-26 12:27:06 +00:00
Changpeng Liu
c837419aac libvfio-user: update submodule
Change-Id: Ia4bab4fd181216fa7a2be1332858ef559832c2e1
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6469
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-26 12:27:06 +00:00
Michal Berger
d511348a8e pkgdep/git: Add support for installing ice driver
Needed as depending on the kernel version given system is running under,
some E800 controllers may not be supported.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ic3ac24e24c68d62fecd702170f0bccc7176da8cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6235
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-02-26 12:24:56 +00:00
Michal Berger
47508028c7 pkgdep/git: Add support for installing irdma driver
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ifd174eaa88fe28588c66fafeef8a3bb7c24164f4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6234
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-02-26 12:24:56 +00:00
Michal Berger
ab7ae487a6 pkgdep: Add bash-completion package to DEV_TOOLS
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I7fe3baa15327b9ff509185ff6aa30390e35e9f8c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6239
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@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>
Community-CI: Mellanox Build Bot
2021-02-26 12:24:56 +00:00
wanghailiangx
097d1979b1 app/trace_record: modify help case to return 0
Case 'h' or 'H' should return 0, this is a normal return.

Change-Id: I872cdeeaab8bbe0efac8a8f959c1bd88f159b0b8
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6064
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: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-02-26 11:50:58 +00:00
Shuhei Matsumoto
1160d8e6f5 lib/iscsi: Submit only subtasks for Data-OUT PDU sequence
This change follows the large read which submits only subtasks, and
simplifies large write cases.

Associate the PDU which sends a SCSI Write PDU with immediate data
with both the primary task and the first secondary task. Then stop
incrementing reference count of the primary task twice.

As same as the last patch, copy the failure status directly among
the primary task and the secondary tasks because the primary task
is not submitted now. Then remove related data from struct
spdk_iscsi_task and related helper functions from conn.c.

Finally simplify unit tests for process_non_read_task_completion().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I54aa38c9b9fb7d7352da040dcdd8bcc1b1756a83
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6344
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: Jim Harris <james.r.harris@intel.com>
2021-02-25 10:27:53 +00:00
Alexey Marchuk
b7115d46fe nvme_rdma_ut: Fix GCC 4.8.5 warning
nvme_rdma_ut.c:370:9: warning: missing braces around initializer [-Wmissing-braces]
  struct nvme_rdma_qpair rqpair = {0};
         ^
Designated initializers is used with scalar value
while the first element of nvme_rdma_qpair is
a structure

Change-Id: I5a4e76612ccbd2c84283fe3ae2c57b9ea98591cf
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6305
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-02-25 10:27:31 +00:00
Niklas Cassel
2910ba6c53 nvme: simplify controller statemachine
For the following nvme controller statemachine states:
NVME_CTRLR_STATE_IDENTIFY_NS
NVME_CTRLR_STATE_IDENTIFY_ID_DESCS
NVME_CTRLR_STATE_IDENTIFY_NS_IOCS_SPECIFIC

The statemachine can either:
- Jump to succeeding state
- If active ns list is empty, jump directly to NVME_CTRLR_STATE_CONFIGURE_AER
- In the unlikely case if NVMe completion error, jump to NVME_CTRLR_STATE_ERROR

Simply this such that we either:
- Jump to succeeding state
- In the unlikely case if NVMe completion error, jump to NVME_CTRLR_STATE_ERROR

This will help to reduce the complexity of the nvme controller statemachine,
especially considering that there are new additional states
(NVME_CTRLR_STATE_IDENTIFY_NS_DIRECTIVE and
NVME_CTRLR_STATE_CONFIGURE_NS_STREAMS) currently on review that would continue
with the bad habit of having three possible jump states instead of just two.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I3242052b1108afcd8adbe6d0378b1358fef58ec8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6521
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: sunshihao <sunshihao@huawei.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-02-25 10:27:21 +00:00
Mao Jiang
092516cae9 test/nvme_rdma: add creating nvme qpair cases
Change-Id: I2d772cab1d65b7a3522191e854327ed84b72a4df
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6335
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-02-25 10:27:07 +00:00
Jacek Kalwas
99b1257154 build: swap pci with bus_pci libs on the list
bus_pci depends on pci so it shall be listed before, otherwise it can
result in linking issue e.g.

/usr/bin/ld: /home/jkalwas/spdk/dpdk/build/lib/librte_bus_pci.a(bus_pci_pci_common.c.o): in function `pci_parse':
pci_common.c:(.text+0x6e): undefined reference to `rte_pci_addr_parse'

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Idff446df82c37844edc122d5171e8ffa684b296f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6404
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-02-25 10:26:48 +00:00
Mao Jiang
504031d850 test/nvme_transport: build nvme transport unittest file
Change-Id: I0ac4e9afdd69a933522e2cada54b891ab3fbd78c
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6458
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-25 10:26:36 +00:00
Liu Xiaodong
4f2f8e8d44 nbd: set NBD_FLAG_SEND_FLUSH
SPDK nbd supports NBD_CMD_FLUSH, so set NBD_FLAG_SEND_FLUSH
to inform kernel about this flush ability.

Change-Id: Iaccb98da07e6fa184a798d792dd062f3d4013ade
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6524
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: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-25 10:26:26 +00:00
Ziye Yang
579a678a51 nvme/tcp: Move sock creation into nvme_tcp_ctrlr_create_qpair function.
Purpose: To get the optimal group, we need the socket information.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I17b048a402fbf002307dd225f64b20a9f876d642
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3324
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-02-25 10:26:08 +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
Ziye Yang
be57e2a6ec lib/nvmf: Use the accelerated engine to compute the data digest.
This patch is used to leverage accelerated engine to compute
the data digest in the following case:

1 DIF is not used.
2 The data to compute is aligned with size 4, i.e, %4 = 0.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I51fb6e3ab04391062b244cba6e249c8e20d3180f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6014
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-02-25 10:25:49 +00:00
Ziye Yang
88754353c0 lib/accel: Add the real chained crc32 support with the example.
This patch added the chained crc32 support API for both batched
and non batched mode usage. And also update the accel_perf
program in order to use the revised accelerated crc32 function.

For example, you can use the following command:

./build/examples/accel_perf -C 4 -q 128 -o 4096 -t 5 -w crc32c -y

In this command, "-C 4" means that caculate the chained
crc32 for an iov array.
(even if you do not have the accelerated DSA hardware)

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Ifede26f9040980b5791da8e5afef41177eede9f6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6457
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: Changpeng Liu <changpeng.liu@intel.com>
2021-02-25 10:25:49 +00:00
Niklas Cassel
1f49ee235f nvme: only reassign start_valid if we fetched a new SGE
For a SGL using PRPs, there is always an alignment check of the start
address in the beginning of the loop. This is stored in start_valid.

If the start is indeed valid, we might fetch a new SGE,
and then perform a second alignment check on this new SGE.

However, this second alignment check is done unconditionally,
meaning that for the last SGE in a request, we check if the
same start address is aligned twice.

Only perform the second alignment check if we actually fetched
a new SGE.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I9df8038c650b0879f838d1d9d895e8dd7172840d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6493
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>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-25 10:25:39 +00:00
Thanos Makatos
dfd7604687 NVMf/vfio-user: handle LOG_INFO and LOG_WARNING log levels
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Change-Id: Ie5129fcda87c054605180d80bf038f4dce2d71c0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6523
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>
2021-02-25 10:25:29 +00:00
Thanos Makatos
53ff83c24e NVMf/vfio-user: don't use SPDK log levels where syslog(3) log levels should be used
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Change-Id: Ia198b509e396a4635af9f9133e6dc40fc34c4ac1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6522
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-25 10:25:29 +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
Niklas Cassel
9d79d27e49 nvme: add function to get ZNS max active zones
Add a function to get the number of max active zones for a zoned
namespace.

The value inside the identify namespace struct is a 0's based value,
where 0xffffffff means unlimited.
If unlimited, the addition will overflow and return 0,
which is the intended value to represent unlimited for this API.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ia09e3db157ca0afadbd3ca4032eedd7bcd88248c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6443
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: sunshihao <sunshihao@huawei.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-24 13:06:32 +00:00
Niklas Cassel
bb5330c06d nvme: add function to get ZNS max open zones
Add a function to get the number of max open zones for a zoned
namespace.

The value inside the identify namespace struct is a 0's based value,
where 0xffffffff means unlimited.
If unlimited, the addition will overflow and return 0,
which is the intended value to represent unlimited for this API.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I4223146bc1ddf90486892a0af5fe5ce006dc5fd3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6442
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: sunshihao <sunshihao@huawei.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-24 13:06:32 +00:00
Mao Jiang
74c43a7446 test/nvme_tcp: Cases for nvme tcp
Cases for sending tcp qpair command and writing tcp qpair pdu.

Change-Id: I183d61fefd0749fb8a269d4f240d6e2e917a4996
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5998
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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-02-24 13:06:21 +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
Nick Connolly
619b8e3733 dpdkbuild: set --buildtype for debug builds
When ./configure --enable-debug is specified, meson is invoked using
the default 'release' buildtype and '-O0 -g' is added to DPDK_CFLAGS.
Instead, specify --buildtype=debug so that meson knows it is a debug
build, will return the correct value from get_option('buildtype') and
can choose the appropriate toolset options to enable symbolic debugging.
Using --buildtype=debug generates unoptimised code which matches
the current intent.

Tested by building with and without --enable-debug and verifying that
meson reports 'debug' for the debug build.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Iabb79cd2051145e03fea8fd749cfb18b78e625a0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6497
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:03:21 +00:00
Nick Connolly
8436569a70 dpdkbuild: add support for mingw cross build
If CONFIG_CROSS_PREFIX includes 'mingw', then specify --cross-file
'config/x86/cross-mingw' which is used as part of regular DPDK
testing, so is being maintained. For any other non-null prefix, default
to the current error message that automatic cross builds are not
supported.

Tested by running ./configure --cross-prefix=x86_64-w64-mingw32
and verified that 'make' in dpdkbuild used the cross tools.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I75c401dfe8422f6c5f1bbe631695e7ae6118f723
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6530
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:02:30 +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
Ziye Yang
90c56d965d lib/accel: Two crc32c APIs are added to provide the chained crc32 operation support
This patch provides two new accelerated crc32c function interface.
And the next patch will be used to add the real support of chained crc32c feature.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I3f8dd55c3da636e29e5fb02fc229b51f05653cd6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6456
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: Changpeng Liu <changpeng.liu@intel.com>
2021-02-23 08:52:48 +00:00
Shuhei Matsumoto
5ddf6f7671 lib/iscsi: Copy failure status directly among secondary tasks and primary task for read
When read is split, only secondary tasks are submitted. Hence we can
copy the failure status directly among secondary tasks and primary
task now.

Additionally, improve the comment in the source code to make us easier
to understand.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I857711dfaf90515231048f8c31c9273eac854d28
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6343
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
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>
Community-CI: Mellanox Build Bot
2021-02-23 08:52:20 +00:00
Shuhei Matsumoto
6358538aa7 lib/iscsi: Pass the range (offset and length) to iscsi_conn_read_data_segment()
This will make the current code simpler and make the following changes easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I5a06f7e876fee03ed05d880525b594f92cadcdca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6410
Reviewed-by: Ziye Yang <ziye.yang@intel.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>
Community-CI: Mellanox Build Bot
2021-02-23 08:52:20 +00:00
Shuhei Matsumoto
d752a1755d lib/iscsi: Remove pdu->data_buf and use pdu->data instead for all cases
data_buf was duplicated with data and was not necessary. Hence
remove it and use data instead in this patch.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I207047ce73d938f83e39f1454d44a9e4bba6b2f7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6407
Reviewed-by: Ziye Yang <ziye.yang@intel.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>
Community-CI: Mellanox Build Bot
2021-02-23 08:52:20 +00:00
Shuhei Matsumoto
0b576bb738 lib/iscsi: Factor out reading PDU payload operation from iscsi_read_pdu()
This patch follows the last cleanup.

Factor out reading PDU payload operation from iscsi_read_pdu() into a
helper function iscsi_pdu_payload_read(). This reduces the nesting
level, improves the readability, and make the following patches easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ie5f51eedefe00f3b43a7b45dcf84be79f8df4e27
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6414
Reviewed-by: Ziye Yang <ziye.yang@intel.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>
Community-CI: Mellanox Build Bot
2021-02-23 08:52:20 +00:00
Ziye Yang
36b9a670c8 lib/iscsi: Refactor the code in iscsi_read_pdu.
For the logic in ISCSI_PDU_RECV_STATE_AWAIT_PDU_PAYLOAD case,
this change will make it easier to read.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Iccc582dd5c749c60b3d22b2b9b73fb8407e59b0d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6360
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
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>
2021-02-23 08:52:20 +00:00
Alexey Marchuk
9451030761 rdma: Add functions to queue and flush recv WRs
Change-Id: I77e286efd48330fcb6c1c85d1515656e49587983
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6290
Tested-by: SPDK CI Jenkins <sys_sgci@intel.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-22 10:05:27 +00:00
Jim Harris
ab0a3f8f33 nvmf: do not pause a namespace when resizing
SPDK block devices can only be resized up when
it is open. So there is no need to pause the
associated namespace itself when resized - just
pausing the subsystem is enough.

Also modify the ns_hotplug_test to do null bdev
resizing - this will help test this resize code path.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3cb7b9de0892c296f2abf2280bed434d18ebe6b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6467
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: <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-22 10:05:11 +00:00
Nick Connolly
d90a55117b lib/env_dpdk: improve portability
Provide a default stub definition for spdk_pci_device_claim/unclaim
for non-linux platforms, rather than just for FreeBSD.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Ica45d967878582d9a58e37b088eba4bf0d94104e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6464
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-02-22 10:05:02 +00:00
Jaylyn Ren
c2a4702d7b perf: Add option to display perf cores usage
Run perf tool with parameter "-m" to display real-time overall cpu usage on used cores.

Signed-off-by: Jaylyn Ren <jaylyn.ren@arm.com>
Change-Id: I1f60315ac1e1ed1dfd238eb0a42a4b93c773e21e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6444
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-02-22 10:04:53 +00:00
Michal Berger
83adcc14c9 scripts/pkgdep: Remove kernel-modules-extra as FUSE dependency
Rationale behind e663dc82ad which put this package as a dependency
into pkgdep was that it shouldn't be exclusive to vm_setup.sh.

However, this particular package causes unnecessary kernel upgrades
whenever newer version is detected by dnf|yum. This behavior is out of
pkgdep's scope and as such similar upgrades should be performed via
vm_setup.sh only where its sole purpose is to configure system on a
wider spectrum.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I066105f95834f3f8d436b9ff52ec1f2bf97844af
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6437
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-02-22 10:04:38 +00:00
Michal Berger
439688a97e scripts/pkgdep: Update lib cache after installing liburing
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I8097b1db08f951e8240248b585c8aeccc7893d49
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6435
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-02-22 10:04:38 +00:00
wanghailiangx
58e587d01b examples/nvmf: modify help case to return 0
Case 'h' or 'H' should return 0, this is a normal return.

Change-Id: I33888fdd8f293b5a297a629a80cf925917b32df8
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6062
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-02-22 10:04:26 +00:00
Alexey Marchuk
13381936af make: Correct ppc detection
gcc -dumpmachine may provide the following output:
ppc64le-redhat-linux
To detect PowerPC system we should check for both
"powerpc%" and "ppc%" strings

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Ifb5afe743797177afa4f1b541a0c8ccaf4befbda
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6378
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>
Community-CI: Mellanox Build Bot
2021-02-22 10:04:14 +00:00
paul luse
9643f7ec6e test/accel: add UT for _get_task()
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I46dcf77715c58056fc81a0fa1250ac5e3b8ba610
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6380
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>
Community-CI: Mellanox Build Bot
2021-02-22 10:03:35 +00:00
paul luse
8dc056bc71 test/accel: add UT for _is_batch_valid()
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ifd9197c6a9941b3643c902cbf2f1ca670b455bd5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6357
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>
Community-CI: Mellanox Build Bot
2021-02-22 10:03:35 +00:00
paul luse
598eda5d78 test/accel: add UT for spdk_accel_get_capabilities()
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I6e18929dc8753301cf8735c2a33f53258a098768
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6356
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>
Community-CI: Mellanox Build Bot
2021-02-22 10:03:35 +00:00
paul luse
480d8ac71d test/accel: add UT for spdk_accel_task_complete()
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I847e85dbcc363f87e62264fb618c81447d2271f6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6355
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>
Community-CI: Mellanox Build Bot
2021-02-22 10:03:35 +00:00
paul luse
5f868ed1c9 test/accel: continue to add UT
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I423b2307967112e1e4b99c9ba176112811073324
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6353
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>
Community-CI: Mellanox Build Bot
2021-02-22 10:03:35 +00:00
paul luse
a8a7bfcae4 test/accel: add UT for sw engine register and unregister
Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I4e957ca524af3924e0b0568e76d145752ab3a9d9
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6352
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>
Community-CI: Mellanox Build Bot
2021-02-22 10:03:35 +00:00
paul luse
82d7226c8e test/accel: add first UT for accel framework
Implementation is pretty solid now, add first test with many
more to follow.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I4b80f3108fcd07919949bcd14dadfdfeb10c45fd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6332
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-22 10:03:35 +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
Jim Harris
345bb2e89d nvme/identify: submit only one GET_FEATURE at a time
This is a workaround for issue #1799 that would require
a fix from Google Cloud Platform.  GCP NVMe SSDs do
not support overlapped GET_FEATURE commands - the
cdw0 value on completions get mixed up.

On GCP the result is that identify app reports only
1 SQ/CQ supported when in fact it supports 16.

We can easily workaround this in the identify app by
submitting one GET_FEATURE and then polling for its
completion before submitting the next one.

We may consider reverting this in the future should GCP
provide a fix, but there is really no harm in keeping
this patch long term since this isn't an I/O path issue.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6454
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-02-19 11:33:21 +00:00
Jim Harris
06ace1efbf nvme/fio_plugin: add print_qid_mappings option
print_qid_mappings=1 will now add logging messages
showing the {filename,qid} tuples associated with
each job.

Note that for the nvme plugin, the filename is
essentially the transport ID.  We just print that
filename for simplicity rather than reconstructing
a transport ID string from the ctrlr object.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6396
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-19 11:33:21 +00:00
Tomasz Zawadzki
d108dcf5b9 test/bdevio: simplify thread allocation
This test was designed with 3 cores in mind,
where ut_thread and io_thread were always on separate
cores.

This patch just simplifies the logic for doing exactly that.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ica0b594d2be20df0fa430e290e97f0b34be17c62
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6233
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: Changpeng Liu <changpeng.liu@intel.com>
2021-02-19 11:30:53 +00:00
Michal Berger
62ab898c8f pkgdep/ubuntu: Include packaged version of meson
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ib6bff3b5d77d5cc0a08d11e9608c10bf0e4d119f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6412
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>
2021-02-19 11:30:43 +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
Nick Connolly
a14deb22e0 lib/event: improve portability
In _set_thread_name, use pthread_setname_np as the default for
platforms that are not Linux or FreeBSD; it's the most common
'non-portable' pthread extension used to set the thread name.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Ia841166f0537cd1303eded15bc7ef1a9f03e3b6e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6465
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>
2021-02-19 11:30:22 +00:00
Ben Walker
1d8861e58f doc: Stop generating latex docs
We only publish them as HTML

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I88daf01556271bf87e5bff45608fb068523cb0c2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6452
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-19 11:30:07 +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
Karol Latecki
78ce3152b5 scripts/nvmf_perf: add function to get interface names
Interface names will later be needed for additional
test options.

Change-Id: Ic16d305a97087ab1fdc35d5fd5a3d1ed2a021d90
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6206
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@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-02-19 11:29:18 +00:00
Karol Latecki
c4a330c937 scripts/nvmf_perf: add remote_nic_ips field to configuration
So far the information about remote target IP addresses was
stored in "nic_ips" attribute. Add a new "remote_nic_ips"
attribute to be able to differantiate which IPs are local
to given Server class object.

Change-Id: I03dac140241341996674b350c51c18da6e2ee447
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6205
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-02-19 11:29:18 +00:00
Liu Xiaodong
62a00973bf nbd: put nbd_disk_register ahead
Also remove duplicated checking on nbd path

Change-Id: I3b2aec6de5134ef2404529690f7692689c198a56
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6121
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-02-19 11:29:07 +00:00
Liu Xiaodong
59d527f10f nbd: release bdev ch and desc after close nbd fd
bdev channel is used in nbd fini process, so it should
be released in the latter part of nbd_stop

Change-Id: I87edea63d2d91954cc41cdb71261485ae24c0d9f
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6280
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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-02-19 11:29:07 +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
Michal Berger
9ab2855d6e pgkdep/git: Don't treat warnings as errors in refspdk build on FreeBSD
12.2 FreeBSD release has problems with building spdk with 3.19 fio
vm_setup.sh provides. Instead of patching anything, simply ignore the
warnings.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I1d85320126d664c7ed45ee369612391cfba8fd06
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6405
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-02-18 13:38:15 +00:00
Alexey Marchuk
92f62deefc nvmf: Fix race condition when adding IO qpair
Similar issue was fixed in
813869d823
nvmf: Fix possible race condition when adding IO qpair

This patch fixes the same issue which occurs a bit later,
when a  message is delivered to another thread. This issue
occurred on CI, callstack is the following:

00:11:46.296  #6  0x00007f2705199f05 in __ubsan_handle_type_mismatch_v1 () from /lib64/libubsan.so.1
00:11:46.296  No symbol table info available.
00:11:46.296  #7  0x00007f27067ace6f in ctrlr_add_qpair_and_update_rsp (qpair=0x221edc0, ctrlr=0x1dc4ea0, rsp=0x2242918) at ctrlr.c:230
00:11:46.296          __PRETTY_FUNCTION__ = "ctrlr_add_qpair_and_update_rsp"
00:11:46.296          __func__ = "ctrlr_add_qpair_and_update_rsp"
00:11:46.296  #8  0x00007f27067b1d0b in nvmf_ctrlr_add_io_qpair (ctx=0x2242540) at ctrlr.c:534
00:11:46.296          req = 0x2242540
00:11:46.296          rsp = 0x2242918
00:11:46.296          qpair = 0x221edc0
00:11:46.296          ctrlr = 0x1dc4ea0
00:11:46.296          __func__ = "nvmf_ctrlr_add_io_qpair"
00:11:46.296  #9  0x00007f27062553ce in msg_queue_run_batch (thread=0x1cff540, max_msgs=8) at thread.c:553

where line 230 in ctrlr.c was
assert(ctrlr->admin_qpair->group->thread == spdk_get_thread());
That means that admin qpair was disconnected from the poll
group and controller is in the process of destruction

Change-Id: I818ba56adda5ed3488a8df78483c0b6839758192
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6364
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-18 13:37:01 +00:00
Shuhei Matsumoto
b3dae51b65 ut/bdev_nvme: Add test case for submit NVMe command
Test bdev_nvme_submit_request() for all supported I/O types
including comare and write.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I8c3e7e1b93307329e9cc55692fa3e0e8c291a5b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6190
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-02-18 13:36:33 +00:00
Shuhei Matsumoto
c4c28dfa74 ut/bdev_nvme: Add test case for async event
Add a test case for AER. It includes populating, depopulating, and
resizing namespaces dynamically.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ib00c3279142cbdd70a0d571baee5797e661bb963
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6138
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-02-18 13:36:33 +00:00
Shuhei Matsumoto
24da97d3ec ut/bdev_nvme: Add test case for reconnecting qpair
Add test case to reconnect connection by adding stubs for I/O
completion.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I52f72708bdb9a6638c24e8ff6121080b0105e67f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6136
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-02-18 13:36:33 +00:00
Shuhei Matsumoto
bbbceb2a63 ut/bdev_nvme: Add test case for attach nvme_bdev_ctrlr
Add stubs and test case to attach nvme_bdev_ctrlr.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I66395de999c3ebc26230b6521bd45c35c4547796
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6135
Community-CI: Mellanox Build Bot
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-18 13:36:33 +00:00
Shuhei Matsumoto
d189309aaa ut/bdev_nvme: Add test cases to reset or failover nvme_bdev_ctrlr including race condition
Add stub of struct spdk_nvme_qpair and related APIs, and test cases
to reset or failover nvme_bdev_ctrlr. They include a case that destruct
and reset are executed concurrently, and a case that two reset requests
are submitted concurrently. For failover, the test cases are for a single
trid or two trids.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I6538a4dc32a73d0d72d6cac2a48c79ea7f00d332
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6132
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
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>
2021-02-18 13:36:33 +00:00
Shuhei Matsumoto
d7cdcbf0ca ut/bdev_nvme: Create framework and add test case to create nvme_bdev_ctrlr
Add framework for unit tests of bdev_nvme, and add a very simple
test case to create and destruct a nvme_bdev_ctrlr first.

Following patches will add more test cases and dynamic stubs.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I98f07d58d469949f3dac5a0bd36a3963de8dc3d1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6131
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-02-18 13:36:33 +00:00
Young Tack Jin
e3c82a0ae2 examples/nvme/identify: add occsd verbose mode for OCSSD chunk state map
print chunk state map of MAX_OCSSD_PU chunks in ocssd verbose mode

Signed-off-by: Young Tack Jin <youngtack.jin@gmail.com>
Change-Id: I5cfe5ece49086acd680f93228d4765215eee3d87
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6089
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>
Community-CI: Mellanox Build Bot
2021-02-18 13:36:25 +00:00
Alexey Marchuk
27d8fd9f4c rdma: Add functions to work with SRQ
Add 4 new functions to create/delete SRQ, queue and flush
recv Work Requests.

Change-Id: I55401d22724cf1ce24f2cca588f2bd1384cdbcd0
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6289
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-02-17 10:19:28 +00:00
Alexey Marchuk
4f2a837238 rdma: Fix doxygen comments
Change-Id: I6a9e9d173aad96c1d6c162396c1e3023b756498b
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6288
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-02-17 10:19:28 +00:00
Jacek Kalwas
0e0805b551 build: add missing log dep for env_dpdk
Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: Ieab3a3851eea9c6c9db2ddbf74d59b17128c3f0f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6403
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-02-17 10:19:06 +00:00
Jacek Kalwas
f758833ef8 build: combine env_dpdk / event_bdev so pkgconfig can de-duplicate deps
- it shows nice feature and usage of pkg-config
- it also prevents from duplicate symbols issue for static build in
case listed libs have a common dependencies

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I1f470d202ea7efe03e354dca472fd50e97bca747
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6406
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-02-17 10:19:06 +00:00
paul luse
9b18966796 accel_perf: update program exit code to reflect non-fatal errors
For use by test scripts to know when there was a non-fatal error.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I1c5e37edb13570aec1e186fe534ed6780a6de0c5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6324
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>
Community-CI: Mellanox Build Bot
2021-02-17 10:18:30 +00:00
paul luse
445fe74ef5 accel_perf: add option to specify threads per core
Useful for DSA, for example, where we might need more than one
thread hitting a single DSA device at a time.  Previously you'd
have to do this by using multiple cores.

Note: the -n option was removed and replaced with -T, it was
a carry over from the ioat perf tool that this was modeled after.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I44840655dc297cdc3116ca7b67718444b0800ab3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6333
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>
Community-CI: Mellanox Build Bot
2021-02-17 10:18:30 +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
Alexey Marchuk
04474fec32 nvme/fabric: Make connect related logs more verbose
Add logging of transport address and status codes

Fixes issue #1790

Change-Id: I67c23f74dd4a4b39233f50c4c29efe25872e0777
Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6338
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-17 10:18:05 +00:00
Jim Harris
5e37d3b2d8 nvme: add spdk_nvme_qpair_get_id
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I550d42806a84eb94effd1e1c4e26d9493cda7703

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6395
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: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-17 10:17:43 +00:00
Niklas Cassel
17ef8ec9ac examples/nvme_fio_plugin: add support for zone append
Now when we have support for spdk_nvme_zns_zone_append() and
spdk_nvme_zns_zone_appendv(), hook them up in the nvme fio plugin.

Note that fio itself does not have support for zone append,
since unlike SPDK, there is no user facing zone append API in
Linux. Therefore, this new option simply replaces writes with
zone appends in the SPDK fio backend.

This is however still useful for the following reasons:
-Provides a way to test zone append in SPDK.
-By using zone append, we can test with iodepth > 1.

With regular writes, the user can only specify iodepth=1.
This is because for zone namespaces, writes have to target
the write pointer. Having more than one write in flight, per
zone, will lead to I/O errors.

In Linux, it is possible to use fio with iodepth > 1
on zoned namespaces, simply because of the mq-deadline
scheduler, which throttles writes such that there is only
one write in flight, per zone, even if user space has
queued up more.

Since a user might not want to use zone append unconditionally,
even on a namespace that supports it, make this an option
rather than enabling it unconditionally.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I028b79f6445bc63b68c97d1370c6f8139779666d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6330
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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-17 10:17:22 +00:00
Niklas Cassel
014baeb8ef nvme: add support for ZNS zone append vector variant
We already have support for spdk_nvme_zns_zone_append(),
add support for spdk_nvme_zns_zone_appendv() (zone append with
NVME_PAYLOAD_TYPE_SGL).

_nvme_ns_cmd_rw() currently performs verification of the SGL,
if the parameter check_sgl is set. This parameter is set for all
calls with payload of type NVME_PAYLOAD_TYPE_SGL.

In order to be able to perform the same check_sgl verfication on
zone append vectors, we need to refactor _nvme_ns_cmd_rw() a bit.

Setting check_sgl ensures that _nvme_ns_cmd_split_request_sgl() or
_nvme_ns_cmd_split_request_prp() gets called.

These functions will split an oversized I/O into several different
requests. However, they also iterate the SGE entries, verifies that
the total payload size, total SGE entries is not too many, and that
buffers are properly aligned. A proper request will not get split.

For zone append, splitting a request into several is not allowed,
however, we still want the verification part to be done, such that
(e.g.) a non first/last SGE which is not page aligned, will cause
the whole request to be rejected.
(In the case of spdk_nvme_ns_cmd_write(), a non first/last SGE which
is not page aligned will instead cause the request to be split.)

An alternative would be to try to rip out the verification part from
_nvme_ns_cmd_split_request_sgl() and _nvme_ns_cmd_split_request_prp().
However, that is non-trivial, and would most likely end up with a lot
of duplicated code, which would easily get out of sync.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I2728acdcadeb70b1f0ed628704df19e75d14dcca
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6248
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-02-17 10:17:22 +00:00
Niklas Cassel
b1b4b8676f nvme: use spdk_nvme_zns_ns_get_zone_size_sectors() where appropriate
Use the new function spdk_nvme_zns_ns_get_zone_size_sectors() where
it is appropriate (in comparison to the existing
spdk_nvme_zns_ns_get_zone_size() variant).

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ic929ffbc5a1f4a16ba6719a985c05ae625caed46
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6417
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-17 10:17:22 +00:00
Niklas Cassel
9a800c38f5 nvme: add spdk_nvme_zns_ns_get_zone_size_sectors()
Sometimes it is more optimal to get the zone size in number
of sectors, instead of in number of bytes.

Therefore, add a new spdk_nvme_zns_ns_get_zone_size_sectors()
function to get zone size in number of sectors.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I0fe67e00a3d74dd27acfc895ae97448d995b89a3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6416
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-17 10:17:22 +00:00
Niklas Cassel
8f5b48f8fd nvme: make enum spdk_nvme_ns_flags more readable
Make enum spdk_nvme_ns_flags more readable.
Other enums in spdk, e.g. enum spdk_nvme_ctrlr_flags,
and e.g. enum NVME_RDMA_COMPLETION_FLAGS, already define
the enum values using bit shifts.

Do the same for enum spdk_nvme_ns_flags.

No functional change intended.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: Ia78ab0bab6fa37d700178d5b2669feb5a3003871
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6383
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-17 10:17:22 +00:00
Simon A. F. Lund
a587d90dcb examples/nvme/identify: add a limit to the zns zone report dump option
Add an optional limit, -z N, to the zone report dump option -z.

The variable g_zone_report_limit replaces the MAX_ZONE_DESC_ENTRIES such
that the maximum-number of zone-descriptors is overwritable. It also
replaces g_zone_report_full as it is represented by the limit-value 0,
e.g. "no limit" dump the full report.

The print of the section-header now includes the total amount of zones
and the limit. With this information, the header's width varies. A
helper-function, print_uline(), for printing an "underline" using a
given marker, is also added.

Signed-off-by: Simon A. F. Lund <simon.lund@samsung.com>
Change-Id: Ic8abead693ed83bb8612eef1f35605098ccade84
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6036
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: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-02-16 08:43:24 +00:00
Simon A. F. Lund
1b0134e0a9 examples/nvme/identify: assert optarg to satisfy analyser
Despite spdk_nvme_transport_id_parse() checking optarg for NULL, then
the Jenkins CI doing code-analysis fails with the error message:

"Null pointer passed as an argument to a 'nonnull' parameter"

This adds an assertion to satisfy the code-analysis.

Signed-off-by: Simon A. F. Lund <simon.lund@samsung.com>
Change-Id: I35f7ee659624c1d5a2abda91bccac9fb58393063
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6068
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>
Community-CI: Mellanox Build Bot
2021-02-16 08:43:24 +00:00
Simon A. F. Lund
f79d4b8baf scripts/nvmf_perf: fix pylint E741
Signed-off-by: Simon A. F. Lund <simon.lund@samsung.com>
Change-Id: I039a2e22a665e0d52082e6876f2c7c1cd9a336c1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6386
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>
Community-CI: Mellanox Build Bot
2021-02-16 08:43:24 +00:00
Ziye Yang
8e039ff3d2 nbd: Continue to read the socket even if the NBD status is not running
In order to make sure we do always response to the kernel module if
there are valid commands in the socket. If we do not see this,
we will see stuck request kernel info in nbd module. And the kernel
will print the timeout message of nbd module again and again.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I2ecc3e9c948231a712778f0126e2ecc6220e1d3c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6276
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
2021-02-16 08:40:55 +00:00
Wenhua Liu
e7f6ff2db6 Fix incorrect implementation of HPDA/CPDA in NVMe/TCP target code.
The current implementation treats HPDA/CPDA as the absolute offset
to the beginning of the PDU where the payload data starts. This is
incorrect. The HPDA/CPDA actually specify where the payload data
should start such that the starting location is a multiple of HPDA
(for C2H PDU) or CPDA (for H2C PDU or CapsuleCmd PDU).

The other issue fixed is that the current implementation calculates
padding only when header digest is enabled. This is also incorrect.

Signed-off-by: Wenhua Liu <liuw@vmware.com>
Change-Id: If7a3896a4c1d73f6d062bd3dbe6a912d31771180
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6256
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-16 08:40:14 +00:00
Nick Connolly
77573e830e lib/bdev: ensure mutex is initialized
For correct behaviour, pthread_mutex should not be locked after it has
been destroyed.

g_bdev_mgr.mutex is statically initialized. It is destroyed in
bdev_mgr_unregister_cb, but not re-initialized in spdk_bdev_initialize.
Repeated calls to initialize/unregister occur during unit tests.
Remove the destroy from bdev_mgr_unregister_cb, which seems
the simplest way of resolving the issue.

The sequence: spdk_put_io_channel(), spdk_bdev_close(),
spdk_bdev_unregister() occurs during unit tests.
spdk_bdev_unregister() destroys internal.mutex which is then
locked by a call to bdev_channel_destroy() resulting from the
earlier spdk_put_io_channel(). Move the destroy and the free of
internal.qos into bdev_destroy_cb so that they don't occur until
all of the channels have been released. Remove the no longer
required bdev_fini.

Repeat calls to spdk_bdev_unregister that occur after an unregister has
completed will lock internal.mutex which has been destroyed by the
previous unregister. This occurs during unit tests. Defer locking
internal.mutex until after the internal.status has been checked for
SPDK_BDEV_STATUS_REMOVING. This is the only place where
internal.status is set to removing and g_bdev_mgr.mutex alone is
sufficient to ensure atomicity here.

Tested with a pthreads library that contains debugging code to
check the mutex state and a modified version of bdev_io_types_test
to call get_io_channel on a different thread.

Suggested-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I81cc46a1b8a766700253829b19cc86c7f0eb79f2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6217
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-16 08:39:17 +00:00
Krzysztof Karas
1450e5bdb2 spdk_top: adjust pop-up details windows positions
Changes the position where pop-ups are displayed.
This patch tries to accomodate different spdk_top window sizes
and display pop-ups in the center as opposed to currently hard-coded
coordinates.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I75a53be7ab8d5549d65053a30365b0da1f31b6ce
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6199
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-02-16 08:37:22 +00:00
Michal Berger
5c61089ca2 test/scheduler: Rewrite the balanced() test
Simplify the test to follow the scheduler period in order to check if
target thread is properly balanced among selected cpus.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I326ad1171ca00c3d171aebe95266c5e4998abad3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6337
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-02-16 08:36:23 +00:00
Pawel Piatek
23c8f667a2 autorun: allow pass configuration file path
Allow to pass configuration file as first parameter with
fallback to previous behaviour where config file is read
from home directory.

Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com>
Change-Id: I45972b04fe5fc978bf3b2bede45aae363be3069c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6361
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
2021-02-16 08:36:03 +00:00
sunshihao520
a4ee18886d pkg: add python3 requires in spdk.spec
When use rpm -i to install spdk-tools, it requires python3-configshell
and python3-pexpect. Add this requires to spec to avoid install failure.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Change-Id: I7fc7e9aab35c3fd730401282b72b1604f765a73f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6336
Community-CI: Mellanox Build Bot
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-02-16 08:34:12 +00:00
Tomasz Zawadzki
232f34d754 lib/env_dpdk: add rte_net dependency
Vhost is enabled by default, so rte_net was always included.
When disabled, rte_power failed as it depends on rte_ethdev and rte_net.

rte_vhost was only possible to enable on Linux, so there
is no conflict with adding it next to rte_power under this condition.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I2e183004d6457e404471740a0540dcb08aa738d8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6398
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com>
Reviewed-by: Nick Connolly <nick.connolly@mayadata.io>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-02-16 08:33:46 +00:00
Krishna Kanth Reddy
48aed8a578 lib/nvme: Adding support for PMR Identification
Identify application prints the PMR details if it is supported

Signed-off-by: Krishna Kanth Reddy <krish.reddy@samsung.com>
Change-Id: Iaba4c15e18e1402035b11a34b2defe8078855751
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6209
Community-CI: Broadcom CI
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-11 08:40:48 +00:00
sunshihao520
9529803fe0 lib:vhost Add version check when use RTE_VHOST_USER_ASYNC_COPY in 21.01
In dpdk 19.11 version, RTE_VHOST_USER_ASYNC_COPY is not define.
After dpdk 20.08, we can use RTE_VHOST_USER_ASYNC_COPY.
Use version check to avoid this problem.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Change-Id: Iaf9914e8380f3d54cded1e2f16af6a7dc3504f95
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6274
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-02-11 08:40:31 +00:00
Nick Connolly
240fdd7dd1 test/string.c: remove hardcoded limit values
Unit tests for spdk_strtol/spdk_strtoll use hard coded strings for
arithmetic constants (LONG_MIN/MAX etc). These are only valid
on platforms where both long and long long are 64-bit values.

Replace the hardcoded values with strings generated from limits.h.
The tests use values that are outside of the MIN/MAX range, which
cannot be represented as int64_t. These are calculated in two parts
to avoid overflow and recombined as a string.

Verified using the unit tests on two different architectures and with
test code to check that the generated string is the same as the
hardcoded value on x86 Linux. Used a small test program to calculate
+/-30 around each limit value to check carry handling and boundary
conditions.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I990ff354f568a0b35853ecc849dd2a452bb1048b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6048
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-02-11 08:40:09 +00:00
Niklas Cassel
4249dc1010 nvme: account for PRACT when calculating max sectors per transfer
There is a special case when using 8-byte metadata + PI + PRACT
where no metadata is transferred to/from controller.

Since _nvme_ns_cmd_rw() already calculates the proper sector size
using _nvme_get_host_buffer_sector_size(), which takes PRACT into
account, change the sectors_per_max_io calculation to also take
PRACT into account.

This will avoid certain requests that don't need splitting getting
split.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I8d450d37c2458453701189f0e0eca4b8fe71173b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6247
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: Ben Walker <benjamin.walker@intel.com>
2021-02-10 08:44:54 +00:00
Liu Xiaodong
b7c33b5e61 nbd: set io timeout
After setting io timeout, host can avoid nbd io
stuck or kernel hang occasionally caused by nbd
stop or underlying bdev removal.

Change-Id: I4ba2a0af7ff7bed369cdaf86121f082136dc1a0b
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6191
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: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-02-10 08:44:36 +00:00
paul luse
eea826a276 accel_perf: update to create worker threads on its own
As reactors no longer have a thread created with them.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ie9e9411c52c215b8cffd894fef6394448ae8167d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6312
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-02-10 08:44:17 +00:00
Nick Connolly
68ff34bc66 include/nvme_spec.h: improve portability
Aspects of bit fields are 'implementation defined'.  On some platforms
alignment will occur if two adjacent fields are of different types. This
occurs in spdk_nvme_feat_async_event_configutation after the crit_warn
member which is effectively an int8_t, followed by an int16_t. There
isn't a generic way of changing the compiler's behaviour, so the best
options are:

- Change crit_warn to a uint32_t bit field and copy the value to/from
  a spdk_nvme_critical_warning_state variable to use it. This requires
  changes to code using the field.

- Adjust the structure definition to use smaller types to avoid the
  problem. This preserves existing semantics, but the field order will
  need to be reviewed if big-endian support is ever added (other places
  in nvme_spec.h will need similar attention). A second reserved field
  is required.

Use smaller types which seems the most straightforward option. Adjust
the use of the spdk_nvme_feat_async_event_configuration reserved fields
in lib/nvmf/ctrlr.c.

The new structure is binary compatible and the fields behave in the same
way, with the exception of an additional reserved field, so updating
CHANGELOG.md probably isn't necessary.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I7d8163c84b4f410fc95a5b7064506ad7b4b62c6c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6340
Community-CI: Broadcom CI
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-10 08:44:10 +00:00
Nick Connolly
424cbc3957 lib/util/math.c: improve portability
__builtin_clzl takes an unsigned long argument which may be smaller
than uint64_t on some platforms. GCC silently ignores the mismatch,
returning the wrong answer at runtime. Use __builtin_clzll instead and
add static assertions to detect the issue.

Attribute 'target_clones' requires 'ifunc' support which only applies to
ELF targets. Add check for defined(__ELF__).

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Iff76640b34223649de531250ad40471d829512c7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6317
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: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-10 08:44:01 +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
Mao Jiang
8654a1b0cf test/nvme_tcp: nvme tcp UT cases
Cases for getting tcp requests and request initialization.

Change-Id: I64ba6dbfba6bd68b70a3b7f1090ea274e3195634
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6140
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>
Community-CI: Mellanox Build Bot
2021-02-10 08:32:30 +00:00
Jim Harris
0aac63ce62 bdevperf: do not append cpumask to thread name
spdk_thread_create() does not require unique thread
names, and we already print out the CPU mask for each
job. So there is no need to append the cpumask to the
thread name.

Removing it has the added advantage of not modifying
the job name specified by the user if they are using
a job config file.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I6d75ea2bdc50061d7338ad41749e458efa62b48e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6331
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-02-10 08:30:40 +00:00
Jim Harris
783293dee4 bdevperf: make usage() clear that -j takes a parameter
-j option requires a filename to specify the job config
file to use.  Update usage() to reflect that.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I38092f43e34c145d476783816f5300a1b0cfd673
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6329
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-02-10 08:30:40 +00:00
Jim Harris
b0c978893c bdevperf: clean up output
We can make the output a bit more precise by putting
the Core Mask on the same line as the Thread Name.

Let's also use "Job Name" instead of "Thread Name"
since that more closely matches the user's intent.
We use a thread internally for each job, but user
specifies workloads in terms of jobs, not threads.

Finally let's get the Total values aligned
with the per-job values again - this seems to have
broken as part of commit d80b4f4.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I04fcd294b8f88374b11e09350aabf84beb2ae60e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6328
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@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>
Community-CI: Mellanox Build Bot
2021-02-10 08:30:40 +00:00
Jim Harris
933868afe5 spdk_top: fix -h option handling
-H is not specified to getopt, so there's no reason
to have a case statement for it.

We should also return 0 when -h is specified. spdk_top
-h should not return error status to the shell since
this is valid usage.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ifa24c93661648c61de6925bea4b4071cd53013d4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6327
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-02-10 08:30:40 +00:00
Jim Harris
1ed57e1fb6 spdk_top: fix up usage() text
spdk_top is a JSON-RPC client, so -r specifies the
RPC connect address, not listen address. Also add
missing close parenthesis while we're here.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I6a910df647a3f5eee4df088a2dcf79bc6d7cc087
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6326
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Mellanox Build Bot
2021-02-10 08:30:40 +00:00
Changpeng Liu
35800b39cf nvmf/vfio-user: use transport cdata_init callback for custom IDENTIFY
Change-Id: I89a0aeb4d42932dc720598da7ff06c59b6cf8ea3
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6313
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-10 08:27:56 +00:00
Changpeng Liu
5118878c37 nvmf/vfio-user: use stack variable for acq_map
insert_queue() will copy it to internal data structure, so that
before successful map we don't need to consider the error path.

Change-Id: Id7ea2ef73da7914ea430ea568e7981657016d3f7
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6310
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-10 08:27:56 +00:00
Changpeng Liu
d786273dc1 nvmf/vfio-user: connect IO queue pair after creating SQ
The CQ is created first, so it's more reasonable to connect
the IO queue pair after creating the SQ.

Change-Id: I196c19a54a015310a3777d9bfca7db8735a4d5b2
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6309
Community-CI: Broadcom CI
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-10 08:27:56 +00:00
Changpeng Liu
8586a1b3cc nvmf/vfio-user: unpack add_qp() function
add_qp() function is only called when creating NVMe SQ/CQ, so unpack
it into the caller to make the code more clear.

Change-Id: Id5cc1152b1684df980909b2f7d73ed2788c0efb2
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6308
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-10 08:27:56 +00:00
Changpeng Liu
a7ab74b114 nvmf/vfio-user: rename map_dma/unmap_dma
The clients(QEMU and NVMe vfio-user driver) use shared memory with
NVMf vfio-user target for zero-copied IO processing, when memory
region hotplug happens from clients, the backend target can get
notification via callbacks.  Here we rename them to reflect the
action.  For now NVMe vfio-user example applications use static
memory model and single memory segment.

Change-Id: Icecbe13883668dd8267019b5fe57d0fef1c68b81
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6307
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-10 08:27:56 +00:00
Changpeng Liu
e738db6218 nvmf/vfio-user: remove unnecessary ABORT command
We can use the NVMf library ABORT implementation directly, so remove
it in vfio-user.

Change-Id: I0f204a869c53c6a6ce67ad900a64d5bb59ac2aab
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6306
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-10 08:27:56 +00:00
Changpeng Liu
a3b56e7f4d test/nvmf_vfio_user: add one more device to the target
Previously we only tested one device with vfio-user target,
now add one more device to the test script.

Change-Id: I6923a313b23f93e6fdc3f25baa060b9af43ba7f7
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6228
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-02-09 11:31:16 +00:00
Changpeng Liu
0f30fea99b nvmf/vfio-user: don't check controller ready state in group poll context
The group poll context is for queue pair state, so we don't need to
check controller state here, and for the disconnect case below, the ADMIN
queue pair will be removed from group poll.

Also add spdk_unlikely in the poll context.

Change-Id: I5ef32ef3cf41ad757a7cb167e1e1fa32c52a84d6
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6227
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-09 11:31:16 +00:00
Niklas Cassel
b05b3d0a12 nvme: add assert in nvme_ns_cmd_zone_append_with_md()
Zone append commands cannot be split.
_nvme_ns_cmd_rw() should never cause a NVME_PAYLOAD_TYPE_CONTIG
zone append request to be split.

This is currently true, but add an assert to make sure that
any refactoring to _nvme_ns_cmd_rw() does not break this promise.
Also add error handling, since release builds are built with
asserts disabled.

Follow-up patches will refactor _nvme_ns_cmd_rw().

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I5fd2440c4c9d6bd8d56f30354b208a9047b64729
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6246
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-02-09 11:30:51 +00:00
Niklas Cassel
c56fb6d3ee nvme: fix typo in zone append header documentation
While zone append is very similar to write, we should refer
to the proper I/O command.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Change-Id: I85dc2634eefb502dd38351ca02d9b09a15c5620f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6245
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Community-CI: Mellanox Build Bot
2021-02-09 11:30:51 +00:00
Shuhei Matsumoto
1c6277b21b ut/json_mock: Add spdk_json_write_string_fmt()
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I42b0afec9a13772a2c09ca88b2e992de31057280
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6130
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Community-CI: Mellanox Build Bot
2021-02-09 11:29:53 +00:00
Shuhei Matsumoto
9b00466392 ut/bdev_ocssd: Move bdev_ocssd_ut from bdev directory to bdev/nvme directory
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: Ifa9aa75086264037ae72926b89c4f63c8123f2eb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6129
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: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
2021-02-09 11:29:53 +00:00
Ziye Yang
e150f6b8b7 accel_perf: Add _free_task_buffers_in_pool function.
This function is used to eliminate the duplicated code.

Also rename _free_task to _free_task_buffers to make
it easy to understand the code.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I2ef9dbbb81c12c229952f5590f616a17dc2fe087
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6128
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@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>
Community-CI: Mellanox Build Bot
2021-02-09 11:28:25 +00:00
Ziye Yang
b34883e07b accel_perf: Fix the memory leak issue of task free
When the task is allocated from _get_task function,
the task is removed from the tasks_pool in non batched mode.

So in _accel_done function, when the is_draining flag is true
and it is not a batched mode, we should add task back to the pool.
If not, the the memory related resource allocated by the task will
not be freed.

PS: In _check_draining function, the related resource of task
in the tasks_pool will be freed. However, if the task is not
added back, the resource free will not work as expected.

PS: The issue is reported by ASAN.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I981117037fba8e111987c771cae65bc06a734a6f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6097
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@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>
Community-CI: Mellanox Build Bot
2021-02-09 11:28:25 +00:00
ChengqiangMeng
82240049d6 unittest/nvmf_rdma: increase code coverage for nvme_rdma_alloc_rsps
nvme_rdma_alloc_rsps code comprehensive coverage.

Signed-off-by: ChengqiangMeng <chengqiangx.meng@intel.com>
Change-Id: Ie01271454558f39f121876802af01ab9bf39d3c4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6127
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>
Community-CI: Mellanox Build Bot
2021-02-09 11:27:55 +00:00
Jim Harris
e329ec45a6 nvme: add set_nvme_pcie_set_hotplug_filter
This function allows applications to specify whether
they wish to allow probing a newly attached NVMe
PCIe SSD.

The env layer will only even probe devices that have
been allowed.  By default, this is all devices, but
if the user has specified some list of
allowed PCI addresses (via spdk_env_opts pci_allowed)
then newly attached PCIe devices are implicitly not
allowed.  This API allows applications to add
device addresses to the allowed list after the
application has started.

This API will be useful for use cases where multiple
SPDK processes are running on one server, and assignment
of PCIe SSDs to those processes are based on some function
of the SSD's PCIe address.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6184
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>
Reviewed-by: <dongx.yi@intel.com>
2021-02-09 11:27:19 +00:00
Jim Harris
207e05831f env: add spdk_pci_device_allow() API
The env layer has a pci_allowed list, which specifies
that only a subset of PCI devices may be attached
by the associated process.

But that doesn't cover PCI devices that are hot-inserted
after the application starts, which is common for
storage/NVMe.

So add a new spdk_pci_device_allow() API which allows
an application to add new devices to the allowed list.

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

Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6183
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>
Reviewed-by: <dongx.yi@intel.com>
2021-02-09 11:27:19 +00:00
Michal Berger
37d8b241a8 test/nvmf: Add DIF test utilizing the digest functionality
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I511d04ff75d5b6b4213e6186b0314a5db1ce722d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6028
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: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-09 11:26:51 +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
yidong0635
4c26a8e79f lib/sock: Check conditions together.
This avoids duplicated codes as other coding style.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: I111bd70d02cf23d38e6e73a4d0249adbfe8f24d4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6314
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
2021-02-09 11:24:57 +00:00
yidong0635
0859c83790 reactor: Construct a function to do common code.
remove lw_thread in a static function.

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: Iade1cb6c88e8aba4ca92c22d2596b8b3dea01ff5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6311
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
2021-02-09 11:24:36 +00:00
Michal Berger
92e49c0044 test/scheduler: Wait for a bit for the governor to change the freq
Issues like https://github.com/spdk/spdk/issues/1784 showed that
governor may need some more time to properly adjust cpufreq's sysfs
knobs. In case we see that frequency setting hasn't changed after
given iteration, wait for 0.5s to make sure it finally settles.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: Ibf25d0d1962bf2b07b13d60d6096c5cc185c1279
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6283
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-02-09 11:24:22 +00:00
sunshihao520
ccbdd1750f pkg:spdk.spec Add ncurses-devel to BuildRequires
ncurses.h is needed in spdk_top, add ncurses-devel to BuildRequires.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Change-Id: I22754838788fe237a29ab74a675a94ab7007bd33
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6258
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-02-09 11:24:06 +00:00
Vasuki Manikarnike
d92c2f118a lib/nvme: Remove qpair from all lists before freeing it.
Fixes #1777.

When a qpair cannot be allocated because the transport connection fails,
the qpair was freed without unlinking it from the other structures.
This was leading to a segfault when attempting to create and free other
qpairs.
Also added a unit test to cover this case.

Change-Id: I74b78d1847f90117248b07203b43a11ff5cfa5d6
Signed-off-by: Vasuki Manikarnike <vasuki.manikarnike@hpe.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6272
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-08 16:13:59 +00:00
wanghailiangx
4b69ab67d9 test/aer: modify help case to return 0
Case 'H' should return 0, this is a normal return.

Change-Id: I09f81e08d782007c62592475750e70461c83f318
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6194
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-08 16:13:29 +00:00
wanghailiangx
cf3ed0e19f test/app/stub: fix a null pointer passed as argument 'H'
When val gets optarg and argument is 'H', a  null pointer passed as argument 1,
which is declared to never be null. So we adjust the order, judge 'H' first.
Then './test/app/stub/stub -H' will display help info instead of 'Segmentation fault'.
This patch fixed it.
And case 'default' should return 1.

Change-Id: I6ba9311eb5ac90266fdf33ab3424ab28fa64a78f
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6083
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-08 16:13:09 +00:00
paul luse
afbab54cbb doc/accel_fw: update docs to reflect updated configuration
Previous patch changed config #0.  Also clarrified config #1 as
well.  A future patch will expose the priority setting mentioned in
config #1 as this is currently internal.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I4761324e522b24f580918a8397810b52dd1a6bd3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6008
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: Jim Harris <james.r.harris@intel.com>
2021-02-05 21:19:37 +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
Tomasz Zawadzki
d126733f41 test/check_so_deps: remove the skip for idxd
libspdk_idxd library was introduced in SPDK 20.04 without
specifying SO suffix. This required to skip a test for this library
after the release.

This is no longer required.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I3981888c9187c47012e252c24fc4d6f7992d5d76
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6219
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-05 14:43:47 +00:00
Nick Connolly
7d3b2c137a unittest/bdev: initialize mutex for portability
For correct behaviour, pthread_mutex must be initialized before use
and destroyed when finished. Add mutex initialization and destroy
calls to io_valid_test.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Idbbf857f3103ba15ab851ed16ce9f4e2bc99f7dd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6218
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-02-05 13:55:04 +00:00
Karol Latecki
00afb74669 test/vm_setup: fix LTS release checkout
We don't typically "describe" our releases and it seems
that last LTS (20.01.2) was described by accident,
so this script worked. Fix it for 21.01 LTS.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I2e64380299cd1a4aeaf21f324890d9257efdaea3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6244
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-02-05 13:47:12 +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
Nick Connolly
6ff30cefe9 test/nvme_pcie: initialize mutex for portability
For correct behaviour, pthread_mutex must be initialized before use
and destroyed before the memory is zeroed. Add mutex initialization
and destroy calls to test_nvme_pcie_hotplug_monitor.

Tested with a pthreads library that contains debugging code to
check the mutex state.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Ifd770a85627a11e2b2c6643f798f796bab10b6cb
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6153
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: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Community-CI: Mellanox Build Bot
2021-02-05 13:46:23 +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
sunshihao520
b1687cd456 lib:env_dpdk fix the enum rte_kernel_driver definition deference between dpdk 19.11 and 20.11
In dpdk 19.11, rte_kernel_driver is the old version, add version check before use the members.
Signed-off-by: sunshihao <sunshihao@huawei.com>
Change-Id: Ic1db37cc0760c7d03692fd2cdcbb6ff1e41f872d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6252
Community-CI: Mellanox Build Bot
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>
2021-02-05 13:45:00 +00:00
paul luse
0e73e10da8 lib/idxd: add a condition to sim workaround
Developer convenience - make this based on a specific version.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I228b8aff6e8957cad5e8c1fae5615b113e16cfb5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5950
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>
Community-CI: Mellanox Build Bot
2021-02-05 13:42:32 +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
9623a0402b idxd: perf optimization, remove reg read
In the completion handler there's no need to do an MMIO read
unless the completion record indicates there's an error.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ic4850d803a23413f9813da30ac6f1b611804f1b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5847
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: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
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
paul luse
15c0e78042 lib/idxd: change config #0 to something more sane
Config #1 remains what is shown as an example in the spec. Change
config #0 to just have 1 work group and 1 work queue all backed
by 4 engines.  As the majority of initial use cases will not be
implementing separate priorities and/or different back end
targets (mem, pmem, etc) having just 1 group and work queue makes
the most sense as it allows the silicon to decide which engine to
use.

Also, having multiple work queues spreads out the available
entires such that if we're not using all of the work queues then
we're not using all of the resources.  As channels are created
they are assigned the next available device.  As a channel is
assigned a device that is already in use it will round robin
work queues.  If then, for example, we have 16 devices then only
the first work queue will ever be used for the first 16 threads
which seems and if there are even just 2 work queues per device
it would take 32 threads to use all of the resources at the
device.

By haing just one work queue per device we always have the max
number of work queue entries available regardless of how many threads
are being used.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ie15ff6bdea12525fe3bfc769613084ddd2de50bf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5845
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-02-05 13:42:32 +00:00
paul luse
f17e67059e examples/accel_perf: rework how batching is done
Previous version just used batching for initial queue depth loading
as an example of how to batch. This version adds a new param -b that
allows the caller to either disable or set a specific batch value
for use during the entire run.  For example Q depth 128 with a batch of
64 will always send IO in batches of 64 so in effect once the Q depth
has been met the tool will wait until the Q depth has dropped enough
to send another 64.  This will allow for a more accurate measurement
of batching performance vs sending IO one at a time.

Also added clarrifying note on usage the Q depth is per core, not
spread over all cores.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: Ieb1df5f668ae9c7b37b0d789fceab1138044a5e6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5489
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>
Community-CI: Mellanox Build Bot
2021-02-05 13:42:32 +00:00
Michal Berger
e7ab45baf7 check_format: Include all potential bash scripts from the repo
Checking only the .sh suffix was omitting ./configure and potentially
other bash scripts which don't necessarily have to include said suffix
in their name.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I6196559e8875de46f80d9c8426577a1a79b5996d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6026
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-02-04 16:11:20 +00:00
Michal Berger
bb0f78a278 configure: Make code compliant with shellcheck
Make sure to at least cover directives check_format.sh is looking
for.

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I51750c9c8ee627de4dbab8e0e4933eb39e84c527
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6025
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-02-04 16:11:20 +00:00
Michal Berger
5ccabc8f27 configure: Fix Bash style syntax to be compliant with shfmt
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Change-Id: I7858a32bb3186df89844407cfc55c8c76b1dddd4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6024
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
2021-02-04 16:11:20 +00:00
Michal Berger
238251a10b sync_dev_uevents: Break from the loop if kernel seqnum matches mdev's
Change-Id: I68b1edf48eb7b243647b3e980d989c580015f812
Signed-off-by: Michal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4710
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-04 16:10:49 +00:00
wanghailiangx
0b6f2e236d example/nvme/plugin: set bs 4160 for Extended Data LBA
The original value of bs is 4096, we can rewrite it in another script.
When spdk_nvme_ns_supports_extended_lba(ns) is 1, we need to
test with an integer multiple value of extended_sector_size, such as 4160.

Change-Id: I8257bee4f741f62597bb2bb645ee9c59cf57bf33
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6018
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
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-02-04 08:45:01 +00:00
Nick Connolly
9e422bd76a test/blob: Use CFLAGS when checking CUnit version
If the CUnit include files are located through CFLAGS rather being
in one of the system include directories, then the version test will
fail and blob.c unit tests will be skipped. Specify CFLAGS as part of
the CC command.

If the version check fails, clean won't be run to remove any left over
artifacts. This can occur if CUnit is being built externally and gets
cleaned before SPDK. Add an extra definition (ALL_DIRS) to control
compilation, so that clean will always be run.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I6099fceb14cfc6473a6b8feed746d2b44b8d291a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6054
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-04 08:44:30 +00:00
Nick Connolly
2a0c2a2dcc configure: Adjust platform tests for portability
Explicitly test sys_host against "Linux" which is clearly the intent
and matches the behaviour described in the comments.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Ic79d32b5d58bf556847849817e6bd72f70363335
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6055
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-04 08:44:13 +00:00
Richael Zhuang
568915b6e4 sock: update sock_map_release comment
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: Icfeb9254f386fb5da6a5bde88b164bd0933f8889
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6070
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
2021-02-04 08:43:31 +00:00
Karol Latecki
738cdf143f scripts/pkgdep.sh: install pyelftools for DPDK
Recent builds with mainline DPDK failed due to missing
python dependency "elftools". This patch adds it to
our system provisioning scripts.

Fixes #1770

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: I9e3879d9bddd64bb0f7be81120e5fadebefa9eb8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6103
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-02-04 08:43:05 +00:00
Rafal Stefanowski
34584d2598 doc/bdev: Update OCF needed memory formula
Signed-off-by: Rafal Stefanowski <rafal.stefanowski@intel.com>
Change-Id: I2f4ee4cd942a69a35004dc83f8c428d7c1604906
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6105
Community-CI: Broadcom CI
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: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2021-02-04 08:42:45 +00:00
Ziye Yang
d4c412720f test/nvmf: Add the digest test in multipath.sh
Since this script is only running tcp transport,
so we can enable the header and data digest configuration
when running nvme connect option.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I9954af0fc9798cc565c2a439ecba1707d3629e83
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6119
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: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-02-04 08:42:33 +00:00
paul luse
d959e41c80 LICENSE: add info about submodules
Make it clear that each submodule carries its own license.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I2e467df995429f3a87140288b8a8488eccb48139
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6123
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>
Community-CI: Mellanox Build Bot
2021-02-04 08:42:09 +00:00
Nick Connolly
7f293c58a5 test/iscsi: initialize mutex for portability
For correct behaviour, pthread_mutex must be initialized before use.
Add static initialization to a couple of structures containing a mutex.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I7049824bb292135dbebab201083a1858597f94d1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6124
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@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>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-04 08:41:56 +00:00
Mao Jiang
6b3ec9683e nvme/rdma: Fix rdma ctrlr creating qpair memory leak
Change-Id: Ie94cacac0b8dcf90b0243e8d568bb728dc7d3045
Signed-off-by: Mao Jiang <maox.jiang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6126
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: Aleksey Marchuk <alexeymar@mellanox.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-04 08:41:33 +00:00
Tomasz Zawadzki
a8104d66d9 test/check_so_deps: move checking Makefile and .so to run_test
Moved the test to a separate function so it runs under run_test.
This will make sure the logs print out "START TEST" and additionally
that time taken will be tracked separately.

It might have been misleading to include results of this test
right after confirm_abi_deps. This could lead to belive that it
was output of confirm_abi_deps. See snippet:

************************************
START TEST confirm_abi_deps
************************************
* Running confirm_abi_deps against spdk_abi_latest
Processed 60 objects.

real	0m3.970s
user	0m3.220s
sys	0m0.600s
************************************
END TEST confirm_abi_deps
************************************
---------------------------------------------------------------------
there was a dependency mismatch in the library nvme
The makefile lists: 'log sock util rdma vfio_user'
readelf outputs   : 'log rdma sock util'
---------------------------------------------------------------------
shared object test failed


Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ie0768b8a9c7390f51d35b2e879f66854a4da2226
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6143
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>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-02-04 08:40:38 +00:00
Allen Zhu
306ad7ff17 nvme/perf: Add missing key (ns) of Transport ID in perf help
NVMe namespace ID (i.e., ns) is a key of Transport ID, which is
supported by perf, but it's missed in the help. In addtion, a
note is added to specify multiple '-r' parameters can be used
to test multiple disks/targets.

Signed-off-by: Allen Zhu <allenz@mellanox.com>
Change-Id: Icf55e6213a63d97396bdc7022e4c0d09c67aab9a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6141
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: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2021-02-04 08:39:51 +00:00
Richael Zhuang
c0a3cf7b88 sock: add enable_quickack and enable_placement_id when writing json config
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Change-Id: If67dcb6bf7b9742d2c96481057b472e31e87e87d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6144
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: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
2021-02-04 08:39:33 +00:00
Matthew King
b56f1ef5e4 Cleanup: Fix boolean arg in fio plugin.
In fio, bools are represented as ints.  They have to be read into int entries
in the options struct, or memory corruption may occur.
Also provided a default to bring it more in line with existing fio code.

Signed-off-by: Matthew King <matthew.king@xilinx.com>
Change-Id: Ib718653d6597a287bf8ff96d2fb864e46295751d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6147
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>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-02-04 08:38:55 +00:00
Nick Connolly
ed1dcc1c50 unittest/nvme: initialize mutex for portability
For correct behaviour, pthread_mutex must be initialized before use
and destroyed before the memory is zeroed. Add mutex initialization
and destroy calls to test_nvme_init_controllers.

Tested with a pthreads library that contains debugging code to
check the mutex state.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I9a0509bee176940e1aa46bd5de4c6ad396b787e1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6152
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: Ben Walker <benjamin.walker@intel.com>
2021-02-04 08:38:44 +00:00
Nick Connolly
b6748a41eb test/nvme_ctrlr_ocssd_cmd: initialize mutex
For correct behaviour, pthread_mutex must be initialized before use
and destroyed afterwards. Add mutex initialization to
DECLARE_AND_CONSTRUCT_CTRLR and add DECONSTRUCT_CTRLR
to cleanup afterwards.

Tested with a pthreads library that contains debugging code to
check the mutex state.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Ifefec17b44ac01769fd9d041119fa093b4e9d8b2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6155
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: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-02-04 08:38:27 +00:00
Nick Connolly
05aaac9c14 test/nvme_ctrlr_cmd: initialize mutex
For correct behaviour, pthread_mutex must be initialized before use
and destroyed afterwards. Add mutex initialization to
DECLARE_AND_CONSTRUCT_CTRLR and add DECONSTRUCT_CTRLR
to cleanup afterwards.

Tested with a pthreads library that contains debugging code to
check the mutex state.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: Id1d62e6f76548bd8e259d4d9c4d453a3218b0b1c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6159
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: Ben Walker <benjamin.walker@intel.com>
2021-02-04 08:38:12 +00:00
Nick Connolly
b34fb47d8c test/nvme_ctrlr: initialize mutex for portability
For correct behaviour, pthread_mutex must be initialized before use
and destroyed afterwards. An already initialized mutex should not
be re-initialized.

Remove the call to mutex_init from setup_qpairs since it will be done
in nvme_ctrlr_construct.

Add calls to nvme_ctrlr_construct where nvme_ctrlr_destruct is
called without a matching construct.

Add missing calls to mutex_init and mutex_destroy as required.

Tested with a pthreads library that contains debugging code to
check the mutex state.

Signed-off-by: Nick Connolly <nick.connolly@mayadata.io>
Change-Id: I0ee97a70d67157668cd8921fbee03d976d4d607d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6161
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: Ben Walker <benjamin.walker@intel.com>
2021-02-04 08:37:59 +00:00
Ziye Yang
74b2916c4a nvme/rdma: Only wait for the RDMA event if spdk_rdma_qp_disconnect return 0
If rdma_qp_disconnect is not correctly sent out, we will not wait
for the event.

Change-Id: I99701e421dc93909d481ccf35e9bfd8004e60da8
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6163
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: <dongx.yi@intel.com>
2021-02-04 08:37:38 +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
Rui Chang
1293377629 lib/util: Fix valgrind error reported on ARM platform
Signed-off-by: Rui Chang <rui.chang@arm.com>
Change-Id: I244a1b0350b4426666e390781b500de65d250c09
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6214
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-02-04 08:35:59 +00:00
Krzysztof Karas
de7f290830 spdk_top: delete unused variable in show poller function
Deletes poller_counter variable as it is used only when constructing
ncurses window and always equal to 0.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: Ib837064e1bbbe59984802d3ec96cb4c46dcf8407
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6198
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-02-04 08:35:39 +00:00
Krzysztof Karas
0d85c5bba9 spdk_top: unify opening and closing pop-up details windows
Changes threads details pop-up and pollers pop-up to open with Enter key
and close with Esc key only. This is to avoid confusion in the future
as now those pop-ups can be opened and closed with both Enter and Esc
and and others can only be closed with Esc key.

Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
Change-Id: I7e8c5a172346662a21f65c7193fc1cbd830fd1e7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6196
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-02-04 08:35:39 +00:00
Tomasz Zawadzki
e3d29a3012 lib/event: do not spawn a thread for each reactor
Those spdk threads were neither used nor tracked in event framework.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1becee6390e172a10e08754703e018f7c44e30df
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6213
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-02-04 08:35:08 +00:00
Tomasz Zawadzki
ce9efeda3a lib/vhost: set g_vhost_core_mask to all cores rather than threads
spdk_vhost_init() relies on having a thread on each reactor.
Every vhost controller could be created on the same core and
even passing --cpumask when creating would not affect it.

This has happened before, see patch (7cc83b62).

This patch modifies the g_vhost_core_mask to match the actual
cores in use.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I42a07c5f99690bfa4ecd2a5b9b7b04d1aa7d2800
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6188
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-02-04 08:35:08 +00:00
Tomasz Zawadzki
b74363bcdf lib/vhost: force cpumask to be subset of application's CPU mask
Documentation for vhost target states that CPU mask must be a subset
of application CPU mask. This wasn't enforced right now and allowed
the cpumask on controller creation so long as at least single
CPU core overlapped with application's CPU mask.

This might have been misleading and covered up user configuration errors.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I03f959ec37efd0be9b98cff9c93c5f996b04af35
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6212
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-02-04 08:35:08 +00:00
Tomasz Zawadzki
daab1abc4f test/vhost: verify cpumask argument for controller creation
`--cpumask` argument for vhost controller creation was
untested. This patch specifies this argument and verifies output
under following conditions:
- no cpumask, resulting in it being equal to the app cpumask
- cpumask equal to app cpumask
- single core
- single non-main core
- two cores

It was motivated by recent changes to reactor code affecting
vhost without it being caught by CI. See commit 7cc83b62.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I92c603061619092007bc27a189d3d8787461a16f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6211
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-02-04 08:35:08 +00:00
Jim Harris
710838103b env_dpdk: add rte_ethdev dependency
As of DPDK main commit 682a6454 ("power: add ethdev
power management"), rte_power depends on rte_ethdev.
So add rte_ethdev library, but only on Linux since
that is the only place where we use rte_power.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ibc3473d6ec75c14a8c0c5517616950017cb2ea96
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6210
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: <dongx.yi@intel.com>
2021-02-04 08:34:30 +00:00
Karol Latecki
4dd1548be3 scripts/nvmf_perf: check "extra_params" key berofe accessing it
If config without this field was used then
script resulted in KeyError exception.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: Icf0b270d28dcc6bf44b66c4b9ed583a6b3ef08b6
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6204
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
2021-02-04 08:33:43 +00:00
Karol Latecki
62c2c1c110 scripts/nvmf_perf: fix pylint E1111 error - assignment on no return
Fix assigning variables from functions which return nothing.

Change-Id: Ic54dc0d42e3339cda23970ed347ac6f7bf92e795
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6203
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Community-CI: Mellanox Build Bot
2021-02-04 08:33:43 +00:00
Karol Latecki
6882e04563 scripts/nvmf_perf: fix pylint C0411 wrong import order
Standard lib modules first, then pip installed modules
and local modules last.

Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Change-Id: If0159fad29bab5bef0b69aa803e3cea429cc5f25
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6202
Reviewed-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
2021-02-04 08:33:43 +00:00
Ziye Yang
5206698e77 nvme/tcp: Add the implementation to get the optimal polling group
Add the real support in nvme tcp transport.

Change-Id: I2aa9b0284d6fe009925e67f602a055e787f77987
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5734
Community-CI: Broadcom CI
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>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2021-02-04 08:30:54 +00:00
Ziye Yang
e749b5d3ec nvme: Add the interface to get the optimal polling group
This patch is used to add spdk_nvme_poll_group_get_optimal
public API.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: Iee34c89e0e1ff1f81167b18e198c144ca28f71de
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3311
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: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-02-04 08:30:54 +00:00
Tomasz Zawadzki
7cc83b6258 Revert "lib/event: do not spawn a thread for each reactor"
This reverts commit 72eed604b4.

spdk_vhost_init() relies on having a thread on each reactor.
Without the revert, every vhost controller is created on the same
core and even passing --cpumask when creating does not affect it.

Proper fix would be to change spdk_vhost_init(),
but would require additional testing. For now revert the patch
that spawned always idle threads.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I0dbd6c9fe1d9d23ada260da8fc7b48086223c632
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6186
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>
Community-CI: Mellanox Build Bot
2021-02-01 08:04:51 +00:00
Tomasz Zawadzki
c15af452f6 doc: added scheduler framework documentation
Added changelog entry for dynamic scheduler, along with general
information on scheduler framework and behaviour of particular
scheduler implemenations.

Change-Id: I9fcef56323c4be136b6b531297b070562981eee5
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6151
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-01-29 18:21:13 +00:00
andypma
7741de6b7d vhost/compat: add RTE_VHOST_USER_ASYNC_COPY flag when used IOVA_PA mode
Recently, we discovered that under the SPDK + UIO mode, it is possible that vm may be wrong when doing io.
such as:
[root@VM_6_151_centos ~]# mkfs.xfs /dev/vdc
meta-data=/dev/vdc               isize=512    agcount=4, agsize=234421142 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=937684566, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=457853, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
bad magic number
bad magic number
Metadata corruption detected at xfs_sb block 0x0/0x1000
libxfs_writebufr: write verifer failed on xfs_sb bno 0x0/0x1000

the github issue link: https://github.com/spdk/spdk/issues/1738
After investigation, we found as below:
The qemu set to VHOST_USER_SET_MEM_TABLE then call vhost_user_set_mem_table(dpdk version spdk-20.11)->mmap(without MAP_POPULATE)
the mmap will only return the virtual address not map the virtual address to the physical address actually.
after call vtophys_notify->vtophys_get_paddr_pagemap, we will get a wrong physical(the virtual address we not access)

So this patch is to set MAP_POPULATE during we use SPDK + UIO.

Signed-off-by: andypma <andypma@tencent.com>
Reviewed-by: Zhigang Lu <tonnylu@tencent.com>
Reviewed-by: Xun Ni <richardni@tencent.com>
Reviewed-by: YuZhoujian <windyu@tencent.com>
Reviewed-by: LuWeiKang <luweikang@tencent.com>
Change-Id: Ib921b6d7381f46bb5894ed787cef52e02524197a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5970
Reviewed-by: Changpeng Liu <changpeng.liu@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>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
2021-01-29 15:16:06 +00:00
Changpeng Liu
3b673b8431 nvmf/vfio_user: disable vfio_user by default
Users can use "--with-vfio-user" to enable it when testing it.
For CI configuration, we add a new test flag SPDK_TEST_VFIOUSER
to enable CI tests.

Change-Id: Id284df721171d01cc52491ebf4088bcc17eee147
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6139
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-01-29 15:15:23 +00:00
Tomasz Zawadzki
f58b29784a doc: list methods to convert from legacy config
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Iccc272ddaeefad3d02b9d63607173bd2b76bd112
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6154
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-29 15:15:13 +00:00
Alexey Marchuk
4a2c27f717 nvmf/rdma: Handle CQ resize for iWARP transport
Since iWARP doesn't support CQ resize, we can't
accept new qpairs when CQ size is insufficient.
In other case if we accept new qpairs we can
et CQ overrun and receive IBV_EVENT_CQ_ERR ibv
async event. In that case we will have to close
all qpairs that use this CQ.

Part of the fix for issue #1747

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I30b9163a7c8abb8651f8813c6bbdb80000741c9c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6106
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: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
2021-01-29 15:14:59 +00:00
Alexey Marchuk
137866e573 nvmf/rdma: Fix search for req to abort when SRQ enabled
When SRQ is enabled, all qpairs share common pool of
rdma requests and we should check that rdma_req which
cid matches belongs to the correct qpair.

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I2505ca39c5110e8e67a48abbe34b6df9ff00229f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6110
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Michael Haeuptle <michaelhaeuptle@gmail.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
2021-01-28 10:27:08 +00:00
Tomasz Zawadzki
19dddb3e32 version: SPDK 21.04 pre
This is first commit that should go into latest SPDK
after the code freeze for SPDK 21.01.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ieeef261f4a83183946358916a084fef886339d83
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6052
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-26 17:44:02 +00:00
476 changed files with 23930 additions and 6114 deletions

5
.gitignore vendored
View File

@ -2,12 +2,17 @@
*.a
*.cmd
*.d
*.dll
*.exe
*.gcda
*.gcno
*.kdev4
*.ko
*.lib
*.log
*.o
*.obj
*.pdb
*.pyc
*.so
*.so.*

2
.gitmodules vendored
View File

@ -1,6 +1,6 @@
[submodule "dpdk"]
path = dpdk
url = https://github.com/spdk/dpdk.git
url = https://git.quacker.org/d/numam-dpdk.git
[submodule "intel-ipsec-mb"]
path = intel-ipsec-mb
url = https://github.com/spdk/intel-ipsec-mb.git

View File

@ -1,6 +1,215 @@
# Changelog
## v21.01: (Upcoming Release)
## v21.04.1: (Upcoming Release)
## v21.04: ZNS NVMe bdev, PMR, ADQ initiator, RPM
### accel
Two new accelerated crc32 functions `spdk_accel_submit_crc32cv` and
`spdk_accel_batch_prep_crc32cv` are added in order to provide the
chained accelerated CRC32 computation support.
### bdev
For `bdev_ocssd_create` RPC, the optional parameter `range` was removed.
Only one OCSSD bdev can be created for one OCSSD namespace.
Removed the `spdk_bdev_open` from bdev library API.
Removed the `spdk_vbdev_register` and `spdk_bdev_part_base_construct` from bdev module API.
Removed the `config_text` function for bdev modules to report legacy config.
Added `spdk_bdev_get_max_active_zones` API to display maximum number active zones of a given bdev.
Added `spdk_bdev_get_max_zone_append_size` API to display maximum zone append data transfer size.
### bdev_nvme
Added support for zoned namespaces.
### blobstore
Removed the `spdk_bdev_create_bs_dev_from_desc` and `spdk_bdev_create_bs_dev` API.
### env
Added `spdk_pci_device_allow` API to allow applications to add PCI addresses to
the allowed list after the application has started.
Removed the `pci_whitelist`, `pci_blacklist` and `master_core` members of struct `spdk_env_opts`.
Added hotplug support based on uevent in `pci_event.c`. Added usage of this functionality in
nvme, virtio-scsi and virtio_blk libraries. Please see the new API `spdk_pci_event_listen`,
`spdk_pci_get_event`, `spdk_pci_register_error_handler` and `spdk_pci_unregister_error_handler`.
### event
Removed the `config_file`, `max_delay_us`, `pci_whitelist`
and `pci_blacklist` members of struct `spdk_app_opts`.
### idxd
A new API `spdk_idxd_device_needs_rebalance` was added so that users of the library
can know whether they need to rebalance the flow control for the channel
that was just added/removed. This is based on how the low level library
shares devices amongst channels.
The API `spdk_idxd_reconfigure_chan` had the `num_channels` removed as this
is now tracked in the library. The app makes use the new API above to
determine whether to rebalance or not. This applies to `spdk_idxd_configure_chan`
as well.
The API `spdk_idxd_put_channel` now returns the rebalance state for the
underlying device.
### iscsi
A security vulnerability has been identified and fixed in the SPDK iSCSI target.
A TEXT PDU with no data, but CONTINUE flag set, would result in a NULL pointer dereference
and crash the SPDK iSCSI target process. All users of the SPDK iSCSI target
are recommended to update. All SPDK versions <= v21.01 are affected.
### net
The net library is deprecated and will be removed in the 21.07 release.
### nvme
Added a new function `spdk_nvme_ctrlr_get_regs_pmrcap` to get the PMR capabilities.
Added an accelerated table pointer in `spdk_nvme_poll_group`
which can be used to provide the accelerated functions by users with
hardware engine, such as crc32c accelerated function.
Added new functions `spdk_nvme_ctrlr_get_pmrsz`, `spdk_nvme_ctrlr_enable_pmr`,
`spdk_nvme_ctrlr_disable_pmr`, `spdk_nvme_ctrlr_map_pmr` and `spdk_nvme_ctrlr_unmap_pmr`.
Added NVMe transport operations to enable, disable, map and unmap the PMR.
Added `spdk_nvme_qpair_get_optimal_poll_group` function and `qpair_get_optimal_poll_group`
function pointer in spdk_nvmf_transport_ops structure in order to add the qpair to the most
suitable polling group.
Added OPTPERF and namespace optimal performance fields to nvme_spec.h.
Added `spdk_nvme_set_hotplug_filter` API to allow applications to choose which
hot-inserted SSDs should be probed. This is useful for use cases where multiple
independent SPDK processes are running on one node. The filter function can
then be implemented in these processes to decide which SSDs to probe based on
the new SSD's PCI address.
New functions `spdk_nvme_poll_group_get_stats` and `spdk_nvme_poll_group_free_stats`
were added. These functions allow to get transport statistics per NVME poll group.
Added `spdk_nvme_map_cmd` API to map the NVMe command with SGL cases.
Added support for vector variant of ZNS zone append commands with new API
`spdk_nvme_zns_zone_appendv` and `spdk_nvme_zns_zone_appendv_with_md`.
Added `spdk_nvme_zns_ns_get_max_open_zones` and `spdk_nvme_zns_ns_get_max_active_zones` API,
to display maximum number of open and active zones of the given namespace.
Added `spdk_nvme_zns_ns_get_zone_size_sectors` API to provide size of zone in number of
sectors.
Added `spdk_nvme_qpair_get_id` API to display the ID of the specified qpair.
### nvmf
Removed the `spdk_nvmf_tgt_listen` and `spdk_nvmf_subsystem_add_ns` API.
Added new APIs:
- `spdk_nvmf_poll_group_dump_stat` (function in `nvmf.h`).
- `poll_group_dump_stat` (transport op in `nvmf_transport.h`).
The following APIs have been deprecated and will be removed in SPDK 21.07:
- `spdk_nvmf_poll_group_get_stat` (function in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_get_stat` (function in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_free_stat`(function in `nvmf.h`),
- `spdk_nvmf_rdma_device_stat` (struct in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_stat` (struct in `nvmf.h`),
- `poll_group_get_stat` (transport op in `nvmf_transport.h`),
- `poll_group_free_stat` (transport op in `nvmf_transport.h`).
See header files for details.
The `trtype` field in JSON returned by `nvmf_get_stats` RPC contains now the name of the transport,
which is the same as the type for defined transports and more informative for a custom transport.
Added `hdgst` and `ddgst` parameters to `bdev_nvme_attach_controller` RPC in order change
state of TCP header and data digest.
Added `num_cqe` parameter to `nvmf_create_transport` RPC to set number of completion queues (CQ)
for RDMA transport. Useful when CQ resize operation is not supported, for example iWARP.
### ocf
Updated OCF submodule to v20.12.2
Added `bdev_ocf_set_cache_mode` RPC to dynamically switch cache mode of OCF bdev.
### opal
Removed the `spdk_opal_supported` API.
### raid
For `bdev_raid_create` RPC, the deprecated parameter `strip_size` was removed.
### rpc
New RPC `bdev_nvme_get_transport_statistics` was added, it allows to get transport statistics
of nvme poll groups.
Parameter `enable-zerocopy-send` of RPC `sock_impl_set_options` is deprecated and will be removed in SPDK 21.07,
use `enable-zerocopy-send-server` or `enable-zerocopy-send-client` instead.
Parameter `disable-zerocopy-send` of RPC `sock_impl_set_options` is deprecated and will be removed in SPDK 21.07,
use `disable-zerocopy-send-server` or `disable-zerocopy-send-client` instead.
### rpm
Added support for new RPM spec, rpmbuild/spdk.spec, which can be used for packaging the
SPDK. The pkg/spdk.spec is considered to be deprecated and scheduled for removal in SPDK 21.07.
See [RPM documentation](https://spdk.io/doc/rpm.html) for more details.
### sock
The type of `enable_placement_id` in struct `spdk_sock_impl_opts` is changed from
bool to int. We can use RPC to configure different value of `enable_placement_id`.
Then we can leverage SO_INCOMING_CPU to get placement_id, which aims to utilize
CPU cache locality, enabled by setting enable_placement_id=2.
A new socket placement mode called PLACEMENT_MARK has been added. Some NICs allow
sockets to be marked using the SO_MARK socket option as a hint for which hardware
queue they should be associated with. This mode leverages that by setting the same
value for all sockets within a poll group.
New parameters `enable_zerocopy_send_server` and `enable_zerocopy_send_client` were added
to struct spdk_sock_impl_opts, these parameters enable or disable zero copy send for server
and client sockets which are created using `spdk_sock_listen` and `spdk_sock_listen_ext` (server);
`spdk_sock_connect` and `spdk_sock_connect_ext` (client) functions. Existing parameter
`enable_zerocopy_send` enables or disables zero copy send for both server and client sockets.
### thread
A new API `spdk_io_channel_get_io_device` was added to get the io_device for the specified
I/O channel.
Added `spdk_thread_set_interrupt_mode` function in order to set present spdk_thread into
interrupt mode or back to poll mode. It is valid only when thread interrupt facility is
enabled by `spdk_interrupt_mode_enable`.
Added `spdk_poller_register_interrupt` function to mark that the poller is capable of
entering interrupt mode. Callback function will be called when the poller must transition
into or out of interrupt mode.
### virtio
Added the `bdev_virtio_blk_set_hotplug` RPC for the virtio blk pci device.
## v21.01:
### bdev
@ -75,6 +284,10 @@ The `--pci-blacklist` command line option has been deprecated, replaced with
The `--pci-whitelist/-W` command line options have been deprecated, replaced with
`--pci-allowed/-A`.
Added new experimental `dynamic` scheduler that rebalances idle threads, adjusts CPU frequency
using dpdk_governor and turns idle reactor cores to interrupt mode. Please see
[scheduler documentation](https://www.spdk.io/doc/scheduler.html) for details.
## ioat
The PCI BDF whitelist option has been removed from the `ioat_scan_accel_engine` RPC.

6
CONFIG
View File

@ -87,6 +87,9 @@ CONFIG_ENV=
# installation.
CONFIG_DPDK_DIR=
# This directory should contain 'include' and 'lib' directories for WPDK.
CONFIG_WPDK_DIR=
# Build SPDK FIO plugin. Requires CONFIG_FIO_SOURCE_DIR set to a valid
# fio source code directory.
CONFIG_FIO_PLUGIN=n
@ -121,7 +124,8 @@ CONFIG_VHOST=y
CONFIG_VIRTIO=y
# Build custom vfio-user transport for NVMf target and NVMe initiator.
CONFIG_VFIO_USER=y
CONFIG_VFIO_USER=n
CONFIG_VFIO_USER_DIR=
# Build with PMDK backends
CONFIG_PMDK=n

13
LICENSE
View File

@ -1,3 +1,16 @@
The SPDK repo contains multiple git submodules each with its own
license info. Unless otherwise noted all other code in this repo
is BSD as stated below.
Submodule license info:
dpdk: see dpdk/license
intel-ipsec-mb: see intel-ipsec-mb/LICENSE
isa-l: see isa-l/LICENSE
libvfio-user: see libvfio-user/LICENSE
ocf: see ocf/LICENSE
The rest of the SPDK repo:
BSD LICENSE
Copyright (c) Intel Corporation.

View File

@ -63,6 +63,13 @@ endif
endif
endif
ifeq ($(OS),Windows)
ifeq ($(CURDIR)/wpdk/build,$(CONFIG_WPDK_DIR))
WPDK = wpdk
DIRS-y += wpdk
endif
endif
ifeq ($(CONFIG_SHARED),y)
LIB = shared_lib
else
@ -101,10 +108,11 @@ uninstall: $(DIRS-y)
$(Q)echo "Uninstalled spdk"
ifneq ($(SKIP_DPDK_BUILD),1)
dpdkbuild: $(DPDK_DEPS)
dpdkdeps $(DPDK_DEPS): $(WPDK)
dpdkbuild: $(WPDK) $(DPDK_DEPS)
endif
lib: $(DPDKBUILD) $(VFIOUSERBUILD)
lib: $(WPDK) $(DPDKBUILD) $(VFIOUSERBUILD)
module: lib
shared_lib: module
app: $(LIB)
@ -120,7 +128,7 @@ mk/cc.mk:
false
build_dir: mk/cc.mk
$(Q)mkdir -p build/lib/pkgconfig
$(Q)mkdir -p build/lib/pkgconfig/tmp
$(Q)mkdir -p build/bin
$(Q)mkdir -p build/fio
$(Q)mkdir -p build/examples

View File

@ -41,7 +41,10 @@ DIRS-y += iscsi_top
DIRS-y += iscsi_tgt
DIRS-y += spdk_tgt
DIRS-y += spdk_lspci
ifneq ($(OS),Windows)
# TODO - currently disabled on Windows due to lack of support for curses
DIRS-y += spdk_top
endif
ifeq ($(OS),Linux)
DIRS-$(CONFIG_VHOST) += vhost
DIRS-y += spdk_dd

View File

@ -37,6 +37,7 @@
#include "spdk/event.h"
#include "spdk/fd.h"
#include "spdk/string.h"
#include "spdk/util.h"
#include "spdk/vmd.h"
#include <libaio.h>

View File

@ -84,6 +84,7 @@
#define MAX_POLLER_IND_STR_LEN 8
#define MAX_CORE_MASK_STR_LEN 16
#define MAX_CORE_STR_LEN 6
#define MAX_CORE_FREQ_STR_LEN 18
#define MAX_TIME_STR_LEN 12
#define MAX_POLLER_RUN_COUNT 20
#define MAX_PERIOD_STR_LEN 12
@ -91,16 +92,14 @@
#define FROM_HEX 16
#define THREAD_WIN_WIDTH 69
#define THREAD_WIN_HEIGHT 9
#define THREAD_WIN_HOR_POS 75
#define THREAD_WIN_FIRST_COL 2
#define CORE_WIN_FIRST_COL 16
#define CORE_WIN_WIDTH 48
#define CORE_WIN_HEIGHT 9
#define CORE_WIN_HOR_POS 60
#define CORE_WIN_HEIGHT 11
#define POLLER_WIN_HEIGHT 8
#define POLLER_WIN_WIDTH 64
#define POLLER_WIN_FIRST_COL 14
#define POLLER_WIN_HOR_POS 59
#define FIRST_DATA_ROW 7
enum tabs {
THREADS_TAB,
@ -143,7 +142,6 @@ struct core_info {
uint8_t g_sleep_time = 1;
uint16_t g_selected_row;
uint16_t g_max_selected_row;
struct rpc_thread_info *g_thread_info[MAX_THREADS];
const char *poller_type_str[SPDK_POLLER_TYPES_COUNT] = {"Active", "Timed", "Paused"};
const char *g_tab_title[NUMBER_OF_TABS] = {"[1] THREADS", "[2] POLLERS", "[3] CORES"};
struct spdk_jsonrpc_client *g_rpc_client;
@ -180,6 +178,7 @@ static struct col_desc g_col_desc[NUMBER_OF_TABS][TABS_COL_COUNT] = {
{.name = "Poller count", .max_data_string = MAX_POLLER_COUNT_STR_LEN},
{.name = "Idle [us]", .max_data_string = MAX_TIME_STR_LEN},
{.name = "Busy [us]", .max_data_string = MAX_TIME_STR_LEN},
{.name = "Frequency [MHz]", .max_data_string = MAX_CORE_FREQ_STR_LEN},
{.name = (char *)NULL}
}
};
@ -258,6 +257,7 @@ struct rpc_core_info {
uint32_t lcore;
uint64_t busy;
uint64_t idle;
uint32_t core_freq;
struct rpc_core_threads threads;
};
@ -275,7 +275,6 @@ struct rpc_threads_stats g_threads_stats;
struct rpc_pollers_stats g_pollers_stats;
struct rpc_cores_stats g_cores_stats;
struct rpc_poller_info g_pollers_history[RPC_MAX_POLLERS];
struct rpc_thread_info g_thread_history[RPC_MAX_THREADS];
static void
init_str_len(void)
@ -475,6 +474,7 @@ static const struct spdk_json_object_decoder rpc_core_info_decoders[] = {
{"lcore", offsetof(struct rpc_core_info, lcore), spdk_json_decode_uint32},
{"busy", offsetof(struct rpc_core_info, busy), spdk_json_decode_uint64},
{"idle", offsetof(struct rpc_core_info, idle), spdk_json_decode_uint64},
{"core_freq", offsetof(struct rpc_core_info, core_freq), spdk_json_decode_uint32, true},
{"lw_threads", offsetof(struct rpc_core_info, threads), rpc_decode_cores_lw_threads},
};
@ -544,12 +544,60 @@ rpc_send_req(char *rpc_name, struct spdk_jsonrpc_client_response **resp)
return 0;
}
static int
sort_threads(const void *p1, const void *p2)
{
const struct rpc_thread_info thread_info1 = *(struct rpc_thread_info *)p1;
const struct rpc_thread_info thread_info2 = *(struct rpc_thread_info *)p2;
uint64_t count1, count2;
switch (g_current_sort_col[THREADS_TAB]) {
case 0: /* Sort by name */
return strcmp(thread_info1.name, thread_info2.name);
case 1: /* Sort by core */
count2 = thread_info1.core_num;
count1 = thread_info2.core_num;
break;
case 2: /* Sort by active pollers number */
count1 = thread_info1.active_pollers_count;
count2 = thread_info2.active_pollers_count;
break;
case 3: /* Sort by timed pollers number */
count1 = thread_info1.timed_pollers_count;
count2 = thread_info2.timed_pollers_count;
break;
case 4: /* Sort by paused pollers number */
count1 = thread_info1.paused_pollers_count;
count2 = thread_info2.paused_pollers_count;
break;
case 5: /* Sort by idle time */
count1 = thread_info1.idle - thread_info1.last_idle;
count2 = thread_info2.idle - thread_info2.last_idle;
break;
case 6: /* Sort by busy time */
count1 = thread_info1.busy - thread_info1.last_busy;
count2 = thread_info2.busy - thread_info2.last_busy;
break;
default:
return 0;
}
if (count2 > count1) {
return 1;
} else if (count2 < count1) {
return -1;
} else {
return 0;
}
}
static int
get_data(void)
{
struct spdk_jsonrpc_client_response *json_resp = NULL;
struct rpc_thread_info *thread_info;
struct rpc_core_info *core_info;
struct rpc_threads_stats threads_stats;
uint64_t i, j;
int rc = 0;
@ -559,24 +607,37 @@ get_data(void)
}
/* Decode json */
memset(&threads_stats, 0, sizeof(threads_stats));
if (spdk_json_decode_object(json_resp->result, rpc_threads_stats_decoders,
SPDK_COUNTOF(rpc_threads_stats_decoders), &g_threads_stats)) {
SPDK_COUNTOF(rpc_threads_stats_decoders), &threads_stats)) {
rc = -EINVAL;
goto end;
}
/* This is to free allocated char arrays with old thread names */
free_rpc_threads_stats(&g_threads_stats);
spdk_jsonrpc_client_free_response(json_resp);
for (i = 0; i < g_threads_stats.threads.threads_count; i++) {
thread_info = &g_threads_stats.threads.thread_info[i];
g_thread_info[thread_info->id] = thread_info;
for (i = 0; i < threads_stats.threads.threads_count; i++) {
for (j = 0; j < g_threads_stats.threads.threads_count; j++) {
if (g_threads_stats.threads.thread_info[j].id == threads_stats.threads.thread_info[i].id) {
threads_stats.threads.thread_info[i].last_busy = g_threads_stats.threads.thread_info[j].busy;
threads_stats.threads.thread_info[i].last_idle = g_threads_stats.threads.thread_info[j].idle;
}
}
}
memcpy(&g_threads_stats, &threads_stats, sizeof(struct rpc_threads_stats));
qsort(&g_threads_stats.threads.thread_info, threads_stats.threads.threads_count,
sizeof(g_threads_stats.threads.thread_info[0]), sort_threads);
rc = rpc_send_req("thread_get_pollers", &json_resp);
if (rc) {
goto end;
}
/* Free old pollers values before allocating memory for new ones */
free_rpc_pollers_stats(&g_pollers_stats);
/* Decode json */
memset(&g_pollers_stats, 0, sizeof(g_pollers_stats));
if (spdk_json_decode_object(json_resp->result, rpc_pollers_stats_decoders,
@ -592,6 +653,9 @@ get_data(void)
goto end;
}
/* Free old cores values before allocating memory for new ones */
free_rpc_cores_stats(&g_cores_stats);
/* Decode json */
memset(&g_cores_stats, 0, sizeof(g_cores_stats));
if (spdk_json_decode_object(json_resp->result, rpc_cores_stats_decoders,
@ -604,7 +668,7 @@ get_data(void)
core_info = &g_cores_stats.cores.core[i];
for (j = 0; j < core_info->threads.threads_count; j++) {
g_thread_info[core_info->threads.thread[j].id]->core_num = core_info->lcore;
g_threads_stats.threads.thread_info[j].core_num = core_info->lcore;
}
}
@ -794,53 +858,6 @@ get_time_str(uint64_t ticks, char *time_str)
snprintf(time_str, MAX_TIME_STR_LEN, "%" PRIu64, time);
}
static int
sort_threads(const void *p1, const void *p2)
{
const struct rpc_thread_info *thread_info1 = *(struct rpc_thread_info **)p1;
const struct rpc_thread_info *thread_info2 = *(struct rpc_thread_info **)p2;
uint64_t count1, count2;
switch (g_current_sort_col[THREADS_TAB]) {
case 0: /* Sort by name */
return strcmp(thread_info1->name, thread_info2->name);
case 1: /* Sort by core */
count2 = thread_info1->core_num;
count1 = thread_info2->core_num;
break;
case 2: /* Sort by active pollers number */
count1 = thread_info1->active_pollers_count;
count2 = thread_info2->active_pollers_count;
break;
case 3: /* Sort by timed pollers number */
count1 = thread_info1->timed_pollers_count;
count2 = thread_info2->timed_pollers_count;
break;
case 4: /* Sort by paused pollers number */
count1 = thread_info1->paused_pollers_count;
count2 = thread_info2->paused_pollers_count;
break;
case 5: /* Sort by idle time */
count1 = thread_info1->idle - thread_info1->last_idle;
count2 = thread_info2->idle - thread_info2->last_idle;
break;
case 6: /* Sort by busy time */
count1 = thread_info1->busy - thread_info1->last_busy;
count2 = thread_info2->busy - thread_info2->last_busy;
break;
default:
return 0;
}
if (count2 > count1) {
return 1;
} else if (count2 < count1) {
return -1;
} else {
return 0;
}
}
static void
draw_row_background(uint8_t item_index, uint8_t tab)
{
@ -859,7 +876,7 @@ refresh_threads_tab(uint8_t current_page)
{
struct col_desc *col_desc = g_col_desc[THREADS_TAB];
uint64_t i, threads_count;
uint16_t j, k;
uint16_t j;
uint16_t col;
uint8_t max_pages, item_index;
static uint8_t last_page = 0;
@ -880,30 +897,16 @@ refresh_threads_tab(uint8_t current_page)
g_last_threads_count = threads_count;
}
/* Thread IDs starts from '1', so we have to take this into account when copying.
* TODO: In future we can have gaps in ID list, so we will need to change the way we
* handle copying threads list below */
memcpy(thread_info, &g_thread_info[1], sizeof(struct rpc_thread_info *) * threads_count);
for (i = 0; i < threads_count; i++) {
thread_info[i] = &g_threads_stats.threads.thread_info[i];
}
if (last_page != current_page) {
for (i = 0; i < threads_count; i++) {
/* Thread IDs start from 1, so we have to do i + 1 */
g_threads_stats.threads.thread_info[i].last_idle = g_thread_info[i + 1]->idle;
g_threads_stats.threads.thread_info[i].last_busy = g_thread_info[i + 1]->busy;
}
last_page = current_page;
}
max_pages = (threads_count + g_max_data_rows - 1) / g_max_data_rows;
qsort(thread_info, threads_count, sizeof(thread_info[0]), sort_threads);
for (k = 0; k < threads_count; k++) {
g_thread_history[thread_info[k]->id].busy = thread_info[k]->busy - thread_info[k]->last_busy;
g_thread_history[thread_info[k]->id].idle = thread_info[k]->idle - thread_info[k]->last_idle;
}
for (i = current_page * g_max_data_rows;
i < spdk_min(threads_count, (uint64_t)((current_page + 1) * g_max_data_rows));
i++) {
@ -947,7 +950,6 @@ refresh_threads_tab(uint8_t current_page)
col += col_desc[4].max_data_string + 2;
}
g_thread_history[thread_info[i]->id].idle = thread_info[i]->idle - thread_info[i]->last_idle;
if (!col_desc[5].disabled) {
if (g_interval_data == true) {
get_time_str(thread_info[i]->idle - thread_info[i]->last_idle, idle_time);
@ -959,7 +961,6 @@ refresh_threads_tab(uint8_t current_page)
col += col_desc[5].max_data_string;
}
g_thread_history[thread_info[i]->id].busy = thread_info[i]->busy - thread_info[i]->last_busy;
if (!col_desc[6].disabled) {
if (g_interval_data == true) {
get_time_str(thread_info[i]->busy - thread_info[i]->last_busy, busy_time);
@ -975,11 +976,6 @@ refresh_threads_tab(uint8_t current_page)
}
}
for (k = 0; k < threads_count; k++) {
thread_info[k]->last_idle = thread_info[k]->idle;
thread_info[k]->last_busy = thread_info[k]->busy;
}
g_max_selected_row = i - current_page * g_max_data_rows - 1;
return max_pages;
@ -1350,7 +1346,8 @@ refresh_cores_tab(uint8_t current_page)
uint8_t max_pages, item_index;
static uint8_t last_page = 0;
char core[MAX_CORE_STR_LEN], threads_number[MAX_THREAD_COUNT_STR_LEN],
pollers_number[MAX_POLLER_COUNT_STR_LEN], idle_time[MAX_TIME_STR_LEN], busy_time[MAX_TIME_STR_LEN];
pollers_number[MAX_POLLER_COUNT_STR_LEN], idle_time[MAX_TIME_STR_LEN],
busy_time[MAX_TIME_STR_LEN], core_freq[MAX_CORE_FREQ_STR_LEN];
struct core_info cores[RPC_MAX_CORES];
memset(&cores, 0, sizeof(cores));
@ -1436,6 +1433,18 @@ refresh_cores_tab(uint8_t current_page)
}
print_max_len(g_tabs[CORES_TAB], TABS_DATA_START_ROW + item_index, offset,
col_desc[4].max_data_string, ALIGN_RIGHT, busy_time);
offset += col_desc[4].max_data_string + 2;
}
if (!col_desc[5].disabled) {
if (!g_cores_stats.cores.core[core_num].core_freq) {
snprintf(core_freq, MAX_CORE_FREQ_STR_LEN, "%s", "N/A");
} else {
snprintf(core_freq, MAX_CORE_FREQ_STR_LEN, "%" PRIu32,
g_cores_stats.cores.core[core_num].core_freq);
}
print_max_len(g_tabs[CORES_TAB], TABS_DATA_START_ROW + item_index, offset,
col_desc[5].max_data_string, ALIGN_RIGHT, core_freq);
}
store_core_last_stats(cores[core_num].core, cores[core_num].idle, cores[core_num].busy);
@ -1601,6 +1610,7 @@ filter_columns(uint8_t tab)
ITEM *cur;
void (*p)(enum tabs tab);
uint8_t current_index, len = 0;
bool disabled[TABS_COL_COUNT];
for (i = 0; col_desc[i].name != NULL; ++i) {
len = spdk_max(col_desc[i].name_len, len);
@ -1631,6 +1641,10 @@ filter_columns(uint8_t tab)
goto fail;
}
for (int i = 0; i < TABS_COL_COUNT; i++) {
disabled[i] = col_desc[i].disabled;
}
while (!stop_loop) {
c = wgetch(filter_win);
@ -1643,6 +1657,17 @@ filter_columns(uint8_t tab)
break;
case 27: /* ESC */
case 'q':
for (int i = 0; i < TABS_COL_COUNT; i++) {
cur = current_item(my_menu);
col_desc[i].disabled = disabled[i];
my_items = refresh_filtering_menu(&my_menu, filter_win, tab, my_items, elements,
item_index(cur) + 1);
if (my_items == NULL || my_menu == NULL) {
goto fail;
}
}
stop_loop = true;
break;
case ' ': /* Space */
@ -1897,6 +1922,17 @@ free_resources(void)
}
}
static uint64_t
get_position_for_window(uint64_t window_size, uint64_t max_size)
{
/* This function calculates position for pop-up detail window.
* Since horizontal and vertical positions are calculated the same way
* there is no need for separate functions. */
window_size = spdk_min(window_size, max_size);
return (max_size - window_size) / 2;
}
static void
display_thread(struct rpc_thread_info *thread_info)
{
@ -1915,7 +1951,8 @@ display_thread(struct rpc_thread_info *thread_info)
thread_info->paused_pollers_count;
thread_win = newwin(pollers_count + THREAD_WIN_HEIGHT, THREAD_WIN_WIDTH,
(g_max_row - pollers_count) / 2, (g_max_col - THREAD_WIN_HOR_POS) / 2);
get_position_for_window(THREAD_WIN_HEIGHT + pollers_count, g_max_row),
get_position_for_window(THREAD_WIN_WIDTH, g_max_col));
keypad(thread_win, TRUE);
thread_panel = new_panel(thread_win);
@ -1936,9 +1973,9 @@ display_thread(struct rpc_thread_info *thread_info)
thread_info->core_num);
if (g_interval_data) {
get_time_str(g_thread_history[thread_info->id].idle, idle_time);
get_time_str(thread_info->idle - thread_info->last_idle, idle_time);
mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 32, idle_time);
get_time_str(g_thread_history[thread_info->id].busy, busy_time);
get_time_str(thread_info->busy - thread_info->last_busy, busy_time);
mvwprintw(thread_win, 3, THREAD_WIN_FIRST_COL + 54, busy_time);
} else {
get_time_str(thread_info->idle, idle_time);
@ -2005,7 +2042,6 @@ display_thread(struct rpc_thread_info *thread_info)
c = wgetch(thread_win);
switch (c) {
case 10: /* ENTER */
case 27: /* ESC */
stop_loop = true;
break;
@ -2021,21 +2057,13 @@ display_thread(struct rpc_thread_info *thread_info)
static void
show_thread(uint8_t current_page)
{
struct rpc_thread_info *thread_info[g_threads_stats.threads.threads_count];
struct rpc_thread_info thread_info;
uint64_t thread_number = current_page * g_max_data_rows + g_selected_row;
uint64_t i;
get_data();
assert(thread_number < g_threads_stats.threads.threads_count);
thread_info = g_threads_stats.threads.thread_info[thread_number];
for (i = 0; i < g_threads_stats.threads.threads_count; i++) {
thread_info[i] = &g_threads_stats.threads.thread_info[i];
}
qsort(thread_info, g_threads_stats.threads.threads_count, sizeof(thread_info[0]), sort_threads);
display_thread(thread_info[thread_number]);
free_data();
display_thread(&thread_info);
}
static void
@ -2065,15 +2093,15 @@ show_core(uint8_t current_page)
bool stop_loop = false;
char idle_time[MAX_TIME_STR_LEN], busy_time[MAX_TIME_STR_LEN];
get_data();
assert(core_number < g_cores_stats.cores.cores_count);
for (i = 0; i < g_cores_stats.cores.cores_count; i++) {
core_info[i] = &g_cores_stats.cores.core[i];
}
threads_count = g_cores_stats.cores.core->threads.threads_count;
core_win = newwin(threads_count + CORE_WIN_HEIGHT, CORE_WIN_WIDTH,
(g_max_row - threads_count) / 2, (g_max_col - CORE_WIN_HOR_POS) / 2);
get_position_for_window(CORE_WIN_HEIGHT + threads_count, g_max_row),
get_position_for_window(CORE_WIN_WIDTH, g_max_col));
keypad(core_win, TRUE);
core_panel = new_panel(core_win);
@ -2089,9 +2117,20 @@ show_core(uint8_t current_page)
mvwaddch(core_win, -1, 0, ACS_LTEE);
mvwhline(core_win, 2, 1, ACS_HLINE, CORE_WIN_WIDTH - 2);
mvwaddch(core_win, 2, CORE_WIN_WIDTH, ACS_RTEE);
print_left(core_win, 3, 1, CORE_WIN_WIDTH, "Thread count: Idle time:", COLOR_PAIR(5));
print_in_middle(core_win, 3, 0, CORE_WIN_WIDTH - (CORE_WIN_WIDTH / 3), "Frequency:", COLOR_PAIR(5));
if (core_info[core_number]->core_freq) {
mvwprintw(core_win, 3, CORE_WIN_FIRST_COL + 15, "%" PRIu32,
core_info[core_number]->core_freq);
} else {
mvwprintw(core_win, 3, CORE_WIN_FIRST_COL + 15, "%s", "N/A");
}
mvwprintw(core_win, 3, CORE_WIN_FIRST_COL, "%" PRIu64,
mvwaddch(core_win, -1, 0, ACS_LTEE);
mvwhline(core_win, 4, 1, ACS_HLINE, CORE_WIN_WIDTH - 2);
mvwaddch(core_win, 4, CORE_WIN_WIDTH, ACS_RTEE);
print_left(core_win, 5, 1, CORE_WIN_WIDTH, "Thread count: Idle time:", COLOR_PAIR(5));
mvwprintw(core_win, 5, CORE_WIN_FIRST_COL, "%" PRIu64,
g_cores_history[core_number].threads_count);
if (g_interval_data == true) {
@ -2101,20 +2140,20 @@ show_core(uint8_t current_page)
get_time_str(core_info[core_number]->idle, idle_time);
get_time_str(core_info[core_number]->busy, busy_time);
}
mvwprintw(core_win, 3, CORE_WIN_FIRST_COL + 20, idle_time);
mvwprintw(core_win, 5, CORE_WIN_FIRST_COL + 20, idle_time);
print_left(core_win, 5, 1, CORE_WIN_WIDTH, "Poller count: Busy time:", COLOR_PAIR(5));
mvwprintw(core_win, 5, CORE_WIN_FIRST_COL, "%" PRIu64,
print_left(core_win, 7, 1, CORE_WIN_WIDTH, "Poller count: Busy time:", COLOR_PAIR(5));
mvwprintw(core_win, 7, CORE_WIN_FIRST_COL, "%" PRIu64,
g_cores_history[core_number].pollers_count);
mvwprintw(core_win, 5, CORE_WIN_FIRST_COL + 20, busy_time);
mvwprintw(core_win, 7, CORE_WIN_FIRST_COL + 20, busy_time);
mvwhline(core_win, 4, 1, ACS_HLINE, CORE_WIN_WIDTH - 2);
mvwhline(core_win, 6, 1, ACS_HLINE, CORE_WIN_WIDTH - 2);
print_left(core_win, 7, 1, CORE_WIN_WIDTH, "Threads on this core", COLOR_PAIR(5));
mvwhline(core_win, 8, 1, ACS_HLINE, CORE_WIN_WIDTH - 2);
print_left(core_win, 9, 1, CORE_WIN_WIDTH, "Threads on this core", COLOR_PAIR(5));
for (j = 0; j < core_info[core_number]->threads.threads_count; j++) {
mvwprintw(core_win, j + 8, 1, core_info[core_number]->threads.thread[j].name);
mvwprintw(core_win, j + 10, 1, core_info[core_number]->threads.thread[j].name);
}
refresh();
@ -2125,9 +2164,9 @@ show_core(uint8_t current_page)
while (!stop_loop) {
for (j = 0; j < core_info[core_number]->threads.threads_count; j++) {
if (j != current_threads_row) {
mvwprintw(core_win, j + 8, 1, core_info[core_number]->threads.thread[j].name);
mvwprintw(core_win, j + 10, 1, core_info[core_number]->threads.thread[j].name);
} else {
print_left(core_win, j + 8, 1, CORE_WIN_WIDTH - 2,
print_left(core_win, j + 10, 1, CORE_WIN_WIDTH - 2,
core_info[core_number]->threads.thread[j].name, COLOR_PAIR(2));
}
}
@ -2159,8 +2198,6 @@ show_core(uint8_t current_page)
del_panel(core_panel);
delwin(core_win);
free_data();
}
static void
@ -2168,19 +2205,19 @@ show_poller(uint8_t current_page)
{
PANEL *poller_panel;
WINDOW *poller_win;
uint64_t poller_counter = 0, count = 0;
uint64_t count = 0;
uint64_t poller_number = current_page * g_max_data_rows + g_selected_row;
struct rpc_poller_info *pollers[RPC_MAX_POLLERS];
bool stop_loop = false;
char poller_period[MAX_TIME_STR_LEN];
int c;
get_data();
prepare_poller_data(current_page, pollers, &count, current_page);
assert(poller_number < count);
poller_win = newwin(POLLER_WIN_HEIGHT, POLLER_WIN_WIDTH,
(g_max_row - poller_counter) / 2, (g_max_col - POLLER_WIN_HOR_POS) / 2);
get_position_for_window(POLLER_WIN_HEIGHT, g_max_row),
get_position_for_window(POLLER_WIN_WIDTH, g_max_col));
keypad(poller_win, TRUE);
poller_panel = new_panel(poller_win);
@ -2230,7 +2267,6 @@ show_poller(uint8_t current_page)
while (!stop_loop) {
c = wgetch(poller_win);
switch (c) {
case 10: /* ENTER */
case 27: /* ESC */
stop_loop = true;
break;
@ -2241,8 +2277,6 @@ show_poller(uint8_t current_page)
del_panel(poller_panel);
delwin(poller_win);
free_data();
}
static void
@ -2257,12 +2291,15 @@ show_stats(void)
uint8_t active_tab = THREADS_TAB;
uint8_t current_page = 0;
uint8_t max_pages = 1;
uint16_t required_size = WINDOW_HEADER + 1;
char current_page_str[CURRENT_PAGE_STR_LEN];
bool force_refresh = true;
clock_gettime(CLOCK_REALTIME, &time_now);
time_last = time_now.tv_sec;
memset(&g_threads_stats, 0, sizeof(g_threads_stats));
switch_tab(THREADS_TAB);
while (1) {
@ -2270,13 +2307,34 @@ show_stats(void)
getmaxyx(stdscr, max_row, max_col);
if (max_row != g_max_row || max_col != g_max_col) {
g_max_row = max_row;
g_max_row = spdk_max(max_row, required_size);
g_max_col = max_col;
g_data_win_size = g_max_row - MENU_WIN_HEIGHT - TAB_WIN_HEIGHT - TABS_DATA_START_ROW;
g_data_win_size = g_max_row - required_size + 1;
g_max_data_rows = g_max_row - WINDOW_HEADER;
resize_interface(active_tab);
}
clock_gettime(CLOCK_REALTIME, &time_now);
time_dif = time_now.tv_sec - time_last;
if (time_dif < 0) {
time_dif = g_sleep_time;
}
if (time_dif >= g_sleep_time || force_refresh) {
time_last = time_now.tv_sec;
rc = get_data();
if (rc) {
mvprintw(g_max_row - 1, g_max_col - strlen(refresh_error) - 2, refresh_error);
}
max_pages = refresh_tab(active_tab, current_page);
snprintf(current_page_str, CURRENT_PAGE_STR_LEN - 1, "Page: %d/%d", current_page + 1, max_pages);
mvprintw(g_max_row - 1, 1, current_page_str);
refresh();
}
c = getch();
if (c == 'q') {
free_resources();
@ -2300,6 +2358,7 @@ show_stats(void)
} else {
active_tab = THREADS_TAB;
}
g_selected_row = 0;
current_page = 0;
switch_tab(active_tab);
break;
@ -2354,39 +2413,19 @@ show_stats(void)
force_refresh = false;
break;
}
clock_gettime(CLOCK_REALTIME, &time_now);
time_dif = time_now.tv_sec - time_last;
if (time_dif < 0) {
time_dif = g_sleep_time;
}
if (time_dif >= g_sleep_time || force_refresh) {
time_last = time_now.tv_sec;
rc = get_data();
if (rc) {
mvprintw(g_max_row - 1, g_max_col - strlen(refresh_error) - 2, refresh_error);
}
max_pages = refresh_tab(active_tab, current_page);
snprintf(current_page_str, CURRENT_PAGE_STR_LEN - 1, "Page: %d/%d", current_page + 1, max_pages);
mvprintw(g_max_row - 1, 1, current_page_str);
free_data();
refresh();
}
}
free_data();
}
static void
draw_interface(void)
{
int i;
uint16_t required_size = WINDOW_HEADER + 1;
getmaxyx(stdscr, g_max_row, g_max_col);
g_data_win_size = g_max_row - MENU_WIN_HEIGHT - TAB_WIN_HEIGHT - TABS_DATA_START_ROW;
g_max_row = spdk_max(g_max_row, required_size);
g_data_win_size = g_max_row - required_size;
g_max_data_rows = g_max_row - WINDOW_HEADER;
g_menu_win = newwin(MENU_WIN_HEIGHT, g_max_col, g_max_row - MENU_WIN_HEIGHT - 1,
@ -2456,13 +2495,40 @@ usage(const char *program_name)
printf("%s [options]", program_name);
printf("\n");
printf("options:\n");
printf(" -r <path> RPC listen address (default: /var/tmp/spdk.sock\n");
printf(" -r <path> RPC connect address (default: /var/tmp/spdk.sock)\n");
printf(" -h show this usage\n");
}
static int
wait_init(void)
{
struct spdk_jsonrpc_client_response *json_resp = NULL;
char *uninit_log = "Waiting for SPDK target application to initialize...",
*uninit_error = "Unable to read SPDK application state!";
int c, max_col, rc = 0;
max_col = getmaxx(stdscr);
print_in_middle(stdscr, FIRST_DATA_ROW, 1, max_col, uninit_log, COLOR_PAIR(5));
rc = rpc_send_req("framework_wait_init", &json_resp);
if (rc) {
spdk_jsonrpc_client_free_response(json_resp);
while (1) {
print_in_middle(stdscr, FIRST_DATA_ROW, 1, max_col, uninit_error, COLOR_PAIR(8));
c = getch();
if (c == 'q') {
return -1;
}
}
}
spdk_jsonrpc_client_free_response(json_resp);
return 0;
}
int main(int argc, char **argv)
{
int op;
int op, rc;
char *socket = SPDK_DEFAULT_RPC_ADDR;
while ((op = getopt(argc, argv, "r:h")) != -1) {
@ -2470,10 +2536,9 @@ int main(int argc, char **argv)
case 'r':
socket = optarg;
break;
case 'H':
default:
usage(argv[0]);
return 1;
return op == 'h' ? 0 : 1;
}
}
@ -2487,7 +2552,11 @@ int main(int argc, char **argv)
init_str_len();
setup_ncurses();
draw_interface();
show_stats();
rc = wait_init();
if (!rc) {
show_stats();
}
finish(0);

View File

@ -613,6 +613,8 @@ int main(int argc, char **argv)
file_name = optarg;
break;
case 'h':
usage();
exit(EXIT_SUCCESS);
default:
usage();
exit(1);

View File

@ -12,6 +12,7 @@ rootdir=$(readlink -f $(dirname $0))
source "$1"
source "$rootdir/test/common/autotest_common.sh"
source "$rootdir/scripts/common.sh"
out=$output_dir
if [ -n "$SPDK_TEST_NATIVE_DPDK" ]; then
@ -118,9 +119,12 @@ function build_native_dpdk() {
if grep "20.08.0" $external_dpdk_base_dir/VERSION; then
wget https://github.com/spdk/dpdk/commit/64f1ced13f974e8b3d46b87c361a09eca68126f9.patch -O dpdk-pci.patch
wget https://github.com/spdk/dpdk/commit/c2c273d5c8fbf673623b427f8f4ab5af5ddf0e08.patch -O dpdk-qat.patch
else
elif grep "20.11\|21.02" $external_dpdk_base_dir/VERSION; then
wget https://github.com/karlatec/dpdk/commit/3219c0cfc38803aec10c809dde16e013b370bda9.patch -O dpdk-pci.patch
wget https://github.com/karlatec/dpdk/commit/adf8f7638de29bc4bf9ba3faf12bbdae73acda0c.patch -O dpdk-qat.patch
else
wget https://github.com/karlatec/dpdk/commit/f95e331be3a1f856b816948990dd2afc67ea4020.patch -O dpdk-pci.patch
wget https://github.com/karlatec/dpdk/commit/6fd2fa906ffdcee04e6ce5da40e61cb841be9827.patch -O dpdk-qat.patch
fi
git config --local user.name "spdk"
git config --local user.email "nomail@all.com"
@ -222,11 +226,15 @@ function test_make_uninstall() {
}
function build_doc() {
local doxygenv
doxygenv=$(doxygen --version)
$MAKE -C "$rootdir"/doc --no-print-directory $MAKEFLAGS &> "$out"/doxygen.log
if [ -s "$out"/doxygen.log ]; then
cat "$out"/doxygen.log
echo "Doxygen errors found!"
exit 1
eq "$doxygenv" 1.8.20 || exit 1
echo "Doxygen $doxygenv detected, all warnings are potentially false positives, continuing the test"
fi
if hash pdflatex 2> /dev/null; then
$MAKE -C "$rootdir"/doc/output/latex --no-print-directory $MAKEFLAGS &>> "$out"/doxygen.log
@ -238,7 +246,8 @@ function build_doc() {
fi
$MAKE -C "$rootdir"/doc --no-print-directory $MAKEFLAGS clean &>> "$out"/doxygen.log
if [ -s "$out"/doxygen.log ]; then
rm "$out"/doxygen.log
# Save the log as an artifact in case we are working with potentially broken version
eq "$doxygenv" 1.8.20 || rm "$out"/doxygen.log
fi
rm -rf "$rootdir"/doc/output
}

View File

@ -13,6 +13,37 @@ source "$1"
rootdir=$(readlink -f $(dirname $0))
source "$rootdir/test/common/autotest_common.sh"
function build_rpms() (
local version rpms
# Make sure linker will not attempt to look under DPDK's repo dir to get the libs
unset -v LD_LIBRARY_PATH
install_uninstall_rpms() {
rpms=("$HOME/rpmbuild/RPMS/x86_64/"spdk{,-devel,{,-dpdk}-libs}-$version-1.x86_64.rpm)
sudo rpm -i "${rpms[@]}"
rpms=("${rpms[@]##*/}") rpms=("${rpms[@]%.rpm}")
# Check if we can find one of the apps in the PATH now and verify if it doesn't miss
# any libs.
LIST_LIBS=yes "$rootdir/rpmbuild/rpm-deps.sh" "${SPDK_APP[@]##*/}"
sudo rpm -e "${rpms[@]}"
}
build_rpm() {
MAKEFLAGS="$MAKEFLAGS" SPDK_VERSION="$version" DEPS=no "$rootdir/rpmbuild/rpm.sh" "$@"
install_uninstall_rpms
}
version="test_shared"
run_test "build_shared_rpm" build_rpm --with-shared
if [[ -n $SPDK_TEST_NATIVE_DPDK ]]; then
version="test_shared_native_dpdk"
run_test "build_shared_native_dpdk_rpm" build_rpm --with-shared --with-dpdk="$SPDK_RUN_EXTERNAL_DPDK"
fi
)
out=$PWD
MAKEFLAGS=${MAKEFLAGS:--j16}
@ -28,7 +59,12 @@ if [ $(git status --porcelain --ignore-submodules | wc -l) -ne 0 ]; then
fi
timing_exit porcelain_check
if [[ $RUN_NIGHTLY -eq 0 && $SPDK_TEST_RELEASE_BUILD -eq 0 ]]; then
if [[ $SPDK_TEST_RELEASE_BUILD -eq 1 ]]; then
run_test "build_rpms" build_rpms
$MAKE clean
fi
if [[ $RUN_NIGHTLY -eq 0 ]]; then
timing_finish
exit 0
fi

View File

@ -4,7 +4,8 @@ set -e
rootdir=$(readlink -f $(dirname $0))
conf=~/autorun-spdk.conf
default_conf=~/autorun-spdk.conf
conf=${1:-${default_conf}}
# If the configuration of tests is not provided, no tests will be carried out.
if [[ ! -f $conf ]]; then

View File

@ -60,8 +60,6 @@ src=$(readlink -f $(dirname $0))
out=$output_dir
cd $src
./scripts/setup.sh status
freebsd_update_contigmem_mod
# lcov takes considerable time to process clang coverage.
@ -127,8 +125,11 @@ if [ $(uname -s) = Linux ]; then
# Export our blocked list so it will take effect during next setup.sh
export PCI_BLOCKED
fi
run_test "setup.sh" "$rootdir/test/setup/test-setup.sh"
fi
./scripts/setup.sh status
if [[ $(uname -s) == Linux ]]; then
# Revert NVMe namespaces to default state
nvme_namespace_revert
@ -150,10 +151,6 @@ timing_enter afterboot
./scripts/setup.sh
timing_exit afterboot
timing_enter nvmf_setup
rdma_device_init
timing_exit nvmf_setup
if [[ $SPDK_TEST_CRYPTO -eq 1 || $SPDK_TEST_REDUCE -eq 1 ]]; then
# Make sure that memory is distributed across all NUMA nodes - by default, all goes to
# node0, but if QAT devices are attached to a different node, all of their VFs will end
@ -198,6 +195,7 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
run_test "bdevperf_config" test/bdev/bdevperf/test_config.sh
if [[ $(uname -s) == Linux ]]; then
run_test "spdk_dd" test/dd/dd.sh
run_test "reactor_set_interrupt" test/interrupt/reactor_set_interrupt.sh
fi
fi
@ -209,6 +207,9 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
run_test "blockdev_nvme" test/bdev/blockdev.sh "nvme"
run_test "blockdev_nvme_gpt" test/bdev/blockdev.sh "gpt"
run_test "nvme" test/nvme/nvme.sh
if [[ $SPDK_TEST_NVME_PMR -eq 1 ]]; then
run_test "nvme_pmr" test/nvme/nvme_pmr.sh
fi
if [[ $SPDK_TEST_NVME_CUSE -eq 1 ]]; then
run_test "nvme_cuse" test/nvme/cuse/nvme_cuse.sh
fi
@ -247,11 +248,17 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
# The NVMe-oF run test cases are split out like this so that the parser that compiles the
# list of all tests can properly differentiate them. Please do not merge them into one line.
if [ "$SPDK_TEST_NVMF_TRANSPORT" = "rdma" ]; then
timing_enter rdma_setup
rdma_device_init
timing_exit rdma_setup
run_test "nvmf_rdma" ./test/nvmf/nvmf.sh --transport=$SPDK_TEST_NVMF_TRANSPORT
run_test "spdkcli_nvmf_rdma" ./test/spdkcli/nvmf.sh
run_test "spdkcli_nvmf_rdma" ./test/spdkcli/nvmf.sh --transport=$SPDK_TEST_NVMF_TRANSPORT
elif [ "$SPDK_TEST_NVMF_TRANSPORT" = "tcp" ]; then
timing_enter tcp_setup
tcp_device_init
timing_exit tcp_setup
run_test "nvmf_tcp" ./test/nvmf/nvmf.sh --transport=$SPDK_TEST_NVMF_TRANSPORT
run_test "spdkcli_nvmf_tcp" ./test/spdkcli/nvmf.sh
run_test "spdkcli_nvmf_tcp" ./test/spdkcli/nvmf.sh --transport=$SPDK_TEST_NVMF_TRANSPORT
run_test "nvmf_identify_passthru" test/nvmf/target/identify_passthru.sh --transport=$SPDK_TEST_NVMF_TRANSPORT
run_test "nvmf_dif" test/nvmf/target/dif.sh
elif [ "$SPDK_TEST_NVMF_TRANSPORT" = "fc" ]; then

257
configure vendored
View File

@ -7,8 +7,7 @@ trap 'echo -e "\n\nConfiguration failed\n\n" >&2' ERR
rootdir=$(readlink -f $(dirname $0))
source "$rootdir/scripts/common.sh"
function usage()
{
function usage() {
echo "'configure' configures SPDK to compile on supported platforms."
echo ""
echo "Usage: ./configure [OPTION]..."
@ -60,7 +59,7 @@ function usage()
echo " virtio Build vhost initiator and virtio-pci bdev modules."
echo " No path required."
echo " vfio-user Build custom vfio-user transport for NVMf target and NVMe initiator."
echo " No path required."
echo " example: /usr/src/libvfio-user"
echo " pmdk Build persistent memory bdev."
echo " example: /usr/share/pmdk"
echo " reduce Build vbdev compression module."
@ -97,6 +96,8 @@ function usage()
echo " No path required."
echo " raid5 Build with bdev_raid module RAID5 support."
echo " No path required."
echo " wpdk Build using WPDK to provide support for Windows (experimental)."
echo " The argument must be a directory containing lib and include."
echo ""
echo "Environment variables:"
echo ""
@ -132,14 +133,18 @@ for i in "$@"; do
done
# Detect the compiler toolchain
$rootdir/scripts/detect_cc.sh --cc="$CC" --cxx="$CXX" --lto="${CONFIG[LTO]}" --ld="$LD" --cross-prefix="${CONFIG[CROSS_PREFIX]}" > $rootdir/mk/cc.mk
$rootdir/scripts/detect_cc.sh --cc="$CC" --cxx="$CXX" --lto="${CONFIG[LTO]}" --ld="$LD" --cross-prefix="${CONFIG[CROSS_PREFIX]}" > $rootdir/mk/cc.mk
CC=$(cat $rootdir/mk/cc.mk | grep "DEFAULT_CC=" | sed s/DEFAULT_CC=//)
CC_TYPE=$(cat $rootdir/mk/cc.mk | grep "CC_TYPE=" | cut -d "=" -f 2)
CC=$(grep "DEFAULT_CC=" "$rootdir/mk/cc.mk" | sed s/DEFAULT_CC=//)
CC_TYPE=$(grep "CC_TYPE=" "$rootdir/mk/cc.mk" | cut -d "=" -f 2)
arch=$($CC -dumpmachine)
sys_name=$(uname -s)
if [[ $arch == *mingw* ]] || [[ $arch == *windows* ]]; then
sys_name=Windows
fi
# Sanitize default configuration. All parameters set by user explicit should fail
# Force no ISA-L if non-x86 or non-aarch64 architecture
if [[ "${CONFIG[ISAL]}" = "y" ]]; then
@ -149,7 +154,7 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then
fi
fi
if [[ $sys_name == "FreeBSD" ]]; then
if [[ $sys_name != "Linux" ]]; then
# Vhost, rte_vhost library and virtio are only supported on Linux.
CONFIG[VHOST]="n"
CONFIG[VIRTIO]="n"
@ -158,7 +163,7 @@ fi
#check nasm only on x86
if [[ $arch == x86_64* ]]; then
ver=$(nasm -v 2>/dev/null | awk '{print $3}')
ver=$(nasm -v 2> /dev/null | awk '{print $3}')
if lt "$ver" 2.14; then
# ISA-L, compression & crypto require NASM version 2.14 or newer.
CONFIG[ISAL]=n
@ -183,7 +188,7 @@ function check_dir() {
for i in "$@"; do
case "$i" in
-h|--help)
-h | --help)
usage
exit 0
;;
@ -277,6 +282,10 @@ for i in "$@"; do
--without-dpdk)
CONFIG[DPDK_DIR]=
;;
--with-wpdk=*)
check_dir "$i"
CONFIG[WPDK_DIR]=$(readlink -f ${i#*=})
;;
--with-env=*)
CONFIG[ENV]="${i#*=}"
;;
@ -341,6 +350,12 @@ for i in "$@"; do
;;
--with-vfio-user)
CONFIG[VFIO_USER]=y
CONFIG[VFIO_USER_DIR]=""
;;
--with-vfio-user=*)
CONFIG[VFIO_USER]=y
check_dir "$i"
CONFIG[VFIO_USER_DIR]=$(readlink -f ${i#*=})
;;
--without-vfio-user)
CONFIG[VFIO_USER]=n
@ -444,46 +459,33 @@ for i in "$@"; do
echo "Unrecognized option $i"
usage
exit 1
;;
esac
done
if [[ $arch == x86_64* ]]; then
BUILD_CMD=($CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS -march=native)
BUILD_CMD=("$CC" -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS "-march=native")
else
BUILD_CMD=($CC -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS)
BUILD_CMD=("$CC" -o /dev/null -x c $CPPFLAGS $CFLAGS $LDFLAGS)
fi
BUILD_CMD+=(-I/usr/local/include -L/usr/local/lib)
function set_os_id_version() {
if [[ -f /etc/os-release ]]; then
source /etc/os-release
fi
OSID=$ID
OSVERSION=$VERSION_ID
echo "OS-ID: $OSID | OS-Version: $OSVERSION"
}
if [[ "${CONFIG[VFIO_USER]}" = "y" ]]; then
set_os_id_version
if [[ $arch != x86_64* ]] || [[ $sys_name == "FreeBSD" ]]; then
echo "Non x86_64 and Linux platform, disable CONFIG_VFIO_USER"
CONFIG[VFIO_USER]="n"
# disable tests on ubuntu16 due to lack of macro definition in pci_regs.h
elif [[ $OSID == "ubuntu" ]] && [[ $OSVERSION == "16.04" ]]; then
echo "ubuntu16 OS, disable CONFIG_VFIO_USER"
CONFIG[VFIO_USER]="n"
elif ! hash cmake; then
echo "cmake not installed, disable CONFIG_VFIO_USER"
CONFIG[VFIO_USER]="n"
elif [[ ! -d /usr/include/json-c ]] && [[ ! -d /usr/local/include/json-c ]]; then
echo "json-c-devel not installed, disable CONFIG_VFIO_USER"
CONFIG[VFIO_USER]="n"
elif [[ ! -e /usr/include/cmocka.h ]] && [[ ! -e /usr/local/include/cmocka.h ]]; then
echo "libcmocka-devel not installed, disable CONFIG_VFIO_USER"
CONFIG[VFIO_USER]="n"
if ! hash cmake; then
echo "ERROR: --with-vfio-user requires cmake"
echo "Please install then re-run this script"
exit 1
fi
if [[ ! -d /usr/include/json-c ]] && [[ ! -d /usr/local/include/json-c ]]; then
echo "ERROR: --with-vfio-user requires json-c-devel"
echo "Please install then re-run this script"
exit 1
fi
if [[ ! -e /usr/include/cmocka.h ]] && [[ ! -e /usr/local/include/cmocka.h ]]; then
echo "ERROR: --with-vfio-user requires libcmocka-devel"
echo "Please install then re-run this script"
exit 1
fi
fi
@ -494,7 +496,7 @@ if [[ "${CONFIG[IDXD]}" = "y" ]]; then
cpu_vendor=$(sysctl -a | grep hw.model | cut -c 1-15)
else
intel="GenuineIntel"
cpu_vendor=$(grep -i 'vendor' /proc/cpuinfo --max-count=1)
cpu_vendor=$(grep -i 'vendor' /proc/cpuinfo --max-count=1)
fi
if [[ "$cpu_vendor" != *"$intel"* ]]; then
echo "ERROR: IDXD cannot be used due to CPU incompatiblity."
@ -511,8 +513,8 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then
fi
if [[ "${CONFIG[ISAL]}" = "n" ]] && [[ "${CONFIG[REDUCE]}" = "y" ]]; then
echo "ERROR Conflicting options: --with-reduce is not compatible with --without-isal."
exit 1
echo "ERROR Conflicting options: --with-reduce is not compatible with --without-isal."
exit 1
fi
if [ -z "${CONFIG[ENV]}" ]; then
@ -547,6 +549,23 @@ else
CONFIG[VIRTIO]="n"
fi
if [[ $sys_name == "Windows" ]]; then
if [ -z "${CONFIG[WPDK_DIR]}" ]; then
if [ ! -f "$rootdir"/wpdk/Makefile ]; then
echo "WPDK not found; please specify --with-wpdk=<path>. See https://wpdk.github.io."
exit 1
else
CONFIG[WPDK_DIR]="${rootdir}/wpdk/build"
echo "Using default WPDK in ${CONFIG[WPDK_DIR]}"
fi
fi
else
if [ -n "${CONFIG[WPDK_DIR]}" ]; then
echo "ERROR: --with-wpdk is only supported for Windows"
exit 1
fi
fi
if [ "${CONFIG[VTUNE]}" = "y" ]; then
if [ -z "${CONFIG[VTUNE_DIR]}" ]; then
echo "When VTune is enabled, you must specify the VTune directory using --with-vtune=path"
@ -554,7 +573,7 @@ if [ "${CONFIG[VTUNE]}" = "y" ]; then
fi
fi
if [ "${CONFIG[ASAN]}" = "y" -a "${CONFIG[TSAN]}" = "y" ]; then
if [[ "${CONFIG[ASAN]}" = "y" && "${CONFIG[TSAN]}" = "y" ]]; then
echo "ERROR: ASAN and TSAN cannot be enabled at the same time."
exit 1
fi
@ -567,7 +586,7 @@ if [[ $sys_name == "FreeBSD" ]]; then
fi
fi
if [[ $sys_name == "FreeBSD" ]]; then
if [[ $sys_name != "Linux" ]]; then
if [[ "${CONFIG[VHOST]}" == "y" ]]; then
echo "Vhost is only supported on Linux."
exit 1
@ -579,22 +598,22 @@ if [[ $sys_name == "FreeBSD" ]]; then
fi
if [ "${CONFIG[RDMA]}" = "y" ]; then
if [[ ! "${CONFIG[RDMA_PROV]}" == "verbs" ]] && [[ ! "${CONFIG[RDMA_PROV]}" == "mlx5_dv" ]]; then
echo "Invalid RDMA provider specified, must be \"verbs\" or \"mlx5_dv\""
exit 1
fi
if [[ ! "${CONFIG[RDMA_PROV]}" == "verbs" ]] && [[ ! "${CONFIG[RDMA_PROV]}" == "mlx5_dv" ]]; then
echo "Invalid RDMA provider specified, must be \"verbs\" or \"mlx5_dv\""
exit 1
fi
if ! echo -e '#include <infiniband/verbs.h>\n#include <rdma/rdma_verbs.h>\n' \
'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -libverbs -lrdmacm - 2>/dev/null; then
echo --with-rdma requires libverbs and librdmacm.
echo Please install then re-run this script.
| "${BUILD_CMD[@]}" -libverbs -lrdmacm - 2> /dev/null; then
echo "--with-rdma requires libverbs and librdmacm."
echo "Please install then re-run this script."
exit 1
fi
if echo -e '#include <infiniband/verbs.h>\n' \
'int main(void) { return !!IBV_WR_SEND_WITH_INV; }\n' \
| ${BUILD_CMD[@]} -c - 2>/dev/null; then
| "${BUILD_CMD[@]}" -c - 2> /dev/null; then
CONFIG[RDMA_SEND_WITH_INVAL]="y"
else
CONFIG[RDMA_SEND_WITH_INVAL]="n"
@ -616,7 +635,7 @@ than or equal to 4.14 will see significantly reduced performance.
if echo -e '#include <rdma/rdma_cma.h>\n' \
'int main(void) { return !!RDMA_OPTION_ID_ACK_TIMEOUT; }\n' \
| ${BUILD_CMD[@]} -c - 2>/dev/null; then
| "${BUILD_CMD[@]}" -c - 2> /dev/null; then
CONFIG[RDMA_SET_ACK_TIMEOUT]="y"
else
CONFIG[RDMA_SET_ACK_TIMEOUT]="n"
@ -624,18 +643,18 @@ than or equal to 4.14 will see significantly reduced performance.
fi
if [ "${CONFIG[RDMA_PROV]}" == "mlx5_dv" ]; then
if ! echo -e '#include <spdk/stdinc.h>\n' \
'#include <infiniband/mlx5dv.h>\n' \
'#include <rdma/rdma_cma.h>\n' \
'int main(void) { return rdma_establish(NULL) || ' \
'!!IBV_QP_INIT_ATTR_SEND_OPS_FLAGS || !!MLX5_OPCODE_RDMA_WRITE; }\n' \
| ${BUILD_CMD[@]} -lmlx5 -I${rootdir}/include -c - 2>/dev/null; then
echo "mlx5_dv provider is not supported"
exit 1
fi
if ! echo -e '#include <spdk/stdinc.h>\n' \
'#include <infiniband/mlx5dv.h>\n' \
'#include <rdma/rdma_cma.h>\n' \
'int main(void) { return rdma_establish(NULL) || ' \
'!!IBV_QP_INIT_ATTR_SEND_OPS_FLAGS || !!MLX5_OPCODE_RDMA_WRITE; }\n' \
| "${BUILD_CMD[@]}" -lmlx5 -I${rootdir}/include -c - 2> /dev/null; then
echo "mlx5_dv provider is not supported"
exit 1
fi
fi
echo "Using "${CONFIG[RDMA_PROV]}" RDMA provider"
echo "Using '${CONFIG[RDMA_PROV]}' RDMA provider"
fi
if [[ "${CONFIG[FC]}" = "y" ]]; then
@ -659,45 +678,29 @@ if [[ "${CONFIG[ISAL]}" = "y" ]] || [[ "${CONFIG[CRYPTO]}" = "y" ]]; then
fi
fi
if [[ "${CONFIG[ISAL]}" = "y" ]]; then
if [ ! -f "$rootdir"/isa-l/autogen.sh ]; then
echo "ISA-L was not found; To install ISA-L run:"
echo " git submodule update --init"
exit 1
fi
cd $rootdir/isa-l
ISAL_LOG=$rootdir/isa-l/spdk-isal.log
echo -n "Configuring ISA-L (logfile: $ISAL_LOG)..."
./autogen.sh &> $ISAL_LOG
./configure CFLAGS="-fPIC -g -O2" --enable-shared=no >> $ISAL_LOG 2>&1
echo "done."
cd $rootdir
fi
if [[ "${CONFIG[PMDK]}" = "y" ]]; then
if ! echo -e '#include <libpmemblk.h>\nint main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -lpmemblk - 2>/dev/null; then
echo --with-pmdk requires libpmemblk.
echo Please install then re-run this script.
| "${BUILD_CMD[@]}" -lpmemblk - 2> /dev/null; then
echo "--with-pmdk requires libpmemblk."
echo "Please install then re-run this script."
exit 1
fi
fi
if [[ "${CONFIG[REDUCE]}" = "y" ]]; then
if ! echo -e '#include <libpmem.h>\nint main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -lpmem - 2>/dev/null; then
echo --with-reduce requires libpmem.
echo Please install then re-run this script.
| "${BUILD_CMD[@]}" -lpmem - 2> /dev/null; then
echo "--with-reduce requires libpmem."
echo "Please install then re-run this script."
exit 1
fi
fi
if [[ "${CONFIG[NVME_CUSE]}" = "y" ]]; then
if ! echo -e '#define FUSE_USE_VERSION 31\n#include <fuse3/cuse_lowlevel.h>\n#include <fuse3/fuse_lowlevel.h>\n#include <fuse3/fuse_opt.h>\nint main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -lfuse3 -D_FILE_OFFSET_BITS=64 - 2>/dev/null; then
echo --with-cuse requires libfuse3.
echo Please install then re-run this script.
| "${BUILD_CMD[@]}" -lfuse3 -D_FILE_OFFSET_BITS=64 - 2> /dev/null; then
echo "--with-cuse requires libfuse3."
echo "Please install then re-run this script."
exit 1
fi
fi
@ -705,9 +708,9 @@ fi
if [[ "${CONFIG[RBD]}" = "y" ]]; then
if ! echo -e '#include <rbd/librbd.h>\n#include <rados/librados.h>\n' \
'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -lrados -lrbd - 2>/dev/null; then
echo --with-rbd requires librados and librbd.
echo Please install then re-run this script.
| "${BUILD_CMD[@]}" -lrados -lrbd - 2> /dev/null; then
echo "--with-rbd requires librados and librbd."
echo "Please install then re-run this script."
exit 1
fi
fi
@ -719,39 +722,39 @@ if [[ "${CONFIG[ISCSI_INITIATOR]}" = "y" ]]; then
'#error\n' \
'#endif\n' \
'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -L/usr/lib64/iscsi -liscsi - 2>/dev/null; then
echo --with-iscsi-initiator requires libiscsi with
echo 'LIBISCSI_API_VERSION >= 20150621.'
echo Please install then re-run this script.
| "${BUILD_CMD[@]}" -L/usr/lib64/iscsi -liscsi - 2> /dev/null; then
echo "--with-iscsi-initiator requires libiscsi with"
echo "LIBISCSI_API_VERSION >= 20150621."
echo "Please install then re-run this script."
exit 1
fi
fi
if [[ "${CONFIG[ASAN]}" = "y" ]]; then
if ! echo -e 'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -fsanitize=address - 2>/dev/null; then
echo --enable-asan requires libasan.
echo Please install then re-run this script.
| "${BUILD_CMD[@]}" -fsanitize=address - 2> /dev/null; then
echo "--enable-asan requires libasan."
echo "Please install then re-run this script."
exit 1
fi
fi
if [[ "${CONFIG[UBSAN]}" = "y" ]]; then
if ! echo -e 'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -fsanitize=undefined - 2>/dev/null; then
echo --enable-ubsan requires libubsan.
echo Please install then re-run this script.
echo If installed, please check that the GCC version is at least 6.4 \
and synchronize CC accordingly.
| "${BUILD_CMD[@]}" -fsanitize=undefined - 2> /dev/null; then
echo "--enable-ubsan requires libubsan."
echo "Please install then re-run this script."
echo "If installed, please check that the GCC version is at least 6.4"
echo "and synchronize CC accordingly."
exit 1
fi
fi
if [[ "${CONFIG[TSAN]}" = "y" ]]; then
if ! echo -e 'int main(void) { return 0; }\n' \
| ${BUILD_CMD[@]} -fsanitize=thread - 2>/dev/null; then
echo --enable-tsan requires libtsan.
echo Please install then re-run this script.
| "${BUILD_CMD[@]}" -fsanitize=thread - 2> /dev/null; then
echo "--enable-tsan requires libtsan."
echo "Please install then re-run this script."
exit 1
fi
fi
@ -782,6 +785,11 @@ if [[ "${CONFIG[URING]}" = "y" ]]; then
echo "${CONFIG[URING_PATH]}: directory not found"
exit 1
fi
elif ! echo -e '#include <liburing.h>\nint main(void) { return 0; }\n' \
| "${BUILD_CMD[@]}" -luring - 2> /dev/null; then
echo "--with-uring requires liburing."
echo "Please build and install then re-run this script."
exit 1
fi
fi
@ -794,29 +802,50 @@ if [[ "${CONFIG[FUSE]}" = "y" ]]; then
fi
if [ "${CONFIG[CET]}" = "y" ]; then
if ! echo -e 'int main(void) { return 0; }\n' | ${BUILD_CMD[@]} -fcf-protection - 2>/dev/null; then
echo --enable-cet requires compiler/linker that supports CET.
echo Please install then re-run this script.
if ! echo -e 'int main(void) { return 0; }\n' | "${BUILD_CMD[@]}" -fcf-protection - 2> /dev/null; then
echo "--enable-cet requires compiler/linker that supports CET."
echo "Please install then re-run this script."
exit 1
fi
fi
if [[ "${CONFIG[ISAL]}" = "y" ]]; then
if [ ! -f "$rootdir"/isa-l/autogen.sh ]; then
echo "ISA-L was not found; To install ISA-L run:"
echo " git submodule update --init"
exit 1
fi
cd $rootdir/isa-l
ISAL_LOG=$rootdir/isa-l/spdk-isal.log
if [[ -n "${CONFIG[CROSS_PREFIX]}" ]]; then
ISAL_OPTS=("--host=${CONFIG[CROSS_PREFIX]}")
else
ISAL_OPTS=()
fi
echo -n "Configuring ISA-L (logfile: $ISAL_LOG)..."
./autogen.sh &> $ISAL_LOG
./configure CFLAGS="-fPIC -g -O2" "${ISAL_OPTS[@]}" --enable-shared=no >> $ISAL_LOG 2>&1
echo "done."
cd $rootdir
fi
# We are now ready to generate final configuration. But first do sanity
# check to see if all keys in CONFIG array have its reflection in CONFIG file.
if [ $(egrep -c "^\s*CONFIG_[[:alnum:]_]+=" $rootdir/CONFIG) -ne ${#CONFIG[@]} ]; then
if (($(grep -cE "^\s*CONFIG_[[:alnum:]_]+=" "$rootdir/CONFIG") != ${#CONFIG[@]})); then
echo ""
echo "BUG: Some configuration options are not present in CONFIG file. Please update this file."
echo "Missing options in CONFIG (+) file and in current config (-): "
diff -u --label "CONFIG file" --label "CONFIG[@]" \
<(sed -r -e '/^\s*$/d; /^\s*#.*/d; s/(CONFIG_[[:alnum:]_]+)=.*/\1/g' CONFIG | sort) \
<(printf "CONFIG_%s\n" ${!CONFIG[@]} | sort)
<(printf "CONFIG_%s\n" "${!CONFIG[@]}" | sort)
exit 1
fi
echo -n "Creating mk/config.mk..."
cp -f $rootdir/CONFIG $rootdir/mk/config.mk
for key in ${!CONFIG[@]}; do
sed -i.bak -r "s#^\s*CONFIG_${key}=.*#CONFIG_${key}\?=${CONFIG[$key]}#g" $rootdir/mk/config.mk
for key in "${!CONFIG[@]}"; do
sed -i.bak -r "s#[[:space:]]*CONFIG_${key}=.*#CONFIG_${key}\?=${CONFIG[$key]}#g" $rootdir/mk/config.mk
done
# On FreeBSD sed -i 'SUFFIX' - SUFFIX is mandatory. So no way but to delete the backed file.
rm -f $rootdir/mk/config.mk.bak
@ -834,7 +863,7 @@ echo "done."
# Create .sh with build config for easy sourcing|lookup during the tests.
for conf in "${!CONFIG[@]}"; do
echo "CONFIG_$conf=${CONFIG[$conf]}"
done >"$rootdir/test/common/build_config.sh"
done > "$rootdir/test/common/build_config.sh"
if [[ $sys_name == "FreeBSD" ]]; then
echo "Type 'gmake' to build."

42
deprecation.md Normal file
View File

@ -0,0 +1,42 @@
# ABI and API Deprecation {#deprecation}
This document details the policy for maintaining stability of SPDK ABI and API.
Major ABI version can change at most once for each quarterly SPDK release.
ABI versions are managed separately for each library and follow [Semantic Versoning](https://semver.org/).
API and ABI deprecation notices shall be posted in the next section.
Each entry must describe what will be removed and can suggest the future use or alternative.
Specific future SPDK release for the removal must be provided.
ABI cannot be removed without providing deprecation notice for at least single SPDK release.
# Deprecation Notices {#deprecation-notices}
## net
The net library is deprecated and will be removed in the 21.07 release.
## nvmf
The following APIs have been deprecated and will be removed in SPDK 21.07:
- `spdk_nvmf_poll_group_get_stat` (function in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_get_stat` (function in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_free_stat`(function in `nvmf.h`),
- `spdk_nvmf_rdma_device_stat` (struct in `nvmf.h`),
- `spdk_nvmf_transport_poll_group_stat` (struct in `nvmf.h`),
- `poll_group_get_stat` (transport op in `nvmf_transport.h`),
- `poll_group_free_stat` (transport op in `nvmf_transport.h`).
Please use `spdk_nvmf_poll_group_dump_stat` and `poll_group_dump_stat` instead.
## rpc
Parameter `enable-zerocopy-send` of RPC `sock_impl_set_options` is deprecated and will be removed in SPDK 21.07,
use `enable-zerocopy-send-server` or `enable-zerocopy-send-client` instead.
Parameter `disable-zerocopy-send` of RPC `sock_impl_set_options` is deprecated and will be removed in SPDK 21.07,
use `disable-zerocopy-send-server` or `disable-zerocopy-send-client` instead.
## rpm
`pkg/spdk.spec` is considered to be deprecated and scheduled for removal in SPDK 21.07.
Please use `rpmbuild/spdk.spec` instead and see
[RPM documentation](https://spdk.io/doc/rpm.html) for more details.

View File

@ -234,7 +234,7 @@ ALIASES =
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
TCL_SUBST =
# TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
@ -813,6 +813,7 @@ INPUT += \
compression.md \
concurrency.md \
containers.md \
../deprecation.md \
event.md \
ftl.md \
gdb_macros.md \
@ -835,6 +836,8 @@ INPUT += \
peer_2_peer.md \
pkgconfig.md \
porting.md \
rpm.md \
scheduler.md \
shfmt.md \
spdkcli.md \
spdk_top.md \
@ -1102,7 +1105,7 @@ ALPHABETICAL_INDEX = YES
# Minimum value: 1, maximum value: 20, default value: 5.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
COLS_IN_ALPHA_INDEX = 5
# COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all classes will
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
@ -1663,7 +1666,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.
GENERATE_LATEX = YES
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@ -2167,7 +2170,7 @@ EXTERNAL_PAGES = YES
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
PERL_PATH = /usr/bin/perl
# PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
@ -2189,7 +2192,7 @@ CLASS_DIAGRAMS = YES
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The

View File

@ -66,14 +66,14 @@ To use the IOAT engine, use the RPC [`ioat_scan_accel_engine`](https://spdk.io/d
To use the DSA engine, use the RPC [`idxd_scan_accel_engine`](https://spdk.io/doc/jsonrpc.html) with an optional parameter of `-c` and provide a configuration number of either 0 or 1. These pre-defined configurations determine how the DSA engine will be setup in terms
of work queues and engines. The DSA engine is very flexible allowing for various configurations of these elements to either account for different quality of service requirements or to isolate hardware paths where the back end media is of varying latency (i.e. persistent memory vs DRAM). The pre-defined configurations are as follows:
0: Four separate work queues each backed with one DSA engine. This is a generic
configuration that provides 4 portals to submit operations to each with a
single engine behind it providing some level of isolation as operations are
submitted round-robin.
0: A single work queue backed with four DSA engines. This is a generic configuration
that enables the hardware to best determine which engine to use as it pulls in new
operations.
1: Two separate work queues each backed with two DSA engines. This is another
generic configuration that provides 2 portals to submit operations to and
lets the DSA hardware decide which engine to select based on loading.
1: Two separate work queues each backed with two DSA engines. This is another
generic configuration that is documented in the specification and allows the
application to partition submissions across two work queues. This would be useful
when different priorities might be desired per group.
There are several other configurations that are possible that include quality
of service parameters on the work queues that are not currently utilized by

View File

@ -312,10 +312,8 @@ To remove `Cache1`:
During removal OCF-cache will be stopped and all cached data will be written to the core device.
Note that OCF has a per-device RAM requirement
of about 56000 + _cache device size_ * 58 / _cache line size_ (in bytes).
To get more information on OCF
please visit [OCF documentation](https://open-cas.github.io/).
Note that OCF has a per-device RAM requirement. More details can be found in the
[OCF documentation](https://open-cas.github.io/guide_system_requirements.html).
# Malloc bdev {#bdev_config_malloc}
@ -371,15 +369,22 @@ This command will remove NVMe bdev named Nvme0.
## NVMe bdev character device {#bdev_config_nvme_cuse}
This feature is considered as experimental.
This feature is considered as experimental. You must configure with --with-nvme-cuse
option to enable this RPC.
Example commands
`rpc.py bdev_nvme_cuse_register -n Nvme0 -p spdk/nvme0`
`rpc.py bdev_nvme_cuse_register -n Nvme3
This command will register /dev/spdk/nvme0 character device associated with Nvme0
controller. If there are namespaces created on Nvme0 controller, for each namespace
device /dev/spdk/nvme0nX is created.
This command will register a character device under /dev/spdk associated with Nvme3
controller. If there are namespaces created on Nvme3 controller, a namespace
character device is also created for each namespace.
For example, the first controller registered will have a character device path of
/dev/spdk/nvmeX, where X is replaced with a unique integer to differentiate it from
other controllers. Note that this 'nvmeX' name here has no correlation to the name
associated with the controller in SPDK. Namespace character devices will have a path
of /dev/spdk/nvmeXnY, where Y is the namespace ID.
Cuse devices are removed from system, when NVMe controller is detached or unregistered
with command:

View File

@ -14,24 +14,24 @@ make
~~~
Clone the RocksDB repository from the SPDK GitHub fork into a separate directory.
Make sure you check out the `spdk-v5.14.3` branch.
Make sure you check out the `6.15.fb` branch.
~~~{.sh}
cd ..
git clone -b spdk-v5.14.3 https://github.com/spdk/rocksdb.git
git clone -b 6.15.fb https://github.com/spdk/rocksdb.git
~~~
Build RocksDB. Only the `db_bench` benchmarking tool is integrated with BlobFS.
~~~{.sh}
cd rocksdb
make db_bench SPDK_DIR=path/to/spdk
make db_bench SPDK_DIR=relative_path/to/spdk
~~~
Or you can also add `DEBUG_LEVEL=0` for a release build (need to turn on `USE_RTTI`).
~~~{.sh}
export USE_RTTI=1 && make db_bench DEBUG_LEVEL=0 SPDK_DIR=path/to/spdk
export USE_RTTI=1 && make db_bench DEBUG_LEVEL=0 SPDK_DIR=relative_path/to/spdk
~~~
Create an NVMe section in the configuration file using SPDK's `gen_nvme.sh` script.

View File

@ -1,5 +1,6 @@
# General Information {#general}
- @subpage event
- @subpage scheduler
- @subpage logical_volumes
- @subpage accel_fw

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,4 +1,4 @@
# Storage Performance Development Kit {#index}
# Storage Performance Development Kit {#mainpage}
# Introduction

View File

@ -4,4 +4,5 @@
- @subpage getting_started
- @subpage vagrant
- @subpage changelog
- @subpage deprecation
- [Source Code (GitHub)](https://github.com/spdk/spdk)

File diff suppressed because it is too large Load Diff

View File

@ -191,3 +191,23 @@ shim/implementation library system.
# two libraries
gcc -o my_app ./my_app.c -lspdk -lcustom_env_shim -lcustom_env_implementation
~~~
# SPDK Static Objects {#static_objects}
SPDK static objects are compiled by default even when no parameters are supplied to the build system.
Unlike SPDK shared objects, the filename does not contain any versioning semantics. Linking against
static objects is similar to shared objects but will always require the use of `-Wl,--whole-archive`
as argument. This is due to the use of constructor functions in SPDK such as those to register
NVMe transports.
Due to the lack of versioning semantics, it is not recommended to install static libraries system wide.
Instead the path to these static libraries should be added as argument at compile time using
`-L/path/to/static/libs`. The use of static objects instead of shared objects can also be forced
through `-Wl,-Bsatic`, otherwise some compilers might prefer to use the shared objects if both
are available.
~~~{.sh}
gcc -o my_app ./my_app.c -L/path/to/static/libs -Wl,--whole-archive -Wl,-Bstatic -lpassthru_external
-lspdk_event_bdev -lspdk_bdev -lspdk_bdev_malloc -lspdk_log -lspdk_thread -lspdk_util -lspdk_event
-lspdk_env_dpdk -Wl,--no-whole-archive -Wl,-Bdynamic -pthread -ldpdk
~~~

View File

@ -106,20 +106,14 @@ using 1GB hugepages or by pre-reserving memory at application startup with `--me
option. All pre-reserved memory will be registered as a single region, but won't be returned to the
system until the SPDK application is terminated.
Another known issue occurs when using the E810 NICs in RoCE mode. Specifically, the NVMe-oF target
sometimes cannot destroy a qpair, because its posted work requests don't get flushed. It can cause
the NVMe-oF target application unable to terminate cleanly.
## TCP transport support {#nvmf_tcp_transport}
The transport is built into the nvmf_tgt by default, and it does not need any special libraries.
## Configuring the SPDK NVMe over Fabrics Target {#nvmf_config}
An NVMe over Fabrics target can be configured using JSON RPCs.
The basic RPCs needed to configure the NVMe-oF subsystem are detailed below. More information about
working with NVMe over Fabrics specific RPCs can be found on the @ref jsonrpc_components_nvmf_tgt RPC page.
Using .ini style configuration files for configuration of the NVMe-oF target is deprecated and should
be replaced with JSON based RPCs. .ini style configuration files can be converted to json format by way
of the new script `scripts/config_converter.py`.
## FC transport support {#nvmf_fc_transport}
To build nvmf_tgt with the FC transport, there is an additional FC LLD (Low Level Driver) code dependency.
@ -147,6 +141,12 @@ cd ../spdk
make
~~~
## Configuring the SPDK NVMe over Fabrics Target {#nvmf_config}
An NVMe over Fabrics target can be configured using JSON RPCs.
The basic RPCs needed to configure the NVMe-oF subsystem are detailed below. More information about
working with NVMe over Fabrics specific RPCs can be found on the @ref jsonrpc_components_nvmf_tgt RPC page.
### Using RPCs {#nvmf_config_rpc}
Start the nvmf_tgt application with elevated privileges. Once the target is started,

View File

@ -68,7 +68,7 @@ system. This is used for access control.
A user of the NVMe-oF target library begins by creating a target using
spdk_nvmf_tgt_create(), setting up a set of addresses on which to accept
connections by calling spdk_nvmf_tgt_listen(), then creating a subsystem
connections by calling spdk_nvmf_tgt_listen_ext(), then creating a subsystem
using spdk_nvmf_subsystem_create().
Subsystems begin in an inactive state and must be activated by calling
@ -78,7 +78,7 @@ calling spdk_nvmf_subsystem_pause() and resumed by calling
spdk_nvmf_subsystem_resume().
Namespaces may be added to the subsystem by calling
spdk_nvmf_subsystem_add_ns() when the subsystem is inactive or paused.
spdk_nvmf_subsystem_add_ns_ext() when the subsystem is inactive or paused.
Namespaces are bdevs. See @ref bdev for more information about the SPDK bdev
layer. A bdev may be obtained by calling spdk_bdev_get_by_name().

View File

@ -1,5 +1,12 @@
# Performance Reports {#performance_reports}
## Release 21.01
- [SPDK 21.01 NVMe Bdev Performance Report](https://ci.spdk.io/download/performance-reports/SPDK_nvme_bdev_perf_report_2101.pdf)
- [SPDK 21.01 NVMe-oF TCP Performance Report](https://ci.spdk.io/download/performance-reports/SPDK_tcp_perf_report_2101.pdf)
- [SPDK 21.01 NVMe-oF RDMA Performance Report](https://ci.spdk.io/download/performance-reports/SPDK_rdma_perf_report_2101.pdf)
- [SPDK 21.01 Vhost Performance Report](https://ci.spdk.io/download/performance-reports/SPDK_vhost_perf_report_2101.pdf)
## Release 20.10
- [SPDK 20.10 NVMe Bdev Performance Report](https://ci.spdk.io/download/performance-reports/SPDK_nvme_bdev_perf_report_2010.pdf)

View File

@ -28,9 +28,10 @@ PKG_CONFIG_PATH=/path/to/spdk/build/lib/pkgconfig pkg-config --libs spdk_syslibs
Note that SPDK libraries use constructor functions liberally, so you must surround
the library list with extra linker options to ensure these functions are not dropped
from the resulting application binary. Here is an example Makefile snippet that
shows how to use pkg-config to link an application that uses the SPDK nvme shared
library:
from the resulting application binary. With shared libraries this is achieved through
the `-Wl,--no-as-needed` parameters while with static libraries `-Wl,--whole-archive`
is used. Here is an example Makefile snippet that shows how to use pkg-config to link
an application that uses the SPDK nvme shared library:
~~~
PKG_CONFIG_PATH = $(SPDK_DIR)/build/lib/pkgconfig

49
doc/rpm.md Normal file
View File

@ -0,0 +1,49 @@
# RPMs {#rpms}
# In this document {#rpms_toc}
* @ref building_rpms
# Building SPDK RPMs {#building_rpms}
To build basic set of RPM packages out of the SPDK repo simply run:
~~~{.sh}
# rpmbuild/rpm.sh
~~~
Additional configuration options can be passed directly as arguments:
~~~{.sh}
# rpmbuild/rpm.sh --with-shared --with-dpdk=/path/to/dpdk/build
~~~
There are several options that may be passed via environment as well:
- DEPS - Install all needed dependencies for building RPM packages.
Default: "yes"
- MAKEFLAGS - Flags passed to make
- RPM_RELEASE - Target release version of the RPM packages. Default: 1
- REQUIREMENTS - Extra set of RPM dependencies if deemed as needed
- SPDK_VERSION - SPDK version. Default: currently checked out tag
~~~{.sh}
# DEPS=no MAKEFLAGS="-d -j1" rpmbuild/rpm.sh --with-shared
~~~
By default, all RPM packages should be created under $HOME directory of the
target user:
~~~{.sh}
# printf '%s\n' /root/rpmbuild/RPMS/x86_64/*
/root/rpmbuild/RPMS/x86_64/spdk-devel-v21.01-1.x86_64.rpm
/root/rpmbuild/RPMS/x86_64/spdk-dpdk-libs-v21.01-1.x86_64.rpm
/root/rpmbuild/RPMS/x86_64/spdk-libs-v21.01-1.x86_64.rpm
/root/rpmbuild/RPMS/x86_64/spdk-v21.01-1.x86_64.rpm
#
~~~
- spdk - provides all the binaries, common tooling, etc.
- spdk-devel - provides development files
- spdk-libs - provides target lib, .pc files (--with-shared)
- spdk-dpdk-libs - provides dpdk lib files (--with-shared|--with-dpdk)

82
doc/scheduler.md Normal file
View File

@ -0,0 +1,82 @@
# Scheduler {#scheduler}
SPDK's event/application framework (`lib/event`) now supports scheduling of
lightweight threads. Schedulers are provided as plugins, called
implementations. A default implementation is provided, but users may wish to
write their own scheduler to integrate into broader code frameworks or meet
their performance needs.
This feature should be considered experimental and is disabled by default. When
enabled, the scheduler framework gathers data for each spdk thread and reactor
and passes it to a scheduler implementation to perform one of the following
actions.
## Actions
### Move a thread
`spdk_thread`s can be moved to another reactor. Schedulers can examine the
suggested cpu_mask value for each lightweight thread to see if the user has
requested specific reactors, or choose a reactor using whatever algorithm they
deem fit.
### Switch reactor mode
Reactors by default run in a mode that constantly polls for new actions for the
most efficient processing. Schedulers can switch a reactor into a mode that
instead waits for an event on a file descriptor. On Linux, this is implemented
using epoll. This results in reduced CPU usage but may be less responsive when
events occur. A reactor cannot enter this mode if any `spdk_threads` are
currently scheduled to it. This limitation is expected to be lifted in the
future, allowing `spdk_threads` to enter interrupt mode.
### Set frequency of CPU core
The frequency of CPU cores can be modified by the scheduler in response to
load. Only CPU cores that match the application cpu_mask may be modified. The
mechanism for controlling CPU frequency is pluggable and the default provided
implementation is called `dpdk_governor`, based on the `rte_power` library from
DPDK.
#### Known limitation
When SMT (Hyperthreading) is enabled the two logical CPU cores sharing a single
physical CPU core must run at the same frequency. If one of two of such logical
CPU cores is outside the application cpu_mask, the policy and frequency on that
core has to be managed by the administrator.
## Scheduler implementations
The scheduler in use may be controlled by JSON-RPC. Please use the
[framework_set_scheduler](jsonrpc.md/#rpc_framework_set_scheduler) RPC to
switch between schedulers or change their options.
[spdk_top](spdk_top.md#spdk_top) is a useful tool to observe the behavior of
schedulers in different scenarios and workloads.
### static [default]
The `static` scheduler is the default scheduler and does no dynamic scheduling.
Lightweight threads are distributed round-robin among reactors, respecting
their requested cpu_mask, and then they are never moved. This is equivalent to
the previous behavior of the SPDK event/application framework.
### dynamic
The `dynamic` scheduler is designed for power saving and reduction of CPU
utilization, especially in cases where workloads show large variations over
time.
Active threads are distributed equally among reactors, taking cpu_mask into
account. All idle threads are moved to the main core. Once an idle thread becomes
active, it is redistributed again.
When a reactor has no scheduled `spdk_thread`s it is switched into interrupt
mode and stops actively polling. After enough threads become active, the
reactor is switched back into poll mode and threads are assigned to it again.
The main core can contain active threads only when their execution time does
not exceed the sum of all idle threads. When no active threads are present on
the main core, the frequency of that CPU core will decrease as the load
decreases. All CPU cores corresponding to the other reactors remain at maximum
frequency.

View File

@ -5,7 +5,7 @@ The spdk_top application is designed to resemble the standard top in that it pro
Why doesn't the classic top utility work for SPDK? SPDK uses a polled-mode design; a reactor thread running on each CPU core assigned to an SPDK application schedules SPDK lightweight threads and pollers to run on the CPU core. Therefore, the standard Linux top utility is not effective for analyzing the CPU usage for polled-mode applications like SPDK because it just reports that they are using 100% of the CPU resources assigned to them. The spdk_top utility was developed to analyze and report the CPU cycles used to do real work vs just polling for work. The utility relies on instrumentation added to pollers to track when they are doing work vs. polling for work. The spdk_top utility gets the fine grained metrics from the pollers, analyzes and report the metrics on a per poller, thread and core basis. This information enables users to identify CPU cores that are busy doing real work so that they can determine if the application needs more or less CPU resources.
# Run spdk_top
Before running spdk_top you need to run the SPDK application whose performance you want to analyze using spdk_top. For example, the nvmf_tgt application was running when we used the spdk_top to capture the screen shots in this documentation.
Before running spdk_top you need to run the SPDK application whose performance you want to analyze using spdk_top.
Run the spdk_top application
@ -13,33 +13,53 @@ Run the spdk_top application
./build/bin/spdk_top
~~~
The spdk_top application has 3 tabs: the cores, threads and pollers tabs.
# Bottom menu
Menu at the bottom of SPDK top window shows many options for changing displayed data. Each menu item has a key associated with it in square brackets.
* Quit - quits the SPDK top application.
* TAB selection - allows to select THREADS/POLLERS/CORES tabs.
* Previous page/Next page - scrolls up/down to the next set of rows displayed. Indicator in the bottom-left corner shows current page and number of all available pages.
* Columns - enables/disables chosen columns in a column pop-up window.
* Sorting - allows to sort displayed data by column in a sorting pop-up.
* Refresh rate - takes user input from 0 to 255 and changes refresh rate to that value in seconds.
* Item details - displays details pop-up window for highlighted data row. Selection is changed by pressing UP and DOWN arrow keys.
* Total/Interval - changes displayed values in all tabs to either Total time (measured since start of SPDK application) or Interval time (measured since last refresh).
# Threads Tab
The threads tab displays a line item for each spdk thread that includes information such as which CPU core the spdk thread is running on, how many pollers the thread is running and how many microseconds was the thread busy/idle. The pollers are grouped into active, timed and pause pollers. To learn more about spdk threads see @ref concurrency.
The threads tab displays a line item for each spdk thread. The information displayed shows:
![Threads Tab](img/spdk_top_page1_threads.png)
* Thread name - name of SPDK thread.
* Core - core on which the thread is currently running.
* Active/Timed/Paused pollers - number of pollers grouped by type on this thread.
* Idle/Busy - how many microseconds the thread was idle/busy.
\n
By pressing ENTER key a pop-up window appears, showing above and a list of pollers running on selected thread (with poller name, type, run count and period).
Pop-up then can be closed by pressing ESC key.
To learn more about spdk threads see @ref concurrency.
# Pollers Tab
The pollers tab displays a line item for each poller and a running counter of the number of times the poller has run so that you can see which pollers are running most frequently.
The pollers tab displays a line item for each poller. The information displayed shows:
![Pollers Tab](img/spdk_top_page2_pollers.png)
* Poller name - name of currently selected poller.
* Type - type of poller (Active/Paused/Timed).
* On thread - thread on which the poller is running.
* Run count - how many times poller was run.
* Period - poller period in microseconds. If period equals 0 then it is not displayed.
* Status - whether poller is currently Busy (red color) or Idle (blue color).
\n
Poller pop-up window can be displayed by pressing ENTER on a selected data row and displays above information.
Pop-up can be closed by pressing ESC key.
# Cores Tab
The cores tab provides insights into how the application is using the CPU cores assigned to it.
It has a line item for each CPU core assigned to the application which shows the number of threads and poller
running on the CPU core. The tab also indicates how busy/idle the each CPU core was in the last 1 second.
The busy column displays how many microseconds the CPU core was doing actual work in the last 1 second.
The idle column displays how many microseconds the CPU core was idle in the last 1 second,
including the time when the CPU core ran pollers but did not find any work.
The cores tab provides insights into how the application is using the CPU cores assigned to it. The information displayed for each core shows:
![Cores Tab](img/spdk_top_page3_cores.png)
* Core - core number.
* Thread count - number of threads currently running on core.
* Poller count - total number of pollers running on core.
* Idle/Busy - how many microseconds core was idle (including time when core ran pollers but did not find any work) or doing actual work.
# Refresh Rate
You can control how often the spdk_top application refreshes the data displayed by hitting the 'r' key on your keyboard and specifying a value between 0 and 255 seconds.
# Sorting
You can sort the data displayed by hitting the 's' key on your keyboard and selecting a column to sort by in the sub menu that is displayed.
# Filtering
You can filter out any column by hitting the 'c' key on your keyboard and unselecting the column in the menu that is displayed.
\n
Pressing ENTER key makes a pop-up window appear, showing above information, along with a list of threads running on selected core. Cores details window allows to select a thread and display thread details pop-up on top of it. To close both pop-ups use ESC key.

2
dpdk

@ -1 +1 @@
Subproject commit 707692e67d0c6c685c42f5dd48f8f112bde6b381
Subproject commit 4f93dbc0c0ab3804abaa20123030ad7fccf78709

View File

@ -45,6 +45,10 @@ DPDK_KMODS = true
endif
DPDK_OPTS += -Denable_kmods=$(DPDK_KMODS)
ifeq ($(CONFIG_DEBUG),y)
DPDK_OPTS += --buildtype=debug
endif
# the drivers we use
DPDK_DRIVERS = bus bus/pci bus/vdev mempool/ring
@ -69,16 +73,16 @@ endif
DPDK_OPTS += -Dmachine=$(TARGET_ARCHITECTURE)
ifneq ($(CONFIG_CROSS_PREFIX),)
ifeq ($(findstring mingw,$(CONFIG_CROSS_PREFIX)),mingw)
DPDK_OPTS += --cross-file $(SPDK_ROOT_DIR)/dpdk/config/x86/cross-mingw
else
$(error Automatic DPDK cross build is not supported. Please compile DPDK manually \
with e.g. `meson build --cross-file config/arm/arm64_armv8_linux_gcc`)
endif
endif
DPDK_CFLAGS += -fPIC
ifeq ($(CONFIG_DEBUG),y)
DPDK_CFLAGS += -O0 -g
endif
ifeq ($(CONFIG_WERROR),y)
DPDK_CFLAGS += -Werror
else
@ -117,7 +121,7 @@ DPDK_ALL_DRIVER_DIRS = $(shell find $(SPDK_ROOT_DIR)/dpdk/drivers -mindepth 1 -t
DPDK_ALL_DRIVERS = $(DPDK_ALL_DRIVER_DIRS:$(SPDK_ROOT_DIR)/dpdk/drivers/%=%)
DPDK_DISABLED_DRVERS = $(filter-out $(DPDK_DRIVERS),$(DPDK_ALL_DRIVERS))
ifeq ($(OS),Linux)
ifneq ($(OS),FreeBSD)
SED_INPLACE_FLAG = "-i"
MESON_PREFIX = $(SPDK_ROOT_DIR)/dpdk/build
else
@ -133,7 +137,7 @@ ifeq ($(MAKE_PID),)
MAKE_PID := $(shell echo $$PPID)
endif
MAKE_NUMJOBS := $(shell ps T | sed -nE 's/\s*$(MAKE_PID)\s.* (-j|--jobs=)( *[0-9]+).*/\1\2/p')
MAKE_NUMJOBS := $(shell ps T | sed -nE 's/[[:space:]]*$(MAKE_PID)[[:space:]].* (-j|--jobs=)( *[0-9]+).*/\1\2/p')
all: $(SPDK_ROOT_DIR)/dpdk/build-tmp
$(Q)# DPDK doesn't handle nested make calls, so unset MAKEFLAGS

View File

@ -45,12 +45,15 @@
#define ALIGN_4K 0x1000
static uint64_t g_tsc_rate;
static uint64_t g_tsc_us_rate;
static uint64_t g_tsc_end;
static int g_rc;
static int g_xfer_size_bytes = 4096;
static int g_queue_depth = 32;
static int g_ops_per_batch = 0;
static int g_threads_per_core = 1;
static int g_time_in_sec = 5;
static uint32_t g_crc32c_seed = 0;
static uint32_t g_crc32c_chained_count = 1;
static int g_fail_percent_goal = 0;
static uint8_t g_fill_pattern = 255;
static bool g_verify = false;
@ -64,8 +67,15 @@ uint64_t g_capabilites;
struct worker_thread;
static void accel_done(void *ref, int status);
struct display_info {
int core;
int thread;
};
struct ap_task {
void *src;
struct iovec *iovs;
uint32_t iov_cnt;
void *dst;
void *dst2;
struct worker_thread *worker;
@ -74,6 +84,14 @@ struct ap_task {
TAILQ_ENTRY(ap_task) link;
};
struct accel_batch {
int status;
int cmd_count;
struct spdk_accel_batch *batch;
struct worker_thread *worker;
TAILQ_ENTRY(accel_batch) link;
};
struct worker_thread {
struct spdk_io_channel *ch;
uint64_t xfer_completed;
@ -88,6 +106,11 @@ struct worker_thread {
struct spdk_poller *is_draining_poller;
struct spdk_poller *stop_poller;
void *task_base;
struct accel_batch *batch_base;
struct display_info display;
TAILQ_HEAD(, accel_batch) in_prep_batches;
TAILQ_HEAD(, accel_batch) in_use_batches;
TAILQ_HEAD(, accel_batch) to_submit_batches;
};
static void
@ -99,6 +122,7 @@ dump_user_config(struct spdk_app_opts *opts)
printf("Workload Type: %s\n", g_workload_type);
if (g_workload_selection == ACCEL_CRC32C) {
printf("CRC-32C seed: %u\n", g_crc32c_seed);
printf("vector size: %u\n", g_crc32c_chained_count);
} else if (g_workload_selection == ACCEL_FILL) {
printf("Fill pattern: 0x%x\n", g_fill_pattern);
} else if ((g_workload_selection == ACCEL_COMPARE) && g_fail_percent_goal > 0) {
@ -106,7 +130,13 @@ dump_user_config(struct spdk_app_opts *opts)
}
printf("Transfer size: %u bytes\n", g_xfer_size_bytes);
printf("Queue depth: %u\n", g_queue_depth);
printf("# threads/core: %u\n", g_threads_per_core);
printf("Run time: %u seconds\n", g_time_in_sec);
if (g_ops_per_batch > 0) {
printf("Batching: %u operations\n", g_ops_per_batch);
} else {
printf("Batching: Disabled\n");
}
printf("Verify: %s\n\n", g_verify ? "Yes" : "No");
}
@ -115,7 +145,9 @@ usage(void)
{
printf("accel_perf options:\n");
printf("\t[-h help message]\n");
printf("\t[-q queue depth]\n");
printf("\t[-q queue depth per core]\n");
printf("\t[-C for crc32c workload, use this value to configre the io vector size to test (default 1)\n");
printf("\t[-T number of threads per core\n");
printf("\t[-n number of channels]\n");
printf("\t[-o transfer size in bytes]\n");
printf("\t[-t time in seconds]\n");
@ -124,15 +156,25 @@ usage(void)
printf("\t[-P for compare workload, percentage of operations that should miscompare (percent, default 0)\n");
printf("\t[-f for fill workload, use this BYTE value (default 255)\n");
printf("\t[-y verify result if this switch is on]\n");
printf("\t[-b batch this number of operations at a time (default 0 = disabled)]\n");
}
static int
parse_args(int argc, char *argv)
{
switch (argc) {
case 'b':
g_ops_per_batch = spdk_strtol(optarg, 10);
break;
case 'C':
g_crc32c_chained_count = spdk_strtol(optarg, 10);
break;
case 'f':
g_fill_pattern = (uint8_t)spdk_strtol(optarg, 10);
break;
case 'T':
g_threads_per_core = spdk_strtol(optarg, 10);
break;
case 'o':
g_xfer_size_bytes = spdk_strtol(optarg, 10);
break;
@ -169,20 +211,24 @@ parse_args(int argc, char *argv)
usage();
return 1;
}
return 0;
}
static int dump_result(void);
static void
unregister_worker(void *arg1)
{
struct worker_thread *worker = arg1;
free(worker->task_base);
free(worker->batch_base);
spdk_put_io_channel(worker->ch);
pthread_mutex_lock(&g_workers_lock);
assert(g_num_workers >= 1);
if (--g_num_workers == 0) {
pthread_mutex_unlock(&g_workers_lock);
g_rc = dump_result();
spdk_app_stop(0);
}
pthread_mutex_unlock(&g_workers_lock);
@ -192,6 +238,7 @@ static int
_get_task_data_bufs(struct ap_task *task)
{
uint32_t align = 0;
uint32_t i = 0;
/* For dualcast, the DSA HW requires 4K alignment on destination addresses but
* we do this for all engines to keep it simple.
@ -200,12 +247,38 @@ _get_task_data_bufs(struct ap_task *task)
align = ALIGN_4K;
}
task->src = spdk_dma_zmalloc(g_xfer_size_bytes, 0, NULL);
if (task->src == NULL) {
fprintf(stderr, "Unable to alloc src buffer\n");
return -ENOMEM;
if (g_workload_selection == ACCEL_CRC32C) {
assert(g_crc32c_chained_count > 0);
task->iov_cnt = g_crc32c_chained_count;
task->iovs = calloc(task->iov_cnt, sizeof(struct iovec));
if (!task->iovs) {
fprintf(stderr, "cannot allocated task->iovs fot task=%p\n", task);
return -ENOMEM;
}
for (i = 0; i < task->iov_cnt; i++) {
task->iovs[i].iov_base = spdk_dma_zmalloc(g_xfer_size_bytes, 0, NULL);
if (task->iovs[i].iov_base == NULL) {
return -ENOMEM;
}
memset(task->iovs[i].iov_base, DATA_PATTERN, g_xfer_size_bytes);
task->iovs[i].iov_len = g_xfer_size_bytes;
}
} else {
task->src = spdk_dma_zmalloc(g_xfer_size_bytes, 0, NULL);
if (task->src == NULL) {
fprintf(stderr, "Unable to alloc src buffer\n");
return -ENOMEM;
}
/* For fill, set the entire src buffer so we can check if verify is enabled. */
if (g_workload_selection == ACCEL_FILL) {
memset(task->src, g_fill_pattern, g_xfer_size_bytes);
} else {
memset(task->src, DATA_PATTERN, g_xfer_size_bytes);
}
}
memset(task->src, DATA_PATTERN, g_xfer_size_bytes);
task->dst = spdk_dma_zmalloc(g_xfer_size_bytes, align, NULL);
if (task->dst == NULL) {
@ -220,11 +293,6 @@ _get_task_data_bufs(struct ap_task *task)
memset(task->dst, ~DATA_PATTERN, g_xfer_size_bytes);
}
/* For fill, set the entire src buffer so we can check if verify is enabled. */
if (g_workload_selection == ACCEL_FILL) {
memset(task->src, g_fill_pattern, g_xfer_size_bytes);
}
if (g_workload_selection == ACCEL_DUALCAST) {
task->dst2 = spdk_dma_zmalloc(g_xfer_size_bytes, align, NULL);
if (task->dst2 == NULL) {
@ -255,8 +323,7 @@ _get_task(struct worker_thread *worker)
return task;
}
static void accel_done(void *ref, int status);
/* Submit one operation using the same ap task that just completed. */
static void
_submit_single(struct worker_thread *worker, struct ap_task *task)
{
@ -276,9 +343,9 @@ _submit_single(struct worker_thread *worker, struct ap_task *task)
g_xfer_size_bytes, accel_done, task);
break;
case ACCEL_CRC32C:
rc = spdk_accel_submit_crc32c(worker->ch, (uint32_t *)task->dst,
task->src, g_crc32c_seed,
g_xfer_size_bytes, accel_done, task);
rc = spdk_accel_submit_crc32cv(worker->ch, (uint32_t *)task->dst,
task->iovs, task->iov_cnt, g_crc32c_seed,
accel_done, task);
break;
case ACCEL_COMPARE:
random_num = rand() % 100;
@ -308,10 +375,15 @@ _submit_single(struct worker_thread *worker, struct ap_task *task)
}
static int
_batch_prep_cmd(struct worker_thread *worker, struct ap_task *task, struct spdk_accel_batch *batch)
_batch_prep_cmd(struct worker_thread *worker, struct ap_task *task,
struct accel_batch *worker_batch)
{
struct spdk_accel_batch *batch = worker_batch->batch;
int rc = 0;
worker_batch->cmd_count++;
assert(worker_batch->cmd_count <= g_ops_per_batch);
switch (g_workload_selection) {
case ACCEL_COPY:
rc = spdk_accel_batch_prep_copy(worker->ch, batch, task->dst,
@ -331,8 +403,8 @@ _batch_prep_cmd(struct worker_thread *worker, struct ap_task *task, struct spdk_
g_xfer_size_bytes, accel_done, task);
break;
case ACCEL_CRC32C:
rc = spdk_accel_batch_prep_crc32c(worker->ch, batch, (uint32_t *)task->dst,
task->src, g_crc32c_seed, g_xfer_size_bytes, accel_done, task);
rc = spdk_accel_batch_prep_crc32cv(worker->ch, batch, (uint32_t *)task->dst,
task->iovs, task->iov_cnt, g_crc32c_seed, accel_done, task);
break;
default:
assert(false);
@ -343,23 +415,162 @@ _batch_prep_cmd(struct worker_thread *worker, struct ap_task *task, struct spdk_
}
static void
_free_task(struct ap_task *task)
_free_task_buffers(struct ap_task *task)
{
spdk_dma_free(task->src);
uint32_t i;
if (g_workload_selection == ACCEL_CRC32C) {
if (task->iovs) {
for (i = 0; i < task->iov_cnt; i++) {
if (task->iovs[i].iov_base) {
spdk_dma_free(task->iovs[i].iov_base);
}
}
free(task->iovs);
}
} else {
spdk_dma_free(task->src);
}
spdk_dma_free(task->dst);
if (g_workload_selection == ACCEL_DUALCAST) {
spdk_dma_free(task->dst2);
}
}
static void _batch_done(void *cb_arg);
static void
_build_batch(struct worker_thread *worker, struct ap_task *task)
{
struct accel_batch *worker_batch = NULL;
int rc;
assert(!TAILQ_EMPTY(&worker->in_prep_batches));
worker_batch = TAILQ_FIRST(&worker->in_prep_batches);
/* If an accel batch hasn't been created yet do so now. */
if (worker_batch->batch == NULL) {
worker_batch->batch = spdk_accel_batch_create(worker->ch);
if (worker_batch->batch == NULL) {
fprintf(stderr, "error unable to create new batch\n");
return;
}
}
/* Prep the command re-using the last completed command's task */
rc = _batch_prep_cmd(worker, task, worker_batch);
if (rc) {
fprintf(stderr, "error preping command for batch\n");
goto error;
}
/* If this batch is full move it to the to_submit list so it gets
* submitted as batches complete.
*/
if (worker_batch->cmd_count == g_ops_per_batch) {
TAILQ_REMOVE(&worker->in_prep_batches, worker_batch, link);
TAILQ_INSERT_TAIL(&worker->to_submit_batches, worker_batch, link);
}
return;
error:
spdk_accel_batch_cancel(worker->ch, worker_batch->batch);
}
static void batch_done(void *cb_arg, int status);
static void
_drain_batch(struct worker_thread *worker)
{
struct accel_batch *worker_batch, *tmp;
int rc;
/* submit any batches that were being built up. */
TAILQ_FOREACH_SAFE(worker_batch, &worker->in_prep_batches, link, tmp) {
if (worker_batch->cmd_count == 0) {
continue;
}
worker->current_queue_depth += worker_batch->cmd_count + 1;
TAILQ_REMOVE(&worker->in_prep_batches, worker_batch, link);
TAILQ_INSERT_TAIL(&worker->in_use_batches, worker_batch, link);
rc = spdk_accel_batch_submit(worker->ch, worker_batch->batch, batch_done, worker_batch);
if (rc == 0) {
worker_batch->cmd_count = 0;
} else {
fprintf(stderr, "error sending final batch\n");
worker->current_queue_depth -= worker_batch->cmd_count + 1;
break;
}
}
}
static void
_batch_done(void *cb_arg)
{
struct accel_batch *worker_batch = (struct accel_batch *)cb_arg;
struct worker_thread *worker = worker_batch->worker;
int rc;
assert(TAILQ_EMPTY(&worker->in_use_batches) == 0);
if (worker_batch->status) {
SPDK_ERRLOG("error %d\n", worker_batch->status);
}
worker->current_queue_depth--;
TAILQ_REMOVE(&worker->in_use_batches, worker_batch, link);
TAILQ_INSERT_TAIL(&worker->in_prep_batches, worker_batch, link);
worker_batch->batch = NULL;
worker_batch->cmd_count = 0;
if (!worker->is_draining) {
worker_batch = TAILQ_FIRST(&worker->to_submit_batches);
if (worker_batch != NULL) {
assert(worker_batch->cmd_count == g_ops_per_batch);
/* Add one for the batch command itself. */
worker->current_queue_depth += g_ops_per_batch + 1;
TAILQ_REMOVE(&worker->to_submit_batches, worker_batch, link);
TAILQ_INSERT_TAIL(&worker->in_use_batches, worker_batch, link);
rc = spdk_accel_batch_submit(worker->ch, worker_batch->batch, batch_done, worker_batch);
if (rc) {
fprintf(stderr, "error ending batch\n");
worker->current_queue_depth -= g_ops_per_batch + 1;
return;
}
}
} else {
_drain_batch(worker);
}
}
static void
batch_done(void *cb_arg, int status)
{
struct ap_task *task = (struct ap_task *)cb_arg;
struct worker_thread *worker = task->worker;
struct accel_batch *worker_batch = (struct accel_batch *)cb_arg;
worker->current_queue_depth--;
TAILQ_INSERT_TAIL(&worker->tasks_pool, task, link);
assert(worker_batch->worker);
worker_batch->status = status;
spdk_thread_send_msg(worker_batch->worker->thread, _batch_done, worker_batch);
}
static uint32_t
_update_crc32c_iov(struct iovec *iov, int iovcnt, uint32_t crc32c)
{
int i;
for (i = 0; i < iovcnt; i++) {
assert(iov[i].iov_base != NULL);
assert(iov[i].iov_len != 0);
crc32c = spdk_crc32c_update(iov[i].iov_base, iov[i].iov_len, crc32c);
}
return crc32c;
}
static void
@ -375,8 +586,7 @@ _accel_done(void *arg1)
if (g_verify && task->status == 0) {
switch (g_workload_selection) {
case ACCEL_CRC32C:
/* calculate sw CRC-32C and compare to sw aceel result. */
sw_crc32c = spdk_crc32c_update(task->src, g_xfer_size_bytes, ~g_crc32c_seed);
sw_crc32c = _update_crc32c_iov(task->iovs, task->iov_cnt, ~g_crc32c_seed);
if (*(uint32_t *)task->dst != sw_crc32c) {
SPDK_NOTICELOG("CRC-32C miscompare\n");
worker->xfer_failed++;
@ -416,7 +626,7 @@ _accel_done(void *arg1)
assert(task->status != 0);
worker->injected_miscompares++;
} else if (task->status) {
/* Expected to pass but API reported error. */
/* Expected to pass but the accel engine reported an error (ex: COMPARE operation). */
worker->xfer_failed++;
}
@ -424,8 +634,16 @@ _accel_done(void *arg1)
worker->current_queue_depth--;
if (!worker->is_draining) {
_submit_single(worker, task);
worker->current_queue_depth++;
if (g_ops_per_batch == 0) {
_submit_single(worker, task);
worker->current_queue_depth++;
} else {
_build_batch(worker, task);
}
} else if (g_ops_per_batch > 0) {
_drain_batch(worker);
} else {
TAILQ_INSERT_TAIL(&worker->tasks_pool, task, link);
}
}
@ -438,8 +656,8 @@ dump_result(void)
uint64_t total_xfer_per_sec, total_bw_in_MiBps;
struct worker_thread *worker = g_workers;
printf("\nCore Transfers Bandwidth Failed Miscompares\n");
printf("-----------------------------------------------------------------\n");
printf("\nCore,Thread Transfers Bandwidth Failed Miscompares\n");
printf("------------------------------------------------------------------------\n");
while (worker != NULL) {
uint64_t xfer_per_sec = worker->xfer_completed / g_time_in_sec;
@ -451,8 +669,8 @@ dump_result(void)
total_miscompared += worker->injected_miscompares;
if (xfer_per_sec) {
printf("%10d%12" PRIu64 "/s%8" PRIu64 " MiB/s%11" PRIu64 " %11" PRIu64 "\n",
worker->core, xfer_per_sec,
printf("%u,%u%17" PRIu64 "/s%9" PRIu64 " MiB/s%7" PRIu64 " %11" PRIu64 "\n",
worker->display.core, worker->display.thread, xfer_per_sec,
bw_in_MiBps, worker->xfer_failed, worker->injected_miscompares);
}
@ -463,26 +681,34 @@ dump_result(void)
total_bw_in_MiBps = (total_completed * g_xfer_size_bytes) /
(g_time_in_sec * 1024 * 1024);
printf("==================================================================\n");
printf("Total:%16" PRIu64 "/s%8" PRIu64 " MiB/s%11" PRIu64 " %11" PRIu64"\n\n",
printf("=========================================================================\n");
printf("Total:%15" PRIu64 "/s%9" PRIu64 " MiB/s%6" PRIu64 " %11" PRIu64"\n\n",
total_xfer_per_sec, total_bw_in_MiBps, total_failed, total_miscompared);
return total_failed ? 1 : 0;
}
static inline void
_free_task_buffers_in_pool(struct worker_thread *worker)
{
struct ap_task *task;
assert(worker);
while ((task = TAILQ_FIRST(&worker->tasks_pool))) {
TAILQ_REMOVE(&worker->tasks_pool, task, link);
_free_task_buffers(task);
}
}
static int
_check_draining(void *arg)
{
struct worker_thread *worker = arg;
struct ap_task *task;
assert(worker);
if (worker->current_queue_depth == 0) {
while ((task = TAILQ_FIRST(&worker->tasks_pool))) {
TAILQ_REMOVE(&worker->tasks_pool, task, link);
_free_task(task);
}
_free_task_buffers_in_pool(worker);
spdk_poller_unregister(&worker->is_draining_poller);
unregister_worker(worker);
}
@ -506,36 +732,83 @@ _worker_stop(void *arg)
return 0;
}
static void
_init_thread_done(void *ctx)
{
}
static void
_init_thread(void *arg1)
{
struct worker_thread *worker;
struct ap_task *task;
int i, rc, max_per_batch, batch_count, num_tasks;
int i, rc, num_batches;
int max_per_batch;
int remaining = g_queue_depth;
struct spdk_accel_batch *batch, *new_batch;
int num_tasks = g_queue_depth;
struct accel_batch *tmp;
struct accel_batch *worker_batch = NULL;
struct display_info *display = arg1;
worker = calloc(1, sizeof(*worker));
if (worker == NULL) {
fprintf(stderr, "Unable to allocate worker\n");
free(display);
return;
}
worker->display.core = display->core;
worker->display.thread = display->thread;
free(display);
worker->core = spdk_env_get_current_core();
worker->thread = spdk_get_thread();
pthread_mutex_lock(&g_workers_lock);
g_num_workers++;
worker->next = g_workers;
g_workers = worker;
pthread_mutex_unlock(&g_workers_lock);
worker->ch = spdk_accel_engine_get_io_channel();
max_per_batch = spdk_accel_batch_get_max(worker->ch);
assert(max_per_batch > 0);
num_tasks = g_queue_depth + spdk_divide_round_up(g_queue_depth, max_per_batch);
TAILQ_INIT(&worker->tasks_pool);
if (g_ops_per_batch > 0) {
max_per_batch = spdk_accel_batch_get_max(worker->ch);
assert(max_per_batch > 0);
if (g_ops_per_batch > max_per_batch) {
fprintf(stderr, "Reducing requested batch amount to max supported of %d\n", max_per_batch);
g_ops_per_batch = max_per_batch;
}
if (g_ops_per_batch > g_queue_depth) {
fprintf(stderr, "Batch amount > queue depth, resetting to %d\n", g_queue_depth);
g_ops_per_batch = g_queue_depth;
}
TAILQ_INIT(&worker->in_prep_batches);
TAILQ_INIT(&worker->to_submit_batches);
TAILQ_INIT(&worker->in_use_batches);
/* A worker_batch will live on one of 3 lists:
* IN_PREP: as individual IOs complete new ones are built on on a
* worker_batch on this list until it reaches g_ops_per_batch.
* TO_SUBMIT: as batches are built up on IO completion they are moved
* to this list once they are full. This list is used in
* batch completion to start new batches.
* IN_USE: the worker_batch is outstanding and will be moved to in prep
* list when the batch is completed.
*
* So we need enough to cover Q depth loading and then one to replace
* each one of those and for when everything is outstanding there needs
* to be one extra batch to build up while the last batch is completing
* IO but before it's completed the batch command.
*/
num_batches = (g_queue_depth / g_ops_per_batch * 2) + 1;
worker->batch_base = calloc(num_batches, sizeof(struct accel_batch));
worker_batch = worker->batch_base;
for (i = 0; i < num_batches; i++) {
worker_batch->worker = worker;
TAILQ_INSERT_TAIL(&worker->in_prep_batches, worker_batch, link);
worker_batch++;
}
}
worker->task_base = calloc(num_tasks, sizeof(struct ap_task));
if (worker->task_base == NULL) {
fprintf(stderr, "Could not allocate task base.\n");
@ -556,66 +829,53 @@ _init_thread(void *arg1)
worker->stop_poller = SPDK_POLLER_REGISTER(_worker_stop, worker,
g_time_in_sec * 1000000ULL);
g_workers = worker;
pthread_mutex_lock(&g_workers_lock);
g_num_workers++;
pthread_mutex_unlock(&g_workers_lock);
/* Batching is only possible if there is at least 2 operations. */
if (g_queue_depth > 1) {
/* Outter loop sets up each batch command, inner loop populates the
* batch descriptors.
*/
/* If batching is enabled load up to the full Q depth before
* processing any completions, then ping pong between two batches,
* one processing and one being built up for when the other completes.
*/
if (g_ops_per_batch > 0) {
do {
new_batch = spdk_accel_batch_create(worker->ch);
if (new_batch == NULL) {
worker_batch = TAILQ_FIRST(&worker->in_prep_batches);
if (worker_batch == NULL) {
goto error;
}
worker_batch->batch = spdk_accel_batch_create(worker->ch);
if (worker_batch->batch == NULL) {
raise(SIGINT);
break;
}
batch = new_batch;
batch_count = 0;
do {
for (i = 0; i < g_ops_per_batch; i++) {
task = _get_task(worker);
if (task == NULL) {
goto error;
}
rc = _batch_prep_cmd(worker, task, batch);
rc = _batch_prep_cmd(worker, task, worker_batch);
if (rc) {
fprintf(stderr, "error preping command\n");
goto error;
}
remaining--;
batch_count++;
} while (batch_count < max_per_batch && remaining > 0);
/* Now send the batch command. */
task = _get_task(worker);
if (task == NULL) {
goto error;
}
rc = spdk_accel_batch_submit(worker->ch, batch, batch_done, task);
/* for the batch operation itself. */
task->worker->current_queue_depth++;
TAILQ_REMOVE(&worker->in_prep_batches, worker_batch, link);
TAILQ_INSERT_TAIL(&worker->in_use_batches, worker_batch, link);
rc = spdk_accel_batch_submit(worker->ch, worker_batch->batch, batch_done, worker_batch);
if (rc) {
fprintf(stderr, "error ending batch %d\n", rc);
fprintf(stderr, "error ending batch\n");
goto error;
}
/* We can't build a batch unless it has 2 descriptors (per spec). */
} while (remaining > 1);
/* If there are no more left, we're done. */
if (remaining == 0) {
return;
}
assert(remaining >= g_ops_per_batch);
remaining -= g_ops_per_batch;
} while (remaining > 0);
}
/* For engines that don't support batch or for the odd event that
* a batch ends with only one descriptor left.
*/
/* Submit as singles when no batching is enabled or we ran out of batches. */
for (i = 0; i < remaining; i++) {
task = _get_task(worker);
if (task == NULL) {
goto error;
@ -625,10 +885,15 @@ _init_thread(void *arg1)
}
return;
error:
while ((task = TAILQ_FIRST(&worker->tasks_pool))) {
TAILQ_REMOVE(&worker->tasks_pool, task, link);
_free_task(task);
if (worker_batch && worker_batch->batch) {
TAILQ_FOREACH_SAFE(worker_batch, &worker->in_use_batches, link, tmp) {
spdk_accel_batch_cancel(worker->ch, worker_batch->batch);
TAILQ_REMOVE(&worker->in_use_batches, worker_batch, link);
}
}
_free_task_buffers_in_pool(worker);
free(worker->batch_base);
free(worker->task_base);
free(worker);
spdk_app_stop(-1);
@ -650,6 +915,12 @@ static void
accel_perf_start(void *arg1)
{
struct spdk_io_channel *accel_ch;
struct spdk_cpuset tmp_cpumask = {};
char thread_name[32];
uint32_t i;
int j;
struct spdk_thread *thread;
struct display_info *display;
accel_ch = spdk_accel_engine_get_io_channel();
g_capabilites = spdk_accel_get_capabilities(accel_ch);
@ -661,13 +932,29 @@ accel_perf_start(void *arg1)
}
g_tsc_rate = spdk_get_ticks_hz();
g_tsc_us_rate = g_tsc_rate / (1000 * 1000);
g_tsc_end = spdk_get_ticks() + g_time_in_sec * g_tsc_rate;
printf("Running for %d seconds...\n", g_time_in_sec);
fflush(stdout);
spdk_for_each_thread(_init_thread, NULL, _init_thread_done);
/* Create worker threads for each core that was specified. */
SPDK_ENV_FOREACH_CORE(i) {
for (j = 0; j < g_threads_per_core; j++) {
snprintf(thread_name, sizeof(thread_name), "ap_worker_%u_%u", i, j);
spdk_cpuset_zero(&tmp_cpumask);
spdk_cpuset_set_cpu(&tmp_cpumask, i, true);
thread = spdk_thread_create(thread_name, &tmp_cpumask);
display = calloc(1, sizeof(*display));
if (display == NULL) {
fprintf(stderr, "Unable to allocate memory\n");
spdk_app_stop(-1);
return;
}
display->core = i;
display->thread = j;
spdk_thread_send_msg(thread, _init_thread, display);
}
}
}
int
@ -675,14 +962,13 @@ main(int argc, char **argv)
{
struct spdk_app_opts opts = {};
struct worker_thread *worker, *tmp;
int rc = 0;
pthread_mutex_init(&g_workers_lock, NULL);
spdk_app_opts_init(&opts, sizeof(opts));
opts.reactor_mask = "0x1";
if (spdk_app_parse_args(argc, argv, &opts, "o:q:t:yw:P:f:", NULL, parse_args,
if (spdk_app_parse_args(argc, argv, &opts, "C:o:q:t:yw:P:f:b:T:", NULL, parse_args,
usage) != SPDK_APP_PARSE_ARGS_SUCCESS) {
rc = -1;
g_rc = -1;
goto cleanup;
}
@ -692,16 +978,28 @@ main(int argc, char **argv)
(g_workload_selection != ACCEL_COMPARE) &&
(g_workload_selection != ACCEL_DUALCAST)) {
usage();
rc = -1;
g_rc = -1;
goto cleanup;
}
if (g_ops_per_batch > 0 && (g_queue_depth % g_ops_per_batch > 0)) {
fprintf(stdout, "batch size must be a multiple of queue depth\n");
usage();
g_rc = -1;
goto cleanup;
}
if (g_workload_selection == ACCEL_CRC32C &&
g_crc32c_chained_count == 0) {
usage();
g_rc = -1;
goto cleanup;
}
dump_user_config(&opts);
rc = spdk_app_start(&opts, accel_perf_start, NULL);
if (rc) {
g_rc = spdk_app_start(&opts, accel_perf_start, NULL);
if (g_rc) {
SPDK_ERRLOG("ERROR starting application\n");
} else {
dump_result();
}
pthread_mutex_destroy(&g_workers_lock);
@ -714,5 +1012,5 @@ main(int argc, char **argv)
}
cleanup:
spdk_app_fini();
return rc;
return g_rc;
}

View File

@ -59,7 +59,7 @@ struct spdk_fio_options {
char *conf;
char *json_conf;
unsigned mem_mb;
bool mem_single_seg;
int mem_single_seg;
};
struct spdk_fio_request {
@ -789,6 +789,7 @@ static struct fio_option options[] = {
.type = FIO_OPT_BOOL,
.off1 = offsetof(struct spdk_fio_options, mem_single_seg),
.help = "If set to 1, SPDK will use just a single hugetlbfs file",
.def = "0",
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},

View File

@ -38,7 +38,7 @@
#include "spdk/event.h"
#include "spdk/log.h"
#include "spdk/string.h"
#include "spdk/bdev_module.h"
#include "spdk/bdev_zone.h"
static char *g_bdev_name = "Malloc0";
@ -191,6 +191,50 @@ hello_bdev_event_cb(enum spdk_bdev_event_type type, struct spdk_bdev *bdev,
SPDK_NOTICELOG("Unsupported bdev event: type %d\n", type);
}
static void
reset_zone_complete(struct spdk_bdev_io *bdev_io, bool success, void *cb_arg)
{
struct hello_context_t *hello_context = cb_arg;
/* Complete the I/O */
spdk_bdev_free_io(bdev_io);
if (!success) {
SPDK_ERRLOG("bdev io reset zone error: %d\n", EIO);
spdk_put_io_channel(hello_context->bdev_io_channel);
spdk_bdev_close(hello_context->bdev_desc);
spdk_app_stop(-1);
return;
}
hello_write(hello_context);
}
static void
hello_reset_zone(void *arg)
{
struct hello_context_t *hello_context = arg;
int rc = 0;
rc = spdk_bdev_zone_management(hello_context->bdev_desc, hello_context->bdev_io_channel,
0, SPDK_BDEV_ZONE_RESET, reset_zone_complete, hello_context);
if (rc == -ENOMEM) {
SPDK_NOTICELOG("Queueing io\n");
/* In case we cannot perform I/O now, queue I/O */
hello_context->bdev_io_wait.bdev = hello_context->bdev;
hello_context->bdev_io_wait.cb_fn = hello_reset_zone;
hello_context->bdev_io_wait.cb_arg = hello_context;
spdk_bdev_queue_io_wait(hello_context->bdev, hello_context->bdev_io_channel,
&hello_context->bdev_io_wait);
} else if (rc) {
SPDK_ERRLOG("%s error while resetting zone: %d\n", spdk_strerror(-rc), rc);
spdk_put_io_channel(hello_context->bdev_io_channel);
spdk_bdev_close(hello_context->bdev_desc);
spdk_app_stop(-1);
}
}
/*
* Our initial event that kicks off everything from main().
*/
@ -250,6 +294,12 @@ hello_start(void *arg1)
}
snprintf(hello_context->buff, blk_size, "%s", "Hello World!\n");
if (spdk_bdev_is_zoned(hello_context->bdev)) {
hello_reset_zone(hello_context);
/* If bdev is zoned, the callback, reset_zone_complete, will call hello_write() */
return;
}
hello_write(hello_context);
}

View File

@ -0,0 +1,15 @@
from rpc.client import print_json
def reactor_set_interrupt_mode(args):
params = {'lcore': args.lcore, 'disable_interrupt': args.disable_interrupt}
return args.client.call('reactor_set_interrupt_mode', params)
def spdk_rpc_plugin_initialize(subparsers):
p = subparsers.add_parser('reactor_set_interrupt_mode',
help="""Set reactor to interrupt or back to poll mode.""")
p.add_argument('lcore', type=int, help='lcore of the reactor')
p.add_argument('-d', '--disable-interrupt', dest='disable_interrupt', action='store_true',
help='Set reactor back to poll mode')
p.set_defaults(func=reactor_set_interrupt_mode)

View File

@ -35,6 +35,70 @@
#include "spdk/conf.h"
#include "spdk/event.h"
#include "spdk/vhost.h"
#include "spdk/json.h"
#include "spdk/jsonrpc.h"
#include "spdk/rpc.h"
#include "spdk/env.h"
#include "spdk_internal/event.h"
struct rpc_reactor_set_interrupt_mode {
int32_t lcore;
bool disable_interrupt;
};
static const struct spdk_json_object_decoder rpc_reactor_set_interrupt_mode_decoders[] = {
{"lcore", offsetof(struct rpc_reactor_set_interrupt_mode, lcore), spdk_json_decode_int32},
{"disable_interrupt", offsetof(struct rpc_reactor_set_interrupt_mode, disable_interrupt), spdk_json_decode_bool},
};
static void
rpc_reactor_set_interrupt_mode_cb(void *cb_arg)
{
struct spdk_jsonrpc_request *request = cb_arg;
SPDK_NOTICELOG("complete reactor switch\n");
spdk_jsonrpc_send_bool_response(request, true);
}
static void
rpc_reactor_set_interrupt_mode(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct rpc_reactor_set_interrupt_mode req = {};
int rc;
if (spdk_json_decode_object(params, rpc_reactor_set_interrupt_mode_decoders,
SPDK_COUNTOF(rpc_reactor_set_interrupt_mode_decoders),
&req)) {
SPDK_ERRLOG("spdk_json_decode_object failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"spdk_json_decode_object failed");
return;
}
SPDK_NOTICELOG("RPC Start to %s interrupt mode on reactor %d.\n",
req.disable_interrupt ? "disable" : "enable", req.lcore);
if (req.lcore >= (int64_t)spdk_env_get_first_core() &&
req.lcore <= (int64_t)spdk_env_get_last_core()) {
rc = spdk_reactor_set_interrupt_mode(req.lcore, !req.disable_interrupt,
rpc_reactor_set_interrupt_mode_cb, request);
if (rc) {
goto err;
}
} else {
goto err;
}
return;
err:
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"Invalid parameters");
}
/* private */ SPDK_RPC_REGISTER("reactor_set_interrupt_mode", rpc_reactor_set_interrupt_mode,
SPDK_RPC_RUNTIME)
static void
interrupt_tgt_usage(void)

View File

@ -35,7 +35,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
DIRS-y += hello_world identify perf reconnect nvme_manage arbitration \
hotplug cmb_copy abort
hotplug cmb_copy abort pmr_persistence
DIRS-$(CONFIG_FIO_PLUGIN) += fio_plugin

View File

@ -642,7 +642,7 @@ parse_args(int argc, char **argv)
long int val;
int rc;
while ((op = getopt(argc, argv, "a:c:i:o:q:r:s:t:w:M:")) != -1) {
while ((op = getopt(argc, argv, "a:c:i:o:q:r:s:t:w:GM:T:")) != -1) {
switch (op) {
case 'a':
case 'i':

View File

@ -139,6 +139,17 @@ then you can reset all zones before fio start running its jobs by using the engi
--initial_zone_reset=1
## Zone Append
When running FIO against a Zoned Namespace you need to specify --iodepth=1 to avoid
"Zone Invalid Write: The write to a zone was not at the write pointer." I/O errors.
However, if your controller supports Zone Append, you can use the engine option:
--zone_append=1
To send zone append commands instead of write commands to the controller.
When using zone append, you will be able to specify a --iodepth greater than 1.
## Shared Memory Increase
If your device has a lot of zones, fio can give you errors such as:

View File

@ -9,7 +9,6 @@ ramp_time=0
runtime=2
iodepth=128
rw=randrw
bs=4k
[test]
numjobs=1

View File

@ -93,6 +93,8 @@ struct spdk_fio_options {
char *digest_enable;
int enable_vmd;
int initial_zone_reset;
int zone_append;
int print_qid_mappings;
};
struct spdk_fio_request {
@ -130,6 +132,7 @@ struct spdk_fio_qpair {
struct spdk_nvme_qpair *qpair;
struct spdk_nvme_ns *ns;
uint32_t io_flags;
bool zone_append_enabled;
bool nvme_pi_enabled;
/* True for DIF and false for DIX, and this is valid only if nvme_pi_enabled is true. */
bool extended_lba;
@ -287,13 +290,35 @@ pcu(struct spdk_nvme_qpair *qpair, int *completed)
}
#endif
static inline uint32_t
_nvme_get_host_buffer_sector_size(struct spdk_nvme_ns *ns, uint32_t io_flags)
{
bool md_excluded_from_xfer = false;
uint32_t md_size;
uint32_t ns_flags;
ns_flags = spdk_nvme_ns_get_flags(ns);
md_size = spdk_nvme_ns_get_md_size(ns);
/* For extended LBA format, if the metadata size is 8 bytes and PRACT is
* enabled(controller inserts/strips PI), we should reduce metadata size
* from block size.
*/
md_excluded_from_xfer = ((io_flags & SPDK_NVME_IO_FLAGS_PRACT) &&
(ns_flags & SPDK_NVME_NS_EXTENDED_LBA_SUPPORTED) &&
(ns_flags & SPDK_NVME_NS_DPS_PI_SUPPORTED) &&
(md_size == 8));
return md_excluded_from_xfer ? spdk_nvme_ns_get_sector_size(ns) :
spdk_nvme_ns_get_extended_sector_size(ns);
}
static void
attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{
struct thread_data *td = cb_ctx;
struct spdk_fio_thread *fio_thread = td->io_ops_data;
struct spdk_nvme_io_qpair_opts qpopts;
struct spdk_fio_ctrlr *fio_ctrlr;
struct spdk_fio_qpair *fio_qpair;
struct spdk_nvme_ns *ns;
@ -302,6 +327,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
uint32_t ns_id;
char *p;
long int tmp;
uint32_t block_size;
struct spdk_fio_options *fio_options = td->eo;
p = strstr(f->file_name, "ns=");
@ -371,20 +397,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
return;
}
spdk_nvme_ctrlr_get_default_io_qpair_opts(fio_ctrlr->ctrlr, &qpopts, sizeof(qpopts));
qpopts.delay_cmd_submit = true;
if (fio_options->enable_wrr) {
qpopts.qprio = fio_options->wrr_priority;
}
fio_qpair->qpair = spdk_nvme_ctrlr_alloc_io_qpair(fio_ctrlr->ctrlr, &qpopts, sizeof(qpopts));
if (!fio_qpair->qpair) {
SPDK_ERRLOG("Cannot allocate nvme io_qpair any more\n");
g_error = true;
free(fio_qpair);
return;
}
f->engine_data = fio_qpair;
fio_qpair->ns = ns;
fio_qpair->f = f;
fio_qpair->fio_ctrlr = fio_ctrlr;
@ -400,14 +413,57 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
fio_qpair->extended_lba ? "extended lba" : "separate metadata");
}
if (spdk_nvme_ns_supports_extended_lba(ns) &&
(td->o.bs[DDIR_READ] % spdk_nvme_ns_get_extended_sector_size(ns) != 0 ||
td->o.bs[DDIR_WRITE] % spdk_nvme_ns_get_extended_sector_size(ns) != 0)) {
SPDK_ERRLOG("--bs has to be equal to LBA data size + Metadata size\n");
block_size = _nvme_get_host_buffer_sector_size(ns, fio_qpair->io_flags);
if (td->o.bs[DDIR_READ] % block_size != 0 || td->o.bs[DDIR_WRITE] % block_size != 0) {
if (spdk_nvme_ns_supports_extended_lba(ns)) {
SPDK_ERRLOG("--bs has to be a multiple of (LBA data size + Metadata size)\n");
} else {
SPDK_ERRLOG("--bs has to be a multiple of LBA data size\n");
}
g_error = true;
return;
}
if (fio_options->zone_append && spdk_nvme_ns_get_csi(ns) == SPDK_NVME_CSI_ZNS) {
if (spdk_nvme_ctrlr_get_flags(ctrlr) & SPDK_NVME_CTRLR_ZONE_APPEND_SUPPORTED) {
fprintf(stdout, "Using zone appends instead of writes on: '%s'\n",
fio_qpair->f->file_name);
fio_qpair->zone_append_enabled = true;
} else {
SPDK_WARNLOG("Falling back to writes on: '%s' - ns lacks zone append cmd\n",
fio_qpair->f->file_name);
}
}
if (fio_options->initial_zone_reset == 1 && spdk_nvme_ns_get_csi(ns) == SPDK_NVME_CSI_ZNS) {
#if FIO_HAS_ZBD
struct spdk_nvme_qpair *tmp_qpair;
int completed = 0, err;
/* qpair has not been allocated yet (it gets allocated in spdk_fio_open()).
* Create a temporary qpair in order to perform the initial zone reset.
*/
assert(!fio_qpair->qpair);
tmp_qpair = spdk_nvme_ctrlr_alloc_io_qpair(ctrlr, NULL, 0);
if (!tmp_qpair) {
SPDK_ERRLOG("Cannot allocate a temporary qpair\n");
g_error = true;
return;
}
err = spdk_nvme_zns_reset_zone(ns, tmp_qpair, 0x0, true, pcu_cb, &completed);
if (err || pcu(tmp_qpair, &completed) || completed < 0) {
log_err("spdk/nvme: warn: initial_zone_reset: err: %d, cpl: %d\n",
err, completed);
}
spdk_nvme_ctrlr_free_io_qpair(tmp_qpair);
#else
log_err("spdk/nvme: ZBD/ZNS is not supported\n");
#endif
}
f->real_file_size = spdk_nvme_ns_get_size(fio_qpair->ns);
if (f->real_file_size <= 0) {
g_error = true;
@ -597,39 +653,35 @@ static int spdk_fio_setup(struct thread_data *td)
g_td_count++;
pthread_mutex_unlock(&g_mutex);
if (fio_options->initial_zone_reset == 1) {
#if FIO_HAS_ZBD
struct spdk_fio_qpair *fio_qpair;
TAILQ_FOREACH(fio_qpair, &fio_thread->fio_qpair, link) {
const struct spdk_nvme_zns_ns_data *zns_data;
int completed = 0, err;
if (!fio_qpair->ns) {
continue;
}
zns_data = spdk_nvme_zns_ns_get_data(fio_qpair->ns);
if (!zns_data) {
continue;
}
err = spdk_nvme_zns_reset_zone(fio_qpair->ns, fio_qpair->qpair, 0x0, true,
pcu_cb, &completed);
if (err || pcu(fio_qpair->qpair, &completed) || completed < 0) {
log_err("spdk/nvme: warn: initial_zone_reset: err: %d, cpl: %d\n",
err, completed);
}
}
#else
log_err("spdk/nvme: ZBD/ZNS is not supported\n");
#endif
}
return rc;
}
static int spdk_fio_open(struct thread_data *td, struct fio_file *f)
{
struct spdk_fio_qpair *fio_qpair = f->engine_data;
struct spdk_fio_ctrlr *fio_ctrlr = fio_qpair->fio_ctrlr;
struct spdk_fio_options *fio_options = td->eo;
struct spdk_nvme_io_qpair_opts qpopts;
spdk_nvme_ctrlr_get_default_io_qpair_opts(fio_ctrlr->ctrlr, &qpopts, sizeof(qpopts));
qpopts.delay_cmd_submit = true;
if (fio_options->enable_wrr) {
qpopts.qprio = fio_options->wrr_priority;
}
fio_qpair->qpair = spdk_nvme_ctrlr_alloc_io_qpair(fio_ctrlr->ctrlr, &qpopts, sizeof(qpopts));
if (!fio_qpair->qpair) {
SPDK_ERRLOG("Cannot allocate nvme io_qpair any more\n");
g_error = true;
free(fio_qpair);
return -1;
}
if (fio_options->print_qid_mappings == 1) {
log_info("job %s: %s qid %d\n", td->o.name, f->file_name,
spdk_nvme_qpair_get_id(fio_qpair->qpair));
}
return 0;
}
@ -688,6 +740,12 @@ static void spdk_fio_io_u_free(struct thread_data *td, struct io_u *io_u)
}
}
static inline uint64_t
fio_offset_to_zslba(unsigned long long offset, struct spdk_nvme_ns *ns)
{
return (offset / spdk_nvme_zns_ns_get_zone_size(ns)) * spdk_nvme_zns_ns_get_zone_size_sectors(ns);
}
static int
fio_extended_lba_setup_pi(struct spdk_fio_qpair *fio_qpair, struct io_u *io_u)
{
@ -857,6 +915,10 @@ static void spdk_fio_completion_cb(void *ctx, const struct spdk_nvme_cpl *cpl)
}
}
if (spdk_nvme_cpl_is_error(cpl)) {
fio_req->io->error = EIO;
}
assert(fio_thread->iocq_count < fio_thread->iocq_size);
fio_thread->iocq[fio_thread->iocq_count++] = fio_req->io;
}
@ -941,16 +1003,7 @@ spdk_fio_queue(struct thread_data *td, struct io_u *io_u)
}
fio_req->fio_qpair = fio_qpair;
block_size = spdk_nvme_ns_get_extended_sector_size(ns);
if ((fio_qpair->io_flags & g_spdk_pract_flag) && (spdk_nvme_ns_get_md_size(ns) == 8)) {
/* If metadata size = 8 bytes, PI is stripped (read) or inserted (write), and
* so reduce metadata size from block size. (If metadata size > 8 bytes, PI
* is passed (read) or replaced (write). So block size is not necessary to
* change.)
*/
block_size = spdk_nvme_ns_get_sector_size(ns);
}
block_size = _nvme_get_host_buffer_sector_size(ns, fio_qpair->io_flags);
lba = io_u->offset / block_size;
lba_count = io_u->xfer_buflen / block_size;
@ -982,15 +1035,31 @@ spdk_fio_queue(struct thread_data *td, struct io_u *io_u)
break;
case DDIR_WRITE:
if (!g_spdk_enable_sgl) {
rc = spdk_nvme_ns_cmd_write_with_md(ns, fio_qpair->qpair, io_u->buf, md_buf, lba,
lba_count,
spdk_fio_completion_cb, fio_req,
fio_qpair->io_flags, dif_ctx->apptag_mask, dif_ctx->app_tag);
if (!fio_qpair->zone_append_enabled) {
rc = spdk_nvme_ns_cmd_write_with_md(ns, fio_qpair->qpair, io_u->buf, md_buf, lba,
lba_count,
spdk_fio_completion_cb, fio_req,
fio_qpair->io_flags, dif_ctx->apptag_mask, dif_ctx->app_tag);
} else {
uint64_t zslba = fio_offset_to_zslba(io_u->offset, fio_qpair->ns);
rc = spdk_nvme_zns_zone_append_with_md(ns, fio_qpair->qpair, io_u->buf, md_buf, zslba,
lba_count,
spdk_fio_completion_cb, fio_req,
fio_qpair->io_flags, dif_ctx->apptag_mask, dif_ctx->app_tag);
}
} else {
rc = spdk_nvme_ns_cmd_writev_with_md(ns, fio_qpair->qpair, lba,
lba_count, spdk_fio_completion_cb, fio_req, fio_qpair->io_flags,
spdk_nvme_io_reset_sgl, spdk_nvme_io_next_sge, md_buf,
dif_ctx->apptag_mask, dif_ctx->app_tag);
if (!fio_qpair->zone_append_enabled) {
rc = spdk_nvme_ns_cmd_writev_with_md(ns, fio_qpair->qpair, lba,
lba_count, spdk_fio_completion_cb, fio_req, fio_qpair->io_flags,
spdk_nvme_io_reset_sgl, spdk_nvme_io_next_sge, md_buf,
dif_ctx->apptag_mask, dif_ctx->app_tag);
} else {
uint64_t zslba = fio_offset_to_zslba(io_u->offset, fio_qpair->ns);
rc = spdk_nvme_zns_zone_appendv_with_md(ns, fio_qpair->qpair, zslba,
lba_count, spdk_fio_completion_cb, fio_req, fio_qpair->io_flags,
spdk_nvme_io_reset_sgl, spdk_nvme_io_next_sge, md_buf,
dif_ctx->apptag_mask, dif_ctx->app_tag);
}
}
break;
default:
@ -1158,6 +1227,7 @@ spdk_fio_report_zones(struct thread_data *td, struct fio_file *f, uint64_t offse
struct spdk_fio_qpair *fio_qpair = NULL;
const struct spdk_nvme_zns_ns_data *zns = NULL;
struct spdk_nvme_zns_zone_report *report;
struct spdk_nvme_qpair *tmp_qpair;
uint32_t report_nzones = 0, report_nzones_max, report_nbytes, mdts_nbytes;
uint64_t zsze_nbytes, ns_nzones, lba_nbytes;
int completed = 0, err;
@ -1173,6 +1243,17 @@ spdk_fio_report_zones(struct thread_data *td, struct fio_file *f, uint64_t offse
return -EINVAL;
}
/* qpair has not been allocated yet (it gets allocated in spdk_fio_open()).
* Create a temporary qpair in order to perform report zones.
*/
assert(!fio_qpair->qpair);
tmp_qpair = spdk_nvme_ctrlr_alloc_io_qpair(fio_qpair->fio_ctrlr->ctrlr, NULL, 0);
if (!tmp_qpair) {
log_err("spdk/nvme: cannot allocate a temporary qpair\n");
return -EIO;
}
/** Retrieve device parameters */
mdts_nbytes = spdk_nvme_ns_get_max_io_xfer_size(fio_qpair->ns);
lba_nbytes = spdk_nvme_ns_get_sector_size(fio_qpair->ns);
@ -1183,16 +1264,17 @@ spdk_fio_report_zones(struct thread_data *td, struct fio_file *f, uint64_t offse
report_nzones_max = (mdts_nbytes - sizeof(*report)) / sizeof(report->descs[0]);
report_nzones_max = spdk_min(spdk_min(report_nzones_max, nr_zones), ns_nzones);
report_nbytes = sizeof(report->descs[0]) * report_nzones_max + sizeof(*report);
report = spdk_dma_zmalloc(report_nbytes, NVME_IO_ALIGN, NULL);
report = calloc(1, report_nbytes);
if (!report) {
log_err("spdk/nvme: failed report_zones(): ENOMEM\n");
return -ENOMEM;
err = -ENOMEM;
goto exit;
}
err = spdk_nvme_zns_report_zones(fio_qpair->ns, fio_qpair->qpair, report, report_nbytes,
err = spdk_nvme_zns_report_zones(fio_qpair->ns, tmp_qpair, report, report_nbytes,
offset / lba_nbytes, SPDK_NVME_ZRA_LIST_ALL, true, pcu_cb,
&completed);
if (err || pcu(fio_qpair->qpair, &completed) || completed < 0) {
if (err || pcu(tmp_qpair, &completed) || completed < 0) {
log_err("spdk/nvme: report_zones(): err: %d, cpl: %d\n", err, completed);
err = err ? err : -EIO;
goto exit;
@ -1250,7 +1332,8 @@ spdk_fio_report_zones(struct thread_data *td, struct fio_file *f, uint64_t offse
}
exit:
spdk_dma_free(report);
spdk_nvme_ctrlr_free_io_qpair(tmp_qpair);
free(report);
return err ? err : (int)report_nzones;
}
@ -1545,6 +1628,26 @@ static struct fio_option options[] = {
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.name = "zone_append",
.lname = "Use zone append instead of write",
.type = FIO_OPT_INT,
.off1 = offsetof(struct spdk_fio_options, zone_append),
.def = "0",
.help = "Use zone append instead of write (zone_append=1 or zone_append=0)",
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.name = "print_qid_mappings",
.lname = "Print job-to-qid mappings",
.type = FIO_OPT_INT,
.off1 = offsetof(struct spdk_fio_options, print_qid_mappings),
.def = "0",
.help = "Print job-to-qid mappings (0=disable, 1=enable)",
.category = FIO_OPT_C_ENGINE,
.group = FIO_OPT_G_INVALID,
},
{
.name = NULL,
},

View File

@ -50,6 +50,7 @@
#define MAX_DISCOVERY_LOG_ENTRIES ((uint64_t)1000)
#define NUM_CHUNK_INFO_ENTRIES 8
#define MAX_OCSSD_PU 128
#define MAX_ZONE_DESC_ENTRIES 8
static int outstanding_commands;
@ -85,9 +86,9 @@ static uint64_t g_discovery_page_numrec;
static struct spdk_ocssd_geometry_data geometry_data;
static struct spdk_ocssd_chunk_information_entry g_ocssd_chunk_info_page[NUM_CHUNK_INFO_ENTRIES ];
static struct spdk_ocssd_chunk_information_entry *g_ocssd_chunk_info_page;
static bool g_zone_report_full = false;
static int64_t g_zone_report_limit = 8;
static bool g_hex_dump = false;
@ -108,6 +109,8 @@ static int g_controllers_found = 0;
static bool g_vmd = false;
static bool g_ocssd_verbose = false;
static void
hex_dump(const void *data, size_t size)
{
@ -225,7 +228,10 @@ get_features(struct spdk_nvme_ctrlr *ctrlr)
SPDK_OCSSD_FEAT_MEDIA_FEEDBACK,
};
/* Submit several GET FEATURES commands and wait for them to complete */
/* Submit only one GET FEATURES at a time. There is a known issue #1799
* with Google Cloud Platform NVMe SSDs that do not handle overlapped
* GET FEATURES commands correctly.
*/
outstanding_commands = 0;
for (i = 0; i < SPDK_COUNTOF(features_to_get); i++) {
if (!spdk_nvme_ctrlr_is_ocssd_supported(ctrlr) &&
@ -237,11 +243,12 @@ get_features(struct spdk_nvme_ctrlr *ctrlr)
} else {
printf("get_feature(0x%02X) failed to submit command\n", features_to_get[i]);
}
while (outstanding_commands) {
spdk_nvme_ctrlr_process_admin_completions(ctrlr);
}
}
while (outstanding_commands) {
spdk_nvme_ctrlr_process_admin_completions(ctrlr);
}
}
static int
@ -542,15 +549,34 @@ get_ocssd_chunk_info_log_page(struct spdk_nvme_ns *ns)
{
struct spdk_nvme_ctrlr *ctrlr = spdk_nvme_ns_get_ctrlr(ns);
int nsid = spdk_nvme_ns_get_id(ns);
uint32_t num_entry = geometry_data.num_grp * geometry_data.num_pu * geometry_data.num_chk;
uint32_t xfer_size = spdk_nvme_ns_get_max_io_xfer_size(ns);
uint32_t buf_size = 0;
uint64_t buf_offset = 0;
outstanding_commands = 0;
if (spdk_nvme_ctrlr_cmd_get_log_page(ctrlr, SPDK_OCSSD_LOG_CHUNK_INFO,
nsid, &g_ocssd_chunk_info_page, sizeof(g_ocssd_chunk_info_page), 0,
get_log_page_completion, NULL) == 0) {
outstanding_commands++;
} else {
printf("get_ocssd_chunk_info_log_page() failed\n");
return -1;
assert(num_entry != 0);
if (!g_ocssd_verbose) {
num_entry = spdk_min(num_entry, NUM_CHUNK_INFO_ENTRIES);
}
g_ocssd_chunk_info_page = calloc(num_entry, sizeof(struct spdk_ocssd_chunk_information_entry));
assert(g_ocssd_chunk_info_page != NULL);
buf_size = num_entry * sizeof(struct spdk_ocssd_chunk_information_entry);
while (buf_size > 0) {
xfer_size = spdk_min(buf_size, xfer_size);
if (spdk_nvme_ctrlr_cmd_get_log_page(ctrlr, SPDK_OCSSD_LOG_CHUNK_INFO,
nsid, (void *) g_ocssd_chunk_info_page + buf_offset,
xfer_size, buf_offset, get_log_page_completion, NULL) == 0) {
outstanding_commands++;
} else {
printf("get_ocssd_chunk_info_log_page() failed\n");
return -1;
}
buf_size -= xfer_size;
buf_offset += xfer_size;
}
while (outstanding_commands) {
@ -648,6 +674,16 @@ print_ascii_string(const void *buf, size_t size)
}
}
/* Underline a "line" with the given marker, e.g. print_uline("=", printf(...)); */
static void
print_uline(char marker, int line_len)
{
for (int i = 1; i < line_len; ++i) {
putchar(marker);
}
putchar('\n');
}
static void
print_ocssd_chunk_info(struct spdk_ocssd_chunk_information_entry *chk_info, int chk_num)
{
@ -677,6 +713,45 @@ print_ocssd_chunk_info(struct spdk_ocssd_chunk_information_entry *chk_info, int
}
}
static void
print_ocssd_chunk_info_verbose(struct spdk_ocssd_chunk_information_entry *chk_info)
{
uint32_t pu, chk, i;
uint32_t cnt_free, cnt_closed, cnt_open, cnt_offline;
uint32_t max_pu = spdk_min(MAX_OCSSD_PU, (geometry_data.num_grp * geometry_data.num_pu));
char cs_str[MAX_OCSSD_PU + 1], cs;
assert(chk_info != NULL);
printf("OCSSD Chunk Info Verbose\n");
printf("======================\n");
printf("%4s %-*s %3s %3s %3s %3s\n", "band", max_pu, "chunk state", "fr", "cl", "op", "of");
for (chk = 0; chk < geometry_data.num_chk; chk++) {
cnt_free = cnt_closed = cnt_open = cnt_offline = 0;
for (pu = 0; pu < max_pu; pu++) {
i = (pu * geometry_data.num_chk) + chk;
if (chk_info[i].cs.free) {
cnt_free++;
cs = 'f';
} else if (chk_info[i].cs.closed) {
cnt_closed++;
cs = 'c';
} else if (chk_info[i].cs.open) {
cnt_open++;
cs = 'o';
} else if (chk_info[i].cs.offline) {
cnt_offline++;
cs = 'l';
} else {
cs = '.';
}
cs_str[pu] = cs;
}
cs_str[pu] = 0;
printf("%4d %s %3d %3d %3d %3d\n", chk, cs_str, cnt_free, cnt_closed, cnt_open, cnt_offline);
}
}
static void
print_ocssd_geometry(struct spdk_ocssd_geometry_data *geometry_data)
{
@ -727,7 +802,7 @@ get_and_print_zns_zone_report(struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *q
{
struct spdk_nvme_zns_zone_report *report_buf;
size_t report_bufsize;
uint64_t zone_size_lba = spdk_nvme_zns_ns_get_zone_size(ns) / spdk_nvme_ns_get_sector_size(ns);
uint64_t zone_size_lba = spdk_nvme_zns_ns_get_zone_size_sectors(ns);
uint64_t total_zones = spdk_nvme_zns_ns_get_num_zones(ns);
uint64_t max_zones_per_buf, zones_to_print, i;
uint64_t handled_zones = 0;
@ -736,21 +811,16 @@ get_and_print_zns_zone_report(struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *q
outstanding_commands = 0;
report_bufsize = spdk_nvme_ns_get_max_io_xfer_size(ns);
report_buf = malloc(report_bufsize);
report_buf = calloc(1, report_bufsize);
if (!report_buf) {
printf("Zone report allocation failed!\n");
exit(1);
}
if (g_zone_report_full) {
zones_to_print = total_zones;
printf("NVMe ZNS Zone Report\n");
printf("====================\n");
} else {
zones_to_print = spdk_min(total_zones, MAX_ZONE_DESC_ENTRIES);
printf("NVMe ZNS Zone Report Glance\n");
printf("===========================\n");
}
zones_to_print = g_zone_report_limit ? spdk_min(total_zones, (uint64_t)g_zone_report_limit) : \
total_zones;
print_uline('=', printf("NVMe ZNS Zone Report (first %zu of %zu)\n", zones_to_print, total_zones));
while (handled_zones < zones_to_print) {
memset(report_buf, 0, report_bufsize);
@ -826,6 +896,24 @@ print_zns_ns_data(const struct spdk_nvme_zns_ns_data *nsdata_zns)
printf("\n");
}
static const char *
csi_name(enum spdk_nvme_csi csi)
{
switch (csi) {
case SPDK_NVME_CSI_NVM:
return "NVM";
case SPDK_NVME_CSI_KV:
return "KV";
case SPDK_NVME_CSI_ZNS:
return "ZNS";
default:
if (csi >= 0x30 && csi <= 0x3f) {
return "Vendor specific";
}
return "Unknown";
}
}
static void
print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
{
@ -837,6 +925,7 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
uint32_t flags;
char uuid_str[SPDK_UUID_STRING_LEN];
uint32_t blocksize;
enum spdk_nvme_dealloc_logical_block_read_value dlfeat_read_value;
cdata = spdk_nvme_ctrlr_get_data(ctrlr);
nsdata = spdk_nvme_ns_get_data(ns);
@ -853,13 +942,16 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
/* This function is only called for active namespaces. */
assert(spdk_nvme_ns_is_active(ns));
printf("Command Set Identifier: %s (%02Xh)\n",
csi_name(spdk_nvme_ns_get_csi(ns)), spdk_nvme_ns_get_csi(ns));
printf("Deallocate: %s\n",
(flags & SPDK_NVME_NS_DEALLOCATE_SUPPORTED) ? "Supported" : "Not Supported");
printf("Deallocated/Unwritten Error: %s\n",
nsdata->nsfeat.dealloc_or_unwritten_error ? "Supported" : "Not Supported");
dlfeat_read_value = spdk_nvme_ns_get_dealloc_logical_block_read_value(ns);
printf("Deallocated Read Value: %s\n",
nsdata->dlfeat.bits.read_value == SPDK_NVME_DEALLOC_READ_00 ? "All 0x00" :
nsdata->dlfeat.bits.read_value == SPDK_NVME_DEALLOC_READ_FF ? "All 0xFF" :
dlfeat_read_value == SPDK_NVME_DEALLOC_READ_00 ? "All 0x00" :
dlfeat_read_value == SPDK_NVME_DEALLOC_READ_FF ? "All 0xFF" :
"Unknown");
printf("Deallocate in Write Zeroes: %s\n",
nsdata->dlfeat.bits.write_zero_deallocate ? "Supported" : "Not Supported");
@ -956,7 +1048,11 @@ print_namespace(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
get_ocssd_geometry(ns, &geometry_data);
print_ocssd_geometry(&geometry_data);
get_ocssd_chunk_info_log_page(ns);
print_ocssd_chunk_info(g_ocssd_chunk_info_page, NUM_CHUNK_INFO_ENTRIES);
if (g_ocssd_verbose) {
print_ocssd_chunk_info_verbose(g_ocssd_chunk_info_page);
} else {
print_ocssd_chunk_info(g_ocssd_chunk_info_page, NUM_CHUNK_INFO_ENTRIES);
}
} else if (spdk_nvme_ns_get_csi(ns) == SPDK_NVME_CSI_ZNS) {
struct spdk_nvme_qpair *qpair = spdk_nvme_ctrlr_alloc_io_qpair(ctrlr, NULL, 0);
if (qpair == NULL) {
@ -1074,6 +1170,7 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
union spdk_nvme_cap_register cap;
union spdk_nvme_vs_register vs;
union spdk_nvme_cmbsz_register cmbsz;
union spdk_nvme_pmrcap_register pmrcap;
uint8_t str[512];
uint32_t i, j;
struct spdk_nvme_error_information_entry *error_entry;
@ -1081,11 +1178,14 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
struct spdk_pci_device *pci_dev;
struct spdk_pci_id pci_id;
uint32_t nsid;
uint64_t pmrsz;
struct spdk_nvme_ana_group_descriptor *desc;
cap = spdk_nvme_ctrlr_get_regs_cap(ctrlr);
vs = spdk_nvme_ctrlr_get_regs_vs(ctrlr);
cmbsz = spdk_nvme_ctrlr_get_regs_cmbsz(ctrlr);
pmrcap = spdk_nvme_ctrlr_get_regs_pmrcap(ctrlr);
pmrsz = spdk_nvme_ctrlr_get_pmrsz(ctrlr);
if (!spdk_nvme_ctrlr_is_discovery(ctrlr)) {
/*
@ -1198,6 +1298,9 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
(uint64_t)1 << (12 + cap.bits.mpsmin));
printf("Memory Page Size Maximum: %" PRIu64 " bytes\n",
(uint64_t)1 << (12 + cap.bits.mpsmax));
printf("Persistent Memory Region: %s\n",
cap.bits.pmrs ? "Supported" : "Not Supported");
printf("Optional Asynchronous Events Supported\n");
printf(" Namespace Attribute Notices: %s\n",
cdata->oaes.ns_attribute_notices ? "Supported" : "Not Supported");
@ -1233,6 +1336,20 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
}
printf("\n");
printf("Persistent Memory Region Support\n");
printf("================================\n");
if (cap.bits.pmrs != 0) {
printf("Supported: Yes\n");
printf("Total Size: %" PRIu64 " bytes\n", pmrsz);
printf("Read data and metadata in PMR %s\n",
pmrcap.bits.rds ? "Supported" : "Not Supported");
printf("Write data and metadata in PMR: %s\n",
pmrcap.bits.wds ? "Supported" : "Not Supported");
} else {
printf("Supported: No\n");
}
printf("\n");
printf("Admin Command Set Attributes\n");
printf("============================\n");
printf("Security Send/Receive: %s\n",
@ -1933,8 +2050,7 @@ usage(const char *program_name)
printf(" -d DPDK huge memory size in MB\n");
printf(" -g use single file descriptor for DPDK memory segments\n");
printf(" -x print hex dump of raw data\n");
printf(" -z For NVMe Zoned Namespaces, dump the full zone report\n");
printf(" -v verbose (enable warnings)\n");
printf(" -z For NVMe Zoned Namespaces, dump the full zone report (-z) or the first N entries (-z N)\n");
printf(" -V enumerate VMD\n");
printf(" -H show this usage\n");
}
@ -1948,7 +2064,7 @@ parse_args(int argc, char **argv)
spdk_nvme_trid_populate_transport(&g_trid, SPDK_NVME_TRANSPORT_PCIE);
snprintf(g_trid.subnqn, sizeof(g_trid.subnqn), "%s", SPDK_NVMF_DISCOVERY_NQN);
while ((op = getopt(argc, argv, "d:gi:p:r:xzHL:V")) != -1) {
while ((op = getopt(argc, argv, "d:gi:op:r:xz::HL:V")) != -1) {
switch (op) {
case 'd':
g_dpdk_mem = spdk_strtol(optarg, 10);
@ -1967,6 +2083,9 @@ parse_args(int argc, char **argv)
return g_shm_id;
}
break;
case 'o':
g_ocssd_verbose = true;
break;
case 'p':
g_main_core = spdk_strtol(optarg, 10);
if (g_main_core < 0) {
@ -1981,6 +2100,7 @@ parse_args(int argc, char **argv)
return 1;
}
assert(optarg != NULL);
hostnqn = strcasestr(optarg, "hostnqn:");
if (hostnqn) {
size_t len;
@ -2001,7 +2121,18 @@ parse_args(int argc, char **argv)
g_hex_dump = true;
break;
case 'z':
g_zone_report_full = true;
if (optarg == NULL && argv[optind] != NULL && argv[optind][0] != '-') {
g_zone_report_limit = spdk_strtol(argv[optind], 10);
++optind;
} else if (optarg) {
g_zone_report_limit = spdk_strtol(optarg, 10);
} else {
g_zone_report_limit = 0;
}
if (g_zone_report_limit < 0) {
fprintf(stderr, "Invalid Zone Report limit\n");
return g_zone_report_limit;
}
break;
case 'L':
rc = spdk_log_set_flag(optarg);

View File

@ -136,6 +136,11 @@ struct ns_worker_stats {
uint64_t total_tsc;
uint64_t min_tsc;
uint64_t max_tsc;
uint64_t last_tsc;
uint64_t busy_tsc;
uint64_t idle_tsc;
uint64_t last_busy_tsc;
uint64_t last_idle_tsc;
};
struct ns_worker_ctx {
@ -203,13 +208,14 @@ struct ns_fn_table {
int (*submit_io)(struct perf_task *task, struct ns_worker_ctx *ns_ctx,
struct ns_entry *entry, uint64_t offset_in_ios);
void (*check_io)(struct ns_worker_ctx *ns_ctx);
int64_t (*check_io)(struct ns_worker_ctx *ns_ctx);
void (*verify_io)(struct perf_task *task, struct ns_entry *entry);
int (*init_ns_worker_ctx)(struct ns_worker_ctx *ns_ctx);
void (*cleanup_ns_worker_ctx)(struct ns_worker_ctx *ns_ctx);
void (*dump_transport_stats)(uint32_t lcore, struct ns_worker_ctx *ns_ctx);
};
static uint32_t g_io_unit_size = (UINT32_MAX & (~0x03));
@ -231,6 +237,8 @@ static pthread_barrier_t g_worker_sync_barrier;
static uint64_t g_tsc_rate;
static bool g_monitor_perf_cores = false;
static uint32_t g_io_align = 0x200;
static bool g_io_align_specified;
static uint32_t g_io_size_bytes;
@ -244,14 +252,11 @@ static int g_queue_depth;
static int g_nr_io_queues_per_ns = 1;
static int g_nr_unused_io_queues;
static int g_time_in_sec;
static uint64_t g_elapsed_time_in_usec;
static int g_warmup_time_in_sec;
static uint32_t g_max_completions;
static int g_dpdk_mem;
static bool g_dpdk_mem_single_seg = false;
static int g_shm_id = -1;
static uint32_t g_disable_sq_cmb;
static bool g_use_uring;
static bool g_no_pci;
static bool g_warn;
static bool g_header_digest;
static bool g_data_digest;
@ -285,11 +290,11 @@ static uint32_t g_quiet_count = 1;
__count++; \
}
static const char *g_core_mask;
static bool g_dump_transport_stats;
static pthread_mutex_t g_stats_mutex;
#define MAX_ALLOWED_PCI_DEVICE_NUM 128
static struct spdk_pci_addr g_allowed_pci_addr[MAX_ALLOWED_PCI_DEVICE_NUM];
static uint32_t g_allowed_pci_addr_num;
struct trid_entry {
struct spdk_nvme_transport_id trid;
@ -330,6 +335,7 @@ perf_set_sock_zcopy(const char *impl_name, bool enable)
}
sock_opts.enable_zerocopy_send = enable;
sock_opts.enable_zerocopy_send_client = enable;
if (spdk_sock_impl_set_opts(impl_name, &sock_opts, opts_size)) {
fprintf(stderr, "Failed to %s zcopy send for sock impl %s: error %d (%s)\n",
@ -447,10 +453,10 @@ uring_submit_io(struct perf_task *task, struct ns_worker_ctx *ns_ctx,
return 0;
}
static void
static int64_t
uring_check_io(struct ns_worker_ctx *ns_ctx)
{
int i, count, to_complete, to_submit, ret = 0;
int i, to_complete, to_submit, count = 0, ret = 0;
struct perf_task *task;
to_submit = ns_ctx->u.uring.io_pending;
@ -460,7 +466,7 @@ uring_check_io(struct ns_worker_ctx *ns_ctx)
* It will automatically call spdk_io_uring_enter appropriately. */
ret = io_uring_submit(&ns_ctx->u.uring.ring);
if (ret < 0) {
return;
return -1;
}
ns_ctx->u.uring.io_pending = 0;
ns_ctx->u.uring.io_inflight += to_submit;
@ -481,6 +487,7 @@ uring_check_io(struct ns_worker_ctx *ns_ctx)
task_complete(task);
}
}
return count;
}
static void
@ -580,7 +587,7 @@ aio_submit_io(struct perf_task *task, struct ns_worker_ctx *ns_ctx,
}
}
static void
static int64_t
aio_check_io(struct ns_worker_ctx *ns_ctx)
{
int count, i;
@ -598,6 +605,7 @@ aio_check_io(struct ns_worker_ctx *ns_ctx)
for (i = 0; i < count; i++) {
task_complete(ns_ctx->u.aio.events[i].data);
}
return count;
}
static void
@ -884,16 +892,18 @@ perf_disconnect_cb(struct spdk_nvme_qpair *qpair, void *ctx)
}
static void
static int64_t
nvme_check_io(struct ns_worker_ctx *ns_ctx)
{
int64_t rc;
rc = spdk_nvme_poll_group_process_completions(ns_ctx->u.nvme.group, 0, perf_disconnect_cb);
rc = spdk_nvme_poll_group_process_completions(ns_ctx->u.nvme.group, g_max_completions,
perf_disconnect_cb);
if (rc < 0) {
fprintf(stderr, "NVMe io qpair process completion error\n");
exit(1);
}
return rc;
}
static void
@ -950,7 +960,7 @@ nvme_init_ns_worker_ctx(struct ns_worker_ctx *ns_ctx)
opts.delay_cmd_submit = true;
opts.create_only = true;
ns_ctx->u.nvme.group = spdk_nvme_poll_group_create(NULL);
ns_ctx->u.nvme.group = spdk_nvme_poll_group_create(NULL, NULL);
if (ns_ctx->u.nvme.group == NULL) {
goto poll_group_failed;
}
@ -1007,6 +1017,84 @@ nvme_cleanup_ns_worker_ctx(struct ns_worker_ctx *ns_ctx)
free(ns_ctx->u.nvme.qpair);
}
static void
nvme_dump_rdma_statistics(struct spdk_nvme_transport_poll_group_stat *stat)
{
struct spdk_nvme_rdma_device_stat *device_stats;
uint32_t i;
printf("RDMA transport:\n");
for (i = 0; i < stat->rdma.num_devices; i++) {
device_stats = &stat->rdma.device_stats[i];
printf("\tdev name: %s\n", device_stats->name);
printf("\tpolls: %"PRIu64"\n", device_stats->polls);
printf("\tidle_polls: %"PRIu64"\n", device_stats->idle_polls);
printf("\tcompletions: %"PRIu64"\n", device_stats->completions);
printf("\tqueued_requests: %"PRIu64"\n", device_stats->queued_requests);
printf("\ttotal_send_wrs: %"PRIu64"\n", device_stats->total_send_wrs);
printf("\tsend_doorbell_updates: %"PRIu64"\n", device_stats->send_doorbell_updates);
printf("\ttotal_recv_wrs: %"PRIu64"\n", device_stats->total_recv_wrs);
printf("\trecv_doorbell_updates: %"PRIu64"\n", device_stats->recv_doorbell_updates);
printf("\t---------------------------------\n");
}
}
static void
nvme_dump_pcie_statistics(struct spdk_nvme_transport_poll_group_stat *stat)
{
struct spdk_nvme_pcie_stat *pcie_stat;
pcie_stat = &stat->pcie;
printf("PCIE transport:\n");
printf("\tpolls: %"PRIu64"\n", pcie_stat->polls);
printf("\tidle_polls: %"PRIu64"\n", pcie_stat->idle_polls);
printf("\tcompletions: %"PRIu64"\n", pcie_stat->completions);
printf("\tcq_doorbell_updates: %"PRIu64"\n", pcie_stat->cq_doorbell_updates);
printf("\tsubmitted_requests: %"PRIu64"\n", pcie_stat->submitted_requests);
printf("\tsq_doobell_updates: %"PRIu64"\n", pcie_stat->sq_doobell_updates);
printf("\tqueued_requests: %"PRIu64"\n", pcie_stat->queued_requests);
}
static void
nvme_dump_transport_stats(uint32_t lcore, struct ns_worker_ctx *ns_ctx)
{
struct spdk_nvme_poll_group *group;
struct spdk_nvme_poll_group_stat *stat = NULL;
uint32_t i;
int rc;
group = ns_ctx->u.nvme.group;
if (group == NULL) {
return;
}
rc = spdk_nvme_poll_group_get_stats(group, &stat);
if (rc) {
fprintf(stderr, "Can't get transport stats, error %d\n", rc);
return;
}
printf("\n====================\n");
printf("lcore %u, ns %s statistics:\n", lcore, ns_ctx->entry->name);
for (i = 0; i < stat->num_transports; i++) {
switch (stat->transport_stat[i]->trtype) {
case SPDK_NVME_TRANSPORT_RDMA:
nvme_dump_rdma_statistics(stat->transport_stat[i]);
break;
case SPDK_NVME_TRANSPORT_PCIE:
nvme_dump_pcie_statistics(stat->transport_stat[i]);
break;
default:
fprintf(stderr, "Unknown transport statistics %d %s\n", stat->transport_stat[i]->trtype,
spdk_nvme_transport_id_trtype_str(stat->transport_stat[i]->trtype));
}
}
spdk_nvme_poll_group_free_stats(group, stat);
}
static const struct ns_fn_table nvme_fn_table = {
.setup_payload = nvme_setup_payload,
.submit_io = nvme_submit_io,
@ -1014,6 +1102,7 @@ static const struct ns_fn_table nvme_fn_table = {
.verify_io = nvme_verify_io,
.init_ns_worker_ctx = nvme_init_ns_worker_ctx,
.cleanup_ns_worker_ctx = nvme_cleanup_ns_worker_ctx,
.dump_transport_stats = nvme_dump_transport_stats
};
static int
@ -1284,6 +1373,10 @@ submit_single_io(struct perf_task *task)
if (spdk_unlikely(rc != 0)) {
RATELIMIT_LOG("starting I/O failed\n");
spdk_dma_free(task->iovs[0].iov_base);
free(task->iovs);
spdk_dma_free(task->md_iov.iov_base);
free(task);
} else {
ns_ctx->current_queue_depth++;
}
@ -1404,6 +1497,11 @@ print_periodic_performance(bool warmup)
double mb_this_second;
struct worker_thread *worker;
struct ns_worker_ctx *ns_ctx;
uint64_t busy_tsc;
uint64_t idle_tsc;
uint64_t core_busy_tsc = 0;
uint64_t core_idle_tsc = 0;
double core_busy_perc = 0;
if (!isatty(STDOUT_FILENO)) {
/* Don't print periodic stats if output is not going
@ -1411,29 +1509,60 @@ print_periodic_performance(bool warmup)
*/
return;
}
io_this_second = 0;
TAILQ_FOREACH(worker, &g_workers, link) {
busy_tsc = 0;
idle_tsc = 0;
TAILQ_FOREACH(ns_ctx, &worker->ns_ctx, link) {
io_this_second += ns_ctx->stats.io_completed - ns_ctx->stats.last_io_completed;
ns_ctx->stats.last_io_completed = ns_ctx->stats.io_completed;
if (g_monitor_perf_cores) {
busy_tsc += ns_ctx->stats.busy_tsc - ns_ctx->stats.last_busy_tsc;
idle_tsc += ns_ctx->stats.idle_tsc - ns_ctx->stats.last_idle_tsc;
ns_ctx->stats.last_busy_tsc = ns_ctx->stats.busy_tsc;
ns_ctx->stats.last_idle_tsc = ns_ctx->stats.idle_tsc;
}
}
if (g_monitor_perf_cores) {
core_busy_tsc += busy_tsc;
core_idle_tsc += idle_tsc;
core_busy_perc += (double)core_busy_tsc / (core_idle_tsc + core_busy_tsc) * 100;
}
}
mb_this_second = (double)io_this_second * g_io_size_bytes / (1024 * 1024);
printf("%s%9ju IOPS, %8.2f MiB/s\r", warmup ? "[warmup] " : "", io_this_second, mb_this_second);
printf("%s%9ju IOPS, %8.2f MiB/s", warmup ? "[warmup] " : "", io_this_second, mb_this_second);
if (g_monitor_perf_cores) {
printf("%3d Core(s): %6.2f%% Busy", g_num_workers, core_busy_perc);
}
printf("\r");
fflush(stdout);
}
static void
perf_dump_transport_statistics(struct worker_thread *worker)
{
struct ns_worker_ctx *ns_ctx;
TAILQ_FOREACH(ns_ctx, &worker->ns_ctx, link) {
if (ns_ctx->entry->fn_table->dump_transport_stats) {
ns_ctx->entry->fn_table->dump_transport_stats(worker->lcore, ns_ctx);
}
}
}
static int
work_fn(void *arg)
{
uint64_t tsc_end, tsc_current, tsc_next_print;
uint64_t tsc_start, tsc_end, tsc_current, tsc_next_print;
struct worker_thread *worker = (struct worker_thread *) arg;
struct ns_worker_ctx *ns_ctx = NULL;
uint32_t unfinished_ns_ctx;
bool warmup = false;
int rc;
int64_t check_rc;
uint64_t check_now;
/* Allocate queue pairs for each namespace. */
TAILQ_FOREACH(ns_ctx, &worker->ns_ctx, link) {
@ -1451,7 +1580,8 @@ work_fn(void *arg)
return 1;
}
tsc_current = spdk_get_ticks();
tsc_start = spdk_get_ticks();
tsc_current = tsc_start;
tsc_next_print = tsc_current + g_tsc_rate;
if (g_warmup_time_in_sec) {
@ -1473,7 +1603,15 @@ work_fn(void *arg)
* to replace each I/O that is completed.
*/
TAILQ_FOREACH(ns_ctx, &worker->ns_ctx, link) {
ns_ctx->entry->fn_table->check_io(ns_ctx);
check_now = spdk_get_ticks();
check_rc = ns_ctx->entry->fn_table->check_io(ns_ctx);
if (check_rc > 0) {
ns_ctx->stats.busy_tsc += check_now - ns_ctx->stats.last_tsc;
} else {
ns_ctx->stats.idle_tsc += check_now - ns_ctx->stats.last_tsc;
}
ns_ctx->stats.last_tsc = check_now;
}
tsc_current = spdk_get_ticks();
@ -1505,6 +1643,20 @@ work_fn(void *arg)
}
}
/* Capture the actual elapsed time when we break out of the main loop. This will account
* for cases where we exit prematurely due to a signal. We only need to capture it on
* one core, so use the main core.
*/
if (worker->lcore == g_main_core) {
g_elapsed_time_in_usec = (tsc_current - tsc_start) * SPDK_SEC_TO_USEC / g_tsc_rate;
}
if (g_dump_transport_stats) {
pthread_mutex_lock(&g_stats_mutex);
perf_dump_transport_statistics(worker);
pthread_mutex_unlock(&g_stats_mutex);
}
/* drain the io of each ns_ctx in round robin to make the fairness */
do {
unfinished_ns_ctx = 0;
@ -1516,15 +1668,17 @@ work_fn(void *arg)
if (ns_ctx->current_queue_depth > 0) {
ns_ctx->entry->fn_table->check_io(ns_ctx);
if (ns_ctx->current_queue_depth == 0) {
cleanup_ns_worker_ctx(ns_ctx);
} else {
if (ns_ctx->current_queue_depth > 0) {
unfinished_ns_ctx++;
}
}
}
} while (unfinished_ns_ctx > 0);
TAILQ_FOREACH(ns_ctx, &worker->ns_ctx, link) {
cleanup_ns_worker_ctx(ns_ctx);
}
return 0;
}
@ -1535,28 +1689,28 @@ static void usage(char *program_name)
printf(" [Kernel device(s)]...");
#endif
printf("\n");
printf("\t[-b allowed local PCIe device address]\n");
printf("\t[-b, --allowed-pci-addr <addr> allowed local PCIe device address]\n");
printf("\t Example: -b 0000:d8:00.0 -b 0000:d9:00.0\n");
printf("\t[-q io depth]\n");
printf("\t[-o io size in bytes]\n");
printf("\t[-O io unit size in bytes (4-byte aligned) for SPDK driver. default: same as io size]\n");
printf("\t[-P number of io queues per namespace. default: 1]\n");
printf("\t[-U number of unused io queues per controller. default: 0]\n");
printf("\t[-w io pattern type, must be one of\n");
printf("\t[-q, --io-depth <val> io depth]\n");
printf("\t[-o, --io-size <val> io size in bytes]\n");
printf("\t[-O, --io-unit-size io unit size in bytes (4-byte aligned) for SPDK driver. default: same as io size]\n");
printf("\t[-P, --num-qpairs <val> number of io queues per namespace. default: 1]\n");
printf("\t[-U, --num-unused-qpairs <val> number of unused io queues per controller. default: 0]\n");
printf("\t[-w, --io-pattern <pattern> io pattern type, must be one of\n");
printf("\t\t(read, write, randread, randwrite, rw, randrw)]\n");
printf("\t[-M rwmixread (100 for reads, 0 for writes)]\n");
printf("\t[-L enable latency tracking via sw, default: disabled]\n");
printf("\t[-M, --rwmixread <0-100> rwmixread (100 for reads, 0 for writes)]\n");
printf("\t[-L, --enable-sw-latency-tracking enable latency tracking via sw, default: disabled]\n");
printf("\t\t-L for latency summary, -LL for detailed histogram\n");
printf("\t[-l enable latency tracking via ssd (if supported), default: disabled]\n");
printf("\t[-t time in seconds]\n");
printf("\t[-a warmup time in seconds]\n");
printf("\t[-c core mask for I/O submission/completion.]\n");
printf("\t[-l, --enable-ssd-latency-tracking enable latency tracking via ssd (if supported), default: disabled]\n");
printf("\t[-t, --time <sec> time in seconds]\n");
printf("\t[-a, --warmup-time <sec> warmup time in seconds]\n");
printf("\t[-c, --core-mask <mask> core mask for I/O submission/completion.]\n");
printf("\t\t(default: 1)\n");
printf("\t[-D disable submission queue in controller memory buffer, default: enabled]\n");
printf("\t[-H enable header digest for TCP transport, default: disabled]\n");
printf("\t[-I enable data digest for TCP transport, default: disabled]\n");
printf("\t[-N no shutdown notification process for controllers, default: disabled]\n");
printf("\t[-r Transport ID for local PCIe NVMe or NVMeoF]\n");
printf("\t[-D, --disable-sq-cmb disable submission queue in controller memory buffer, default: enabled]\n");
printf("\t[-H, --enable-tcp-hdgst enable header digest for TCP transport, default: disabled]\n");
printf("\t[-I, --enable-tcp-ddgst enable data digest for TCP transport, default: disabled]\n");
printf("\t[-N, --no-shst-notification no shutdown notification process for controllers, default: disabled]\n");
printf("\t[-r, --transport <fmt> Transport ID for local PCIe NVMe or NVMeoF]\n");
printf("\t Format: 'key:value [key:value] ...'\n");
printf("\t Keys:\n");
printf("\t trtype Transport type (e.g. PCIe, RDMA)\n");
@ -1564,37 +1718,42 @@ static void usage(char *program_name)
printf("\t traddr Transport address (e.g. 0000:04:00.0 for PCIe or 192.168.100.8 for RDMA)\n");
printf("\t trsvcid Transport service identifier (e.g. 4420)\n");
printf("\t subnqn Subsystem NQN (default: %s)\n", SPDK_NVMF_DISCOVERY_NQN);
printf("\t ns NVMe namespace ID (all active namespaces are used by default)\n");
printf("\t hostnqn Host NQN\n");
printf("\t Example: -r 'trtype:PCIe traddr:0000:04:00.0' for PCIe or\n");
printf("\t -r 'trtype:RDMA adrfam:IPv4 traddr:192.168.100.8 trsvcid:4420' for NVMeoF\n");
printf("\t[-e metadata configuration]\n");
printf("\t Note: can be specified multiple times to test multiple disks/targets.\n");
printf("\t[-e, --metadata <fmt> metadata configuration]\n");
printf("\t Keys:\n");
printf("\t PRACT Protection Information Action bit (PRACT=1 or PRACT=0)\n");
printf("\t PRCHK Control of Protection Information Checking (PRCHK=GUARD|REFTAG|APPTAG)\n");
printf("\t Example: -e 'PRACT=0,PRCHK=GUARD|REFTAG|APPTAG'\n");
printf("\t -e 'PRACT=1,PRCHK=GUARD'\n");
printf("\t[-k keep alive timeout period in millisecond]\n");
printf("\t[-s DPDK huge memory size in MB.]\n");
printf("\t[-g use single file descriptor for DPDK memory segments]\n");
printf("\t[-C max completions per poll]\n");
printf("\t[-k, --keepalive <ms> keep alive timeout period in millisecond]\n");
printf("\t[-s, --hugemem-size <MB> DPDK huge memory size in MB.]\n");
printf("\t[-g, --mem-single-seg use single file descriptor for DPDK memory segments]\n");
printf("\t[-C, --max-completion-per-poll <val> max completions per poll]\n");
printf("\t\t(default: 0 - unlimited)\n");
printf("\t[-i shared memory group ID]\n");
printf("\t[-Q log I/O errors every N times (default: 1)\n");
printf("\t[-i, --shmem-grp-id <id> shared memory group ID]\n");
printf("\t[-Q, --skip-errors log I/O errors every N times (default: 1)\n");
printf("\t");
spdk_log_usage(stdout, "-T");
printf("\t[-V enable VMD enumeration]\n");
printf("\t[-z disable zero copy send for the given sock implementation. Default for posix impl]\n");
printf("\t[-Z enable zero copy send for the given sock implementation]\n");
printf("\t[-A IO buffer alignment. Must be power of 2 and not less than cache line (%u)]\n",
printf("\t[-V, --enable-vmd enable VMD enumeration]\n");
printf("\t[-z, --disable-zcopy <impl> disable zero copy send for the given sock implementation. Default for posix impl]\n");
printf("\t[-Z, --enable-zcopy <impl> enable zero copy send for the given sock implementation]\n");
printf("\t[-A, --buffer-alignment IO buffer alignment. Must be power of 2 and not less than cache line (%u)]\n",
SPDK_CACHE_LINE_SIZE);
printf("\t[-S set the default sock impl, e.g. \"posix\"]\n");
printf("\t[-S, --default-sock-impl <impl> set the default sock impl, e.g. \"posix\"]\n");
printf("\t[-m, --cpu-usage display real-time overall cpu usage on used cores]\n");
#ifdef SPDK_CONFIG_URING
printf("\t[-R enable using liburing to drive kernel devices (Default: libaio)]\n");
printf("\t[-R, --enable-uring enable using liburing to drive kernel devices (Default: libaio)]\n");
#endif
#ifdef DEBUG
printf("\t[-G enable debug logging]\n");
printf("\t[-G, --enable-debug enable debug logging]\n");
#else
printf("\t[-G enable debug logging (flag disabled, must reconfigure with --enable-debug)\n");
printf("\t[-G, --enable-debug enable debug logging (flag disabled, must reconfigure with --enable-debug)\n");
printf("\t[--transport-stats dump transport statistics]\n");
printf("\t[--iova-mode <mode> specify DPDK IOVA mode: va|pa]\n");
#endif
}
@ -1668,7 +1827,7 @@ print_performance(void)
TAILQ_FOREACH(worker, &g_workers, link) {
TAILQ_FOREACH(ns_ctx, &worker->ns_ctx, link) {
if (ns_ctx->stats.io_completed != 0) {
io_per_second = (double)ns_ctx->stats.io_completed / g_time_in_sec;
io_per_second = (double)ns_ctx->stats.io_completed * 1000 * 1000 / g_elapsed_time_in_usec;
mb_per_second = io_per_second * g_io_size_bytes / (1024 * 1024);
average_latency = ((double)ns_ctx->stats.total_tsc / ns_ctx->stats.io_completed) * 1000 * 1000 /
g_tsc_rate;
@ -1902,23 +2061,23 @@ add_trid(const char *trid_str)
}
static int
add_allowed_pci_device(const char *bdf_str)
add_allowed_pci_device(const char *bdf_str, struct spdk_env_opts *env_opts)
{
int rc;
if (g_allowed_pci_addr_num >= MAX_ALLOWED_PCI_DEVICE_NUM) {
if (env_opts->num_pci_addr >= MAX_ALLOWED_PCI_DEVICE_NUM) {
fprintf(stderr, "Currently we only support allowed PCI device num=%d\n",
MAX_ALLOWED_PCI_DEVICE_NUM);
return -1;
}
rc = spdk_pci_addr_parse(&g_allowed_pci_addr[g_allowed_pci_addr_num], bdf_str);
rc = spdk_pci_addr_parse(&env_opts->pci_allowed[env_opts->num_pci_addr], bdf_str);
if (rc < 0) {
fprintf(stderr, "Failed to parse the given bdf_str=%s\n", bdf_str);
return -1;
}
g_allowed_pci_addr_num++;
env_opts->num_pci_addr++;
return 0;
}
@ -2012,77 +2171,155 @@ parse_metadata(const char *metacfg_str)
return 0;
}
#define PERF_GETOPT_SHORT "a:b:c:e:gi:lmo:q:r:k:s:t:w:z:A:C:DGHILM:NO:P:Q:RS:T:U:VZ:"
static const struct option g_perf_cmdline_opts[] = {
#define PERF_WARMUP_TIME 'a'
{"warmup-time", required_argument, NULL, PERF_WARMUP_TIME},
#define PERF_ALLOWED_PCI_ADDR 'b'
{"allowed-pci-addr", required_argument, NULL, PERF_ALLOWED_PCI_ADDR},
#define PERF_CORE_MASK 'c'
{"core-mask", required_argument, NULL, PERF_CORE_MASK},
#define PERF_METADATA 'e'
{"metadata", required_argument, NULL, PERF_METADATA},
#define PERF_MEM_SINGL_SEG 'g'
{"mem-single-seg", no_argument, NULL, PERF_MEM_SINGL_SEG},
#define PERF_SHMEM_GROUP_ID 'i'
{"shmem-grp-id", required_argument, NULL, PERF_SHMEM_GROUP_ID},
#define PERF_ENABLE_SSD_LATENCY_TRACING 'l'
{"enable-ssd-latency-tracking", no_argument, NULL, PERF_ENABLE_SSD_LATENCY_TRACING},
#define PERF_CPU_USAGE 'm'
{"cpu-usage", no_argument, NULL, PERF_CPU_USAGE},
#define PERF_IO_SIZE 'o'
{"io-size", required_argument, NULL, PERF_IO_SIZE},
#define PERF_IO_DEPTH 'q'
{"io-depth", required_argument, NULL, PERF_IO_DEPTH},
#define PERF_TRANSPORT 'r'
{"transport", required_argument, NULL, PERF_TRANSPORT},
#define PERF_KEEPALIVE 'k'
{"keepalive", required_argument, NULL, PERF_KEEPALIVE},
#define PERF_HUGEMEM_SIZE 's'
{"hugemem-size", required_argument, NULL, PERF_HUGEMEM_SIZE},
#define PERF_TIME 't'
{"time", required_argument, NULL, PERF_TIME},
#define PERF_IO_PATTERN 'w'
{"io-pattern", required_argument, NULL, PERF_IO_PATTERN},
#define PERF_DISABLE_ZCOPY 'z'
{"disable-zcopy", required_argument, NULL, PERF_DISABLE_ZCOPY},
#define PERF_BUFFER_ALIGNMENT 'A'
{"buffer-alignment", required_argument, NULL, PERF_BUFFER_ALIGNMENT},
#define PERF_MAX_COMPLETIONS_PER_POLL 'C'
{"max-completion-per-poll", required_argument, NULL, PERF_MAX_COMPLETIONS_PER_POLL},
#define PERF_DISABLE_SQ_CMB 'D'
{"disable-sq-cmb", no_argument, NULL, PERF_DISABLE_SQ_CMB},
#define PERF_ENABLE_DEBUG 'G'
{"enable-debug", no_argument, NULL, PERF_ENABLE_DEBUG},
#define PERF_ENABLE_TCP_HDGST 'H'
{"enable-tcp-hdgst", no_argument, NULL, PERF_ENABLE_TCP_HDGST},
#define PERF_ENABLE_TCP_DDGST 'I'
{"enable-tcp-ddgst", no_argument, NULL, PERF_ENABLE_TCP_DDGST},
#define PERF_ENABLE_SW_LATENCY_TRACING 'L'
{"enable-sw-latency-tracking", no_argument, NULL, PERF_ENABLE_SW_LATENCY_TRACING},
#define PERF_RW_MIXREAD 'M'
{"rwmixread", required_argument, NULL, PERF_RW_MIXREAD},
#define PERF_NO_SHST_NOTIFICATION 'N'
{"no-shst-notification", no_argument, NULL, PERF_NO_SHST_NOTIFICATION},
#define PERF_IO_UNIT_SIZE 'O'
{"io-unit-size", required_argument, NULL, PERF_IO_UNIT_SIZE},
#define PERF_IO_QUEUES_PER_NS 'P'
{"num-qpairs", required_argument, NULL, PERF_IO_QUEUES_PER_NS},
#define PERF_SKIP_ERRRORS 'Q'
{"skip-errors", required_argument, NULL, PERF_SKIP_ERRRORS},
#define PERF_ENABLE_URING 'R'
{"enable-uring", no_argument, NULL, PERF_ENABLE_URING},
#define PERF_DEFAULT_SOCK_IMPL 'S'
{"default-sock-impl", required_argument, NULL, PERF_DEFAULT_SOCK_IMPL},
#define PERF_LOG_FLAG 'T'
{"logflag", required_argument, NULL, PERF_LOG_FLAG},
#define PERF_NUM_UNUSED_IO_QPAIRS 'U'
{"num-unused-qpairs", required_argument, NULL, PERF_NUM_UNUSED_IO_QPAIRS},
#define PERF_ENABLE_VMD 'V'
{"enable-vmd", no_argument, NULL, PERF_ENABLE_VMD},
#define PERF_ENABLE_ZCOPY 'Z'
{"enable-zcopy", required_argument, NULL, PERF_ENABLE_ZCOPY},
#define PERF_TRANSPORT_STATISTICS 257
{"transport-stats", no_argument, NULL, PERF_TRANSPORT_STATISTICS},
#define PERF_IOVA_MODE 258
{"iova-mode", required_argument, NULL, PERF_IOVA_MODE},
/* Should be the last element */
{0, 0, 0, 0}
};
static int
parse_args(int argc, char **argv)
parse_args(int argc, char **argv, struct spdk_env_opts *env_opts)
{
int op;
int op, long_idx;
long int val;
int rc;
while ((op = getopt(argc, argv,
"a:b:c:e:gi:lo:q:r:k:s:t:w:z:A:C:DGHILM:NO:P:Q:RS:T:U:VZ:")) != -1) {
while ((op = getopt_long(argc, argv, PERF_GETOPT_SHORT, g_perf_cmdline_opts, &long_idx)) != -1) {
switch (op) {
case 'a':
case 'A':
case 'i':
case 'C':
case 'P':
case 'o':
case 'O':
case 'q':
case 'k':
case 's':
case 't':
case 'M':
case 'Q':
case 'U':
case PERF_WARMUP_TIME:
case PERF_BUFFER_ALIGNMENT:
case PERF_SHMEM_GROUP_ID:
case PERF_MAX_COMPLETIONS_PER_POLL:
case PERF_IO_QUEUES_PER_NS:
case PERF_IO_SIZE:
case PERF_IO_UNIT_SIZE:
case PERF_IO_DEPTH:
case PERF_KEEPALIVE:
case PERF_HUGEMEM_SIZE:
case PERF_TIME:
case PERF_RW_MIXREAD:
case PERF_NUM_UNUSED_IO_QPAIRS:
case PERF_SKIP_ERRRORS:
val = spdk_strtol(optarg, 10);
if (val < 0) {
fprintf(stderr, "Converting a string to integer failed\n");
return val;
}
switch (op) {
case 'a':
case PERF_WARMUP_TIME:
g_warmup_time_in_sec = val;
break;
case 'i':
g_shm_id = val;
case PERF_SHMEM_GROUP_ID:
env_opts->shm_id = val;
break;
case 'C':
case PERF_MAX_COMPLETIONS_PER_POLL:
g_max_completions = val;
break;
case 'P':
case PERF_IO_QUEUES_PER_NS:
g_nr_io_queues_per_ns = val;
break;
case 'o':
case PERF_IO_SIZE:
g_io_size_bytes = val;
break;
case 'O':
case PERF_IO_UNIT_SIZE:
g_io_unit_size = val;
break;
case 'q':
case PERF_IO_DEPTH:
g_queue_depth = val;
break;
case 'k':
case PERF_KEEPALIVE:
g_keep_alive_timeout_in_ms = val;
break;
case 's':
g_dpdk_mem = val;
case PERF_HUGEMEM_SIZE:
env_opts->mem_size = val;
break;
case 't':
case PERF_TIME:
g_time_in_sec = val;
break;
case 'M':
case PERF_RW_MIXREAD:
g_rw_percentage = val;
g_mix_specified = true;
break;
case 'Q':
case PERF_SKIP_ERRRORS:
g_quiet_count = val;
break;
case 'U':
case PERF_NUM_UNUSED_IO_QPAIRS:
g_nr_unused_io_queues = val;
break;
case 'A':
case PERF_BUFFER_ALIGNMENT:
g_io_align = val;
if (!spdk_u32_is_pow2(g_io_align) || g_io_align < SPDK_CACHE_LINE_SIZE) {
fprintf(stderr, "Wrong alignment %u. Must be power of 2 and not less than cache lize (%u)\n",
@ -2094,40 +2331,43 @@ parse_args(int argc, char **argv)
break;
}
break;
case 'b':
if (add_allowed_pci_device(optarg)) {
case PERF_ALLOWED_PCI_ADDR:
if (add_allowed_pci_device(optarg, env_opts)) {
usage(argv[0]);
return 1;
}
break;
case 'c':
g_core_mask = optarg;
case PERF_CORE_MASK:
env_opts->core_mask = optarg;
break;
case 'e':
case PERF_METADATA:
if (parse_metadata(optarg)) {
usage(argv[0]);
return 1;
}
break;
case 'g':
g_dpdk_mem_single_seg = true;
case PERF_MEM_SINGL_SEG:
env_opts->hugepage_single_segments = true;
break;
case 'l':
case PERF_ENABLE_SSD_LATENCY_TRACING:
g_latency_ssd_tracking_enable = true;
break;
case 'r':
case PERF_CPU_USAGE:
g_monitor_perf_cores = true;
break;
case PERF_TRANSPORT:
if (add_trid(optarg)) {
usage(argv[0]);
return 1;
}
break;
case 'w':
case PERF_IO_PATTERN:
g_workload_type = optarg;
break;
case 'D':
case PERF_DISABLE_SQ_CMB:
g_disable_sq_cmb = 1;
break;
case 'G':
case PERF_ENABLE_DEBUG:
#ifndef DEBUG
fprintf(stderr, "%s must be configured with --enable-debug for -G flag\n",
argv[0]);
@ -2138,19 +2378,19 @@ parse_args(int argc, char **argv)
spdk_log_set_print_level(SPDK_LOG_DEBUG);
break;
#endif
case 'H':
case PERF_ENABLE_TCP_HDGST:
g_header_digest = 1;
break;
case 'I':
case PERF_ENABLE_TCP_DDGST:
g_data_digest = 1;
break;
case 'L':
case PERF_ENABLE_SW_LATENCY_TRACING:
g_latency_sw_tracking_level++;
break;
case 'N':
case PERF_NO_SHST_NOTIFICATION:
g_no_shn_notification = true;
break;
case 'R':
case PERF_ENABLE_URING:
#ifndef SPDK_CONFIG_URING
fprintf(stderr, "%s must be rebuilt with CONFIG_URING=y for -R flag.\n",
argv[0]);
@ -2159,7 +2399,7 @@ parse_args(int argc, char **argv)
#endif
g_use_uring = true;
break;
case 'T':
case PERF_LOG_FLAG:
rc = spdk_log_set_flag(optarg);
if (rc < 0) {
fprintf(stderr, "unknown flag\n");
@ -2170,22 +2410,28 @@ parse_args(int argc, char **argv)
spdk_log_set_print_level(SPDK_LOG_DEBUG);
#endif
break;
case 'V':
case PERF_ENABLE_VMD:
g_vmd = true;
break;
case 'z':
case PERF_DISABLE_ZCOPY:
perf_set_sock_zcopy(optarg, false);
break;
case 'Z':
case PERF_ENABLE_ZCOPY:
perf_set_sock_zcopy(optarg, true);
break;
case 'S':
case PERF_DEFAULT_SOCK_IMPL:
rc = spdk_sock_set_default_impl(optarg);
if (rc) {
fprintf(stderr, "Failed to set sock impl %s, err %d (%s)\n", optarg, errno, strerror(errno));
return 1;
}
break;
case PERF_TRANSPORT_STATISTICS:
g_dump_transport_stats = true;
break;
case PERF_IOVA_MODE:
env_opts->iova_mode = optarg;
break;
default:
usage(argv[0]);
return 1;
@ -2198,12 +2444,12 @@ parse_args(int argc, char **argv)
}
if (!g_queue_depth) {
fprintf(stderr, "missing -q (queue size) operand\n");
fprintf(stderr, "missing -q (--io-depth) operand\n");
usage(argv[0]);
return 1;
}
if (!g_io_size_bytes) {
fprintf(stderr, "missing -o (block size) operand\n");
fprintf(stderr, "missing -o (--io-size) operand\n");
usage(argv[0]);
return 1;
}
@ -2212,17 +2458,17 @@ parse_args(int argc, char **argv)
return 1;
}
if (!g_workload_type) {
fprintf(stderr, "missing -w (io pattern type) operand\n");
fprintf(stderr, "missing -w (--io-pattern) operand\n");
usage(argv[0]);
return 1;
}
if (!g_time_in_sec) {
fprintf(stderr, "missing -t (test time in seconds) operand\n");
fprintf(stderr, "missing -t (--time) operand\n");
usage(argv[0]);
return 1;
}
if (!g_quiet_count) {
fprintf(stderr, "-Q value must be greater than 0\n");
fprintf(stderr, "-Q (--skip-errors) value must be greater than 0\n");
usage(argv[0]);
return 1;
}
@ -2235,19 +2481,19 @@ parse_args(int argc, char **argv)
if (strcmp(g_workload_type, "read") == 0 || strcmp(g_workload_type, "write") == 0) {
g_rw_percentage = strcmp(g_workload_type, "read") == 0 ? 100 : 0;
if (g_mix_specified) {
fprintf(stderr, "Ignoring -M option... Please use -M option"
fprintf(stderr, "Ignoring -M (--rwmixread) option... Please use -M option"
" only when using rw or randrw.\n");
}
} else if (strcmp(g_workload_type, "rw") == 0) {
if (g_rw_percentage < 0 || g_rw_percentage > 100) {
fprintf(stderr,
"-M must be specified to value from 0 to 100 "
"-M (--rwmixread) must be specified to value from 0 to 100 "
"for rw or randrw.\n");
return 1;
}
} else {
fprintf(stderr,
"io pattern type must be one of\n"
"-o (--io-pattern) io pattern type must be one of\n"
"(read, write, randread, randwrite, rw, randrw)\n");
return 1;
}
@ -2258,11 +2504,11 @@ parse_args(int argc, char **argv)
} else {
struct trid_entry *trid_entry, *trid_entry_tmp;
g_no_pci = true;
env_opts->no_pci = true;
/* check whether there is local PCIe type */
TAILQ_FOREACH_SAFE(trid_entry, &g_trid_list, tailq, trid_entry_tmp) {
if (trid_entry->trid.trtype == SPDK_NVME_TRANSPORT_PCIE) {
g_no_pci = false;
env_opts->no_pci = false;
break;
}
}
@ -2546,29 +2792,19 @@ int main(int argc, char **argv)
struct spdk_env_opts opts;
pthread_t thread_id = 0;
rc = parse_args(argc, argv);
spdk_env_opts_init(&opts);
opts.name = "perf";
opts.pci_allowed = g_allowed_pci_addr;
rc = parse_args(argc, argv, &opts);
if (rc != 0) {
return rc;
}
spdk_env_opts_init(&opts);
opts.name = "perf";
opts.shm_id = g_shm_id;
if (g_core_mask) {
opts.core_mask = g_core_mask;
}
if (g_dpdk_mem) {
opts.mem_size = g_dpdk_mem;
}
opts.hugepage_single_segments = g_dpdk_mem_single_seg;
if (g_no_pci) {
opts.no_pci = g_no_pci;
}
if (g_allowed_pci_addr_num) {
opts.pci_allowed = g_allowed_pci_addr;
opts.num_pci_addr = g_allowed_pci_addr_num;
/* Transport statistics are printed from each thread.
* To avoid mess in terminal, init and use mutex */
rc = pthread_mutex_init(&g_stats_mutex, NULL);
if (rc != 0) {
fprintf(stderr, "Failed to init mutex\n");
goto cleanup;
}
if (spdk_env_init(&opts) < 0) {
fprintf(stderr, "Unable to initialize SPDK env\n");
@ -2664,6 +2900,8 @@ cleanup:
unregister_controllers();
unregister_workers();
pthread_mutex_destroy(&g_stats_mutex);
if (rc != 0) {
fprintf(stderr, "%s: errors occured\n", argv[0]);
}

View File

@ -0,0 +1,38 @@
#
# BSD LICENSE
#
# Copyright (c) Samsung Electronics Co., Ltd.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Samsung Electronics Co., Ltd. nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../..)
APP = pmr_persistence
include $(SPDK_ROOT_DIR)/mk/nvme.libtest.mk

View File

@ -0,0 +1,419 @@
/*-
* BSD LICENSE
*
* Copyright (c) Samsung Electronics Co., Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Samsung Electronics Co., Ltd., nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "spdk/stdinc.h"
#include "spdk/env.h"
#include "spdk/nvme.h"
#include "spdk/string.h"
struct nvme_io {
struct spdk_nvme_ctrlr *ctrlr;
struct spdk_nvme_transport_id trid;
struct spdk_nvme_ns *ns;
unsigned nsid;
unsigned rlba;
unsigned nlbas;
unsigned wlba;
uint32_t lba_size;
unsigned done;
};
struct config {
struct nvme_io pmr_dev;
size_t copy_size;
};
static struct config g_config;
/* Namespaces index from 1. Return 0 to invoke an error */
static unsigned
get_nsid(const struct spdk_nvme_transport_id *trid)
{
if (!strcmp(trid->traddr, g_config.pmr_dev.trid.traddr)) {
return g_config.pmr_dev.nsid;
}
return 0;
}
static void
check_io(void *arg, const struct spdk_nvme_cpl *completion)
{
g_config.pmr_dev.done = 1;
}
static int
pmr_persistence(void)
{
int rc = 0;
void *pmr_buf, *buf;
size_t sz;
struct spdk_nvme_qpair *qpair;
/* Allocate Queue Pair for the Controller with PMR */
qpair = spdk_nvme_ctrlr_alloc_io_qpair(g_config.pmr_dev.ctrlr, NULL, 0);
if (qpair == NULL) {
printf("ERROR: spdk_nvme_ctrlr_alloc_io_qpair() failed\n");
return -ENOMEM;
}
/* Enable the PMR */
rc = spdk_nvme_ctrlr_enable_pmr(g_config.pmr_dev.ctrlr);
if (rc) {
printf("ERROR: Enabling PMR failed\n");
printf("Are you sure %s has a valid PMR?\n",
g_config.pmr_dev.trid.traddr);
goto free_qpair;
}
/* Allocate buffer from PMR */
pmr_buf = spdk_nvme_ctrlr_map_pmr(g_config.pmr_dev.ctrlr, &sz);
if (pmr_buf == NULL || sz < g_config.copy_size) {
printf("ERROR: PMR buffer allocation failed\n");
rc = -ENOMEM;
goto disable_pmr;
}
/* Clear the done flag */
g_config.pmr_dev.done = 0;
/* Do the write to the PMR IO buffer, reading from rlba */
rc = spdk_nvme_ns_cmd_read(g_config.pmr_dev.ns, qpair, pmr_buf,
g_config.pmr_dev.rlba, g_config.pmr_dev.nlbas,
check_io, NULL, 0);
if (rc != 0) {
fprintf(stderr, "Read I/O to PMR failed\n");
rc = -EIO;
goto unmap_pmr;
}
while (!g_config.pmr_dev.done) {
spdk_nvme_qpair_process_completions(qpair, 0);
}
/* Clear the done flag */
g_config.pmr_dev.done = 0;
pmr_buf = NULL;
/* Free PMR buffer */
rc = spdk_nvme_ctrlr_unmap_pmr(g_config.pmr_dev.ctrlr);
if (rc) {
printf("ERROR: Unmapping PMR failed\n");
goto disable_pmr;
}
/* Disable the PMR */
rc = spdk_nvme_ctrlr_disable_pmr(g_config.pmr_dev.ctrlr);
if (rc) {
printf("ERROR: Disabling PMR failed\n");
goto free_qpair;
}
/* Free the queue */
spdk_nvme_ctrlr_free_io_qpair(qpair);
rc = spdk_nvme_ctrlr_reset(g_config.pmr_dev.ctrlr);
if (rc) {
printf("ERROR: Resetting Controller failed\n");
return rc;
}
/* Allocate Queue Pair for the Controller with PMR */
qpair = spdk_nvme_ctrlr_alloc_io_qpair(g_config.pmr_dev.ctrlr, NULL, 0);
if (qpair == NULL) {
printf("ERROR: spdk_nvme_ctrlr_alloc_io_qpair() failed\n");
return -ENOMEM;
}
/* Enable the PMR */
rc = spdk_nvme_ctrlr_enable_pmr(g_config.pmr_dev.ctrlr);
if (rc) {
printf("ERROR: Enabling PMR failed\n");
goto free_qpair;
}
/* Allocate buffer from PMR */
pmr_buf = spdk_nvme_ctrlr_map_pmr(g_config.pmr_dev.ctrlr, &sz);
if (pmr_buf == NULL || sz < g_config.copy_size) {
printf("ERROR: PMR buffer allocation failed\n");
rc = -ENOMEM;
goto disable_pmr;
}
/* Do the read from the PMR IO buffer, write to wlba */
rc = spdk_nvme_ns_cmd_write(g_config.pmr_dev.ns, qpair, pmr_buf,
g_config.pmr_dev.wlba, g_config.pmr_dev.nlbas,
check_io, NULL, 0);
if (rc != 0) {
fprintf(stderr, "Read I/O from PMR failed\n");
rc = -EIO;
goto unmap_pmr;
}
while (!g_config.pmr_dev.done) {
spdk_nvme_qpair_process_completions(qpair, 0);
}
/* Clear the done flag */
g_config.pmr_dev.done = 0;
buf = spdk_zmalloc(g_config.copy_size, 0x1000, NULL, SPDK_ENV_SOCKET_ID_ANY, SPDK_MALLOC_DMA);
if (buf == NULL) {
printf("ERROR: Buffer allocation failed\n");
rc = -ENOMEM;
goto unmap_pmr;
}
/* Do the read from wlba to a buffer */
rc = spdk_nvme_ns_cmd_read(g_config.pmr_dev.ns, qpair, buf,
g_config.pmr_dev.wlba, g_config.pmr_dev.nlbas,
check_io, NULL, 0);
if (rc != 0) {
fprintf(stderr, "Read I/O from WLBA failed\n");
rc = -EIO;
goto free_buf;
}
while (!g_config.pmr_dev.done) {
spdk_nvme_qpair_process_completions(qpair, 0);
}
/* Clear the done flag */
g_config.pmr_dev.done = 0;
/* Compare the data in the read buffer to the PMR buffer */
if (memcmp(buf, pmr_buf, g_config.copy_size)) {
printf("PMR Data Not Persistent, after Controller Reset\n");
rc = -EIO;
} else {
printf("PMR Data is Persistent across Controller Reset\n");
}
free_buf:
spdk_free(buf);
unmap_pmr:
/* Free PMR buffer */
spdk_nvme_ctrlr_unmap_pmr(g_config.pmr_dev.ctrlr);
disable_pmr:
/* Disable the PMR */
spdk_nvme_ctrlr_disable_pmr(g_config.pmr_dev.ctrlr);
free_qpair:
/* Free the queue */
spdk_nvme_ctrlr_free_io_qpair(qpair);
return rc;
}
static bool
probe_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr_opts *opts)
{
/* We will only attach to the Controller specified by the user */
if (spdk_nvme_transport_id_compare(trid, &g_config.pmr_dev.trid)) {
printf("%s - not probed %s!\n", __func__, trid->traddr);
return 0;
}
printf("%s - probed %s!\n", __func__, trid->traddr);
return 1;
}
static void
attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_ctrlr_opts *opts)
{
struct spdk_nvme_ns *ns;
ns = spdk_nvme_ctrlr_get_ns(ctrlr, get_nsid(trid));
if (ns == NULL) {
fprintf(stderr, "Could not locate namespace %d on controller %s.\n",
get_nsid(trid), trid->traddr);
exit(-1);
}
g_config.pmr_dev.ctrlr = ctrlr;
g_config.pmr_dev.ns = ns;
g_config.pmr_dev.lba_size = spdk_nvme_ns_get_sector_size(ns);
printf("%s - attached %s!\n", __func__, trid->traddr);
}
static void
usage(char *program_name)
{
printf("%s options (all mandatory)", program_name);
printf("\n");
printf("\t[-p PCIe address of the NVMe Device with PMR support]\n");
printf("\t[-n Namespace ID]\n");
printf("\t[-r Read LBA]\n");
printf("\t[-l Number of LBAs to read]\n");
printf("\t[-w Write LBA]\n");
printf("\n");
}
static int
parse_args(int argc, char **argv)
{
int op;
unsigned num_args = 0;
long int val;
while ((op = getopt(argc, argv, "p:n:r:l:w:")) != -1) {
switch (op) {
case 'p':
snprintf(&g_config.pmr_dev.trid.traddr[0], SPDK_NVMF_TRADDR_MAX_LEN + 1,
"%s", optarg);
g_config.pmr_dev.trid.trtype = SPDK_NVME_TRANSPORT_PCIE;
spdk_nvme_transport_id_populate_trstring(&g_config.pmr_dev.trid,
spdk_nvme_transport_id_trtype_str(g_config.pmr_dev.trid.trtype));
num_args++;
break;
case 'n':
case 'r':
case 'l':
case 'w':
val = spdk_strtol(optarg, 10);
if (val < 0) {
fprintf(stderr, "Converting a string to integer failed\n");
return val;
}
switch (op) {
case 'n':
g_config.pmr_dev.nsid = (unsigned)val;
num_args++;
break;
case 'r':
g_config.pmr_dev.rlba = (unsigned)val;
num_args++;
break;
case 'l':
g_config.pmr_dev.nlbas = (unsigned)val;
num_args++;
break;
case 'w':
g_config.pmr_dev.wlba = (unsigned)val;
num_args++;
break;
}
break;
default:
usage(argv[0]);
return 1;
}
}
if (num_args != 5) {
usage(argv[0]);
return 1;
}
return 0;
}
static void
cleanup(void)
{
struct spdk_nvme_detach_ctx *detach_ctx = NULL;
spdk_nvme_detach_async(g_config.pmr_dev.ctrlr, &detach_ctx);
while (detach_ctx && spdk_nvme_detach_poll_async(detach_ctx) == -EAGAIN) {
;
}
}
int main(int argc, char **argv)
{
int rc = 0;
struct spdk_env_opts opts;
/*
* Parse the input arguments. For now we use the following
* format list:
*
* -p <pci id> -n <namespace> -r <Read LBA> -l <number of LBAs> -w <Write LBA>
*
*/
rc = parse_args(argc, argv);
if (rc) {
fprintf(stderr, "Error in parse_args(): %d\n", rc);
return rc;
}
/*
* SPDK relies on an abstraction around the local environment
* named env that handles memory allocation and PCI device operations.
* This library must be initialized first.
*
*/
spdk_env_opts_init(&opts);
opts.name = "pmr_persistence";
opts.shm_id = 0;
if (spdk_env_init(&opts) < 0) {
fprintf(stderr, "Unable to initialize SPDK env\n");
return 1;
}
/*
* PMRs only apply to PCIe attached NVMe controllers so we
* only probe the PCIe bus. This is the default when we pass
* in NULL for the first argument.
*/
rc = spdk_nvme_probe(NULL, NULL, probe_cb, attach_cb, NULL);
if (rc) {
fprintf(stderr, "Error in spdk_nvme_probe(): %d\n", rc);
cleanup();
return rc;
}
g_config.copy_size = g_config.pmr_dev.nlbas * g_config.pmr_dev.lba_size;
/*
* Call the pmr_persistence() function which performs the data copy
* to PMR region, resets the Controller and verifies the data persistence
* or returns an error code if it fails.
*/
rc = pmr_persistence();
if (rc) {
fprintf(stderr, "Error in pmr_persistence(): %d\n", rc);
}
cleanup();
return rc;
}

View File

@ -183,6 +183,8 @@ parse_args(int argc, char **argv, struct spdk_env_opts *opts)
opts->no_pci = true;
break;
case 'h':
usage(argv[0]);
exit(EXIT_SUCCESS);
default:
usage(argv[0]);
return 1;
@ -709,7 +711,13 @@ static void
nvmf_subsystem_init_done(int rc, void *cb_arg)
{
fprintf(stdout, "bdev subsystem init successfully\n");
spdk_rpc_initialize(g_rpc_addr);
rc = spdk_rpc_initialize(g_rpc_addr);
if (rc) {
spdk_app_stop(rc);
return;
}
spdk_rpc_set_state(SPDK_RPC_RUNTIME);
g_target_state = NVMF_INIT_TARGET;

View File

@ -39,6 +39,6 @@ APP = led
C_SRCS := led.c
SPDK_LIB_LIST = vmd log
SPDK_LIB_LIST = vmd log util
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -39,6 +39,6 @@ APP = lsvmd
C_SRCS := lsvmd.c
SPDK_LIB_LIST = vmd log
SPDK_LIB_LIST = vmd log util
include $(SPDK_ROOT_DIR)/mk/spdk.app.mk

View File

@ -315,6 +315,27 @@ int spdk_accel_batch_prep_crc32c(struct spdk_io_channel *ch, struct spdk_accel_b
uint32_t *dst, void *src, uint32_t seed, uint64_t nbytes,
spdk_accel_completion_cb cb_fn, void *cb_arg);
/**
* Synchronous call to prepare a chained crc32c request into a previously initialized batch
* created with spdk_accel_batch_create(). The callback will be called when the crc32c
* completes after the batch has been submitted by an asynchronous call to
* spdk_accel_batch_submit().
*
* \param ch I/O channel associated with this call.
* \param batch Handle provided when the batch was started with spdk_accel_batch_create().
* \param dst Destination to write the CRC-32C to.
* \param iovs The io vector array which stores the src data and len.
* \param iovcnt The size of the iov.
* \param seed Four byte seed value.
* \param cb_fn Called when this operation completes.
* \param cb_arg Callback argument.
*
* \return 0 on success, negative errno on failure.
*/
int spdk_accel_batch_prep_crc32cv(struct spdk_io_channel *ch, struct spdk_accel_batch *batch,
uint32_t *dst, struct iovec *iovs, uint32_t iovcnt, uint32_t seed,
spdk_accel_completion_cb cb_fn, void *cb_arg);
/**
* Submit a CRC-32C calculation request.
*
@ -333,6 +354,24 @@ int spdk_accel_batch_prep_crc32c(struct spdk_io_channel *ch, struct spdk_accel_b
int spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *dst, void *src, uint32_t seed,
uint64_t nbytes, spdk_accel_completion_cb cb_fn, void *cb_arg);
/**
* Submit a chained CRC-32C calculation request.
*
* This operation will calculate the 4 byte CRC32-C for the given data.
*
* \param ch I/O channel associated with this call.
* \param dst Destination to write the CRC-32C to.
* \param iovs The io vector array which stores the src data and len.
* \param iovcnt The size of the iov.
* \param seed Four byte seed value.
* \param cb_fn Called when this CRC-32C operation completes.
* \param cb_arg Callback argument.
*
* \return 0 on success, negative errno on failure.
*/
int spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *dst, struct iovec *iovs,
uint32_t iovcnt, uint32_t seed, spdk_accel_completion_cb cb_fn, void *cb_arg);
struct spdk_json_write_ctx;
/**

View File

@ -90,7 +90,7 @@ typedef void (*spdk_bdev_remove_cb_t)(void *remove_ctx);
/**
* Block device event callback.
*
* \param event Event details.
* \param type Event type.
* \param bdev Block device that triggered event.
* \param event_ctx Context for the block device event.
*/
@ -332,23 +332,6 @@ struct spdk_bdev *spdk_bdev_first_leaf(void);
*/
struct spdk_bdev *spdk_bdev_next_leaf(struct spdk_bdev *prev);
/**
* Open a block device for I/O operations (deprecated, please use spdk_bdev_open_ext).
*
* \param bdev Block device to open.
* \param write true is read/write access requested, false if read-only
* \param remove_cb notification callback to be called when the bdev gets
* hotremoved. This will always be called on the same thread that
* spdk_bdev_open() was called on. It can be NULL, in which case the upper
* layer won't be notified about the bdev hotremoval. The descriptor will
* have to be manually closed to make the bdev unregister proceed.
* \param remove_ctx param for remove_cb.
* \param desc output parameter for the descriptor when operation is successful
* \return 0 if operation is successful, suitable errno value otherwise
*/
int spdk_bdev_open(struct spdk_bdev *bdev, bool write, spdk_bdev_remove_cb_t remove_cb,
void *remove_ctx, struct spdk_bdev_desc **desc);
/**
* Open a block device for I/O operations.
*
@ -356,7 +339,7 @@ int spdk_bdev_open(struct spdk_bdev *bdev, bool write, spdk_bdev_remove_cb_t rem
* \param write true is read/write access requested, false if read-only
* \param event_cb notification callback to be called when the bdev triggers
* asynchronous event such as bdev removal. This will always be called on the
* same thread that spdk_bdev_open() was called on. In case of removal event
* same thread that spdk_bdev_open_ext() was called on. In case of removal event
* the descriptor will have to be manually closed to make the bdev unregister
* proceed.
* \param event_ctx param for event_cb.
@ -369,7 +352,7 @@ int spdk_bdev_open_ext(const char *bdev_name, bool write, spdk_bdev_event_cb_t e
/**
* Close a previously opened block device.
*
* Must be called on the same thread that the spdk_bdev_open()
* Must be called on the same thread that the spdk_bdev_open_ext()
* was performed on.
*
* \param desc Block device descriptor to close.

View File

@ -85,13 +85,6 @@ struct spdk_bdev_module {
*/
void (*module_fini)(void);
/**
* Function called to return a text string representing the
* module's configuration options for inclusion in a configuration file.
* (Deprecated and shall not be called by bdev layer)
*/
void (*config_text)(FILE *fp);
/**
* Function called to return a text string representing the module-level
* JSON RPCs required to regenerate the current configuration. This will
@ -368,11 +361,21 @@ struct spdk_bdev {
*/
uint64_t zone_size;
/**
* Maximum zone append data transfer size (in blocks).
*/
uint32_t max_zone_append_size;
/**
* Maximum number of open zones.
*/
uint32_t max_open_zones;
/**
* Maximum number of active zones.
*/
uint32_t max_active_zones;
/**
* Optimal number of open zones.
*/
@ -734,25 +737,6 @@ void spdk_bdev_unregister(struct spdk_bdev *bdev, spdk_bdev_unregister_cb cb_fn,
*/
void spdk_bdev_destruct_done(struct spdk_bdev *bdev, int bdeverrno);
/**
* Register a virtual bdev.
*
* This function is deprecated. Users should call spdk_bdev_register instead.
* The bdev layer currently makes no use of the base_bdevs array, so switching
* to spdk_bdev_register results in no loss of functionality.
*
* \param vbdev Virtual bdev to register.
* \param base_bdevs Array of bdevs upon which this vbdev is based.
* \param base_bdev_count Number of bdevs in base_bdevs.
*
* \return 0 on success
* \return -EINVAL if the bdev name is NULL.
* \return -EEXIST if the bdev already exists.
* \return -ENOMEM if allocation of the base_bdevs array or the base bdevs vbdevs array fails.
*/
int spdk_vbdev_register(struct spdk_bdev *vbdev, struct spdk_bdev **base_bdevs,
int base_bdev_count);
/**
* Indicate to the bdev layer that the module is done examining a bdev.
*
@ -1112,35 +1096,6 @@ int spdk_bdev_part_free(struct spdk_bdev_part *part);
void spdk_bdev_part_base_hotremove(struct spdk_bdev_part_base *part_base,
struct bdev_part_tailq *tailq);
/**
* Construct a new spdk_bdev_part_base on top of the provided bdev
* (deprecated. please use spdk_bdev_part_base_construct_ext).
*
* \param bdev The spdk_bdev upon which this base will be built.
* \param remove_cb Function to be called upon hotremove of the bdev.
* \param module The module to which this bdev base belongs.
* \param fn_table Function table for communicating with the bdev backend.
* \param tailq The head of the list of all spdk_bdev_part structures registered to this base's module.
* \param free_fn User provided function to free base related context upon bdev removal or shutdown.
* \param ctx Module specific context for this bdev part base.
* \param channel_size Channel size in bytes.
* \param ch_create_cb Called after a new channel is allocated.
* \param ch_destroy_cb Called upon channel deletion.
*
* \return The part object on top of the bdev if operation is successful, or
* NULL otherwise.
*/
struct spdk_bdev_part_base *spdk_bdev_part_base_construct(struct spdk_bdev *bdev,
spdk_bdev_remove_cb_t remove_cb,
struct spdk_bdev_module *module,
struct spdk_bdev_fn_table *fn_table,
struct bdev_part_tailq *tailq,
spdk_bdev_part_base_free_fn free_fn,
void *ctx,
uint32_t channel_size,
spdk_io_channel_create_cb ch_create_cb,
spdk_io_channel_destroy_cb ch_destroy_cb);
/**
* Construct a new spdk_bdev_part_base on top of the provided bdev.
*

View File

@ -53,16 +53,20 @@ enum spdk_bdev_zone_action {
SPDK_BDEV_ZONE_CLOSE,
SPDK_BDEV_ZONE_FINISH,
SPDK_BDEV_ZONE_OPEN,
SPDK_BDEV_ZONE_RESET
SPDK_BDEV_ZONE_RESET,
SPDK_BDEV_ZONE_OFFLINE,
};
enum spdk_bdev_zone_state {
SPDK_BDEV_ZONE_STATE_EMPTY,
SPDK_BDEV_ZONE_STATE_OPEN,
SPDK_BDEV_ZONE_STATE_FULL,
SPDK_BDEV_ZONE_STATE_CLOSED,
SPDK_BDEV_ZONE_STATE_READ_ONLY,
SPDK_BDEV_ZONE_STATE_OFFLINE
SPDK_BDEV_ZONE_STATE_EMPTY = 0x0,
SPDK_BDEV_ZONE_STATE_IMP_OPEN = 0x1,
/* OPEN is an alias for IMP_OPEN. OPEN is kept for backwards compatibility. */
SPDK_BDEV_ZONE_STATE_OPEN = SPDK_BDEV_ZONE_STATE_IMP_OPEN,
SPDK_BDEV_ZONE_STATE_FULL = 0x2,
SPDK_BDEV_ZONE_STATE_CLOSED = 0x3,
SPDK_BDEV_ZONE_STATE_READ_ONLY = 0x4,
SPDK_BDEV_ZONE_STATE_OFFLINE = 0x5,
SPDK_BDEV_ZONE_STATE_EXP_OPEN = 0x6,
};
struct spdk_bdev_zone_info {
@ -80,9 +84,30 @@ struct spdk_bdev_zone_info {
*/
uint64_t spdk_bdev_get_zone_size(const struct spdk_bdev *bdev);
/**
* Get the number of zones for the given device.
*
* \param bdev Block device to query.
* \return The number of zones.
*/
uint64_t spdk_bdev_get_num_zones(const struct spdk_bdev *bdev);
/**
* Get device maximum zone append data transfer size in logical blocks.
*
* If this value is 0, there is no limit.
*
* \param bdev Block device to query.
* \return Maximum zone append data transfer size for this zoned device in logical blocks.
*/
uint32_t spdk_bdev_get_max_zone_append_size(const struct spdk_bdev *bdev);
/**
* Get device maximum number of open zones.
*
* An open zone is defined as a zone being in zone state
* SPDK_BDEV_ZONE_STATE_IMP_OPEN or SPDK_BDEV_ZONE_STATE_EXP_OPEN.
*
* If this value is 0, there is no limit.
*
* \param bdev Block device to query.
@ -90,6 +115,20 @@ uint64_t spdk_bdev_get_zone_size(const struct spdk_bdev *bdev);
*/
uint32_t spdk_bdev_get_max_open_zones(const struct spdk_bdev *bdev);
/**
* Get device maximum number of active zones.
*
* An active zone is defined as a zone being in zone state
* SPDK_BDEV_ZONE_STATE_IMP_OPEN, SPDK_BDEV_ZONE_STATE_EXP_OPEN or
* SPDK_BDEV_ZONE_STATE_CLOSED.
*
* If this value is 0, there is no limit.
*
* \param bdev Block device to query.
* \return Maximum number of active zones for this zoned device.
*/
uint32_t spdk_bdev_get_max_active_zones(const struct spdk_bdev *bdev);
/**
* Get device optimal number of open zones.
*
@ -129,7 +168,7 @@ int spdk_bdev_get_zone_info(struct spdk_bdev_desc *desc, struct spdk_io_channel
* \param desc Block device descriptor.
* \param ch I/O channel. Obtained by calling spdk_bdev_get_io_channel().
* \param zone_id First logical block of a zone.
* \param action Action to perform on a zone (open, close, reset, finish).
* \param action Action to perform on a zone (open, close, reset, finish, offline).
* \param cb Called when the request is complete.
* \param cb_arg Argument passed to cb.
*

View File

@ -127,7 +127,7 @@ typedef void (*spdk_blob_op_with_id_complete)(void *cb_arg, spdk_blob_id blobid,
* Blob operation completion callback with handle.
*
* \param cb_arg Callback argument.
* \param bs Handle to a blob.
* \param blb Handle to a blob.
* \param bserrno 0 if it completed successfully, or negative errno if it failed.
*/
typedef void (*spdk_blob_op_with_handle_complete)(void *cb_arg, struct spdk_blob *blb, int bserrno);

View File

@ -49,27 +49,6 @@ struct spdk_bs_dev;
struct spdk_bdev;
struct spdk_bdev_module;
/**
* Create a blobstore block device from a bdev (deprecated, please use spdk_bdev_create_bs_dev_ext).
*
* \param bdev Bdev to use.
* \param remove_cb Called when the block device is removed.
* \param remove_ctx Argument passed to function remove_cb.
*
* \return a pointer to the blobstore block device on success or NULL otherwise.
*/
struct spdk_bs_dev *spdk_bdev_create_bs_dev(struct spdk_bdev *bdev, spdk_bdev_remove_cb_t remove_cb,
void *remove_ctx);
/**
* Create a blobstore block device from the descriptor of a bdev (deprecated, please use spdk_bdev_create_bs_dev_ext).
*
* \param desc Descriptor of a bdev. spdk_bdev_open_ext() is recommended to get the desc.
*
* \return a pointer to the blobstore block device on success or NULL otherwise.
*/
struct spdk_bs_dev *spdk_bdev_create_bs_dev_from_desc(struct spdk_bdev_desc *desc);
/**
* Create a blobstore block device from a bdev.
*

View File

@ -112,10 +112,10 @@ typedef void (*fs_request_fn)(void *arg);
* This function will be invoked any time when the filesystem wants to pass a
* message to the main dispatch thread.
*
* \param fs_request_fn A pointer to the request function.
* \param fn A pointer to the request function.
* \param arg Argument to the request function.
*/
typedef void (*fs_send_request_fn)(fs_request_fn, void *arg);
typedef void (*fs_send_request_fn)(fs_request_fn fn, void *arg);
/**
* Initialize a spdk_blobfs_opts structure to the default option values.

View File

@ -76,24 +76,15 @@ struct spdk_env_opts {
const char *core_mask;
int shm_id;
int mem_channel;
union {
int main_core;
int master_core __attribute__((deprecated));
};
int main_core;
int mem_size;
bool no_pci;
bool hugepage_single_segments;
bool unlink_hugepage;
size_t num_pci_addr;
const char *hugedir;
union {
struct spdk_pci_addr *pci_blocked;
struct spdk_pci_addr *pci_blacklist __attribute__((deprecated));
};
union {
struct spdk_pci_addr *pci_allowed;
struct spdk_pci_addr *pci_whitelist __attribute__((deprecated));
};
struct spdk_pci_addr *pci_blocked;
struct spdk_pci_addr *pci_allowed;
const char *iova_mode;
uint64_t base_virtaddr;
@ -1008,6 +999,22 @@ void spdk_pci_device_detach(struct spdk_pci_device *device);
int spdk_pci_device_attach(struct spdk_pci_driver *driver, spdk_pci_enum_cb enum_cb,
void *enum_ctx, struct spdk_pci_addr *pci_address);
/**
* Allow the specified PCI device to be probed by the calling process.
*
* When using spdk_pci_enumerate(), only devices with allowed PCI addresses will
* be probed. By default, this is all PCI addresses, but the pci_allowed
* and pci_blocked environment options can override this behavior.
* This API enables the caller to allow a new PCI address that may have previously
* been blocked.
*
* \param pci_addr PCI address to allow
* \return 0 if successful
* \return -ENOMEM if environment-specific data structures cannot be allocated
* \return -EINVAL if specified PCI address is not valid
*/
int spdk_pci_device_allow(struct spdk_pci_addr *pci_addr);
/**
* Read \c len bytes from the PCI configuration space.
*
@ -1322,10 +1329,60 @@ int spdk_mem_reserve(void *vaddr, size_t len);
* \param vaddr Virtual address to get
* \param offset Virtual address's map offset to the file descriptor
*
* \ return negative errno on failure, otherwise return the file descriptor
* \return negative errno on failure, otherwise return the file descriptor
*/
int spdk_mem_get_fd_and_offset(void *vaddr, uint64_t *offset);
enum spdk_pci_event_type {
SPDK_UEVENT_ADD = 0,
SPDK_UEVENT_REMOVE = 1,
};
struct spdk_pci_event {
enum spdk_pci_event_type action;
struct spdk_pci_addr traddr;
};
typedef void (*spdk_pci_error_handler)(siginfo_t *info, void *ctx);
/**
* Begin listening for PCI bus events. This is used to detect hot-insert and
* hot-remove events. Once the system is listening, events may be retrieved
* by calling spdk_pci_get_event() periodically.
*
* \return negative errno on failure, otherwise, return a file descriptor
* that may be later passed to spdk_pci_get_event().
*/
int spdk_pci_event_listen(void);
/**
* Get the next PCI bus event.
*
* \param fd A file descriptor returned by spdk_pci_event_listen()
* \param event An event on the PCI bus
*
* \return Negative errno on failure. 0 for no event. A positive number
* when an event has been returned
*/
int spdk_pci_get_event(int fd, struct spdk_pci_event *event);
/**
* Register a signal handler to handle bus errors on the PCI bus
*
* \param sighandler Signal bus handler of the PCI bus
* \param ctx The arg pass to the registered signal bus handler.
*
* \return negative errno on failure, otherwise it means successful
*/
int spdk_pci_register_error_handler(spdk_pci_error_handler sighandler, void *ctx);
/**
* Register a signal handler to handle bus errors on the PCI bus
*
* \param sighandler Signal bus handler of the PCI bus
*/
void spdk_pci_unregister_error_handler(spdk_pci_error_handler sighandler);
#ifdef __cplusplus
}
#endif

View File

@ -89,7 +89,6 @@ typedef void (*spdk_sighandler_t)(int signal);
*/
struct spdk_app_opts {
const char *name;
const char *config_file; /* deprecated */
const char *json_config_file;
bool json_config_ignore_errors;
const char *rpc_addr; /* Can be UNIX domain socket path or IP address + TCP port */
@ -102,10 +101,7 @@ struct spdk_app_opts {
bool enable_coredump;
int mem_channel;
union {
int main_core;
int master_core __attribute__((deprecated));
};
int main_core;
int mem_size;
bool no_pci;
bool hugepage_single_segments;
@ -113,25 +109,10 @@ struct spdk_app_opts {
const char *hugedir;
enum spdk_log_level print_level;
size_t num_pci_addr;
union {
struct spdk_pci_addr *pci_blocked;
struct spdk_pci_addr *pci_blacklist __attribute__((deprecated));
};
union {
struct spdk_pci_addr *pci_allowed;
struct spdk_pci_addr *pci_whitelist __attribute__((deprecated));
};
struct spdk_pci_addr *pci_blocked;
struct spdk_pci_addr *pci_allowed;
const char *iova_mode;
/* DEPRECATED. No longer has any effect.
*
* The maximum latency allowed when passing an event
* from one core to another. A value of 0
* means all cores continually poll. This is
* specified in microseconds.
*/
uint64_t max_delay_us;
/* Wait for the associated RPC before initializing subsystems
* when this flag is enabled.
*/

View File

@ -64,7 +64,7 @@ struct idxd_batch;
/**
* Signature for configuring a channel
*
* \param chan IDXD channel to be configured.
* \param chan IDXD channel to be configured
* \return 0 on success, negative errno on failure.
*/
int spdk_idxd_configure_chan(struct spdk_idxd_io_channel *chan);
@ -73,10 +73,9 @@ int spdk_idxd_configure_chan(struct spdk_idxd_io_channel *chan);
* Reconfigures this channel based on how many current channels there are.
*
* \param chan IDXD channel to be set.
* \param num_channels total number of channels in use.
* \return 0 on success, negative errno on failure.
*/
int spdk_idxd_reconfigure_chan(struct spdk_idxd_io_channel *chan, uint32_t num_channels);
int spdk_idxd_reconfigure_chan(struct spdk_idxd_io_channel *chan);
/**
* Signature for callback function invoked when a request is completed.
@ -392,8 +391,9 @@ int spdk_idxd_submit_crc32c(struct spdk_idxd_io_channel *chan, uint32_t *dst, vo
* Check for completed requests on an IDXD channel.
*
* \param chan IDXD channel to check for completions.
* \return number of operations completed.
*/
void spdk_idxd_process_events(struct spdk_idxd_io_channel *chan);
int spdk_idxd_process_events(struct spdk_idxd_io_channel *chan);
/**
* Returns an IDXD channel for a given IDXD device.
@ -408,8 +408,17 @@ struct spdk_idxd_io_channel *spdk_idxd_get_channel(struct spdk_idxd_device *idxd
* Free an IDXD channel.
*
* \param chan IDXD channel to free.
* \return true if the underlying device needs a rebalance
*/
void spdk_idxd_put_channel(struct spdk_idxd_io_channel *chan);
bool spdk_idxd_put_channel(struct spdk_idxd_io_channel *chan);
/**
* Determine if the idxd device needs rebalancing.
*
* \param idxd IDXD device.
* \return true if rebalance is needed, false if not.
*/
bool spdk_idxd_device_needs_rebalance(struct spdk_idxd_device *idxd);
#ifdef __cplusplus
}

View File

@ -82,7 +82,7 @@ struct spdk_jsonrpc_client_response {
*
* \param request JSON-RPC request to handle.
* \param method Function to handle the request.
* \param param Parameters passed to the function 'method'.
* \param params Parameters passed to the function 'method'.
*/
typedef void (*spdk_jsonrpc_handle_request_fn)(
struct spdk_jsonrpc_request *request,

View File

@ -2,7 +2,7 @@
* BSD LICENSE
*
* Copyright (c) Intel Corporation. All rights reserved.
* Copyright (c) 2019, 2020 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 2019-2021 Mellanox Technologies LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -258,6 +258,36 @@ struct spdk_nvme_ctrlr_opts {
uint64_t fabrics_connect_timeout_us;
};
/**
* NVMe acceleration operation callback.
*
* \param cb_arg The user provided arg which is passed to the corresponding accelerated function call
* defined in struct spdk_nvme_accel_fn_table.
* \param status 0 if it completed successfully, or negative errno if it failed.
*/
typedef void (*spdk_nvme_accel_completion_cb)(void *cb_arg, int status);
/**
* Function table for the NVMe acccelerator device.
*
* This table provides a set of APIs to allow user to leverage
* accelerator functions.
*/
struct spdk_nvme_accel_fn_table {
/**
* The size of spdk_nvme_accel_fun_table according to the caller of
* this library is used for ABI compatibility. The library uses this
* field to know how many fields in this structure are valid.
* And the library will populate any remaining fields with default values.
* Newly added fields should be put at the end of the struct.
*/
size_t table_size;
/** The accelerated crc32c function. */
void (*submit_accel_crc32c)(void *ctx, uint32_t *dst, struct iovec *iov,
uint32_t iov_cnt, uint32_t seed, spdk_nvme_accel_completion_cb cb_fn, void *cb_arg);
};
/**
* Indicate whether a ctrlr handle is associated with a Discovery controller.
*
@ -420,6 +450,44 @@ struct spdk_nvme_host_id {
char hostsvcid[SPDK_NVMF_TRSVCID_MAX_LEN + 1];
};
struct spdk_nvme_rdma_device_stat {
const char *name;
uint64_t polls;
uint64_t idle_polls;
uint64_t completions;
uint64_t queued_requests;
uint64_t total_send_wrs;
uint64_t send_doorbell_updates;
uint64_t total_recv_wrs;
uint64_t recv_doorbell_updates;
};
struct spdk_nvme_pcie_stat {
uint64_t polls;
uint64_t idle_polls;
uint64_t completions;
uint64_t cq_doorbell_updates;
uint64_t submitted_requests;
uint64_t queued_requests;
uint64_t sq_doobell_updates;
};
struct spdk_nvme_transport_poll_group_stat {
spdk_nvme_transport_type_t trtype;
union {
struct {
uint32_t num_devices;
struct spdk_nvme_rdma_device_stat *device_stats;
} rdma;
struct spdk_nvme_pcie_stat pcie;
};
};
struct spdk_nvme_poll_group_stat {
uint32_t num_transports;
struct spdk_nvme_transport_poll_group_stat **transport_stat;
};
/*
* Controller support flags
*
@ -657,6 +725,24 @@ typedef void (*spdk_nvme_attach_cb)(void *cb_ctx, const struct spdk_nvme_transpo
*/
typedef void (*spdk_nvme_remove_cb)(void *cb_ctx, struct spdk_nvme_ctrlr *ctrlr);
typedef bool (*spdk_nvme_pcie_hotplug_filter_cb)(const struct spdk_pci_addr *addr);
/**
* Register the associated function to allow filtering of hot-inserted PCIe SSDs.
*
* If an application is using spdk_nvme_probe() to detect hot-inserted SSDs,
* this function may be used to register a function to filter those SSDs.
* If the filter function returns true, the nvme library will notify the SPDK
* env layer to allow probing of the device.
*
* Registering a filter function is optional. If none is registered, the nvme
* library will allow probing of all hot-inserted SSDs.
*
* \param filter_cb Filter function callback routine
*/
void
spdk_nvme_pcie_set_hotplug_filter(spdk_nvme_pcie_hotplug_filter_cb filter_cb);
/**
* Enumerate the bus indicated by the transport ID and attach the userspace NVMe
* driver to each device found if desired.
@ -999,6 +1085,24 @@ union spdk_nvme_vs_register spdk_nvme_ctrlr_get_regs_vs(struct spdk_nvme_ctrlr *
*/
union spdk_nvme_cmbsz_register spdk_nvme_ctrlr_get_regs_cmbsz(struct spdk_nvme_ctrlr *ctrlr);
/**
* Get the NVMe controller PMRCAP (Persistent Memory Region Capabilities) register.
*
* \param ctrlr Opaque handle to NVMe controller.
*
* \return the NVMe controller PMRCAP (Persistent Memory Region Capabilities) register.
*/
union spdk_nvme_pmrcap_register spdk_nvme_ctrlr_get_regs_pmrcap(struct spdk_nvme_ctrlr *ctrlr);
/**
* Get the NVMe controller PMR size.
*
* \param ctrlr Opaque handle to NVMe controller.
*
* \return the NVMe controller PMR size or 0 if PMR is not supported.
*/
uint64_t spdk_nvme_ctrlr_get_pmrsz(struct spdk_nvme_ctrlr *ctrlr);
/**
* Get the number of namespaces for the given NVMe controller.
*
@ -1111,21 +1215,21 @@ bool spdk_nvme_ctrlr_is_feature_supported(struct spdk_nvme_ctrlr *ctrlr, uint8_t
/**
* Signature for callback function invoked when a command is completed.
*
* \param spdk_nvme_cpl Completion queue entry that coontains the completion status.
* \param ctx Callback context provided when the command was submitted.
* \param cpl Completion queue entry that contains the completion status.
*/
typedef void (*spdk_nvme_cmd_cb)(void *, const struct spdk_nvme_cpl *);
typedef void (*spdk_nvme_cmd_cb)(void *ctx, const struct spdk_nvme_cpl *cpl);
/**
* Signature for callback function invoked when an asynchronous error request
* command is completed.
*
* \param ctrlr Opaque handle to NVMe controller.
* \param aer_cb_arg Context specified by spdk_nvme_register_aer_callback().
* \param spdk_nvme_cpl Completion queue entry that contains the completion status
* \param cpl Completion queue entry that contains the completion status
* of the asynchronous event request that was completed.
*/
typedef void (*spdk_nvme_aer_cb)(void *aer_cb_arg,
const struct spdk_nvme_cpl *);
const struct spdk_nvme_cpl *cpl);
/**
* Register callback function invoked when an AER command is completed for the
@ -1383,7 +1487,8 @@ spdk_nvme_qp_failure_reason spdk_nvme_ctrlr_get_admin_qp_failure_reason(
*
* \param qpair I/O queue pair to free.
*
* \return 0 on success, -1 on failure.
* \return 0 on success, -1 on failure. On failure, the caller should reset
* the controller and try to free the io qpair again after the reset.
*/
int spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair *qpair);
@ -2131,6 +2236,56 @@ void *spdk_nvme_ctrlr_map_cmb(struct spdk_nvme_ctrlr *ctrlr, size_t *size);
*/
void spdk_nvme_ctrlr_unmap_cmb(struct spdk_nvme_ctrlr *ctrlr);
/**
* Enable the Persistent Memory Region
*
* \param ctrlr Controller that contains the Persistent Memory Region
*
* \return 0 on success. Negated errno on the following error conditions:
* -ENOTSUP: PMR is not supported by the Controller.
* -EIO: Registers access failure.
* -EINVAL: PMR Time Units Invalid or PMR is already enabled.
* -ETIMEDOUT: Timed out to Enable PMR.
* -ENOSYS: Transport does not support Enable PMR function.
*/
int spdk_nvme_ctrlr_enable_pmr(struct spdk_nvme_ctrlr *ctrlr);
/**
* Disable the Persistent Memory Region
*
* \param ctrlr Controller that contains the Persistent Memory Region
*
* \return 0 on success. Negated errno on the following error conditions:
* -ENOTSUP: PMR is not supported by the Controller.
* -EIO: Registers access failure.
* -EINVAL: PMR Time Units Invalid or PMR is already disabled.
* -ETIMEDOUT: Timed out to Disable PMR.
* -ENOSYS: Transport does not support Disable PMR function.
*/
int spdk_nvme_ctrlr_disable_pmr(struct spdk_nvme_ctrlr *ctrlr);
/**
* Map the Persistent Memory Region so that it's data is
* visible from the CPU.
*
* \param ctrlr Controller that contains the Persistent Memory Region
* \param size Size of the region that was mapped.
*
* \return Pointer to Persistent Memory Region, or NULL on failure.
*/
void *spdk_nvme_ctrlr_map_pmr(struct spdk_nvme_ctrlr *ctrlr, size_t *size);
/**
* Free the Persistent Memory Region.
*
* \param ctrlr Controller from which to unmap the Persistent Memory Region.
*
* \return 0 on success, negative errno on failure.
* -ENXIO: Either PMR is not supported by the Controller or the PMR is already unmapped.
* -ENOSYS: Transport does not support Unmap PMR function.
*/
int spdk_nvme_ctrlr_unmap_pmr(struct spdk_nvme_ctrlr *ctrlr);
/**
* Get the transport ID for a given NVMe controller.
*
@ -2181,10 +2336,22 @@ typedef void (*spdk_nvme_disconnected_qpair_cb)(struct spdk_nvme_qpair *qpair,
* Create a new poll group.
*
* \param ctx A user supplied context that can be retrieved later with spdk_nvme_poll_group_get_ctx
* \param table The call back table defined by users which contains the accelerated functions
* which can be used to accelerate some operations such as crc32c.
*
* \return Pointer to the new poll group, or NULL on error.
*/
struct spdk_nvme_poll_group *spdk_nvme_poll_group_create(void *ctx);
struct spdk_nvme_poll_group *spdk_nvme_poll_group_create(void *ctx,
struct spdk_nvme_accel_fn_table *table);
/**
* Get a optimal poll group.
*
* \param qpair The qpair to get the optimal poll group.
*
* \return Pointer to the optimal poll group, or NULL if not found.
*/
struct spdk_nvme_poll_group *spdk_nvme_qpair_get_optimal_poll_group(struct spdk_nvme_qpair *qpair);
/**
* Add an spdk_nvme_qpair to a poll group. qpairs may only be added to
@ -2245,6 +2412,28 @@ int64_t spdk_nvme_poll_group_process_completions(struct spdk_nvme_poll_group *gr
*/
void *spdk_nvme_poll_group_get_ctx(struct spdk_nvme_poll_group *group);
/**
* Retrieves transport statistics for the given poll group.
*
* Note: the structure returned by this function should later be freed with
* @b spdk_nvme_poll_group_free_stats function
*
* \param group Pointer to NVME poll group
* \param stats Double pointer to statistics to be filled by this function
* \return 0 on success or negated errno on failure
*/
int spdk_nvme_poll_group_get_stats(struct spdk_nvme_poll_group *group,
struct spdk_nvme_poll_group_stat **stats);
/**
* Frees poll group statistics retrieved using @b spdk_nvme_poll_group_get_stats function
*
* @param group Pointer to a poll group
* @param stat Pointer to statistics to be released
*/
void spdk_nvme_poll_group_free_stats(struct spdk_nvme_poll_group *group,
struct spdk_nvme_poll_group_stat *stat);
/**
* Get the identify namespace data as defined by the NVMe specification.
*
@ -2455,16 +2644,16 @@ enum spdk_nvme_csi spdk_nvme_ns_get_csi(const struct spdk_nvme_ns *ns);
* \brief Namespace command support flags.
*/
enum spdk_nvme_ns_flags {
SPDK_NVME_NS_DEALLOCATE_SUPPORTED = 0x1, /**< The deallocate command is supported */
SPDK_NVME_NS_FLUSH_SUPPORTED = 0x2, /**< The flush command is supported */
SPDK_NVME_NS_RESERVATION_SUPPORTED = 0x4, /**< The reservation command is supported */
SPDK_NVME_NS_WRITE_ZEROES_SUPPORTED = 0x8, /**< The write zeroes command is supported */
SPDK_NVME_NS_DPS_PI_SUPPORTED = 0x10, /**< The end-to-end data protection is supported */
SPDK_NVME_NS_EXTENDED_LBA_SUPPORTED = 0x20, /**< The extended lba format is supported,
SPDK_NVME_NS_DEALLOCATE_SUPPORTED = 1 << 0, /**< The deallocate command is supported */
SPDK_NVME_NS_FLUSH_SUPPORTED = 1 << 1, /**< The flush command is supported */
SPDK_NVME_NS_RESERVATION_SUPPORTED = 1 << 2, /**< The reservation command is supported */
SPDK_NVME_NS_WRITE_ZEROES_SUPPORTED = 1 << 3, /**< The write zeroes command is supported */
SPDK_NVME_NS_DPS_PI_SUPPORTED = 1 << 4, /**< The end-to-end data protection is supported */
SPDK_NVME_NS_EXTENDED_LBA_SUPPORTED = 1 << 5, /**< The extended lba format is supported,
metadata is transferred as a contiguous
part of the logical block that it is associated with */
SPDK_NVME_NS_WRITE_UNCORRECTABLE_SUPPORTED = 0x40, /**< The write uncorrectable command is supported */
SPDK_NVME_NS_COMPARE_SUPPORTED = 0x80, /**< The compare command is supported */
SPDK_NVME_NS_WRITE_UNCORRECTABLE_SUPPORTED = 1 << 6, /**< The write uncorrectable command is supported */
SPDK_NVME_NS_COMPARE_SUPPORTED = 1 << 7, /**< The compare command is supported */
};
/**
@ -3208,6 +3397,14 @@ void spdk_nvme_qpair_print_command(struct spdk_nvme_qpair *qpair,
void spdk_nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair,
struct spdk_nvme_cpl *cpl);
/**
* \brief Gets the NVMe qpair ID for the specified qpair.
*
* \param qpair Pointer to the NVMe queue pair.
* \returns ID for the specified qpair.
*/
uint16_t spdk_nvme_qpair_get_id(struct spdk_nvme_qpair *qpair);
/**
* \brief Prints (SPDK_NOTICELOG) the contents of an NVMe submission queue entry (command).
*
@ -3334,6 +3531,21 @@ int spdk_nvme_map_prps(void *prv, struct spdk_nvme_cmd *cmd, struct iovec *iovs,
uint32_t len, size_t mps,
void *(*gpa_to_vva)(void *prv, uint64_t addr, uint64_t len));
/**
* Map NVMe command data buffers sent from Virtual Machine to virtual addresses
*
*\param prv Opaque handle to gpa_to_vva callback
*\param cmd NVMe command
*\param iovs IO vectors used to point the data buffers in NVMe command
*\param max_iovcnt Maximum IO vectors that can be used
*\param len Total buffer length for the NVMe command
*\param mps Memory page size
*\param gpa_to_vva Callback to map memory from Guest Physical address to Virtual address
*/
int spdk_nvme_map_cmd(void *prv, struct spdk_nvme_cmd *cmd, struct iovec *iovs, uint32_t max_iovcnt,
uint32_t len, size_t mps,
void *(*gpa_to_vva)(void *prv, uint64_t addr, uint64_t len));
/**
* Opaque handle for a transport poll group. Used by the transport function table.
*/
@ -3384,6 +3596,14 @@ struct spdk_nvme_transport_ops {
int (*ctrlr_unmap_cmb)(struct spdk_nvme_ctrlr *ctrlr);
int (*ctrlr_enable_pmr)(struct spdk_nvme_ctrlr *ctrlr);
int (*ctrlr_disable_pmr)(struct spdk_nvme_ctrlr *ctrlr);
void *(*ctrlr_map_pmr)(struct spdk_nvme_ctrlr *ctrlr, size_t *size);
int (*ctrlr_unmap_pmr)(struct spdk_nvme_ctrlr *ctrlr);
struct spdk_nvme_qpair *(*ctrlr_create_io_qpair)(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid,
const struct spdk_nvme_io_qpair_opts *opts);
@ -3408,6 +3628,8 @@ struct spdk_nvme_transport_ops {
void (*admin_qpair_abort_aers)(struct spdk_nvme_qpair *qpair);
struct spdk_nvme_transport_poll_group *(*poll_group_create)(void);
struct spdk_nvme_transport_poll_group *(*qpair_get_optimal_poll_group)(
struct spdk_nvme_qpair *qpair);
int (*poll_group_add)(struct spdk_nvme_transport_poll_group *tgroup, struct spdk_nvme_qpair *qpair);
@ -3422,6 +3644,12 @@ struct spdk_nvme_transport_ops {
uint32_t completions_per_qpair, spdk_nvme_disconnected_qpair_cb disconnected_qpair_cb);
int (*poll_group_destroy)(struct spdk_nvme_transport_poll_group *tgroup);
int (*poll_group_get_stats)(struct spdk_nvme_transport_poll_group *tgroup,
struct spdk_nvme_transport_poll_group_stat **stats);
void (*poll_group_free_stats)(struct spdk_nvme_transport_poll_group *tgroup,
struct spdk_nvme_transport_poll_group_stat *stats);
};
/**

View File

@ -109,7 +109,10 @@ union spdk_nvme_cap_register {
/** memory page size maximum */
uint32_t mpsmax : 4;
uint32_t reserved3 : 8;
/** persistent memory region supported */
uint32_t pmrs : 1;
uint32_t reserved3 : 7;
} bits;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_cap_register) == 8, "Incorrect size");
@ -299,6 +302,139 @@ union spdk_nvme_cmbsts_register {
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_cmbsts_register) == 4, "Incorrect size");
union spdk_nvme_pmrcap_register {
uint32_t raw;
struct {
uint32_t reserved1 : 3;
/** read data support */
uint32_t rds : 1;
/** write data support */
uint32_t wds : 1;
/** base indicator register */
uint32_t bir : 3;
/**
* persistent memory region time units
* 00b: 500 milliseconds
* 01b: minutes
*/
uint32_t pmrtu : 2;
/** persistent memory region write barrier mechanisms */
uint32_t pmrwbm : 4;
uint32_t reserved2 : 2;
/** persistent memory region timeout */
uint32_t pmrto : 8;
/** controller memory space supported */
uint32_t cmss : 1;
uint32_t reserved3 : 7;
} bits;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_pmrcap_register) == 4, "Incorrect size");
union spdk_nvme_pmrctl_register {
uint32_t raw;
struct {
/** enable */
uint32_t en : 1;
uint32_t reserved : 31;
} bits;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_pmrctl_register) == 4, "Incorrect size");
union spdk_nvme_pmrsts_register {
uint32_t raw;
struct {
/** err */
uint32_t err : 8;
/** not ready */
uint32_t nrdy : 1;
/**
* health status
* 000b: Normal Operation
* 001b: Restore Error
* 010b: Read Only
* 011b: Unreliable
*/
uint32_t hsts : 3;
/** controller base address invalid */
uint32_t cbai : 1;
uint32_t reserved : 19;
} bits;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_pmrsts_register) == 4, "Incorrect size");
union spdk_nvme_pmrebs_register {
uint32_t raw;
struct {
/**
* pmr elasicity buffer size units
* 0h: Bytes
* 1h: 1 KiB
* 2h: 1 MiB
* 3h: 1 GiB
*/
uint32_t pmrszu : 4;
/** read bypass behavior */
uint32_t rbb : 1;
uint32_t reserved : 3;
/** pmr elasticity buffer size base */
uint32_t pmrwbz : 24;
} bits;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_pmrebs_register) == 4, "Incorrect size");
union spdk_nvme_pmrswtp_register {
uint32_t raw;
struct {
/**
* pmr sustained write throughput units
* 0h: Bytes per second
* 1h: 1 KiB / s
* 2h: 1 MiB / s
* 3h: 1 GiB / s
*/
uint32_t pmrswtu : 4;
uint32_t reserved : 4;
/** pmr sustained write throughput */
uint32_t pmrswtv : 24;
} bits;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_pmrswtp_register) == 4, "Incorrect size");
union spdk_nvme_pmrmscl_register {
uint32_t raw;
struct {
uint32_t reserved1 : 1;
/** controller memory space enable */
uint32_t cmse : 1;
uint32_t reserved2 : 10;
/** controller base address */
uint32_t cba : 20;
} bits;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_pmrmscl_register) == 4, "Incorrect size");
/** Boot partition information */
union spdk_nvme_bpinfo_register {
uint32_t raw;
@ -387,7 +523,29 @@ struct spdk_nvme_registers {
/** controller memory buffer status */
union spdk_nvme_cmbsts_register cmbsts;
uint32_t reserved3[0x3e9];
uint32_t reserved2[0x369];
/** persistent memory region capabilities */
union spdk_nvme_pmrcap_register pmrcap;
/** persistent memory region control */
union spdk_nvme_pmrctl_register pmrctl;
/** persistent memory region status */
union spdk_nvme_pmrsts_register pmrsts;
/** persistent memory region elasticity buffer size */
union spdk_nvme_pmrebs_register pmrebs;
/** persistent memory region sustained write throughput */
union spdk_nvme_pmrswtp_register pmrswtp;
/** persistent memory region memory space control lower */
union spdk_nvme_pmrmscl_register pmrmscl;
uint32_t pmrmscu; /* persistent memory region memory space control upper */
uint32_t reserved3[0x79];
struct {
uint32_t sq_tdbl; /* submission queue tail doorbell */
@ -423,6 +581,20 @@ SPDK_STATIC_ASSERT(0x50 == offsetof(struct spdk_nvme_registers, cmbmsc),
"Incorrect register offset");
SPDK_STATIC_ASSERT(0x58 == offsetof(struct spdk_nvme_registers, cmbsts),
"Incorrect register offset");
SPDK_STATIC_ASSERT(0xE00 == offsetof(struct spdk_nvme_registers, pmrcap),
"Incorrect register offset");
SPDK_STATIC_ASSERT(0xE04 == offsetof(struct spdk_nvme_registers, pmrctl),
"Incorrect register offset");
SPDK_STATIC_ASSERT(0xE08 == offsetof(struct spdk_nvme_registers, pmrsts),
"Incorrect register offset");
SPDK_STATIC_ASSERT(0xE0C == offsetof(struct spdk_nvme_registers, pmrebs),
"Incorrect register offset");
SPDK_STATIC_ASSERT(0xE10 == offsetof(struct spdk_nvme_registers, pmrswtp),
"Incorrect register offset");
SPDK_STATIC_ASSERT(0xE14 == offsetof(struct spdk_nvme_registers, pmrmscl),
"Incorrect register offset");
SPDK_STATIC_ASSERT(0xE18 == offsetof(struct spdk_nvme_registers, pmrmscu),
"Incorrect register offset");
enum spdk_nvme_sgl_descriptor_type {
SPDK_NVME_SGL_TYPE_DATA_BLOCK = 0x0,
@ -712,13 +884,14 @@ union spdk_nvme_feat_async_event_configuration {
uint32_t raw;
struct {
union spdk_nvme_critical_warning_state crit_warn;
uint32_t ns_attr_notice : 1;
uint32_t fw_activation_notice : 1;
uint32_t telemetry_log_notice : 1;
uint32_t ana_change_notice : 1;
uint32_t reserved : 19;
uint8_t ns_attr_notice : 1;
uint8_t fw_activation_notice : 1;
uint8_t telemetry_log_notice : 1;
uint8_t ana_change_notice : 1;
uint8_t reserved1 : 4;
uint16_t reserved2 : 15;
/** Discovery log change (refer to the NVMe over Fabrics specification) */
uint32_t discovery_log_change_notice : 1;
uint16_t discovery_log_change_notice : 1;
} bits;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_feat_async_event_configuration) == 4, "Incorrect size");
@ -1110,7 +1283,7 @@ struct spdk_nvme_status {
uint16_t p : 1; /* phase tag */
uint16_t sc : 8; /* status code */
uint16_t sct : 3; /* status code type */
uint16_t rsvd2 : 2;
uint16_t crd : 2; /* command retry delay */
uint16_t m : 1; /* more */
uint16_t dnr : 1; /* do not retry */
};
@ -1414,6 +1587,12 @@ spdk_nvme_bytes_to_numd(uint32_t len)
return (len >> 2) - 1;
}
struct __attribute__((packed)) spdk_nvme_host_behavior {
uint8_t acre;
uint8_t reserved[511];
};
SPDK_STATIC_ASSERT(sizeof(struct spdk_nvme_host_behavior) == 512, "Incorrect size");
enum spdk_nvme_feat {
/* 0x00 - reserved */
@ -1451,6 +1630,14 @@ enum spdk_nvme_feat {
/** cdw11 layout defined by \ref spdk_nvme_feat_non_operational_power_state_config */
SPDK_NVME_FEAT_NON_OPERATIONAL_POWER_STATE_CONFIG = 0x11,
SPDK_NVME_FEAT_READ_RECOVERY_LEVEL_CONFIG = 0x12,
SPDK_NVME_FEAT_PREDICTABLE_LATENCY_MODE_CONFIG = 0x13,
SPDK_NVME_FEAT_PREDICTABLE_LATENCY_MODE_WINDOW = 0x14,
SPDK_NVME_FEAT_LBA_STATUS_INFORMATION_ATTRIBUTES = 0x15,
/** data buffer layout defined by \ref spdk_nvme_host_behavior */
SPDK_NVME_FEAT_HOST_BEHAVIOR_SUPPORT = 0x16,
SPDK_NVME_FEAT_SANITIZE_CONFIG = 0x17,
SPDK_NVME_FEAT_ENDURANCE_GROUP_EVENT = 0x18,
/* 0x12-0x77 - reserved */
/* 0x78-0x7F - NVMe-MI features */
@ -1721,7 +1908,10 @@ struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_ctrlr_data {
/** FRU globally unique identifier */
uint8_t fguid[16];
uint8_t reserved_128[128];
/** Command Retry Delay Time 1, 2 and 3 */
uint16_t crdt[3];
uint8_t reserved_122[122];
/* bytes 256-511: admin command set attributes */
@ -2122,7 +2312,10 @@ struct spdk_nvme_ns_data {
/** Non-zero NGUID and EUI64 for namespace are never reused */
uint8_t guid_never_reused : 1;
uint8_t reserved1 : 4;
/** Optimal Performance field */
uint8_t optperf : 1;
uint8_t reserved1 : 3;
} nsfeat;
/** number of lba formats */
@ -2271,7 +2464,22 @@ struct spdk_nvme_ns_data {
/** NVM capacity */
uint64_t nvmcap[2];
uint8_t reserved64[28];
/** Namespace Preferred Write Granularity */
uint16_t npwg;
/** Namespace Preferred Write Alignment */
uint16_t npwa;
/** Namespace Preferred Deallocate Granularity */
uint16_t npdg;
/** Namespace Preferred Deallocate Alignment */
uint16_t npda;
/** Namespace Optimal Write Size */
uint16_t nows;
uint8_t reserved64[18];
/** ANA group identifier */
uint32_t anagrpid;

View File

@ -60,6 +60,18 @@ extern "C" {
*/
const struct spdk_nvme_zns_ns_data *spdk_nvme_zns_ns_get_data(struct spdk_nvme_ns *ns);
/**
* Get the zone size, in number of sectors, of the given namespace.
*
* This function is thread safe and can be called at any point while the controller
* is attached to the SPDK NVMe driver.
*
* \param ns Namespace to query.
*
* \return the zone size of the given namespace in number of sectors.
*/
uint64_t spdk_nvme_zns_ns_get_zone_size_sectors(struct spdk_nvme_ns *ns);
/**
* Get the zone size, in bytes, of the given namespace.
*
@ -84,6 +96,40 @@ uint64_t spdk_nvme_zns_ns_get_zone_size(struct spdk_nvme_ns *ns);
*/
uint64_t spdk_nvme_zns_ns_get_num_zones(struct spdk_nvme_ns *ns);
/**
* Get the maximum number of open zones for the given namespace.
*
* An open zone is a zone in any of the zone states:
* EXPLICIT OPEN or IMPLICIT OPEN.
*
* If this value is 0, there is no limit.
*
* This function is thread safe and can be called at any point while the controller
* is attached to the SPDK NVMe driver.
*
* \param ns Namespace to query.
*
* \return the maximum number of open zones.
*/
uint32_t spdk_nvme_zns_ns_get_max_open_zones(struct spdk_nvme_ns *ns);
/**
* Get the maximum number of active zones for the given namespace.
*
* An active zone is a zone in any of the zone states:
* EXPLICIT OPEN, IMPLICIT OPEN or CLOSED.
*
* If this value is 0, there is no limit.
*
* This function is thread safe and can be called at any point while the controller
* is attached to the SPDK NVMe driver.
*
* \param ns Namespace to query.
*
* \return the maximum number of active zones.
*/
uint32_t spdk_nvme_zns_ns_get_max_active_zones(struct spdk_nvme_ns *ns);
/**
* Get the Zoned Namespace Command Set Specific Identify Controller data
* as defined by the NVMe Zoned Namespace Command Set Specification.
@ -114,11 +160,11 @@ uint32_t spdk_nvme_zns_ctrlr_get_max_zone_append_size(const struct spdk_nvme_ctr
* The user must ensure that only one thread submits I/O on a given qpair at any
* given time.
*
* \param ns NVMe namespace to submit the write I/O.
* \param ns NVMe namespace to submit the zone append I/O.
* \param qpair I/O queue pair to submit the request.
* \param buffer Virtual address pointer to the data payload buffer.
* \param zslba Zone Start LBA of the zone that we are appending to.
* \param lba_count Length (in sectors) for the write operation.
* \param lba_count Length (in sectors) for the zone append operation.
* \param cb_fn Callback function to invoke when the I/O is completed.
* \param cb_arg Argument to pass to the callback function.
* \param io_flags Set flags, defined by the SPDK_NVME_IO_FLAGS_* entries in
@ -141,13 +187,13 @@ int spdk_nvme_zns_zone_append(struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *q
* The user must ensure that only one thread submits I/O on a given qpair at any
* given time.
*
* \param ns NVMe namespace to submit the write I/O.
* \param ns NVMe namespace to submit the zone append I/O.
* \param qpair I/O queue pair to submit the request.
* \param buffer Virtual address pointer to the data payload buffer.
* \param metadata Virtual address pointer to the metadata payload, the length
* of metadata is specified by spdk_nvme_ns_get_md_size().
* \param zslba Zone Start LBA of the zone that we are appending to.
* \param lba_count Length (in sectors) for the write operation.
* \param lba_count Length (in sectors) for the zone append operation.
* \param cb_fn Callback function to invoke when the I/O is completed.
* \param cb_arg Argument to pass to the callback function.
* \param io_flags Set flags, defined by the SPDK_NVME_IO_FLAGS_* entries in
@ -165,6 +211,69 @@ int spdk_nvme_zns_zone_append_with_md(struct spdk_nvme_ns *ns, struct spdk_nvme_
uint32_t lba_count, spdk_nvme_cmd_cb cb_fn, void *cb_arg,
uint32_t io_flags, uint16_t apptag_mask, uint16_t apptag);
/**
* Submit a zone append I/O to the specified NVMe namespace.
*
* The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
* The user must ensure that only one thread submits I/O on a given qpair at any
* given time.
*
* \param ns NVMe namespace to submit the zone append I/O.
* \param qpair I/O queue pair to submit the request.
* \param zslba Zone Start LBA of the zone that we are appending to.
* \param lba_count Length (in sectors) for the zone append operation.
* \param cb_fn Callback function to invoke when the I/O is completed.
* \param cb_arg Argument to pass to the callback function.
* \param io_flags Set flags, defined in nvme_spec.h, for this I/O.
* \param reset_sgl_fn Callback function to reset scattered payload.
* \param next_sge_fn Callback function to iterate each scattered payload memory
* segment.
*
* \return 0 if successfully submitted, negated errnos on the following error conditions:
* -EINVAL: The request is malformed.
* -ENOMEM: The request cannot be allocated.
* -ENXIO: The qpair is failed at the transport level.
*/
int spdk_nvme_zns_zone_appendv(struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *qpair,
uint64_t zslba, uint32_t lba_count,
spdk_nvme_cmd_cb cb_fn, void *cb_arg, uint32_t io_flags,
spdk_nvme_req_reset_sgl_cb reset_sgl_fn,
spdk_nvme_req_next_sge_cb next_sge_fn);
/**
* Submit a zone append I/O to the specified NVMe namespace.
*
* The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
* The user must ensure that only one thread submits I/O on a given qpair at any
* given time.
*
* \param ns NVMe namespace to submit the zone append I/O.
* \param qpair I/O queue pair to submit the request.
* \param zslba Zone Start LBA of the zone that we are appending to.
* \param lba_count Length (in sectors) for the zone append operation.
* \param cb_fn Callback function to invoke when the I/O is completed.
* \param cb_arg Argument to pass to the callback function.
* \param io_flags Set flags, defined in nvme_spec.h, for this I/O.
* \param reset_sgl_fn Callback function to reset scattered payload.
* \param next_sge_fn Callback function to iterate each scattered payload memory
* segment.
* \param metadata Virtual address pointer to the metadata payload, the length
* of metadata is specified by spdk_nvme_ns_get_md_size().
* \param apptag_mask Application tag mask.
* \param apptag Application tag to use end-to-end protection information.
*
* \return 0 if successfully submitted, negated errnos on the following error conditions:
* -EINVAL: The request is malformed.
* -ENOMEM: The request cannot be allocated.
* -ENXIO: The qpair is failed at the transport level.
*/
int spdk_nvme_zns_zone_appendv_with_md(struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *qpair,
uint64_t zslba, uint32_t lba_count,
spdk_nvme_cmd_cb cb_fn, void *cb_arg, uint32_t io_flags,
spdk_nvme_req_reset_sgl_cb reset_sgl_fn,
spdk_nvme_req_next_sge_cb next_sge_fn, void *metadata,
uint16_t apptag_mask, uint16_t apptag);
/**
* Submit a Close Zone operation to the specified NVMe namespace.
*

View File

@ -2,7 +2,7 @@
* BSD LICENSE
*
* Copyright (c) Intel Corporation. All rights reserved.
* Copyright (c) 2018-2019 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 2018-2021 Mellanox Technologies LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -76,6 +76,7 @@ struct spdk_nvmf_transport_opts {
uint16_t max_queue_depth;
uint16_t max_qpairs_per_ctrlr;
uint32_t in_capsule_data_size;
/* used to calculate mdts */
uint32_t max_io_size;
uint32_t io_unit_size;
uint32_t max_aq_depth;
@ -124,17 +125,30 @@ struct spdk_nvmf_poll_group_stat {
uint64_t pending_bdev_io;
};
/* Deprecated.
* Please use the flow with spdk_nvmf_poll_group_dump_stat,
* which hides statistics structures within the transport.
*/
struct spdk_nvmf_rdma_device_stat {
const char *name;
uint64_t polls;
uint64_t idle_polls;
uint64_t completions;
uint64_t requests;
uint64_t request_latency;
uint64_t pending_free_request;
uint64_t pending_rdma_read;
uint64_t pending_rdma_write;
uint64_t total_send_wrs;
uint64_t send_doorbell_updates;
uint64_t total_recv_wrs;
uint64_t recv_doorbell_updates;
};
/* Deprecated.
* Please use the flow with spdk_nvmf_poll_group_dump_stat,
* which hides statistics structures within the transport.
*/
struct spdk_nvmf_transport_poll_group_stat {
spdk_nvme_transport_type_t trtype;
union {
@ -228,21 +242,6 @@ struct spdk_nvmf_tgt *spdk_nvmf_get_next_tgt(struct spdk_nvmf_tgt *prev);
*/
void spdk_nvmf_tgt_write_config_json(struct spdk_json_write_ctx *w, struct spdk_nvmf_tgt *tgt);
/**
* Begin accepting new connections at the address provided (deprecated, please use spdk_nvmf_tgt_listen_ext).
*
* The connections will be matched with a subsystem, which may or may not allow
* the connection based on a subsystem-specific list of allowed hosts. See
* spdk_nvmf_subsystem_add_host() and spdk_nvmf_subsystem_add_listener()
*
* \param tgt The target associated with this listen address.
* \param trid The address to listen at.
*
* \return 0 on success or a negated errno on failure.
*/
int spdk_nvmf_tgt_listen(struct spdk_nvmf_tgt *tgt,
struct spdk_nvme_transport_id *trid);
/**
* Begin accepting new connections at the address provided.
*
@ -262,7 +261,7 @@ int spdk_nvmf_tgt_listen_ext(struct spdk_nvmf_tgt *tgt, const struct spdk_nvme_t
/**
* Stop accepting new connections at the provided address.
*
* This is a counterpart to spdk_nvmf_tgt_listen().
* This is a counterpart to spdk_nvmf_tgt_listen_ext().
*
* \param tgt The target associated with the listen address.
* \param trid The address to stop listening at.
@ -315,7 +314,7 @@ int spdk_nvmf_poll_group_add(struct spdk_nvmf_poll_group *group,
struct spdk_nvmf_qpair *qpair);
/**
* Get current poll group statistics.
* Get current poll group statistics. (deprecated)
*
* \param tgt The NVMf target.
* \param stat Pointer to allocated statistics structure to fill with values.
@ -409,7 +408,7 @@ void spdk_nvmf_subsystem_destroy(struct spdk_nvmf_subsystem *subsystem);
/**
* Function to be called once the subsystem has changed state.
*
* \param subsytem NVMe-oF subsystem that has changed state.
* \param subsystem NVMe-oF subsystem that has changed state.
* \param cb_arg Argument passed to callback function.
* \param status 0 if it completed successfully, or negative errno if it failed.
*/
@ -618,7 +617,7 @@ const char *spdk_nvmf_host_get_nqn(const struct spdk_nvmf_host *host);
/**
* Accept new connections on the address provided.
*
* This does not start the listener. Use spdk_nvmf_tgt_listen() for that.
* This does not start the listener. Use spdk_nvmf_tgt_listen_ext() for that.
*
* May only be performed on subsystems in the PAUSED or INACTIVE states.
* No namespaces are required to be paused.
@ -772,23 +771,6 @@ struct spdk_nvmf_ns_opts {
*/
void spdk_nvmf_ns_opts_get_defaults(struct spdk_nvmf_ns_opts *opts, size_t opts_size);
/**
* Add a namespace to a subsytem (deprecated, please use spdk_nvmf_subsystem_add_ns_ext).
*
* May only be performed on subsystems in the PAUSED or INACTIVE states.
*
* \param subsystem Subsystem to add namespace to.
* \param bdev Block device to add as a namespace.
* \param opts Namespace options, or NULL to use defaults.
* \param opts_size sizeof(*opts)
* \param ptpl_file Persist through power loss file path.
*
* \return newly added NSID on success, or 0 on failure.
*/
uint32_t spdk_nvmf_subsystem_add_ns(struct spdk_nvmf_subsystem *subsystem, struct spdk_bdev *bdev,
const struct spdk_nvmf_ns_opts *opts, size_t opts_size,
const char *ptpl_file);
/**
* Add a namespace to a subsystems in the PAUSED or INACTIVE states.
*
@ -1106,7 +1088,7 @@ spdk_nvmf_transport_stop_listen(struct spdk_nvmf_transport *transport,
/**
* Stop accepting new connections at the provided address.
*
* This is a counterpart to spdk_nvmf_tgt_listen(). It differs
* This is a counterpart to spdk_nvmf_tgt_listen_ext(). It differs
* from spdk_nvmf_transport_stop_listen() in that it also destroys all
* qpairs that are connected to the specified listener. Because
* this function disconnects the qpairs, it has to be asynchronous.
@ -1123,8 +1105,11 @@ int spdk_nvmf_transport_stop_listen_async(struct spdk_nvmf_transport *transport,
spdk_nvmf_tgt_subsystem_listen_done_fn cb_fn,
void *cb_arg);
/**
* \brief Get current transport poll group statistics.
* \brief Get current transport poll group statistics. (deprecated)
*
* Please use the flow with spdk_nvmf_poll_group_dump_stat.
*
* This function allocates memory for statistics and returns it
* in \p stat parameter. Caller must free this memory with
@ -1147,7 +1132,9 @@ spdk_nvmf_transport_poll_group_get_stat(struct spdk_nvmf_tgt *tgt,
struct spdk_nvmf_transport_poll_group_stat **stat);
/**
* Free statistics memory previously allocated with spdk_nvmf_transport_poll_group_get_stat().
* Free statistics memory previously allocated with spdk_nvmf_transport_poll_group_get_stat(). (deprecated)
*
* Please use the flow with spdk_nvmf_poll_group_dump_stat.
*
* \param transport The NVMf transport.
* \param stat Pointer to transport poll group statistics structure.
@ -1156,6 +1143,15 @@ void
spdk_nvmf_transport_poll_group_free_stat(struct spdk_nvmf_transport *transport,
struct spdk_nvmf_transport_poll_group_stat *stat);
/**
* Dump poll group statistics into JSON.
*
* \param group The group which statistics should be dumped.
* \param w The JSON write context to which statistics should be dumped.
*/
void spdk_nvmf_poll_group_dump_stat(struct spdk_nvmf_poll_group *group,
struct spdk_json_write_ctx *w);
/**
* \brief Set the global hooks for the RDMA transport, if necessary.
*

View File

@ -48,7 +48,7 @@
#define SPDK_NVMF_MAX_SGL_ENTRIES 16
/* The maximum number of buffers per request */
#define NVMF_REQ_MAX_BUFFERS (SPDK_NVMF_MAX_SGL_ENTRIES * 2)
#define NVMF_REQ_MAX_BUFFERS (SPDK_NVMF_MAX_SGL_ENTRIES * 2 + 1)
/* AIO backend requires block size aligned data buffers,
* extra 4KiB aligned data buffer should work for most devices.
@ -368,15 +368,23 @@ struct spdk_nvmf_transport_ops {
struct spdk_nvmf_request *req);
/*
* Get transport poll group statistics
* Get transport poll group statistics. (deprecated)
* Please use the flow with spdk_nvmf_poll_group_dump_stat.
*/
int (*poll_group_get_stat)(struct spdk_nvmf_tgt *tgt,
struct spdk_nvmf_transport_poll_group_stat **stat);
/*
* Free transport poll group statistics previously allocated with poll_group_get_stat()
* Free transport poll group statistics previously allocated with poll_group_get_stat(). (deprecated)
* Please use the flow with spdk_nvmf_poll_group_dump_stat.
*/
void (*poll_group_free_stat)(struct spdk_nvmf_transport_poll_group_stat *stat);
/*
* Dump transport poll group statistics into JSON.
*/
void (*poll_group_dump_stat)(struct spdk_nvmf_transport_poll_group *group,
struct spdk_json_write_ctx *w);
};
/**

View File

@ -102,8 +102,6 @@ void spdk_opal_dev_destruct(struct spdk_opal_dev *dev);
struct spdk_opal_d0_features_info *spdk_opal_get_d0_features_info(struct spdk_opal_dev *dev);
__attribute__((__deprecated__)) bool spdk_opal_supported(struct spdk_opal_dev *dev);
int spdk_opal_cmd_take_ownership(struct spdk_opal_dev *dev, char *new_passwd);
/**

View File

@ -105,8 +105,6 @@
*
*/
#include "spdk/util.h"
/*
* Singly-linked Tail queue declarations.
*/

View File

@ -80,6 +80,13 @@ struct spdk_sock_request {
#define SPDK_SOCK_REQUEST_IOV(req, i) ((struct iovec *)(((uint8_t *)req + sizeof(struct spdk_sock_request)) + (sizeof(struct iovec) * i)))
enum spdk_placement_mode {
PLACEMENT_NONE,
PLACEMENT_NAPI,
PLACEMENT_CPU,
PLACEMENT_MARK,
};
/**
* SPDK socket implementation options.
*
@ -104,6 +111,7 @@ struct spdk_sock_impl_opts {
bool enable_recv_pipe;
/**
* **Deprecated, please use enable_zerocopy_send_server or enable_zerocopy_send_client instead**
* Enable or disable use of zero copy flow on send. Used by posix socket module.
*/
bool enable_zerocopy_send;
@ -115,9 +123,19 @@ struct spdk_sock_impl_opts {
/**
* Enable or disable placement_id. Used by posix and uring socket modules.
* Valid values in the enum spdk_placement_mode.
*/
bool enable_placement_id;
uint32_t enable_placement_id;
/**
* Enable or disable use of zero copy flow on send for server sockets. Used by posix socket module.
*/
bool enable_zerocopy_send_server;
/**
* Enable or disable use of zero copy flow on send for client sockets. Used by posix socket module.
*/
bool enable_zerocopy_send_client;
};
/**

View File

@ -131,7 +131,7 @@ typedef int (*spdk_poller_fn)(void *ctx);
* \param thread_ctx Context for the thread.
* \param fn Callback function for a poller.
* \param arg Argument passed to callback.
* \param period Polling period in microseconds.
* \param period_microseconds Polling period in microseconds.
*
* \return a pointer to the poller on success, or NULL on failure.
*/
@ -148,6 +148,30 @@ typedef struct spdk_poller *(*spdk_start_poller)(void *thread_ctx,
*/
typedef void (*spdk_stop_poller)(struct spdk_poller *poller, void *thread_ctx);
/**
* Callback function to set poller into interrupt mode or back to poll mode.
*
* \param poller Poller to set interrupt or poll mode.
* \param cb_arg Argument passed to the callback function.
* \param interrupt_mode Set interrupt mode for true, or poll mode for false
*/
typedef void (*spdk_poller_set_interrupt_mode_cb)(struct spdk_poller *poller, void *cb_arg,
bool interrupt_mode);
/**
* Mark that the poller is capable of entering interrupt mode.
*
* When registering the poller set interrupt callback, the callback will get
* executed immediately if its spdk_thread is in the interrupt mode.
*
* \param poller The poller to register callback function.
* \param cb_fn Callback function called when the poller must transition into or out of interrupt mode
* \param cb_arg Argument passed to the callback function.
*/
void spdk_poller_register_interrupt(struct spdk_poller *poller,
spdk_poller_set_interrupt_mode_cb cb_fn,
void *cb_arg);
/**
* I/O channel creation callback.
*
@ -513,6 +537,16 @@ int spdk_thread_send_critical_msg(struct spdk_thread *thread, spdk_msg_fn fn);
*/
void spdk_for_each_thread(spdk_msg_fn fn, void *ctx, spdk_msg_fn cpl);
/**
* Set current spdk_thread into interrupt mode or back to poll mode.
*
* Only valid when thread interrupt facility is enabled by
* spdk_interrupt_mode_enable().
*
* \param enable_interrupt Set interrupt mode for true, or poll mode for false
*/
void spdk_thread_set_interrupt_mode(bool enable_interrupt);
/**
* Register a poller on the current thread.
*
@ -721,6 +755,15 @@ struct spdk_io_channel *spdk_io_channel_iter_get_channel(struct spdk_io_channel_
*/
void *spdk_io_channel_iter_get_ctx(struct spdk_io_channel_iter *i);
/**
* Get the io_device for the specified I/O channel.
*
* \param ch I/O channel.
*
* \return a pointer to the io_device for the I/O channel
*/
void *spdk_io_channel_get_io_device(struct spdk_io_channel *ch);
/**
* Helper function to iterate all channels for spdk_for_each_channel().
*

View File

@ -46,7 +46,7 @@
/**
* Minor version number (month of original release).
*/
#define SPDK_VERSION_MINOR 1
#define SPDK_VERSION_MINOR 4
/**
* Patch level.
@ -54,7 +54,7 @@
* Patch level is incremented on maintenance branch releases and reset to 0 for each
* new major.minor release.
*/
#define SPDK_VERSION_PATCH 0
#define SPDK_VERSION_PATCH 1
/**
* Version string suffix.

View File

@ -80,14 +80,26 @@ struct spdk_accel_task {
struct spdk_accel_batch *batch;
spdk_accel_completion_cb cb_fn;
void *cb_arg;
void *src;
union {
struct {
struct iovec *iovs; /* iovs passed by the caller */
uint32_t iovcnt; /* iovcnt passed by the caller */
} v;
void *src;
};
union {
void *dst;
void *src2;
};
void *dst2;
uint32_t seed;
uint64_t fill_pattern;
union {
struct {
spdk_accel_completion_cb cb_fn;
void *cb_arg;
} chained;
void *dst2;
uint32_t seed;
uint64_t fill_pattern;
};
enum accel_opcode op_code;
uint64_t nbytes;
TAILQ_ENTRY(spdk_accel_task) link;

View File

@ -214,7 +214,7 @@ void spdk_app_json_config_load(const char *json_config_file, const char *rpc_add
*/
void spdk_subsystem_config_json(struct spdk_json_write_ctx *w, struct spdk_subsystem *subsystem);
void spdk_rpc_initialize(const char *listen_addr);
int spdk_rpc_initialize(const char *listen_addr);
void spdk_rpc_finish(void);
struct spdk_governor_capabilities {
@ -236,7 +236,7 @@ struct spdk_governor {
/* freqs - the buffer array to save the frequencies; num - the number of frequencies to get; return - the number of available frequencies */
uint32_t (*get_core_freqs)(uint32_t lcore_id, uint32_t *freqs, uint32_t num);
/* return - current frequency */
/* return - current frequency on success, 0 on failure */
uint32_t (*get_core_curr_freq)(uint32_t lcore_id);
/**

View File

@ -102,6 +102,7 @@ struct nvme_tcp_pdu {
bool has_hdgst;
bool ddgst_enable;
uint32_t header_digest_crc32;
uint32_t data_digest_crc32;
uint8_t data_digest[SPDK_NVME_TCP_DIGEST_LEN];
uint8_t ch_valid_bytes;
@ -618,12 +619,12 @@ nvme_tcp_pdu_calc_psh_len(struct nvme_tcp_pdu *pdu, bool hdgst_enable)
if (g_nvme_tcp_hdgst[pdu->hdr.common.pdu_type] && hdgst_enable) {
pdu->has_hdgst = true;
psh_len += SPDK_NVME_TCP_DIGEST_LEN;
if (pdu->hdr.common.plen > psh_len) {
pdo = pdu->hdr.common.pdo;
padding_len = pdo - psh_len;
if (padding_len > 0) {
psh_len = pdo;
}
}
if (pdu->hdr.common.plen > psh_len) {
pdo = pdu->hdr.common.pdo;
padding_len = pdo - psh_len;
if (padding_len > 0) {
psh_len = pdo;
}
}

View File

@ -41,6 +41,18 @@
/* Contains hooks definition */
#include "spdk/nvme.h"
struct spdk_rdma_wr_stats {
/* Total number of submitted requests */
uint64_t num_submitted_wrs;
/* Total number of doorbell updates */
uint64_t doorbell_updates;
};
struct spdk_rdma_qp_stats {
struct spdk_rdma_wr_stats send;
struct spdk_rdma_wr_stats recv;
};
struct spdk_rdma_qp_init_attr {
void *qp_context;
struct ibv_cq *send_cq;
@ -48,6 +60,7 @@ struct spdk_rdma_qp_init_attr {
struct ibv_srq *srq;
struct ibv_qp_cap cap;
struct ibv_pd *pd;
struct spdk_rdma_qp_stats *stats;
};
struct spdk_rdma_send_wr_list {
@ -55,10 +68,18 @@ struct spdk_rdma_send_wr_list {
struct ibv_send_wr *last;
};
struct spdk_rdma_recv_wr_list {
struct ibv_recv_wr *first;
struct ibv_recv_wr *last;
};
struct spdk_rdma_qp {
struct ibv_qp *qp;
struct rdma_cm_id *cm_id;
struct spdk_rdma_send_wr_list send_wrs;
struct spdk_rdma_recv_wr_list recv_wrs;
struct spdk_rdma_qp_stats *stats;
bool shared_stats;
};
struct spdk_rdma_mem_map;
@ -77,10 +98,58 @@ struct spdk_rdma_memory_translation {
union spdk_rdma_mr mr_or_key;
uint8_t translation_type;
};
struct spdk_rdma_srq_init_attr {
struct ibv_pd *pd;
struct spdk_rdma_wr_stats *stats;
struct ibv_srq_init_attr srq_init_attr;
};
struct spdk_rdma_srq {
struct ibv_srq *srq;
struct spdk_rdma_recv_wr_list recv_wrs;
struct spdk_rdma_wr_stats *stats;
bool shared_stats;
};
/**
* Create RDMA SRQ
*
* \param init_attr Pointer to SRQ init attr
* \return pointer to srq on success or NULL on failure. errno is updated in failure case.
*/
struct spdk_rdma_srq *spdk_rdma_srq_create(struct spdk_rdma_srq_init_attr *init_attr);
/**
* Destroy RDMA SRQ
*
* \param rdma_srq Pointer to SRQ
* \return 0 on succes, errno on failure
*/
int spdk_rdma_srq_destroy(struct spdk_rdma_srq *rdma_srq);
/**
* Append the given recv wr structure to the SRQ's outstanding recv list.
* This function accepts either a single Work Request or the first WR in a linked list.
*
* \param rdma_srq Pointer to SRQ
* \param first pointer to the first Work Request
* \return true if there were no outstanding WRs before, false otherwise
*/
bool spdk_rdma_srq_queue_recv_wrs(struct spdk_rdma_srq *rdma_srq, struct ibv_recv_wr *first);
/**
* Submit all queued receive Work Request
*
* \param rdma_srq Pointer to SRQ
* \param bad_wr Stores a pointer to the first failed WR if this function return nonzero value
* \return 0 on succes, errno on failure
*/
int spdk_rdma_srq_flush_recv_wrs(struct spdk_rdma_srq *rdma_srq, struct ibv_recv_wr **bad_wr);
/**
* Create RDMA provider specific qpair
* \param cm_id Pointer to RDMACM cm_id
*
* \param cm_id Pointer to RDMA_CM cm_id
* \param qp_attr Pointer to qpair init attributes
* \return Pointer to a newly created qpair on success or NULL on failure
*/
@ -89,7 +158,8 @@ struct spdk_rdma_qp *spdk_rdma_qp_create(struct rdma_cm_id *cm_id,
/**
* Accept a connection request. Called by the passive side (NVMEoF target)
* \param spdk_rdma_qp Pointer to a qpair
*
* \param spdk_rdma_qp Pointer to SPDK RDMA qpair
* \param conn_param Optional information needed to establish the connection
* \return 0 on success, errno on failure
*/
@ -98,21 +168,24 @@ int spdk_rdma_qp_accept(struct spdk_rdma_qp *spdk_rdma_qp, struct rdma_conn_para
/**
* Complete the connection process, must be called by the active
* side (NVMEoF initiator) upon receipt RDMA_CM_EVENT_CONNECT_RESPONSE
* \param spdk_rdma_qp Pointer to a qpair
*
* \param spdk_rdma_qp Pointer to SPDK RDMA qpair
* \return 0 on success, errno on failure
*/
int spdk_rdma_qp_complete_connect(struct spdk_rdma_qp *spdk_rdma_qp);
/**
* Destroy RDMA provider specific qpair
* \param spdk_rdma_qp Pointer to qpair to be destroyed
*
* \param spdk_rdma_qp Pointer to SPDK RDMA qpair to be destroyed
*/
void spdk_rdma_qp_destroy(struct spdk_rdma_qp *spdk_rdma_qp);
/**
* Disconnect a connection and transition assoiciated qpair to error state.
* Disconnect a connection and transition associated qpair to error state.
* Generates RDMA_CM_EVENT_DISCONNECTED on both connection sides
* \param spdk_rdma_qp Pointer to qpair to be destroyed
*
* \param spdk_rdma_qp Pointer to qpair to be disconnected
*/
int spdk_rdma_qp_disconnect(struct spdk_rdma_qp *spdk_rdma_qp);
@ -127,13 +200,32 @@ int spdk_rdma_qp_disconnect(struct spdk_rdma_qp *spdk_rdma_qp);
bool spdk_rdma_qp_queue_send_wrs(struct spdk_rdma_qp *spdk_rdma_qp, struct ibv_send_wr *first);
/**
* Submit all queued Work Request
* Submit all queued send Work Request
*
* \param spdk_rdma_qp Pointer to SPDK RDMA qpair
* \param bad_wr Stores a pointer to the first failed WR if this function return nonzero value
* \return 0 on succes, errno on failure
*/
int spdk_rdma_qp_flush_send_wrs(struct spdk_rdma_qp *spdk_rdma_qp, struct ibv_send_wr **bad_wr);
/**
* Append the given recv wr structure to the qpair's outstanding recv list.
* This function accepts either a single Work Request or the first WR in a linked list.
*
* \param spdk_rdma_qp Pointer to SPDK RDMA qpair
* \param first Pointer to the first Work Request
* \return true if there were no outstanding WRs before, false otherwise
*/
bool spdk_rdma_qp_queue_recv_wrs(struct spdk_rdma_qp *spdk_rdma_qp, struct ibv_recv_wr *first);
/**
* Submit all queued recv Work Request
* \param spdk_rdma_qp Pointer to SPDK RDMA qpair
* \param bad_wr Stores a pointer to the first failed WR if this function return nonzero value
* \return 0 on succes, errno on failure
*/
int spdk_rdma_qp_flush_recv_wrs(struct spdk_rdma_qp *spdk_rdma_qp, struct ibv_recv_wr **bad_wr);
/**
* Create a memory map which is used to register Memory Regions and perform address -> memory
* key translations

View File

@ -66,7 +66,6 @@ struct spdk_sock {
int cb_cnt;
spdk_sock_cb cb_fn;
void *cb_arg;
int placement_id;
struct {
uint8_t closed : 1;
uint8_t reserved : 7;
@ -80,14 +79,14 @@ struct spdk_sock_group {
struct spdk_sock_group_impl {
struct spdk_net_impl *net_impl;
struct spdk_sock_group *group;
TAILQ_HEAD(, spdk_sock) socks;
STAILQ_ENTRY(spdk_sock_group_impl) link;
/* List of removed sockets. refreshed each time we poll the sock group. */
int num_removed_socks;
/* Unfortunately, we can't just keep a tailq of the sockets in case they are freed
* or added to another poll group later.
*/
uintptr_t removed_socks[MAX_EVENTS_PER_POLL];
};
struct spdk_sock_map {
STAILQ_HEAD(, spdk_sock_placement_id_entry) entries;
pthread_mutex_t mtx;
};
struct spdk_net_impl {
@ -115,7 +114,7 @@ struct spdk_net_impl {
bool (*is_ipv4)(struct spdk_sock *sock);
bool (*is_connected)(struct spdk_sock *sock);
int (*get_placement_id)(struct spdk_sock *sock, int *placement_id);
struct spdk_sock_group_impl *(*group_impl_get_optimal)(struct spdk_sock *sock);
struct spdk_sock_group_impl *(*group_impl_create)(void);
int (*group_impl_add_sock)(struct spdk_sock_group_impl *group, struct spdk_sock *sock);
int (*group_impl_remove_sock)(struct spdk_sock_group_impl *group, struct spdk_sock *sock);
@ -277,6 +276,65 @@ end:
return iovcnt;
}
static inline void
spdk_sock_get_placement_id(int fd, enum spdk_placement_mode mode, int *placement_id)
{
*placement_id = -1;
switch (mode) {
case PLACEMENT_NONE:
break;
case PLACEMENT_MARK:
case PLACEMENT_NAPI: {
#if defined(SO_INCOMING_NAPI_ID)
socklen_t len = sizeof(int);
getsockopt(fd, SOL_SOCKET, SO_INCOMING_NAPI_ID, placement_id, &len);
#endif
break;
}
case PLACEMENT_CPU: {
#if defined(SO_INCOMING_CPU)
socklen_t len = sizeof(int);
getsockopt(fd, SOL_SOCKET, SO_INCOMING_CPU, placement_id, &len);
#endif
break;
}
default:
break;
}
}
/**
* Insert a group into the placement map.
* If the group is already in the map, take a reference.
*/
int spdk_sock_map_insert(struct spdk_sock_map *map, int placement_id,
struct spdk_sock_group_impl *group_impl);
/**
* Release a reference for the given placement_id. If the reference count goes to 0, the
* entry will no longer be associated with a group.
*/
void spdk_sock_map_release(struct spdk_sock_map *map, int placement_id);
/**
* Look up the group for the given placement_id.
*/
int spdk_sock_map_lookup(struct spdk_sock_map *map, int placement_id,
struct spdk_sock_group_impl **group_impl);
/**
* Find a placement id with no associated group
*/
int spdk_sock_map_find_free(struct spdk_sock_map *map);
/**
* Clean up all memory associated with the given map
*/
void spdk_sock_map_cleanup(struct spdk_sock_map *map);
#ifdef __cplusplus
}
#endif

View File

@ -74,7 +74,9 @@ struct spdk_poller {
spdk_poller_fn fn;
void *arg;
struct spdk_thread *thread;
int timerfd;
int interruptfd;
spdk_poller_set_interrupt_mode_cb set_intr_cb_fn;
void *set_intr_cb_arg;
char name[SPDK_MAX_POLLER_NAME_LEN + 1];
};
@ -128,7 +130,8 @@ struct spdk_thread {
struct spdk_cpuset cpumask;
uint64_t exit_timeout_tsc;
bool interrupt_mode;
/* Indicates whether this spdk_thread currently runs in interrupt. */
bool in_interrupt;
struct spdk_fd_group *fgrp;
/* User context allocated at the end */

View File

@ -483,4 +483,16 @@ int virtio_user_dev_init(struct virtio_dev *vdev, const char *name, const char *
int virtio_pci_dev_init(struct virtio_dev *vdev, const char *name,
struct virtio_pci_ctx *pci_ctx);
/**
* Process the uevent which is accepted from the kernel and the
* uevent descript the physical device hot add or remove action.
*
* \param fd the file descriptor of the kobject netlink socket
* \param device_id virtio device ID used to represent virtio-blk or other device.
* \return the name of the virtio device on success, NULL means it
* is not a suitable uevent.
*/
const char *
virtio_pci_dev_event_process(int fd, uint16_t device_id);
#endif /* SPDK_VIRTIO_H */

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 4
SO_VER := 5
SO_MINOR := 0
SO_SUFFIX := $(SO_VER).$(SO_MINOR)

View File

@ -36,6 +36,7 @@
#include "spdk_internal/accel_engine.h"
#include "spdk/env.h"
#include "spdk/likely.h"
#include "spdk/log.h"
#include "spdk/thread.h"
#include "spdk/json.h"
@ -72,6 +73,7 @@ static void _sw_accel_copy(void *dst, void *src, uint64_t nbytes);
static int _sw_accel_compare(void *src1, void *src2, uint64_t nbytes);
static void _sw_accel_fill(void *dst, uint8_t fill, uint64_t nbytes);
static void _sw_accel_crc32c(uint32_t *dst, void *src, uint32_t seed, uint64_t nbytes);
static void _sw_accel_crc32cv(uint32_t *dst, struct iovec *iov, uint32_t iovcnt, uint32_t seed);
/* Registration of hw modules (currently supports only 1 at a time) */
void
@ -111,13 +113,19 @@ void
spdk_accel_task_complete(struct spdk_accel_task *accel_task, int status)
{
struct accel_io_channel *accel_ch = accel_task->accel_ch;
struct spdk_accel_batch *batch;
struct spdk_accel_batch *batch = accel_task->batch;
spdk_accel_completion_cb cb_fn = accel_task->cb_fn;
void *cb_arg = accel_task->cb_arg;
accel_task->cb_fn(accel_task->cb_arg, status);
/* We should put the accel_task into the list firstly in order to avoid
* the accel task list is exhausted when there is recursive call to
* allocate accel_task in user's call back function (cb_fn)
*/
TAILQ_INSERT_TAIL(&accel_ch->task_pool, accel_task, link);
cb_fn(cb_arg, status);
/* If this task is part of a batch, check for completion of the batch. */
if (accel_task->batch) {
batch = accel_task->batch;
if (batch) {
assert(batch->count > 0);
batch->count--;
if (batch->count == 0) {
@ -129,8 +137,6 @@ spdk_accel_task_complete(struct spdk_accel_task *accel_task, int status)
TAILQ_INSERT_TAIL(&accel_ch->batch_pool, batch, link);
}
}
TAILQ_INSERT_TAIL(&accel_ch->task_pool, accel_task, link);
}
/* Accel framework public API for discovering current engine capabilities. */
@ -308,6 +314,7 @@ spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *dst, void *src, u
accel_task->dst = (void *)dst;
accel_task->src = src;
accel_task->v.iovcnt = 0;
accel_task->seed = seed;
accel_task->nbytes = nbytes;
accel_task->op_code = ACCEL_OPCODE_CRC32C;
@ -321,6 +328,78 @@ spdk_accel_submit_crc32c(struct spdk_io_channel *ch, uint32_t *dst, void *src, u
}
}
static void
crc32cv_done(void *cb_arg, int status)
{
struct spdk_accel_task *accel_task = cb_arg;
struct spdk_io_channel *ch = spdk_io_channel_from_ctx(accel_task->accel_ch);
assert(accel_task->chained.cb_fn != NULL);
assert(accel_task->chained.cb_arg != NULL);
if (spdk_likely(!status)) {
status = spdk_accel_submit_crc32cv(ch, accel_task->dst, ++accel_task->v.iovs,
accel_task->v.iovcnt - 1, ~(*((uint32_t *)accel_task->dst)),
accel_task->chained.cb_fn, accel_task->chained.cb_arg);
if (spdk_likely(!status)) {
return;
}
}
accel_task->chained.cb_fn(accel_task->chained.cb_arg, status);
}
/* Accel framework public API for chained CRC-32C function */
int
spdk_accel_submit_crc32cv(struct spdk_io_channel *ch, uint32_t *dst, struct iovec *iov,
uint32_t iov_cnt, uint32_t seed, spdk_accel_completion_cb cb_fn, void *cb_arg)
{
struct accel_io_channel *accel_ch;
struct spdk_accel_task *accel_task;
if (iov == NULL) {
SPDK_ERRLOG("iov should not be NULL");
return -EINVAL;
}
if (!iov_cnt) {
SPDK_ERRLOG("iovcnt should not be zero value\n");
return -EINVAL;
}
if (iov_cnt == 1) {
return spdk_accel_submit_crc32c(ch, dst, iov[0].iov_base, seed, iov[0].iov_len, cb_fn, cb_arg);
}
accel_ch = spdk_io_channel_get_ctx(ch);
accel_task = _get_task(accel_ch, NULL, cb_fn, cb_arg);
if (accel_task == NULL) {
SPDK_ERRLOG("no memory\n");
assert(0);
return -ENOMEM;
}
accel_task->v.iovs = iov;
accel_task->v.iovcnt = iov_cnt;
accel_task->dst = (void *)dst;
accel_task->op_code = ACCEL_OPCODE_CRC32C;
if (_is_supported(accel_ch->engine, ACCEL_CRC32C)) {
accel_task->cb_fn = crc32cv_done;
accel_task->cb_arg = accel_task;
accel_task->chained.cb_fn = cb_fn;
accel_task->chained.cb_arg = cb_arg;
accel_task->nbytes = iov[0].iov_len;
return accel_ch->engine->submit_tasks(accel_ch->engine_ch, accel_task);
} else {
_sw_accel_crc32cv(dst, iov, iov_cnt, seed);
spdk_accel_task_complete(accel_task, 0);
return 0;
}
}
/* Accel framework public API for getting max operations for a batch. */
uint32_t
spdk_accel_batch_get_max(struct spdk_io_channel *ch)
@ -459,6 +538,7 @@ spdk_accel_batch_prep_crc32c(struct spdk_io_channel *ch, struct spdk_accel_batch
accel_task->dst = dst;
accel_task->src = src;
accel_task->v.iovcnt = 0;
accel_task->seed = seed;
accel_task->nbytes = nbytes;
accel_task->op_code = ACCEL_OPCODE_CRC32C;
@ -472,6 +552,82 @@ spdk_accel_batch_prep_crc32c(struct spdk_io_channel *ch, struct spdk_accel_batch
return 0;
}
static void
batched_crc32cv_done(void *cb_arg, int status)
{
struct spdk_accel_task *accel_task = cb_arg;
struct spdk_io_channel *ch = spdk_io_channel_from_ctx(accel_task->accel_ch);
struct spdk_accel_batch *batch;
batch = accel_task->batch;
assert(batch != NULL);
assert(accel_task->chained.cb_fn != NULL);
assert(accel_task->chained.cb_arg != NULL);
if (spdk_likely(!status)) {
status = spdk_accel_batch_prep_crc32cv(ch, batch, accel_task->dst,
++accel_task->v.iovs, accel_task->v.iovcnt - 1, ~(*((uint32_t *)accel_task->dst)),
accel_task->chained.cb_fn, accel_task->chained.cb_arg);
if (spdk_likely(!status)) {
return;
}
}
accel_task->chained.cb_fn(accel_task->chained.cb_arg, status);
}
int
spdk_accel_batch_prep_crc32cv(struct spdk_io_channel *ch, struct spdk_accel_batch *batch,
uint32_t *dst, struct iovec *iovs, uint32_t iov_cnt, uint32_t seed,
spdk_accel_completion_cb cb_fn, void *cb_arg)
{
struct accel_io_channel *accel_ch;
struct spdk_accel_task *accel_task;
if (iovs == NULL) {
SPDK_ERRLOG("iovs should not be NULL\n");
return -EINVAL;
}
if (iov_cnt == 0) {
SPDK_ERRLOG("iovcnt should not be zero value\n");
return -EINVAL;
}
if (iov_cnt == 1) {
return spdk_accel_batch_prep_crc32c(ch, batch, dst, iovs[0].iov_base, seed, iovs[0].iov_len, cb_fn,
cb_arg);
}
accel_ch = spdk_io_channel_get_ctx(ch);
accel_task = _get_task(accel_ch, batch, cb_fn, cb_arg);
if (accel_task == NULL) {
return -ENOMEM;
}
accel_task->v.iovs = iovs;
accel_task->v.iovcnt = iov_cnt;
accel_task->dst = dst;
accel_task->seed = seed;
accel_task->op_code = ACCEL_OPCODE_CRC32C;
if (_is_supported(accel_ch->engine, ACCEL_CRC32C)) {
accel_task->cb_arg = accel_task;
accel_task->cb_fn = batched_crc32cv_done;
accel_task->cb_arg = accel_task;
accel_task->chained.cb_fn = cb_fn;
accel_task->chained.cb_arg = cb_arg;
accel_task->nbytes = iovs[0].iov_len;
TAILQ_INSERT_TAIL(&batch->hw_tasks, accel_task, link);
} else {
TAILQ_INSERT_TAIL(&batch->sw_tasks, accel_task, link);
}
return 0;
}
/* Accel framework public API for batch_create function. */
struct spdk_accel_batch *
spdk_accel_batch_create(struct spdk_io_channel *ch)
@ -551,8 +707,12 @@ spdk_accel_batch_submit(struct spdk_io_channel *ch, struct spdk_accel_batch *bat
batch->status |= rc;
break;
case ACCEL_OPCODE_CRC32C:
_sw_accel_crc32c(accel_task->dst, accel_task->src, accel_task->seed,
accel_task->nbytes);
if (accel_task->v.iovcnt == 0) {
_sw_accel_crc32c(accel_task->dst, accel_task->src, accel_task->seed,
accel_task->nbytes);
} else {
_sw_accel_crc32cv(accel_task->dst, accel_task->v.iovs, accel_task->v.iovcnt, accel_task->seed);
}
spdk_accel_task_complete(accel_task, 0);
break;
case ACCEL_OPCODE_DUALCAST:
@ -804,6 +964,20 @@ _sw_accel_crc32c(uint32_t *dst, void *src, uint32_t seed, uint64_t nbytes)
*dst = spdk_crc32c_update(src, nbytes, ~seed);
}
static void
_sw_accel_crc32cv(uint32_t *dst, struct iovec *iov, uint32_t iovcnt, uint32_t seed)
{
uint32_t i, crc32c = ~seed;
for (i = 0; i < iovcnt; i++) {
assert(iov[i].iov_base != NULL);
assert(iov[i].iov_len != 0);
crc32c = spdk_crc32c_update(iov[i].iov_base, iov[i].iov_len, crc32c);
}
*dst = crc32c;
}
static struct spdk_io_channel *sw_accel_get_io_channel(void);
static uint32_t

View File

@ -14,6 +14,7 @@
spdk_accel_batch_prep_compare;
spdk_accel_batch_prep_fill;
spdk_accel_batch_prep_crc32c;
spdk_accel_batch_prep_crc32cv;
spdk_accel_batch_submit;
spdk_accel_batch_cancel;
spdk_accel_submit_copy;
@ -21,6 +22,7 @@
spdk_accel_submit_compare;
spdk_accel_submit_fill;
spdk_accel_submit_crc32c;
spdk_accel_submit_crc32cv;
spdk_accel_write_config_json;
# functions needed by modules

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 5
SO_VER := 6
SO_MINOR := 0
ifeq ($(CONFIG_VTUNE),y)

View File

@ -304,11 +304,7 @@ struct spdk_bdev_desc {
struct spdk_bdev *bdev;
struct spdk_thread *thread;
struct {
bool open_with_ext;
union {
spdk_bdev_remove_cb_t remove_fn;
spdk_bdev_event_cb_t event_fn;
};
spdk_bdev_event_cb_t event_fn;
void *ctx;
} callback;
bool closed;
@ -1475,7 +1471,6 @@ bdev_mgr_unregister_cb(void *io_device)
g_fini_cb_arg = NULL;
g_bdev_mgr.init_complete = false;
g_bdev_mgr.module_init_complete = false;
pthread_mutex_destroy(&g_bdev_mgr.mutex);
}
static void
@ -3464,7 +3459,7 @@ spdk_bdev_notify_blockcnt_change(struct spdk_bdev *bdev, uint64_t size)
bdev->blockcnt = size;
TAILQ_FOREACH(desc, &bdev->internal.open_descs, link) {
pthread_mutex_lock(&desc->mutex);
if (desc->callback.open_with_ext && !desc->closed) {
if (!desc->closed) {
desc->refs++;
spdk_thread_send_msg(desc->thread, _resize_notify, desc);
}
@ -5311,6 +5306,8 @@ spdk_bdev_io_complete_nvme_status(struct spdk_bdev_io *bdev_io, uint32_t cdw0, i
{
if (sct == SPDK_NVME_SCT_GENERIC && sc == SPDK_NVME_SC_SUCCESS) {
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_SUCCESS;
} else if (sct == SPDK_NVME_SCT_GENERIC && sc == SPDK_NVME_SC_ABORTED_BY_REQUEST) {
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_ABORTED;
} else {
bdev_io->internal.status = SPDK_BDEV_IO_STATUS_NVME_ERROR;
}
@ -5498,6 +5495,9 @@ bdev_destroy_cb(void *io_device)
cb_fn = bdev->internal.unregister_cb;
cb_arg = bdev->internal.unregister_ctx;
pthread_mutex_destroy(&bdev->internal.mutex);
free(bdev->internal.qos);
rc = bdev->fn_table->destruct(bdev->ctxt);
if (rc < 0) {
SPDK_ERRLOG("destruct failed\n");
@ -5507,17 +5507,6 @@ bdev_destroy_cb(void *io_device)
}
}
static void
bdev_fini(struct spdk_bdev *bdev)
{
pthread_mutex_destroy(&bdev->internal.mutex);
free(bdev->internal.qos);
spdk_io_device_unregister(__bdev_to_io_dev(bdev), bdev_destroy_cb);
}
static void
bdev_start_finished(void *arg)
{
@ -5550,13 +5539,6 @@ spdk_bdev_register(struct spdk_bdev *bdev)
return rc;
}
int
spdk_vbdev_register(struct spdk_bdev *vbdev, struct spdk_bdev **base_bdevs, int base_bdev_count)
{
SPDK_ERRLOG("This function is deprecated. Use spdk_bdev_register() instead.\n");
return spdk_bdev_register(vbdev);
}
void
spdk_bdev_destruct_done(struct spdk_bdev *bdev, int bdeverrno)
{
@ -5575,11 +5557,7 @@ _remove_notify(void *arg)
if (!desc->closed) {
pthread_mutex_unlock(&desc->mutex);
if (desc->callback.open_with_ext) {
desc->callback.event_fn(SPDK_BDEV_EVENT_REMOVE, desc->bdev, desc->callback.ctx);
} else {
desc->callback.remove_fn(desc->callback.ctx);
}
desc->callback.event_fn(SPDK_BDEV_EVENT_REMOVE, desc->bdev, desc->callback.ctx);
return;
} else if (0 == desc->refs) {
/* This descriptor was closed after this remove_notify message was sent.
@ -5645,9 +5623,7 @@ spdk_bdev_unregister(struct spdk_bdev *bdev, spdk_bdev_unregister_cb cb_fn, void
}
pthread_mutex_lock(&g_bdev_mgr.mutex);
pthread_mutex_lock(&bdev->internal.mutex);
if (bdev->internal.status == SPDK_BDEV_STATUS_REMOVING) {
pthread_mutex_unlock(&bdev->internal.mutex);
pthread_mutex_unlock(&g_bdev_mgr.mutex);
if (cb_fn) {
cb_fn(cb_arg, -EBUSY);
@ -5655,6 +5631,7 @@ spdk_bdev_unregister(struct spdk_bdev *bdev, spdk_bdev_unregister_cb cb_fn, void
return;
}
pthread_mutex_lock(&bdev->internal.mutex);
bdev->internal.status = SPDK_BDEV_STATUS_REMOVING;
bdev->internal.unregister_cb = cb_fn;
bdev->internal.unregister_ctx = cb_arg;
@ -5665,16 +5642,10 @@ spdk_bdev_unregister(struct spdk_bdev *bdev, spdk_bdev_unregister_cb cb_fn, void
pthread_mutex_unlock(&g_bdev_mgr.mutex);
if (rc == 0) {
bdev_fini(bdev);
spdk_io_device_unregister(__bdev_to_io_dev(bdev), bdev_destroy_cb);
}
}
static void
bdev_dummy_event_cb(void *remove_ctx)
{
SPDK_DEBUGLOG(bdev, "Bdev remove event received with no remove callback specified");
}
static int
bdev_start_qos(struct spdk_bdev *bdev)
{
@ -5742,46 +5713,6 @@ bdev_open(struct spdk_bdev *bdev, bool write, struct spdk_bdev_desc *desc)
return 0;
}
int
spdk_bdev_open(struct spdk_bdev *bdev, bool write, spdk_bdev_remove_cb_t remove_cb,
void *remove_ctx, struct spdk_bdev_desc **_desc)
{
struct spdk_bdev_desc *desc;
int rc;
desc = calloc(1, sizeof(*desc));
if (desc == NULL) {
SPDK_ERRLOG("Failed to allocate memory for bdev descriptor\n");
return -ENOMEM;
}
if (remove_cb == NULL) {
remove_cb = bdev_dummy_event_cb;
}
TAILQ_INIT(&desc->pending_media_events);
TAILQ_INIT(&desc->free_media_events);
desc->callback.open_with_ext = false;
desc->callback.remove_fn = remove_cb;
desc->callback.ctx = remove_ctx;
pthread_mutex_init(&desc->mutex, NULL);
pthread_mutex_lock(&g_bdev_mgr.mutex);
rc = bdev_open(bdev, write, desc);
if (rc != 0) {
bdev_desc_free(desc);
desc = NULL;
}
*_desc = desc;
pthread_mutex_unlock(&g_bdev_mgr.mutex);
return rc;
}
int
spdk_bdev_open_ext(const char *bdev_name, bool write, spdk_bdev_event_cb_t event_cb,
void *event_ctx, struct spdk_bdev_desc **_desc)
@ -5816,7 +5747,6 @@ spdk_bdev_open_ext(const char *bdev_name, bool write, spdk_bdev_event_cb_t event
TAILQ_INIT(&desc->pending_media_events);
TAILQ_INIT(&desc->free_media_events);
desc->callback.open_with_ext = true;
desc->callback.event_fn = event_cb;
desc->callback.ctx = event_ctx;
pthread_mutex_init(&desc->mutex, NULL);
@ -5897,7 +5827,7 @@ spdk_bdev_close(struct spdk_bdev_desc *desc)
pthread_mutex_unlock(&bdev->internal.mutex);
if (rc == 0) {
bdev_fini(bdev);
spdk_io_device_unregister(__bdev_to_io_dev(bdev), bdev_destroy_cb);
}
} else {
pthread_mutex_unlock(&bdev->internal.mutex);

View File

@ -44,12 +44,30 @@ spdk_bdev_get_zone_size(const struct spdk_bdev *bdev)
return bdev->zone_size;
}
uint64_t
spdk_bdev_get_num_zones(const struct spdk_bdev *bdev)
{
return bdev->zone_size ? bdev->blockcnt / bdev->zone_size : 0;
}
uint32_t
spdk_bdev_get_max_zone_append_size(const struct spdk_bdev *bdev)
{
return bdev->max_zone_append_size;
}
uint32_t
spdk_bdev_get_max_open_zones(const struct spdk_bdev *bdev)
{
return bdev->max_open_zones;
}
uint32_t
spdk_bdev_get_max_active_zones(const struct spdk_bdev *bdev)
{
return bdev->max_active_zones;
}
uint32_t
spdk_bdev_get_optimal_open_zones(const struct spdk_bdev *bdev)
{

View File

@ -491,27 +491,6 @@ spdk_bdev_part_base_construct_ext(const char *bdev_name,
return 0;
}
struct spdk_bdev_part_base *
spdk_bdev_part_base_construct(struct spdk_bdev *bdev,
spdk_bdev_remove_cb_t remove_cb, struct spdk_bdev_module *module,
struct spdk_bdev_fn_table *fn_table, struct bdev_part_tailq *tailq,
spdk_bdev_part_base_free_fn free_fn, void *ctx,
uint32_t channel_size, spdk_io_channel_create_cb ch_create_cb,
spdk_io_channel_destroy_cb ch_destroy_cb)
{
struct spdk_bdev_part_base *base = NULL;
int rc;
rc = spdk_bdev_part_base_construct_ext(spdk_bdev_get_name(bdev), remove_cb, module,
fn_table, tailq, free_fn, ctx,
channel_size, ch_create_cb, ch_destroy_cb, &base);
if (rc == 0) {
return base;
} else {
return NULL;
}
}
int
spdk_bdev_part_construct(struct spdk_bdev_part *part, struct spdk_bdev_part_base *base,
char *name, uint64_t offset_blocks, uint64_t num_blocks,

View File

@ -99,7 +99,6 @@
spdk_bdev_register;
spdk_bdev_unregister;
spdk_bdev_destruct_done;
spdk_vbdev_register;
spdk_bdev_module_examine_done;
spdk_bdev_module_init_done;
spdk_bdev_module_finish_done;
@ -132,7 +131,6 @@
spdk_bdev_part_base_free;
spdk_bdev_part_free;
spdk_bdev_part_base_hotremove;
spdk_bdev_part_base_construct;
spdk_bdev_part_base_construct_ext;
spdk_bdev_part_construct;
spdk_bdev_part_submit_request;
@ -145,7 +143,10 @@
# Public functions in bdev_zone.h
spdk_bdev_get_zone_size;
spdk_bdev_get_num_zones;
spdk_bdev_get_max_zone_append_size;
spdk_bdev_get_max_open_zones;
spdk_bdev_get_max_active_zones;
spdk_bdev_get_optimal_open_zones;
spdk_bdev_get_zone_info;
spdk_bdev_zone_management;

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 4
SO_VER := 5
SO_MINOR := 0
C_SRCS = blobstore.c request.c zeroes.c blob_bs_dev.c

View File

@ -63,8 +63,8 @@ static int blob_get_xattr_value(struct spdk_blob *blob, const char *name,
const void **value, size_t *value_len, bool internal);
static int blob_remove_xattr(struct spdk_blob *blob, const char *name, bool internal);
static void blob_insert_extent(struct spdk_blob *blob, uint32_t extent, uint64_t cluster_num,
spdk_blob_op_complete cb_fn, void *cb_arg);
static void blob_write_extent_page(struct spdk_blob *blob, uint32_t extent, uint64_t cluster_num,
spdk_blob_op_complete cb_fn, void *cb_arg);
static void
blob_verify_md_op(struct spdk_blob *blob)
@ -1642,6 +1642,7 @@ blob_persist_complete(spdk_bs_sequence_t *seq, struct spdk_blob_persist_ctx *ctx
free(ctx);
if (next_persist != NULL) {
blob->state = SPDK_BLOB_STATE_DIRTY;
blob_persist_check_dirty(next_persist);
}
}
@ -2131,36 +2132,31 @@ blob_persist_write_extent_pages(spdk_bs_sequence_t *seq, void *cb_arg, int bserr
return;
}
/* Only write out changed extent pages */
for (i = ctx->next_extent_page; i < blob->active.num_extent_pages; i++) {
/* Only write out Extent Pages when blob was resized. */
for (i = ctx->next_extent_page; i < blob->active.extent_pages_array_size; i++) {
extent_page_id = blob->active.extent_pages[i];
if (extent_page_id == 0) {
/* No Extent Page to persist */
assert(spdk_blob_is_thin_provisioned(blob));
continue;
}
/* Writing out new extent page for the first time. Either active extent pages is larger
* than clean extent pages or there was no extent page assigned due to thin provisioning. */
if (i >= blob->clean.extent_pages_array_size || blob->clean.extent_pages[i] == 0) {
blob->state = SPDK_BLOB_STATE_DIRTY;
assert(spdk_bit_array_get(blob->bs->used_md_pages, extent_page_id));
ctx->next_extent_page = i + 1;
rc = blob_serialize_add_page(ctx->blob, &ctx->extent_page, &page_count, &ctx->extent_page);
if (rc < 0) {
blob_persist_complete(seq, ctx, rc);
return;
}
blob_serialize_extent_page(blob, i * SPDK_EXTENTS_PER_EP, ctx->extent_page);
ctx->extent_page->crc = blob_md_page_calc_crc(ctx->extent_page);
bs_sequence_write_dev(seq, ctx->extent_page, bs_md_page_to_lba(blob->bs, extent_page_id),
bs_byte_to_lba(blob->bs, SPDK_BS_PAGE_SIZE),
blob_persist_write_extent_pages, ctx);
assert(spdk_bit_array_get(blob->bs->used_md_pages, extent_page_id));
ctx->next_extent_page = i + 1;
rc = blob_serialize_add_page(ctx->blob, &ctx->extent_page, &page_count, &ctx->extent_page);
if (rc < 0) {
blob_persist_complete(seq, ctx, rc);
return;
}
assert(blob->clean.extent_pages[i] != 0);
blob->state = SPDK_BLOB_STATE_DIRTY;
blob_serialize_extent_page(blob, i * SPDK_EXTENTS_PER_EP, ctx->extent_page);
ctx->extent_page->crc = blob_md_page_calc_crc(ctx->extent_page);
bs_sequence_write_dev(seq, ctx->extent_page, bs_md_page_to_lba(blob->bs, extent_page_id),
bs_byte_to_lba(blob->bs, SPDK_BS_PAGE_SIZE),
blob_persist_write_extent_pages, ctx);
return;
}
blob_persist_generate_new_md(ctx);
@ -2182,6 +2178,20 @@ blob_persist_start(struct spdk_blob_persist_ctx *ctx)
}
if (blob->clean.num_clusters < blob->active.num_clusters) {
/* Blob was resized up */
assert(blob->clean.num_extent_pages <= blob->active.num_extent_pages);
ctx->next_extent_page = spdk_max(1, blob->clean.num_extent_pages) - 1;
} else if (blob->active.num_clusters < blob->active.cluster_array_size) {
/* Blob was resized down */
assert(blob->clean.num_extent_pages >= blob->active.num_extent_pages);
ctx->next_extent_page = spdk_max(1, blob->active.num_extent_pages) - 1;
} else {
/* No change in size occured */
blob_persist_generate_new_md(ctx);
return;
}
blob_persist_write_extent_pages(seq, ctx, 0);
}
@ -2268,7 +2278,6 @@ blob_persist(spdk_bs_sequence_t *seq, struct spdk_blob *blob,
ctx->seq = seq;
ctx->cb_fn = cb_fn;
ctx->cb_arg = cb_arg;
ctx->next_extent_page = 0;
/* Multiple blob persists can affect one another, via blob->state or
* blob mutable data changes. To prevent it, queue up the persists. */
@ -6346,6 +6355,7 @@ struct delete_snapshot_ctx {
spdk_blob_op_with_handle_complete cb_fn;
void *cb_arg;
int bserrno;
uint32_t next_extent_page;
};
static void
@ -6515,6 +6525,62 @@ delete_snapshot_sync_clone_cpl(void *cb_arg, int bserrno)
spdk_blob_sync_md(ctx->snapshot, delete_snapshot_sync_snapshot_cpl, ctx);
}
static void
delete_snapshot_update_extent_pages_cpl(struct delete_snapshot_ctx *ctx)
{
/* Delete old backing bs_dev from clone (related to snapshot that will be removed) */
ctx->clone->back_bs_dev->destroy(ctx->clone->back_bs_dev);
/* Set/remove snapshot xattr and switch parent ID and backing bs_dev on clone... */
if (ctx->parent_snapshot_entry != NULL) {
/* ...to parent snapshot */
ctx->clone->parent_id = ctx->parent_snapshot_entry->id;
ctx->clone->back_bs_dev = ctx->snapshot->back_bs_dev;
blob_set_xattr(ctx->clone, BLOB_SNAPSHOT, &ctx->parent_snapshot_entry->id,
sizeof(spdk_blob_id),
true);
} else {
/* ...to blobid invalid and zeroes dev */
ctx->clone->parent_id = SPDK_BLOBID_INVALID;
ctx->clone->back_bs_dev = bs_create_zeroes_dev();
blob_remove_xattr(ctx->clone, BLOB_SNAPSHOT, true);
}
spdk_blob_sync_md(ctx->clone, delete_snapshot_sync_clone_cpl, ctx);
}
static void
delete_snapshot_update_extent_pages(void *cb_arg, int bserrno)
{
struct delete_snapshot_ctx *ctx = cb_arg;
uint32_t *extent_page;
uint64_t i;
for (i = ctx->next_extent_page; i < ctx->snapshot->active.num_extent_pages &&
i < ctx->clone->active.num_extent_pages; i++) {
if (ctx->snapshot->active.extent_pages[i] == 0) {
/* No extent page to use from snapshot */
continue;
}
extent_page = &ctx->clone->active.extent_pages[i];
if (*extent_page == 0) {
/* Copy extent page from snapshot when clone did not have a matching one */
*extent_page = ctx->snapshot->active.extent_pages[i];
continue;
}
/* Clone and snapshot both contain partialy filled matching extent pages.
* Update the clone extent page in place with cluster map containing the mix of both. */
ctx->next_extent_page = i + 1;
blob_write_extent_page(ctx->clone, *extent_page, i * SPDK_EXTENTS_PER_EP,
delete_snapshot_update_extent_pages, ctx);
return;
}
delete_snapshot_update_extent_pages_cpl(ctx);
}
static void
delete_snapshot_sync_snapshot_xattr_cpl(void *cb_arg, int bserrno)
{
@ -6538,32 +6604,8 @@ delete_snapshot_sync_snapshot_xattr_cpl(void *cb_arg, int bserrno)
ctx->clone->active.clusters[i] = ctx->snapshot->active.clusters[i];
}
}
for (i = 0; i < ctx->snapshot->active.num_extent_pages &&
i < ctx->clone->active.num_extent_pages; i++) {
if (ctx->clone->active.extent_pages[i] == 0) {
ctx->clone->active.extent_pages[i] = ctx->snapshot->active.extent_pages[i];
}
}
/* Delete old backing bs_dev from clone (related to snapshot that will be removed) */
ctx->clone->back_bs_dev->destroy(ctx->clone->back_bs_dev);
/* Set/remove snapshot xattr and switch parent ID and backing bs_dev on clone... */
if (ctx->parent_snapshot_entry != NULL) {
/* ...to parent snapshot */
ctx->clone->parent_id = ctx->parent_snapshot_entry->id;
ctx->clone->back_bs_dev = ctx->snapshot->back_bs_dev;
blob_set_xattr(ctx->clone, BLOB_SNAPSHOT, &ctx->parent_snapshot_entry->id,
sizeof(spdk_blob_id),
true);
} else {
/* ...to blobid invalid and zeroes dev */
ctx->clone->parent_id = SPDK_BLOBID_INVALID;
ctx->clone->back_bs_dev = bs_create_zeroes_dev();
blob_remove_xattr(ctx->clone, BLOB_SNAPSHOT, true);
}
spdk_blob_sync_md(ctx->clone, delete_snapshot_sync_clone_cpl, ctx);
ctx->next_extent_page = 0;
delete_snapshot_update_extent_pages(ctx, 0);
}
static void
@ -7033,6 +7075,18 @@ blob_insert_cluster_msg_cb(void *arg, int bserrno)
spdk_thread_send_msg(ctx->thread, blob_insert_cluster_msg_cpl, ctx);
}
static void
blob_insert_new_ep_cb(void *arg, int bserrno)
{
struct spdk_blob_insert_cluster_ctx *ctx = arg;
uint32_t *extent_page;
extent_page = bs_cluster_to_extent_page(ctx->blob, ctx->cluster_num);
*extent_page = ctx->extent_page;
ctx->blob->state = SPDK_BLOB_STATE_DIRTY;
blob_sync_md(ctx->blob, blob_insert_cluster_msg_cb, ctx);
}
static void
blob_persist_extent_page_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
{
@ -7043,8 +7097,8 @@ blob_persist_extent_page_cpl(spdk_bs_sequence_t *seq, void *cb_arg, int bserrno)
}
static void
blob_insert_extent(struct spdk_blob *blob, uint32_t extent, uint64_t cluster_num,
spdk_blob_op_complete cb_fn, void *cb_arg)
blob_write_extent_page(struct spdk_blob *blob, uint32_t extent, uint64_t cluster_num,
spdk_blob_op_complete cb_fn, void *cb_arg)
{
spdk_bs_sequence_t *seq;
struct spdk_bs_cpl cpl;
@ -7100,13 +7154,11 @@ blob_insert_cluster_msg(void *arg)
extent_page = bs_cluster_to_extent_page(ctx->blob, ctx->cluster_num);
if (*extent_page == 0) {
/* Extent page requires allocation.
* It was already claimed in the used_md_pages map and placed in ctx.
* Blob persist will take care of writing out new extent page on disk. */
* It was already claimed in the used_md_pages map and placed in ctx. */
assert(ctx->extent_page != 0);
assert(spdk_bit_array_get(ctx->blob->bs->used_md_pages, ctx->extent_page) == true);
*extent_page = ctx->extent_page;
ctx->blob->state = SPDK_BLOB_STATE_DIRTY;
blob_sync_md(ctx->blob, blob_insert_cluster_msg_cb, ctx);
blob_write_extent_page(ctx->blob, ctx->extent_page, ctx->cluster_num,
blob_insert_new_ep_cb, ctx);
} else {
/* It is possible for original thread to allocate extent page for
* different cluster in the same extent page. In such case proceed with
@ -7118,8 +7170,8 @@ blob_insert_cluster_msg(void *arg)
}
/* Extent page already allocated.
* Every cluster allocation, requires just an update of single extent page. */
blob_insert_extent(ctx->blob, *extent_page, ctx->cluster_num,
blob_insert_cluster_msg_cb, ctx);
blob_write_extent_page(ctx->blob, *extent_page, ctx->cluster_num,
blob_insert_cluster_msg_cb, ctx);
}
}

View File

@ -34,7 +34,7 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 3
SO_VER := 4
SO_MINOR := 0
C_SRCS = blobfs.c tree.c

View File

@ -34,8 +34,8 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 2
SO_MINOR := 1
SO_VER := 3
SO_MINOR := 0
C_SRCS = conf.c
LIBNAME = conf

View File

@ -34,12 +34,13 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
SO_VER := 5
SO_MINOR := 1
SO_VER := 6
SO_MINOR := 0
CFLAGS += $(ENV_CFLAGS)
C_SRCS = env.c memory.c pci.c init.c threads.c
C_SRCS += pci_ioat.c pci_virtio.c pci_vmd.c pci_idxd.c
C_SRCS += pci_event.c sigbus_handler.c
LIBNAME = env_dpdk
SPDK_MAP_FILE = $(abspath $(CURDIR)/spdk_env_dpdk.map)
@ -48,9 +49,18 @@ include $(SPDK_ROOT_DIR)/mk/spdk.lib.mk
LIBDPDK_PKGCONFIG = $(call pkgconfig_filename,spdk_dpdklibs)
$(LIBDPDK_PKGCONFIG): $(PKGCONFIG)
$(LIBDPDK_PKGCONFIG): $(PKGCONFIG) $(PKGCONFIG_INST)
$(Q)$(SPDK_ROOT_DIR)/scripts/pc_libs.sh \
"-L$(DPDK_ABS_DIR)/lib $(DPDK_LIB_LIST:%=-l%)" "" DPDK spdk_dpdklibs > $@
$(Q)echo Requires: spdk_dpdklibs >> $(PKGCONFIG)
$(Q)sed -i.bak '5s,.*,Requires: $(DEPDIRS-$(LIBNAME):%=spdk_%) spdk_dpdklibs,' $(PKGCONFIG) ; rm $(PKGCONFIG).bak
$(Q)sed -i.bak '5s,.*,Requires: $(DEPDIRS-$(LIBNAME):%=spdk_%) spdk_dpdklibs,' $(PKGCONFIG_INST) ; rm $(PKGCONFIG_INST).bak
all : $(LIBDPDK_PKGCONFIG)
_install_dpdklibs: $(LIBDPDK_PKGCONFIG)
@$(call pkgconfig_install,$(LIBDPDK_PKGCONFIG))
_uninstall_dpdklibs: $(LIBDPDK_PKGCONFIG)
@$(call pkgconfig_uninstall,$(LIBDPDK_PKGCONFIG))
all: $(LIBDPDK_PKGCONFIG)
install: _install_dpdklibs
uninstall: _uninstall_dpdklibs

View File

@ -48,10 +48,10 @@ DPDK_INC_DIR := $(DPDK_ABS_DIR)/include/dpdk
endif
DPDK_INC := -I$(DPDK_INC_DIR)
DPDK_LIB_LIST = rte_eal rte_mempool rte_ring rte_mbuf rte_pci rte_bus_pci rte_mempool_ring
DPDK_LIB_LIST = rte_eal rte_mempool rte_ring rte_mbuf rte_bus_pci rte_pci rte_mempool_ring
ifeq ($(OS),Linux)
DPDK_LIB_LIST += rte_power
DPDK_LIB_LIST += rte_power rte_ethdev rte_net
endif
# DPDK 20.05 eal dependency
@ -101,7 +101,7 @@ endif
LINK_HASH=n
ifeq ($(CONFIG_VHOST),y)
DPDK_LIB_LIST += rte_vhost rte_net
DPDK_LIB_LIST += rte_vhost
LINK_HASH=y
ifneq ($(DPDK_FRAMEWORK),y)
DPDK_LIB_LIST += rte_cryptodev

View File

@ -832,10 +832,8 @@ vtophys_iommu_map_dma(uint64_t vaddr, uint64_t iova, uint64_t size)
ret = ioctl(g_vfio.fd, VFIO_IOMMU_MAP_DMA, &dma_map->map);
if (ret) {
DEBUG_PRINT("Cannot set up DMA mapping, error %d\n", errno);
pthread_mutex_unlock(&g_vfio.mutex);
free(dma_map);
return ret;
/* There are cases the vfio container doesn't have IOMMU group, it's safe for this case */
SPDK_NOTICELOG("Cannot set up DMA mapping, error %d, ignored\n", errno);
}
out_insert:
@ -892,9 +890,7 @@ vtophys_iommu_unmap_dma(uint64_t iova, uint64_t size)
unmap.size = dma_map->map.size;
ret = ioctl(g_vfio.fd, VFIO_IOMMU_UNMAP_DMA, &unmap);
if (ret) {
DEBUG_PRINT("Cannot clear DMA mapping, error %d\n", errno);
pthread_mutex_unlock(&g_vfio.mutex);
return ret;
SPDK_NOTICELOG("Cannot clear DMA mapping, error %d, ignored\n", errno);
}
out_remove:
@ -1238,7 +1234,11 @@ vtophys_iommu_device_event(const char *device_name,
RTE_DEV_FOREACH(dev, "bus=pci", &dev_iter) {
if (strcmp(dev->name, device_name) == 0) {
struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev);
#if RTE_VERSION < RTE_VERSION_NUM(20, 11, 0, 0)
if (pci_dev->kdrv == RTE_KDRV_VFIO) {
#else
if (pci_dev->kdrv == RTE_PCI_KDRV_VFIO) {
#endif
/* This is a new PCI device using vfio */
g_vfio.device_ref++;
}
@ -1267,7 +1267,11 @@ vtophys_iommu_device_event(const char *device_name,
RTE_DEV_FOREACH(dev, "bus=pci", &dev_iter) {
if (strcmp(dev->name, device_name) == 0) {
struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev);
#if RTE_VERSION < RTE_VERSION_NUM(20, 11, 0, 0)
if (pci_dev->kdrv == RTE_KDRV_VFIO) {
#else
if (pci_dev->kdrv == RTE_PCI_KDRV_VFIO) {
#endif
/* This is a PCI device using vfio */
g_vfio.device_ref--;
}
@ -1362,7 +1366,11 @@ vtophys_iommu_init(void)
RTE_DEV_FOREACH(dev, "bus=pci", &dev_iter) {
struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev);
#if RTE_VERSION < RTE_VERSION_NUM(20, 11, 0, 0)
if (pci_dev->kdrv == RTE_KDRV_VFIO) {
#else
if (pci_dev->kdrv == RTE_PCI_KDRV_VFIO) {
#endif
/* This is a PCI device using vfio */
g_vfio.device_ref++;
}
@ -1456,6 +1464,7 @@ vtophys_init(void)
g_vtophys_map = spdk_mem_map_alloc(SPDK_VTOPHYS_ERROR, &vtophys_map_ops, NULL);
if (g_vtophys_map == NULL) {
DEBUG_PRINT("vtophys map allocation failed\n");
spdk_mem_map_free(&g_phys_ref_map);
return -ENOMEM;
}
return 0;

View File

@ -37,6 +37,7 @@
#include <rte_devargs.h>
#include "spdk/env.h"
#include "spdk/log.h"
#include "spdk/string.h"
#define SYSFS_PCI_DRIVERS "/sys/bus/pci/drivers"
@ -63,6 +64,28 @@ static TAILQ_HEAD(, spdk_pci_device) g_pci_hotplugged_devices =
TAILQ_HEAD_INITIALIZER(g_pci_hotplugged_devices);
static TAILQ_HEAD(, spdk_pci_driver) g_pci_drivers = TAILQ_HEAD_INITIALIZER(g_pci_drivers);
struct env_devargs {
struct rte_bus *bus;
char name[128];
uint64_t allowed_at;
TAILQ_ENTRY(env_devargs) link;
};
static TAILQ_HEAD(, env_devargs) g_env_devargs = TAILQ_HEAD_INITIALIZER(g_env_devargs);
static struct env_devargs *
find_env_devargs(struct rte_bus *bus, const char *name)
{
struct env_devargs *da;
TAILQ_FOREACH(da, &g_env_devargs, link) {
if (bus == da->bus && !strcmp(name, da->name)) {
return da;
}
}
return NULL;
}
static int
map_bar_rte(struct spdk_pci_device *device, uint32_t bar,
void **mapped_addr, uint64_t *phys_addr, uint64_t *size)
@ -246,8 +269,17 @@ pci_device_rte_dev_event(const char *device_name,
if (dev != NULL && can_detach) {
/* if device is not attached we can remove it right away.
* Otherwise it will be removed at detach. */
remove_rte_dev(dev->dev_handle);
* Otherwise it will be removed at detach.
*
* Because the user's callback is invoked in eal interrupt
* callback, the interrupt callback need to be finished before
* it can be unregistered when detaching device. So finish
* callback soon and use a deferred removal to detach device
* is need. It is a workaround, once the device detaching be
* moved into the eal in the future, the deferred removal could
* be deleted.
*/
rte_eal_alarm_set(1, detach_rte_cb, dev->dev_handle);
}
break;
}
@ -448,6 +480,39 @@ pci_device_init(struct rte_pci_driver *_drv,
return 0;
}
static void
set_allowed_at(struct rte_devargs *rte_da, uint64_t tsc)
{
struct env_devargs *env_da;
env_da = find_env_devargs(rte_da->bus, rte_da->name);
if (env_da == NULL) {
env_da = calloc(1, sizeof(*env_da));
if (env_da == NULL) {
SPDK_ERRLOG("could not set_allowed_at for device %s\n", rte_da->name);
return;
}
env_da->bus = rte_da->bus;
spdk_strcpy_pad(env_da->name, rte_da->name, sizeof(env_da->name), 0);
TAILQ_INSERT_TAIL(&g_env_devargs, env_da, link);
}
env_da->allowed_at = tsc;
}
static uint64_t
get_allowed_at(struct rte_devargs *rte_da)
{
struct env_devargs *env_da;
env_da = find_env_devargs(rte_da->bus, rte_da->name);
if (env_da) {
return env_da->allowed_at;
} else {
return 0;
}
}
int
pci_device_fini(struct rte_pci_device *_dev)
{
@ -468,7 +533,7 @@ pci_device_fini(struct rte_pci_device *_dev)
/* remove our allowed_at option */
if (_dev->device.devargs) {
_dev->device.devargs->data = NULL;
set_allowed_at(_dev->device.devargs, 0);
}
assert(!dev->internal.removed);
@ -541,8 +606,8 @@ scan_pci_bus(bool delay_init)
rte_dev->device.devargs = da;
}
if (da->data) {
uint64_t allowed_at = (uint64_t)(uintptr_t)da->data;
if (get_allowed_at(da)) {
uint64_t allowed_at = get_allowed_at(da);
/* this device was seen by spdk before... */
if (da->policy == RTE_DEV_BLOCKED && allowed_at <= now) {
@ -554,10 +619,10 @@ scan_pci_bus(bool delay_init)
if (delay_init) {
da->policy = RTE_DEV_BLOCKED;
da->data = (void *)(now + 2 * spdk_get_ticks_hz());
set_allowed_at(da, now + 2 * spdk_get_ticks_hz());
} else {
da->policy = RTE_DEV_ALLOWED;
da->data = (void *)(uintptr_t)now;
set_allowed_at(da, now);
}
}
}
@ -638,8 +703,8 @@ spdk_pci_device_attach(struct spdk_pci_driver *driver,
rte_dev = dev->dev_handle;
da = rte_dev->device.devargs;
if (da && da->data) {
da->data = (void *)(uintptr_t)spdk_get_ticks();
if (da && get_allowed_at(da)) {
set_allowed_at(da, spdk_get_ticks());
da->policy = RTE_DEV_ALLOWED;
}
@ -979,9 +1044,7 @@ spdk_pci_device_unclaim(struct spdk_pci_device *dev)
dev->internal.claim_fd = -1;
unlink(dev_name);
}
#endif /* __linux__ */
#ifdef __FreeBSD__
#else /* !__linux__ */
int
spdk_pci_device_claim(struct spdk_pci_device *dev)
{
@ -994,7 +1057,7 @@ spdk_pci_device_unclaim(struct spdk_pci_device *dev)
{
/* TODO */
}
#endif /* __FreeBSD__ */
#endif /* __linux__ */
int
spdk_pci_addr_parse(struct spdk_pci_addr *addr, const char *bdf)
@ -1072,3 +1135,37 @@ spdk_pci_device_get_type(const struct spdk_pci_device *dev)
{
return dev->type;
}
int
spdk_pci_device_allow(struct spdk_pci_addr *pci_addr)
{
struct rte_devargs *da;
char devargs_str[128];
da = calloc(1, sizeof(*da));
if (da == NULL) {
SPDK_ERRLOG("could not allocate rte_devargs\n");
return -ENOMEM;
}
snprintf(devargs_str, sizeof(devargs_str), "pci:%04x:%02x:%02x.%x",
pci_addr->domain, pci_addr->bus, pci_addr->dev, pci_addr->func);
if (rte_devargs_parse(da, devargs_str) != 0) {
SPDK_ERRLOG("rte_devargs_parse() failed on '%s'\n", devargs_str);
free(da);
return -EINVAL;
}
da->policy = RTE_DEV_ALLOWED;
/* Note: if a devargs already exists for this device address, it just gets
* overridden. So we do not need to check if the devargs already exists.
* DPDK will take care of memory management for the devargs structure after
* it has been inserted, so there's nothing SPDK needs to track.
*/
if (rte_devargs_insert(&da) != 0) {
SPDK_ERRLOG("rte_devargs_insert() failed on '%s'\n", devargs_str);
free(da);
return -EINVAL;
}
return 0;
}

View File

@ -35,8 +35,7 @@
#include "spdk/string.h"
#include "spdk/log.h"
#include "nvme_uevent.h"
#include "spdk/env.h"
#ifdef __linux__
@ -46,72 +45,94 @@
#define SPDK_UEVENT_RECVBUF_SIZE 1024 * 1024
int
nvme_uevent_connect(void)
spdk_pci_event_listen(void)
{
struct sockaddr_nl addr;
int netlink_fd;
int size = SPDK_UEVENT_RECVBUF_SIZE;
int flag;
int flag, rc;
memset(&addr, 0, sizeof(addr));
addr.nl_family = AF_NETLINK;
addr.nl_pid = getpid();
addr.nl_pid = 0;
addr.nl_groups = 0xffffffff;
netlink_fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
if (netlink_fd < 0) {
return -1;
SPDK_ERRLOG("Failed to create netlink socket\n");
return netlink_fd;
}
setsockopt(netlink_fd, SOL_SOCKET, SO_RCVBUFFORCE, &size, sizeof(size));
if (setsockopt(netlink_fd, SOL_SOCKET, SO_RCVBUFFORCE, &size, sizeof(size)) < 0) {
rc = errno;
SPDK_ERRLOG("Failed to set socket option\n");
close(netlink_fd);
return -rc;
}
flag = fcntl(netlink_fd, F_GETFL);
if (fcntl(netlink_fd, F_SETFL, flag | O_NONBLOCK) < 0) {
SPDK_ERRLOG("fcntl can't set nonblocking mode for socket, fd: %d (%s)\n", netlink_fd,
spdk_strerror(errno));
if (flag < 0) {
rc = errno;
SPDK_ERRLOG("Failed to get socket flag, fd: %d\n", netlink_fd);
close(netlink_fd);
return -1;
return -rc;
}
if (fcntl(netlink_fd, F_SETFL, flag | O_NONBLOCK) < 0) {
rc = errno;
SPDK_ERRLOG("Fcntl can't set nonblocking mode for socket, fd: %d\n", netlink_fd);
close(netlink_fd);
return -rc;
}
if (bind(netlink_fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
rc = errno;
SPDK_ERRLOG("Failed to bind the netlink\n");
close(netlink_fd);
return -1;
return -rc;
}
return netlink_fd;
}
/* Note: We only parse the event from uio subsystem and will ignore
/* Note: We parse the event from uio and vfio subsystem and will ignore
* all the event from other subsystem. the event from uio subsystem
* as below:
* action: "add" or "remove"
* subsystem: "uio"
* dev_path: "/devices/pci0000:80/0000:80:01.0/0000:81:00.0/uio/uio0"
* VFIO subsystem add event:
* ACTION=bind
* DRIVER=vfio-pci
* PCI_SLOT_NAME=0000:d8:00.0
*/
static int
parse_event(const char *buf, struct spdk_uevent *event)
parse_subsystem_event(const char *buf, struct spdk_pci_event *event)
{
char action[SPDK_UEVENT_MSG_LEN];
char subsystem[SPDK_UEVENT_MSG_LEN];
char action[SPDK_UEVENT_MSG_LEN];
char dev_path[SPDK_UEVENT_MSG_LEN];
char driver[SPDK_UEVENT_MSG_LEN];
char vfio_pci_addr[SPDK_UEVENT_MSG_LEN];
char *pci_address, *tmp;
int rc;
memset(action, 0, SPDK_UEVENT_MSG_LEN);
memset(subsystem, 0, SPDK_UEVENT_MSG_LEN);
memset(action, 0, SPDK_UEVENT_MSG_LEN);
memset(dev_path, 0, SPDK_UEVENT_MSG_LEN);
memset(driver, 0, SPDK_UEVENT_MSG_LEN);
memset(vfio_pci_addr, 0, SPDK_UEVENT_MSG_LEN);
while (*buf) {
if (!strncmp(buf, "ACTION=", 7)) {
if (!strncmp(buf, "SUBSYSTEM=", 10)) {
buf += 10;
snprintf(subsystem, sizeof(subsystem), "%s", buf);
} else if (!strncmp(buf, "ACTION=", 7)) {
buf += 7;
snprintf(action, sizeof(action), "%s", buf);
} else if (!strncmp(buf, "DEVPATH=", 8)) {
buf += 8;
snprintf(dev_path, sizeof(dev_path), "%s", buf);
} else if (!strncmp(buf, "SUBSYSTEM=", 10)) {
buf += 10;
snprintf(subsystem, sizeof(subsystem), "%s", buf);
} else if (!strncmp(buf, "DRIVER=", 7)) {
buf += 7;
snprintf(driver, sizeof(driver), "%s", buf);
@ -119,102 +140,111 @@ parse_event(const char *buf, struct spdk_uevent *event)
buf += 14;
snprintf(vfio_pci_addr, sizeof(vfio_pci_addr), "%s", buf);
}
while (*buf++)
;
}
if (!strncmp(subsystem, "uio", 3)) {
char *pci_address, *tmp;
struct spdk_pci_addr pci_addr;
event->subsystem = SPDK_NVME_UEVENT_SUBSYSTEM_UIO;
if (!strncmp(action, "add", 3)) {
event->action = SPDK_NVME_UEVENT_ADD;
}
if (!strncmp(action, "remove", 6)) {
event->action = SPDK_NVME_UEVENT_REMOVE;
event->action = SPDK_UEVENT_REMOVE;
} else if (!strncmp(action, "add", 3)) {
/* Support the ADD UEVENT for the device allow */
event->action = SPDK_UEVENT_ADD;
} else {
return 0;
}
tmp = strstr(dev_path, "/uio/");
if (!tmp) {
SPDK_ERRLOG("Invalid format of uevent: %s\n", dev_path);
return -1;
return -EBADMSG;
}
memset(tmp, 0, SPDK_UEVENT_MSG_LEN - (tmp - dev_path));
pci_address = strrchr(dev_path, '/');
if (!pci_address) {
SPDK_ERRLOG("Not found NVMe BDF in uevent: %s\n", dev_path);
return -1;
SPDK_ERRLOG("Not found PCI device BDF in uevent: %s\n", dev_path);
return -EBADMSG;
}
pci_address++;
if (spdk_pci_addr_parse(&pci_addr, pci_address) != 0) {
SPDK_ERRLOG("Invalid format for NVMe BDF: %s\n", pci_address);
return -1;
}
spdk_pci_addr_fmt(event->traddr, sizeof(event->traddr), &pci_addr);
} else if (!strncmp(driver, "vfio-pci", 8)) {
struct spdk_pci_addr pci_addr;
event->subsystem = SPDK_NVME_UEVENT_SUBSYSTEM_VFIO;
if (!strncmp(action, "bind", 4)) {
event->action = SPDK_NVME_UEVENT_ADD;
rc = spdk_pci_addr_parse(&event->traddr, pci_address);
if (rc != 0) {
SPDK_ERRLOG("Invalid format for PCI device BDF: %s\n", pci_address);
return rc;
}
if (!strncmp(action, "remove", 6)) {
event->action = SPDK_NVME_UEVENT_REMOVE;
}
if (spdk_pci_addr_parse(&pci_addr, vfio_pci_addr) != 0) {
SPDK_ERRLOG("Invalid format for NVMe BDF: %s\n", vfio_pci_addr);
return -1;
}
spdk_pci_addr_fmt(event->traddr, sizeof(event->traddr), &pci_addr);
} else {
event->subsystem = SPDK_NVME_UEVENT_SUBSYSTEM_UNRECOGNIZED;
return 1;
}
return 1;
if (!strncmp(driver, "vfio-pci", 8)) {
if (!strncmp(action, "bind", 4)) {
/* Support the ADD UEVENT for the device allow */
event->action = SPDK_UEVENT_ADD;
} else {
/* Only need to support add event.
* VFIO hotplug interface is "pci.c:pci_device_rte_dev_event".
* VFIO informs the userspace hotplug through vfio req notifier interrupt.
* The app needs to free the device userspace driver resource first then
* the OS remove the device VFIO driver and boardcast the VFIO uevent.
*/
return 0;
}
rc = spdk_pci_addr_parse(&event->traddr, vfio_pci_addr);
if (rc != 0) {
SPDK_ERRLOG("Invalid format for PCI device BDF: %s\n", vfio_pci_addr);
return rc;
}
return 1;
}
return 0;
}
int
nvme_get_uevent(int fd, struct spdk_uevent *uevent)
spdk_pci_get_event(int fd, struct spdk_pci_event *event)
{
int ret;
char buf[SPDK_UEVENT_MSG_LEN];
memset(uevent, 0, sizeof(struct spdk_uevent));
memset(buf, 0, SPDK_UEVENT_MSG_LEN);
memset(event, 0, sizeof(*event));
ret = recv(fd, buf, SPDK_UEVENT_MSG_LEN - 1, MSG_DONTWAIT);
if (ret > 0) {
return parse_event(buf, uevent);
}
if (ret < 0) {
return parse_subsystem_event(buf, event);
} else if (ret < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
return 0;
} else {
SPDK_ERRLOG("Socket read error(%d): %s\n", errno, spdk_strerror(errno));
return -1;
ret = errno;
SPDK_ERRLOG("Socket read error %d\n", errno);
return -ret;
}
} else {
/* connection closed */
return -ENOTCONN;
}
/* connection closed */
if (ret == 0) {
return -1;
}
return 0;
}
#else /* Not Linux */
int
nvme_uevent_connect(void)
spdk_pci_event_listen(void)
{
return -1;
SPDK_ERRLOG("Non-Linux does not support this operation\n");
return -ENOTSUP;
}
int
nvme_get_uevent(int fd, struct spdk_uevent *uevent)
spdk_pci_get_event(int fd, struct spdk_pci_event *event)
{
return -1;
SPDK_ERRLOG("Non-Linux does not support this operation\n");
return -ENOTSUP;
}
#endif

View File

@ -0,0 +1,137 @@
/*-
* BSD LICENSE
*
* Copyright (c) Intel Corporation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "spdk/stdinc.h"
#include "spdk/env.h"
#include "spdk/log.h"
struct sigbus_handler {
spdk_pci_error_handler func;
void *ctx;
TAILQ_ENTRY(sigbus_handler) tailq;
};
static pthread_mutex_t g_sighandler_mutex = PTHREAD_MUTEX_INITIALIZER;
static TAILQ_HEAD(, sigbus_handler) g_sigbus_handler =
TAILQ_HEAD_INITIALIZER(g_sigbus_handler);
static void
sigbus_fault_sighandler(int signum, siginfo_t *info, void *ctx)
{
struct sigbus_handler *sigbus_handler;
pthread_mutex_lock(&g_sighandler_mutex);
TAILQ_FOREACH(sigbus_handler, &g_sigbus_handler, tailq) {
sigbus_handler->func(info, sigbus_handler->ctx);
}
pthread_mutex_unlock(&g_sighandler_mutex);
}
__attribute__((constructor)) static void
device_set_signal(void)
{
struct sigaction sa;
sa.sa_sigaction = sigbus_fault_sighandler;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_SIGINFO;
sigaction(SIGBUS, &sa, NULL);
}
__attribute__((destructor)) static void
device_destroy_signal(void)
{
struct sigbus_handler *sigbus_handler, *tmp;
TAILQ_FOREACH_SAFE(sigbus_handler, &g_sigbus_handler, tailq, tmp) {
free(sigbus_handler);
}
}
int
spdk_pci_register_error_handler(spdk_pci_error_handler sighandler, void *ctx)
{
struct sigbus_handler *sigbus_handler;
if (!sighandler) {
SPDK_ERRLOG("Error handler is NULL\n");
return -EINVAL;
}
pthread_mutex_lock(&g_sighandler_mutex);
TAILQ_FOREACH(sigbus_handler, &g_sigbus_handler, tailq) {
if (sigbus_handler->func == sighandler) {
pthread_mutex_unlock(&g_sighandler_mutex);
SPDK_ERRLOG("Error handler has been registered\n");
return -EINVAL;
}
}
pthread_mutex_unlock(&g_sighandler_mutex);
sigbus_handler = calloc(1, sizeof(*sigbus_handler));
if (!sigbus_handler) {
SPDK_ERRLOG("Failed to allocate sigbus handler\n");
return -ENOMEM;
}
sigbus_handler->func = sighandler;
sigbus_handler->ctx = ctx;
pthread_mutex_lock(&g_sighandler_mutex);
TAILQ_INSERT_TAIL(&g_sigbus_handler, sigbus_handler, tailq);
pthread_mutex_unlock(&g_sighandler_mutex);
return 0;
}
void
spdk_pci_unregister_error_handler(spdk_pci_error_handler sighandler)
{
struct sigbus_handler *sigbus_handler;
if (!sighandler) {
return;
}
pthread_mutex_lock(&g_sighandler_mutex);
TAILQ_FOREACH(sigbus_handler, &g_sigbus_handler, tailq) {
if (sigbus_handler->func == sighandler) {
TAILQ_REMOVE(&g_sigbus_handler, sigbus_handler, tailq);
free(sigbus_handler);
pthread_mutex_unlock(&g_sighandler_mutex);
return;
}
}
pthread_mutex_unlock(&g_sighandler_mutex);
}

Some files were not shown because too many files have changed in this diff Show More