From patchwork Wed Oct 14 07:25:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Chen" X-Patchwork-Id: 271314 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00,FROM_WSP_TRAIL, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FF67C433E7 for ; Wed, 14 Oct 2020 07:33:06 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A107120878 for ; Wed, 14 Oct 2020 07:33:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A107120878 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kSbHU-000451-1k for qemu-devel@archiver.kernel.org; Wed, 14 Oct 2020 03:33:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSbD4-0007gi-9F for qemu-devel@nongnu.org; Wed, 14 Oct 2020 03:28:30 -0400 Received: from mga05.intel.com ([192.55.52.43]:54366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kSbD1-00041v-O1 for qemu-devel@nongnu.org; Wed, 14 Oct 2020 03:28:29 -0400 IronPort-SDR: o3hzt5hwvsxXPs6vnsFc4Tht9/agEqM7NG+g7Ib9xTugk0aojoWw4fYjpJzHBbwgE9oAZZO1br XaIgmYKsrKeg== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="250751922" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="250751922" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 00:28:25 -0700 IronPort-SDR: jz81B8NYT74HL9y6waUCUwr5gv4gdvyjIKdmel80ynnMMbh+wrq0K6vZCXg18x2FKI01uIJoCa URzbvfUEs0FQ== X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="521323034" Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 00:28:24 -0700 From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 02/10] Optimize seq_sorter function for colo-compare Date: Wed, 14 Oct 2020 15:25:48 +0800 Message-Id: <20201014072555.12515-3-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201014072555.12515-1-chen.zhang@intel.com> References: <20201014072555.12515-1-chen.zhang@intel.com> Received-SPF: pass client-ip=192.55.52.43; envelope-from=chen.zhang@intel.com; helo=mga05.intel.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/14 03:28:22 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, FROM_ADDR_WS=2.999, FROM_WSP_TRAIL=2.199, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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 , "Rao, Lei" , Zhang Chen Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: "Rao, Lei" The seq of tcp has been filled in fill_pkt_tcp_info, it can be used directly here. Signed-off-by: leirao Signed-off-by: Zhang Chen Reviewed-by: Li Zhijian Reviewed-by: Zhang Chen --- net/colo-compare.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index 3a45d64175..86980cef5e 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -196,11 +196,7 @@ static void colo_compare_inconsistency_notify(CompareState *s) static gint seq_sorter(Packet *a, Packet *b, gpointer data) { - struct tcp_hdr *atcp, *btcp; - - atcp = (struct tcp_hdr *)(a->transport_header); - btcp = (struct tcp_hdr *)(b->transport_header); - return ntohl(atcp->th_seq) - ntohl(btcp->th_seq); + return a->tcp_seq - b->tcp_seq; } static void fill_pkt_tcp_info(void *data, uint32_t *max_ack)