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>,
weifuqiang <weifuqiang@huawei.com>,
"eddie . dong" <eddie.dong@intel.com>,
bian naimeng <biannm@cn.fujitsu.com>,
Li Zhijian <lizhijian@cn.fujitsu.com>
Subject: [Qemu-devel] [PATCH V4 06/12] net/colo-compare.c: Add new option to enable vnet support for colo-compare
Date: Fri, 12 May 2017 09:41:22 +0800 [thread overview]
Message-ID: <1494553288-30764-7-git-send-email-zhangchen.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1494553288-30764-1-git-send-email-zhangchen.fnst@cn.fujitsu.com>
We add the vnet_hdr option for colo-compare, default is disable.
If you use virtio-net-pci net driver, please enable it.
You can use it for example:
-object colo-compare,id=comp0,primary_in=compare0-0,secondary_in=compare1,outdev=compare_out0,vnet_hdr=on
Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
net/colo-compare.c | 34 +++++++++++++++++++++++++++++++++-
qemu-options.hx | 3 ++-
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/net/colo-compare.c b/net/colo-compare.c
index 332f57e..99a6912 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -73,6 +73,7 @@ typedef struct CompareState {
CharBackend chr_out;
SocketReadState pri_rs;
SocketReadState sec_rs;
+ bool vnet_hdr;
/* connection list: the connections belonged to this NIC could be found
* in this list.
@@ -642,6 +643,28 @@ static void compare_set_outdev(Object *obj, const char *value, Error **errp)
s->outdev = g_strdup(value);
}
+static char *compare_get_vnet_hdr(Object *obj, Error **errp)
+{
+ CompareState *s = COLO_COMPARE(obj);
+
+ return s->vnet_hdr ? g_strdup("on") : g_strdup("off");
+}
+
+static void compare_set_vnet_hdr(Object *obj,
+ const char *value,
+ Error **errp)
+{
+ CompareState *s = COLO_COMPARE(obj);
+
+ if (strcmp(value, "on") && strcmp(value, "off")) {
+ error_setg(errp, "Invalid value for colo-compare vnet_hdr, "
+ "should be 'on' or 'off'");
+ return;
+ }
+
+ s->vnet_hdr = !strcmp(value, "on");
+}
+
static void compare_pri_rs_finalize(SocketReadState *pri_rs)
{
CompareState *s = container_of(pri_rs, CompareState, pri_rs);
@@ -667,7 +690,6 @@ static void compare_sec_rs_finalize(SocketReadState *sec_rs)
}
}
-
/*
* Return 0 is success.
* Return 1 is failed.
@@ -775,6 +797,8 @@ static void colo_compare_class_init(ObjectClass *oc, void *data)
static void colo_compare_init(Object *obj)
{
+ CompareState *s = COLO_COMPARE(obj);
+
object_property_add_str(obj, "primary_in",
compare_get_pri_indev, compare_set_pri_indev,
NULL);
@@ -784,6 +808,14 @@ static void colo_compare_init(Object *obj)
object_property_add_str(obj, "outdev",
compare_get_outdev, compare_set_outdev,
NULL);
+ /*
+ * The vnet_hdr is disabled by default, if you want to enable
+ * this option, you must enable all the option on related modules
+ * (like other filter or colo-compare).
+ */
+ s->vnet_hdr = false;
+ object_property_add_str(obj, "vnet_hdr", compare_get_vnet_hdr,
+ compare_set_vnet_hdr, NULL);
}
static void colo_compare_finalize(Object *obj)
diff --git a/qemu-options.hx b/qemu-options.hx
index 0f81c22..115b83f 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4061,12 +4061,13 @@ The file format is libpcap, so it can be analyzed with tools such as tcpdump
or Wireshark.
@item -object colo-compare,id=@var{id},primary_in=@var{chardevid},secondary_in=@var{chardevid},
-outdev=@var{chardevid}
+outdev=@var{chardevid},vnet_hdr=@var{on|off}
Colo-compare gets packet from primary_in@var{chardevid} and secondary_in@var{chardevid}, than compare primary packet with
secondary packet. If the packets are same, we will output primary
packet to outdev@var{chardevid}, else we will notify colo-frame
do checkpoint and send primary packet to outdev@var{chardevid}.
+if vnet_hdr = on, colo compare will send/recv packet with vnet_hdr_len.
we must use it with the help of filter-mirror and filter-redirector.
--
2.7.4
next prev parent reply other threads:[~2017-05-12 1:44 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-12 1:41 [Qemu-devel] [PATCH V4 00/12] Add COLO-proxy virtio-net support Zhang Chen
2017-05-12 1:41 ` [Qemu-devel] [PATCH V4 01/12] net: Add vnet_hdr_len related arguments in NetClientState Zhang Chen
2017-05-13 21:24 ` Philippe Mathieu-Daudé
2017-05-15 3:24 ` Jason Wang
2017-05-15 6:56 ` Zhang Chen
2017-05-15 8:06 ` Jason Wang
2017-05-15 8:14 ` Zhang Chen
2017-05-16 6:49 ` Jason Wang
2017-05-23 12:06 ` Zhang Chen
2017-05-12 1:41 ` [Qemu-devel] [PATCH V4 02/12] net/filter-mirror.c: Add new option to enable vnet support for filter-mirror Zhang Chen
2017-05-13 1:49 ` Hailiang Zhang
2017-05-14 14:31 ` Zhang Chen
2017-05-15 3:26 ` Jason Wang
2017-05-15 6:57 ` Zhang Chen
2017-05-12 1:41 ` [Qemu-devel] [PATCH V4 03/12] net/filter-mirror.c: Make filter_mirror_send support vnet support Zhang Chen
2017-05-15 3:28 ` Jason Wang
2017-05-15 7:34 ` Zhang Chen
2017-05-12 1:41 ` [Qemu-devel] [PATCH V4 04/12] net/filter-mirror.c: Add new option to enable vnet support for filter-redirector Zhang Chen
2017-05-15 3:31 ` Jason Wang
2017-05-15 7:47 ` Zhang Chen
2017-05-12 1:41 ` [Qemu-devel] [PATCH V4 05/12] net/net.c: Add vnet_hdr support in SocketReadState Zhang Chen
2017-05-15 4:02 ` Jason Wang
2017-05-15 7:49 ` Zhang Chen
2017-05-12 1:41 ` Zhang Chen [this message]
2017-05-15 4:03 ` [Qemu-devel] [PATCH V4 06/12] net/colo-compare.c: Add new option to enable vnet support for colo-compare Jason Wang
2017-05-15 7:55 ` Zhang Chen
2017-05-12 1:41 ` [Qemu-devel] [PATCH V4 07/12] net/colo.c: Make vnet_hdr_len as packet property Zhang Chen
2017-05-15 4:05 ` Jason Wang
2017-05-15 8:03 ` Zhang Chen
2017-05-15 8:18 ` Jason Wang
2017-05-23 11:59 ` Zhang Chen
2017-05-12 1:41 ` [Qemu-devel] [PATCH V4 08/12] net/colo-compare.c: Make colo-compare support vnet_hdr_len Zhang Chen
2017-05-12 1:41 ` [Qemu-devel] [PATCH V4 09/12] net/colo.c: Add vnet packet parse feature in colo-proxy Zhang Chen
2017-05-12 1:41 ` [Qemu-devel] [PATCH V4 10/12] net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare Zhang Chen
2017-05-15 4:11 ` Jason Wang
2017-05-15 8:04 ` Zhang Chen
2017-05-12 1:41 ` [Qemu-devel] [PATCH V4 11/12] net/filter-rewriter.c: Add new option to enable vnet support for filter-rewriter Zhang Chen
2017-05-15 4:12 ` Jason Wang
2017-05-15 8:05 ` Zhang Chen
2017-05-12 1:41 ` [Qemu-devel] [PATCH V4 12/12] net/filter-rewriter.c: Make filter-rewriter support vnet_hdr_len 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=1494553288-30764-7-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=weifuqiang@huawei.com \
--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).