From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gI+ygwoA; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 8C7285A0262 for ; Fri, 06 Sep 2024 18:05:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725638704; 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=eEkbyMdXeulmWen80xW1C2CD5yWcqVMWq5IlqG9AzEE=; b=gI+ygwoA9w+KVeNqWYu6prrtUldALWKEP51cdl/gqt1hiagD5mY2FrHWIbX+aJlhhLTEK9 l5nG7nvHzJe0/Bo4c0RpRTrAy05Pb+6LTAUCUYq4E9b4Rh+SgvrmRYi5TCU6eLoCumSm/R Edb2g1lSYgPaZCvkvlY/GHdXTOZggQg= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-77-zgrFHnefO8-7R6KglMGO0w-1; Fri, 06 Sep 2024 12:05:03 -0400 X-MC-Unique: zgrFHnefO8-7R6KglMGO0w-1 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2A9F11955F40 for ; Fri, 6 Sep 2024 16:05:02 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.193.22]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 9B4C3195608A; Fri, 6 Sep 2024 16:05:00 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v4 2/4] vhost-user: introduce virtio API Date: Fri, 6 Sep 2024 18:04:47 +0200 Message-ID: <20240906160455.2088854-3-lvivier@redhat.com> In-Reply-To: <20240906160455.2088854-1-lvivier@redhat.com> References: <20240906160455.2088854-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Message-ID-Hash: 726B276KSKMXIMFIKC5CDYJZSF4I2GNK X-Message-ID-Hash: 726B276KSKMXIMFIKC5CDYJZSF4I2GNK X-MailFrom: lvivier@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: QWRkIHZpcnRpby5jIGFuZCB2aXJ0aW8uaCB0aGF0IGRlZmluZSB0aGUgZnVuY3Rpb25zIG5lZWRl ZA0KdG8gbWFuYWdlIHZpcnRxdWV1ZXMuDQoNClNpZ25lZC1vZmYtYnk6IExhdXJlbnQgVml2aWVy IDxsdml2aWVyQHJlZGhhdC5jb20+DQotLS0NCiBNYWtlZmlsZSB8ICAgNCArLQ0KIHV0aWwuaCAg IHwgICA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