From nobody Sun Feb 8 21:33:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1560099102; cv=none; d=zoho.com; s=zohoarc; b=dUKbYHNBD3+AFJESX1QXIgGLdPBlWEntvVe+TdyPawMR7UxWJaxw4Ov3q9OlOEKVNWrPgM7Nmbfdh6KENoODsvrlU9gVPra045TX5NpvimiM6VuCpG9cXFMXJFvlrhodKzIQev72m87/d56eBbKG+bJwftuqUyqhSrvmsz4s5WI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560099102; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=1bDt4xHyyB2I2djaufhx4zFHTnDlalRNxuTu21ili64=; b=Df8Hsr0A17YRdxxMLm+iwkA85yil+Q6iDSjQKgsOgHkY63xcOKNw/COqb7E7rZx31HOiRTQVkpln5/u1ldzPGpiQ08oSrR2oUk0C/j1wMtnxe70k/9kjWawNxeLS+aZGPm1w0WDCqpQDFBzrEoOnvaAz6qRlSkRWXiYdURhYX/4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560099102968282.12347770086046; Sun, 9 Jun 2019 09:51:42 -0700 (PDT) Received: from localhost ([::1]:37062 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha12b-0002RE-Up for importer@patchew.org; Sun, 09 Jun 2019 12:51:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56519) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1ha10S-0000QG-Bl for qemu-devel@nongnu.org; Sun, 09 Jun 2019 12:49:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ha10R-0007GO-7j for qemu-devel@nongnu.org; Sun, 09 Jun 2019 12:49:20 -0400 Received: from mga14.intel.com ([192.55.52.115]:62029) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ha10Q-0007BK-U0 for qemu-devel@nongnu.org; Sun, 09 Jun 2019 12:49:19 -0400 Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jun 2019 09:49:16 -0700 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga005.jf.intel.com with ESMTP; 09 Jun 2019 09:49:14 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Zhang Chen To: Li Zhijian , "Dr. David Alan Gilbert" , Juan Quintela , zhanghailiang , Jason Wang , qemu-dev , Stefano Stabellini , Paul Durrant Date: Mon, 10 Jun 2019 00:44:31 +0800 Message-Id: <20190609164433.5866-4-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.GIT In-Reply-To: <20190609164433.5866-1-chen.zhang@intel.com> References: <20190609164433.5866-1-chen.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.115 Subject: [Qemu-devel] [PATCH V2 3/5] COLO-compare: Make the compare_chr_send() can send notification message. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhang Chen , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Zhang Chen We need use this function to send notification message for remote colo-fram= e(Xen). So we add new parameter for this job. Signed-off-by: Zhang Chen --- net/colo-compare.c | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 8b7bd9f0c7..16285f4a96 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -129,7 +129,8 @@ static void colo_compare_inconsistency_notify(void) static int compare_chr_send(CompareState *s, const uint8_t *buf, uint32_t size, - uint32_t vnet_hdr_len); + uint32_t vnet_hdr_len, + bool notify_remote_frame); =20 static gint seq_sorter(Packet *a, Packet *b, gpointer data) { @@ -241,7 +242,8 @@ static void colo_release_primary_pkt(CompareState *s, P= acket *pkt) ret =3D compare_chr_send(s, pkt->data, pkt->size, - pkt->vnet_hdr_len); + pkt->vnet_hdr_len, + false); if (ret < 0) { error_report("colo send primary packet failed"); } @@ -671,7 +673,8 @@ static void colo_compare_connection(void *opaque, void = *user_data) static int compare_chr_send(CompareState *s, const uint8_t *buf, uint32_t size, - uint32_t vnet_hdr_len) + uint32_t vnet_hdr_len, + bool notify_remote_frame) { int ret =3D 0; uint32_t len =3D htonl(size); @@ -680,7 +683,14 @@ static int compare_chr_send(CompareState *s, return 0; } =20 - ret =3D qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)&len, sizeof(len= )); + if (notify_remote_frame) { + ret =3D qemu_chr_fe_write_all(&s->chr_notify_dev, + (uint8_t *)&len, + sizeof(len)); + } else { + ret =3D qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)&len, sizeof= (len)); + } + if (ret !=3D sizeof(len)) { goto err; } @@ -691,13 +701,26 @@ static int compare_chr_send(CompareState *s, * know how to parse net packet correctly. */ len =3D htonl(vnet_hdr_len); - ret =3D qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)&len, sizeof= (len)); + + if (!notify_remote_frame) { + ret =3D qemu_chr_fe_write_all(&s->chr_out, + (uint8_t *)&len, + sizeof(len)); + } + if (ret !=3D sizeof(len)) { goto err; } } =20 - ret =3D qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)buf, size); + if (notify_remote_frame) { + ret =3D qemu_chr_fe_write_all(&s->chr_notify_dev, + (uint8_t *)buf, + size); + } else { + ret =3D qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)buf, size); + } + if (ret !=3D size) { goto err; } @@ -943,7 +966,8 @@ static void compare_pri_rs_finalize(SocketReadState *pr= i_rs) compare_chr_send(s, pri_rs->buf, pri_rs->packet_len, - pri_rs->vnet_hdr_len); + pri_rs->vnet_hdr_len, + false); } else { /* compare packet in the specified connection */ colo_compare_connection(conn, s); @@ -1075,7 +1099,8 @@ static void colo_flush_packets(void *opaque, void *us= er_data) compare_chr_send(s, pkt->data, pkt->size, - pkt->vnet_hdr_len); + pkt->vnet_hdr_len, + false); packet_destroy(pkt, NULL); } while (!g_queue_is_empty(&conn->secondary_list)) { --=20 2.17.GIT