From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
To: qemu devel <qemu-devel@nongnu.org>, Jason Wang <jasowang@redhat.com>
Cc: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>,
zhanghailiang <zhang.zhanghailiang@huawei.com>,
"eddie . dong" <eddie.dong@intel.com>,
bian naimeng <biannm@cn.fujitsu.com>,
Li Zhijian <lizhijian@cn.fujitsu.com>
Subject: [Qemu-devel] [PATCH 3/3] COLO-compare: Add virtio-net packet compare support
Date: Thu, 16 Mar 2017 17:52:08 +0800 [thread overview]
Message-ID: <1489657928-14919-4-git-send-email-zhangchen.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1489657928-14919-1-git-send-email-zhangchen.fnst@cn.fujitsu.com>
If packet is virtio-net packet we will skip the virtio-net header
compare packet's payload.
Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
net/colo-compare.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/net/colo-compare.c b/net/colo-compare.c
index ce0cd12..34af11a 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -237,7 +237,12 @@ static int colo_packet_compare_tcp(Packet *spkt, Packet *ppkt)
}
if (ptcp->th_sum == stcp->th_sum) {
- res = colo_packet_compare_common(ppkt, spkt, ETH_HLEN);
+ if (ppkt->is_virtio_net_pkt) {
+ res = colo_packet_compare_common(ppkt, spkt, ETH_HLEN
+ + VIRTIO_NET_HEADER);
+ } else {
+ res = colo_packet_compare_common(ppkt, spkt, ETH_HLEN);
+ }
} else {
res = -1;
}
@@ -285,8 +290,14 @@ static int colo_packet_compare_udp(Packet *spkt, Packet *ppkt)
* other field like TOS,TTL,IP Checksum. we only need to compare
* the ip payload here.
*/
- ret = colo_packet_compare_common(ppkt, spkt,
- network_header_length + ETH_HLEN);
+ if (ppkt->is_virtio_net_pkt) {
+ ret = colo_packet_compare_common(ppkt, spkt,
+ network_header_length
+ + VIRTIO_NET_HEADER + ETH_HLEN);
+ } else {
+ ret = colo_packet_compare_common(ppkt, spkt,
+ network_header_length + ETH_HLEN);
+ }
if (ret) {
trace_colo_compare_udp_miscompare("primary pkt size", ppkt->size);
@@ -309,6 +320,7 @@ static int colo_packet_compare_udp(Packet *spkt, Packet *ppkt)
static int colo_packet_compare_icmp(Packet *spkt, Packet *ppkt)
{
int network_header_length = ppkt->ip->ip_hl * 4;
+ int ret;
trace_colo_compare_main("compare icmp");
@@ -322,8 +334,17 @@ static int colo_packet_compare_icmp(Packet *spkt, Packet *ppkt)
* other field like TOS,TTL,IP Checksum. we only need to compare
* the ip payload here.
*/
- if (colo_packet_compare_common(ppkt, spkt,
- network_header_length + ETH_HLEN)) {
+
+ if (ppkt->is_virtio_net_pkt) {
+ ret = colo_packet_compare_common(ppkt, spkt,
+ network_header_length
+ + VIRTIO_NET_HEADER + ETH_HLEN);
+ } else {
+ ret = colo_packet_compare_common(ppkt, spkt,
+ network_header_length + ETH_HLEN);
+ }
+
+ if (ret) {
trace_colo_compare_icmp_miscompare("primary pkt size",
ppkt->size);
trace_colo_compare_icmp_miscompare("Secondary pkt size",
--
2.7.4
next prev parent reply other threads:[~2017-03-16 9:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-16 9:52 [Qemu-devel] [PATCH 0/3] Add COLO-proxy virtio-net support Zhang Chen
2017-03-16 9:52 ` [Qemu-devel] [PATCH 1/3] COLO-proxy: Add virtio-net packet parse function Zhang Chen
2017-03-16 9:52 ` [Qemu-devel] [PATCH 2/3] COLO-proxy: Add a tag to mark virtio-net packet Zhang Chen
2017-03-16 9:52 ` Zhang Chen [this message]
2017-03-21 3:39 ` [Qemu-devel] [PATCH 0/3] Add COLO-proxy virtio-net support Jason Wang
2017-03-21 5:47 ` Zhang Chen
2017-03-21 6:10 ` Jason Wang
2017-03-21 6:16 ` Zhang Chen
2017-03-21 6:30 ` Jason Wang
2017-03-21 7:08 ` Zhang Chen
2017-03-21 9:15 ` Jason Wang
2017-03-22 1:50 ` Zhang Chen
2017-03-22 3:13 ` Jason Wang
2017-03-22 3:37 ` Zhang Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1489657928-14919-4-git-send-email-zhangchen.fnst@cn.fujitsu.com \
--to=zhangchen.fnst@cn.fujitsu.com \
--cc=biannm@cn.fujitsu.com \
--cc=eddie.dong@intel.com \
--cc=jasowang@redhat.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
--cc=zhang.zhanghailiang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).