From patchwork Thu Mar 16 09:52:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhang Chen X-Patchwork-Id: 739740 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vkP1l6JTZz9s06 for ; Thu, 16 Mar 2017 20:53:47 +1100 (AEDT) Received: from localhost ([::1]:42285 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coS6K-0000gl-Nf for incoming@patchwork.ozlabs.org; Thu, 16 Mar 2017 05:53:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coS5V-0000fD-Tr for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:52:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1coS5V-0005bo-1M for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:52:53 -0400 Received: from [59.151.112.132] (port=49856 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1coS5T-0005b4-PP for qemu-devel@nongnu.org; Thu, 16 Mar 2017 05:52:52 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="16648914" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 16 Mar 2017 17:52:48 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 0CDEA477AE90; Thu, 16 Mar 2017 17:52:48 +0800 (CST) Received: from localhost.localdomain (10.167.226.56) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 16 Mar 2017 17:52:46 +0800 From: Zhang Chen To: qemu devel , Jason Wang Date: Thu, 16 Mar 2017 17:52:07 +0800 Message-ID: <1489657928-14919-3-git-send-email-zhangchen.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1489657928-14919-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> References: <1489657928-14919-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.56] X-yoursite-MailScanner-ID: 0CDEA477AE90.A075F X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: zhangchen.fnst@cn.fujitsu.com X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Subject: [Qemu-devel] [PATCH 2/3] COLO-proxy: Add a tag to mark virtio-net packet 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: Li Zhijian , bian naimeng , "eddie . dong" , zhanghailiang , Zhang Chen Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add this tag that compare can recognize virtio-net packet. Signed-off-by: Zhang Chen --- net/colo.c | 6 ++++++ net/colo.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/net/colo.c b/net/colo.c index 060e822..d2b3683 100644 --- a/net/colo.c +++ b/net/colo.c @@ -79,6 +79,12 @@ int parse_packet_early(Packet *pkt, int offset) } pkt->transport_header = pkt->network_header + network_length; + if (offset == VIRTIO_NET_HEADER) { + pkt->is_virtio_net_pkt = true; + } else { + pkt->is_virtio_net_pkt = false; + } + return 0; } diff --git a/net/colo.h b/net/colo.h index b713f87..535793d 100644 --- a/net/colo.h +++ b/net/colo.h @@ -46,6 +46,8 @@ typedef struct Packet { int size; /* Time of packet creation, in wall clock ms */ int64_t creation_ms; + /* Mark this packet as a virtio net packet or not */ + bool is_virtio_net_pkt; } Packet; typedef struct ConnectionKey {