From patchwork Mon Oct 10 17:29:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 613770 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2128782pvb; Mon, 10 Oct 2022 10:56:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7z/DqCTCB/Im0AuOjkvM44grGJ3YPRXr9zZSgEbiaG0zNOccm8d8Jch7qIZhfWtPK+sUWX X-Received: by 2002:a05:620a:370d:b0:6ec:53fa:1d8f with SMTP id de13-20020a05620a370d00b006ec53fa1d8fmr6399059qkb.481.1665424572931; Mon, 10 Oct 2022 10:56:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665424572; cv=none; d=google.com; s=arc-20160816; b=vpZZeJLwB0jMtTP380wax3M2DiPUurMIOHBnd7qVifn3wL1p4/qlJb1GdONmAyRgbM jItLi7T90LOd1Ccsw52j1ex2hxnPOVeRibilKh/d4JmCA3QbBVjJ0bUT5TXBWWEoEx8A dpsNKLUIP7JVK3bHnZKZJe9NTIMzUXTFSphfEGJSX7dCq46xo41edoM4D2QRnm8joijI NF7wI72fpCBhzN1GS5zZ/18v64u4zIm7wL5eqJCswJ+FvjW1K4yqyz1j/er2htOAHGQJ TQPRO5Khv3tazbwoRK+kBSYMjvkzarmGJU11/KZ4B7TfBshFHOLzFRqAfpxPDljZ796E 5hww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2BsOC0ZeJk0TSOpxBXS/s5koTGeCNaE/TuTHTvbRH+I=; b=JpUetsLFozgIVhy+0hltYNsqTf7IOTi5VLIc+xq1TCc8AaB2uwY+76r5KUa+Iw34PN FaWJ+MKaqsAHPXAvoqWLeuWkyXipxB2AXXS1M81kveVHB+9OWT6KRA0JHQ8pPo3u1Wxb 0UkdL8t98VVLbxT/5CMc+6/45wuGG11ttk68BCt2FXnqVRtG61DGBbtSfykSwycbUPG6 Aixk9MLan0k2WmQlVFZa8DmzwNC/G8BAyeRzt215n4NQ4yvHyFaMct7CUvqZ5Tj0V7sY 9ey1xs8UfX58L25A+pSpFT6PAFeYvlL6K42P8UbuE9Xg6x2CvJ+Gs9+4iK0FKhwWzMhc Wbnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RBoqLtek; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fz22-20020a05622a5a9600b0035ade0f6e22si5639962qtb.273.2022.10.10.10.56.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Oct 2022 10:56:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RBoqLtek; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:53512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ohx0d-0004H9-SB for patch@linaro.org; Mon, 10 Oct 2022 13:56:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43006) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohwbB-0001YP-D8 for qemu-devel@nongnu.org; Mon, 10 Oct 2022 13:29:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:43243) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohwb4-0006bz-I3 for qemu-devel@nongnu.org; Mon, 10 Oct 2022 13:29:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665422985; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2BsOC0ZeJk0TSOpxBXS/s5koTGeCNaE/TuTHTvbRH+I=; b=RBoqLtekE+vW2Xa6u6HL5lcLyRx2+g1pwvIFohNELkGVyjIdhV98tNW+Xb6K0Fst8lmhB2 8qSlPWgKN8vsudD3WtkxM5ISx99ium4JZVoboI8I1vWYOpg65SsGV7/LjT7r0+YJTEI7YY uSUgrdIH+DHctksvYxsxxdGc2/Jdp+M= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-529-d-5MlkNKPNGlJdMkddBxpg-1; Mon, 10 Oct 2022 13:29:44 -0400 X-MC-Unique: d-5MlkNKPNGlJdMkddBxpg-1 Received: by mail-wm1-f69.google.com with SMTP id i5-20020a1c3b05000000b003c47c8569easo4142986wma.1 for ; Mon, 10 Oct 2022 10:29:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2BsOC0ZeJk0TSOpxBXS/s5koTGeCNaE/TuTHTvbRH+I=; b=z7UYo4pF/tx2bCL9Btawbat5R5pwXeKfxlQ4c+MELMkn3031Jt4ye8LIifCOWJIifI NRDDM3oLWKtBW990Nr0ugv/wiXdJLpT+zTCo8xQO2cgiEicfV/DMlr3dF41JdLSU3H4w dobieW6KFi3EI+me5iYIHlD4ttFDOfMPa2hIjIATyAYtSTUVczcs/OwBtuv74bs8NWxf o8xjgdSUzdlC60GUOfUXIwjrY62Tx4d+0+k9dZTNd5onPRr6dh5acnwkjbheI8WkbDZM COVUF8GRDgnn918/Yywd9w4s9y19zf0E+eYVocqXKU4hKK6N49GJunZVPKH/WPgvfHpT R7kQ== X-Gm-Message-State: ACrzQf24mEcNhpTGaJDq6xZ8bRWHS/R4BcoYXrwqMofAbWe1BLjKP8R2 yIbZZqFMyO6a7bJSU4Vf7tKU0oJ+bRA9edS3TI8fogMN1y050i80k2dSQu45geRVRNJpHagTwhA r7B/LtrNElwucZTyEWMNvovXOZhb0vYzek0qBMrLcSscgZfURy/3GJdnlvtii X-Received: by 2002:a05:600c:3c84:b0:3b4:eff4:ab69 with SMTP id bg4-20020a05600c3c8400b003b4eff4ab69mr20440321wmb.104.1665422983140; Mon, 10 Oct 2022 10:29:43 -0700 (PDT) X-Received: by 2002:a05:600c:3c84:b0:3b4:eff4:ab69 with SMTP id bg4-20020a05600c3c8400b003b4eff4ab69mr20440304wmb.104.1665422982851; Mon, 10 Oct 2022 10:29:42 -0700 (PDT) Received: from redhat.com ([2.55.183.131]) by smtp.gmail.com with ESMTPSA id a13-20020adff7cd000000b0022a403954c3sm9368022wrq.42.2022.10.10.10.29.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 10:29:42 -0700 (PDT) Date: Mon, 10 Oct 2022 13:29:38 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= , Thomas Huth , Laurent Vivier , Paolo Bonzini Subject: [PULL 14/55] tests/qtest: catch unhandled vhost-user messages Message-ID: <20221010172813.204597-15-mst@redhat.com> References: <20221010172813.204597-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221010172813.204597-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée We don't need to action every message but lets document the ones we are expecting to consume so future tests don't get confused about unhandled bits. Signed-off-by: Alex Bennée Message-Id: <20220802095010.3330793-18-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/vhost-user-test.c | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index 99dc6080e5..8d2d4ba535 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -358,12 +358,44 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) } break; + case VHOST_USER_SET_OWNER: + /* + * We don't need to do anything here, the remote is just + * letting us know it is in charge. Just log it. + */ + qos_printf("set_owner: start of session\n"); + break; + case VHOST_USER_GET_PROTOCOL_FEATURES: if (s->vu_ops->get_protocol_features) { s->vu_ops->get_protocol_features(s, chr, &msg); } break; + case VHOST_USER_SET_PROTOCOL_FEATURES: + /* + * We did set VHOST_USER_F_PROTOCOL_FEATURES so its valid for + * the remote end to send this. There is no handshake reply so + * just log the details for debugging. + */ + qos_printf("set_protocol_features: 0x%"PRIx64 "\n", msg.payload.u64); + break; + + /* + * A real vhost-user backend would actually set the size and + * address of the vrings but we can simply report them. + */ + case VHOST_USER_SET_VRING_NUM: + qos_printf("set_vring_num: %d/%d\n", + msg.payload.state.index, msg.payload.state.num); + break; + case VHOST_USER_SET_VRING_ADDR: + qos_printf("set_vring_addr: 0x%"PRIx64"/0x%"PRIx64"/0x%"PRIx64"\n", + msg.payload.addr.avail_user_addr, + msg.payload.addr.desc_user_addr, + msg.payload.addr.used_user_addr); + break; + case VHOST_USER_GET_VRING_BASE: /* send back vring base to qemu */ msg.flags |= VHOST_USER_REPLY_MASK; @@ -428,7 +460,18 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); break; + case VHOST_USER_SET_VRING_ENABLE: + /* + * Another case we ignore as we don't need to respond. With a + * fully functioning vhost-user we would enable/disable the + * vring monitoring. + */ + qos_printf("set_vring(%d)=%s\n", msg.payload.state.index, + msg.payload.state.num ? "enabled" : "disabled"); + break; + default: + qos_printf("vhost-user: un-handled message: %d\n", msg.request); break; }