From d7529cf85db5f46e0f1d283bcd61e1a7690aab30 Mon Sep 17 00:00:00 2001 From: John Levon Date: Fri, 4 Dec 2020 15:19:57 +0000 Subject: implement VFIO_USER_FLAG_NO_REPLY (#157) Signed-off-by: John Levon Reviewed-by: Thanos Makatos --- lib/libvfio-user.c | 20 ++++++++++++++------ 1 file 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; -- cgit v1.1