diff options
author | John Levon <john.levon@nutanix.com> | 2020-12-04 15:19:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-04 15:19:57 +0000 |
commit | d7529cf85db5f46e0f1d283bcd61e1a7690aab30 (patch) | |
tree | cb930d218a1aac5117b14d7da675c545f06b5f92 | |
parent | 1841c4db2bf27f7938eb0ae66f01ce9aa707cd31 (diff) | |
download | libvfio-user-d7529cf85db5f46e0f1d283bcd61e1a7690aab30.zip libvfio-user-d7529cf85db5f46e0f1d283bcd61e1a7690aab30.tar.gz libvfio-user-d7529cf85db5f46e0f1d283bcd61e1a7690aab30.tar.bz2 |
implement VFIO_USER_FLAG_NO_REPLY (#157)
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
-rw-r--r-- | lib/libvfio-user.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c index 8cf37f1..00406a1 100644 --- a/lib/libvfio-user.c +++ b/lib/libvfio-user.c @@ -1052,13 +1052,21 @@ process_request(vfu_ctx_t *vfu_ctx) ret = 0; } - // FIXME: SPEC: should the reply include the command? I'd say yes? - ret = vfu_send_iovec(vfu_ctx->conn_fd, hdr.msg_id, true, - 0, iovecs, nr_iovecs, NULL, 0, -ret); - if (unlikely(ret < 0)) { - vfu_log(vfu_ctx, LOG_ERR, "failed to complete command: %s", - strerror(-ret)); + if (!(hdr.flags.no_reply)) { + // FIXME: SPEC: should the reply include the command? I'd say yes? + ret = vfu_send_iovec(vfu_ctx->conn_fd, hdr.msg_id, true, + 0, iovecs, nr_iovecs, NULL, 0, -ret); + if (unlikely(ret < 0)) { + vfu_log(vfu_ctx, LOG_ERR, "failed to complete command: %s", + strerror(-ret)); + } + } else { + /* + * A failed client request is not a failure of process_request() itself. + */ + ret = 0; } + if (iovecs != NULL && iovecs != _iovecs) { if (free_iovec_data) { size_t i; |