From nobody Sat Feb 7 06:55:16 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1507876673508243.17565183806835; Thu, 12 Oct 2017 23:37:53 -0700 (PDT) Received: from localhost ([::1]:48621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2tbO-0000gN-2q for importer@patchew.org; Fri, 13 Oct 2017 02:37:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2tZf-00080i-2b for qemu-devel@nongnu.org; Fri, 13 Oct 2017 02:36:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e2tZc-0004vi-W1 for qemu-devel@nongnu.org; Fri, 13 Oct 2017 02:35:59 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:34094 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e2tZc-0004qA-KZ for qemu-devel@nongnu.org; Fri, 13 Oct 2017 02:35:56 -0400 Received: from localhost (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 13 Oct 2017 14:35:45 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id E5C5D47F13B1; Fri, 13 Oct 2017 14:35:45 +0800 (CST) Received: from localhost.localdomain (10.167.226.123) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 13 Oct 2017 14:35:45 +0800 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="29028900" From: Mao Zhongyi To: Date: Fri, 13 Oct 2017 14:32:07 +0800 Message-ID: <20171013063209.15617-3-maozy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171013063209.15617-1-maozy.fnst@cn.fujitsu.com> References: <20171013063209.15617-1-maozy.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.123] X-yoursite-MailScanner-ID: E5C5D47F13B1.A27CA X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: maozy.fnst@cn.fujitsu.com X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 183.91.158.132 Subject: [Qemu-devel] [PATCH 2/4] colo-compare: compare the packet in a specified Connection X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang , Li Zhijian , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A package from pri_indev or sec_indev only belongs to a particular Connection, so we only need to compare the package in the specified Connection's primary_list and secondary_list, rather than for each the whole Connection list to compare. This is time-consuming and unnecessary. Less checkpoint more efficiency. Cc: Zhang Chen Cc: Li Zhijian Cc: Jason Wang Signed-off-by: Mao Zhongyi --- net/colo-compare.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 54b6347..5d2429b 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -136,7 +136,7 @@ static int colo_insert_packet(GQueue *queue, Packet *pk= t) * Return 0 on success, if return -1 means the pkt * is unsupported(arp and ipv6) and will be sent later */ -static int packet_enqueue(CompareState *s, int mode) +static int packet_enqueue(CompareState *s, int mode, Connection **con) { ConnectionKey key; Packet *pkt =3D NULL; @@ -179,6 +179,7 @@ static int packet_enqueue(CompareState *s, int mode) "drop packet"); } } + con =3D &conn; =20 return 0; } @@ -728,8 +729,9 @@ static void compare_set_vnet_hdr(Object *obj, static void compare_pri_rs_finalize(SocketReadState *pri_rs) { CompareState *s =3D container_of(pri_rs, CompareState, pri_rs); + Connection *conn =3D NULL; =20 - if (packet_enqueue(s, PRIMARY_IN)) { + if (packet_enqueue(s, PRIMARY_IN, &conn)) { trace_colo_compare_main("primary: unsupported packet in"); compare_chr_send(s, pri_rs->buf, @@ -737,19 +739,20 @@ static void compare_pri_rs_finalize(SocketReadState *= pri_rs) pri_rs->vnet_hdr_len); } else { /* compare connection */ - g_queue_foreach(&s->conn_list, colo_compare_connection, s); + colo_compare_connection(conn, s); } } =20 static void compare_sec_rs_finalize(SocketReadState *sec_rs) { CompareState *s =3D container_of(sec_rs, CompareState, sec_rs); + Connection *conn =3D NULL; =20 - if (packet_enqueue(s, SECONDARY_IN)) { + if (packet_enqueue(s, SECONDARY_IN, &conn)) { trace_colo_compare_main("secondary: unsupported packet in"); } else { /* compare connection */ - g_queue_foreach(&s->conn_list, colo_compare_connection, s); + colo_compare_connection(conn, s); } } =20 --=20 2.9.4