Commit Graph

8169 Commits

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