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=bGmC8PB3; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id 8362D5A0621 for ; Wed, 13 Nov 2024 09:04:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731485059; 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=H/y8+OQsrSECVMchgZypwhvU96og0j8pn4MTsntPZ9Q=; b=bGmC8PB3JIUxKaeTYC8taimQmb658iAsqAEwCP/naVdEeLH3/bzOmMtB1cln+c54wO7/wA 6+6okvz2+DGVJ6Ey5o2BnA7hDPmn9vJ+r/DRu3qUTGEPGkg7/LxtSgmrO1Cl7940fuy+mE WU5DnUj+4sK+8uKesugn1NehOUWrrNo= Received: from mx-prod-mc-05.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-564-ULli1sioPvKQdbbvMVNi8g-1; Wed, 13 Nov 2024 03:04:18 -0500 X-MC-Unique: ULli1sioPvKQdbbvMVNi8g-1 X-Mimecast-MFC-AGG-ID: ULli1sioPvKQdbbvMVNi8g 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F04871955F44 for ; Wed, 13 Nov 2024 08:04:16 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.192.187]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DAF5A19560A3; Wed, 13 Nov 2024 08:04:15 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v11 02/10] vhost-user: introduce virtio API Date: Wed, 13 Nov 2024 09:04:01 +0100 Message-ID: <20241113080411.476646-3-lvivier@redhat.com> In-Reply-To: <20241113080411.476646-1-lvivier@redhat.com> References: <20241113080411.476646-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: XI2nEKeEEcjhIFfd8jQtuHG9mnH4R9Cpkh3noVZOjps_1731485057 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Message-ID-Hash: A5JHHC7N4SWTPYEQMDOCCHAP3QU6HA67 X-Message-ID-Hash: A5JHHC7N4SWTPYEQMDOCCHAP3QU6HA67 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 ZA0KdG8gbWFuYWdlIHZpcnRxdWV1ZXMuDQoNClNpZ25lZC1vZmYtY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