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=cRFF4Ozb; 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 EB9145A004E for ; Thu, 10 Oct 2024 14:29:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728563352; 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=GlHnbppIHzBdiR1wxoo3yUIYkyCLMJ1q1bCZ8JlQFkc=; b=cRFF4OzbUD7ME47gXSra32qUqeHTzeIa3bGvPQCxDj+HlAIuVohlpzdLEzpVTRMo9rWw0S jbg8WvidEKKfUWVOqSx4gCsCpcKna4C6E2j13oB67Nmj4qzcW0+zFFQYNhF1zcKNMmKo5V COGHCXB1ndDhFCxQFsFCclhLJX/WWR4= 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-693-hSc4ng26PLeJwPxIQBZ-cw-1; Thu, 10 Oct 2024 08:29:11 -0400 X-MC-Unique: hSc4ng26PLeJwPxIQBZ-cw-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 93D301955D60 for ; Thu, 10 Oct 2024 12:29:10 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.193.163]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 701E419560AE; Thu, 10 Oct 2024 12:29:09 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v8 2/8] vhost-user: introduce virtio API Date: Thu, 10 Oct 2024 14:28:56 +0200 Message-ID: <20241010122903.1188992-3-lvivier@redhat.com> In-Reply-To: <20241010122903.1188992-1-lvivier@redhat.com> References: <20241010122903.1188992-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Message-ID-Hash: DDRXNHLDENNYPORELE74SYFFITTUNCD6 X-Message-ID-Hash: DDRXNHLDENNYPORELE74SYFFITTUNCD6 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 IHwgICA4ICs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