Commit Graph

1622 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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