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=G1S7l8Az; 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 37A785A061C for ; Fri, 08 Nov 2024 11:37:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731062262; 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=U3XfNEIBpzTU2hzxKfLcyIKsNRfgEPOGyz60WY7blsU=; b=G1S7l8AzRZ2D9Jd6xW3ARRQoCTnE8gRHCFTBk+x61o3vsGNgSR7xcSjjXCzMG4KmOH/Nft 8xjrvJ8uWYapIJu27wALdqzpoq/D+o4WRnMBu9PuttSlQS8fkeKncAM1AuwjomSrKrlkwf gc4SPLevtLE5xX+qPnkeidAWTuwfA6w= 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-569-UemPPxuuOc--_fKS5EKFig-1; Fri, 08 Nov 2024 05:37:40 -0500 X-MC-Unique: UemPPxuuOc--_fKS5EKFig-1 X-Mimecast-MFC-AGG-ID: UemPPxuuOc--_fKS5EKFig 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 B832F19560B0 for ; Fri, 8 Nov 2024 10:37:39 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.194.73]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 93DA41953887; Fri, 8 Nov 2024 10:37:38 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v10 02/12] vhost-user: introduce virtio API Date: Fri, 8 Nov 2024 11:37:21 +0100 Message-ID: <20241108103733.3554357-3-lvivier@redhat.com> In-Reply-To: <20241108103733.3554357-1-lvivier@redhat.com> References: <20241108103733.3554357-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-MFC-PROC-ID: na7muySJ9UbAANGj9D-UKP7c6jWZo3nc_JDFJ5YrZAo_1731062259 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Message-ID-Hash: 6RT4Q5VPZNY3KQX67F55PWNDOBQ6KKDB X-Message-ID-Hash: 6RT4Q5VPZNY3KQX67F55PWNDOBQ6KKDB 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 ZA0KdG8gbWFuYWdlIHZpcnRxdWV1ZXMuDQoNClNpZ25lZC1vZm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