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=HuAVZxt9; 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 397505A0277 for ; Thu, 15 Aug 2024 17:50:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723737032; 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=rFW4J07kt5aSgolwrlnyo/dQxl1ID05P00Xxy71tLM4=; b=HuAVZxt9qucnnv+Ep4RAeFHT1XCe1m77JvzZbKjK/4m6Wct8cTFdgEFp/aLMY6Bs5YM9r9 VDcsYde6IMXIHOpSdiajGI9BV+zEKkvTu8CpBOuJqR9Vf2IFxjzAOApFRJ3+xrvTIfYA/6 +tdzjDcQmstYTeA1dhJLRYRvpV7LYXM= 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-611-Asi_dhKIM8KiP5LJ4mfufA-1; Thu, 15 Aug 2024 11:50:30 -0400 X-MC-Unique: Asi_dhKIM8KiP5LJ4mfufA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 698791955D58 for ; Thu, 15 Aug 2024 15:50:29 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.192.69]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3FB8B1955D42; Thu, 15 Aug 2024 15:50:28 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v3 2/4] vhost-user: introduce virtio API Date: Thu, 15 Aug 2024 17:50:21 +0200 Message-ID: <20240815155024.827956-3-lvivier@redhat.com> In-Reply-To: <20240815155024.827956-1-lvivier@redhat.com> References: <20240815155024.827956-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Message-ID-Hash: TGO77S2IVZEMFOV4YDPCJOYLXGTNM5EG X-Message-ID-Hash: TGO77S2IVZEMFOV4YDPCJOYLXGTNM5EG 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 IH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