From: Jason Wang <jasowang@redhat.com>
To: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>,
qemu devel <qemu-devel@nongnu.org>
Cc: 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: Re: [Qemu-devel] [PATCH V5 6/9] net/colo-compare.c: Make colo-compare support vnet_hdr_len
Date: Thu, 25 May 2017 14:22:20 +0800 [thread overview]
Message-ID: <9f0e7f5e-7da7-4d78-95d9-be544b1bd28e@redhat.com> (raw)
In-Reply-To: <1495549241-23380-7-git-send-email-zhangchen.fnst@cn.fujitsu.com>
On 2017年05月23日 22:20, Zhang Chen wrote:
> 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
This is not accurate since virtio-net-pci is not the only card that uses
vnet_hdr. E1000E is another one.
>
> COLO-compare can get vnet header length from filter,
> Add vnet_hdr_len to struct packet and output packet with
> the vnet_hdr_len.
>
> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
> ---
> net/colo-compare.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++-------
> qemu-options.hx | 4 +--
> 2 files changed, 69 insertions(+), 11 deletions(-)
>
> diff --git a/net/colo-compare.c b/net/colo-compare.c
> index bf0b856..f89b380 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.
> @@ -97,9 +98,10 @@ enum {
> SECONDARY_IN,
> };
>
> -static int compare_chr_send(CharBackend *out,
> +static int compare_chr_send(CompareState *s,
> const uint8_t *buf,
> - uint32_t size);
> + uint32_t size,
> + uint32_t vnet_hdr_len);
>
> static gint seq_sorter(Packet *a, Packet *b, gpointer data)
> {
> @@ -472,7 +474,10 @@ static void colo_compare_connection(void *opaque, void *user_data)
> }
>
> if (result) {
> - ret = compare_chr_send(&s->chr_out, pkt->data, pkt->size);
> + ret = compare_chr_send(s,
> + pkt->data,
> + pkt->size,
> + pkt->vnet_hdr_len);
Why not check vnet_hdr support here? And don't we need strip vnet_hdr
here? (Since the redirector on destination does not do this)
> if (ret < 0) {
> error_report("colo_send_primary_packet failed");
> }
> @@ -493,9 +498,10 @@ static void colo_compare_connection(void *opaque, void *user_data)
> }
> }
>
> -static int compare_chr_send(CharBackend *out,
> +static int compare_chr_send(CompareState *s,
> const uint8_t *buf,
> - uint32_t size)
> + uint32_t size,
> + uint32_t vnet_hdr_len)
> {
> int ret = 0;
> uint32_t len = htonl(size);
> @@ -504,12 +510,24 @@ static int compare_chr_send(CharBackend *out,
> return 0;
> }
>
> - ret = qemu_chr_fe_write_all(out, (uint8_t *)&len, sizeof(len));
> + ret = qemu_chr_fe_write_all(&s->chr_out, (uint8_t *)&len, sizeof(len));
> if (ret != sizeof(len)) {
> goto err;
> }
>
> - ret = qemu_chr_fe_write_all(out, (uint8_t *)buf, size);
> + if (s->vnet_hdr) {
> + /*
> + * We send vnet header len make other module(like filter-redirector)
> + * know how to parse net packet correctly.
> + */
But redirector does not strip the vnet header, does this really work?
Thanks
next prev parent reply other threads:[~2017-05-25 6:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-23 14:20 [Qemu-devel] [PATCH V5 0/9] Add COLO-proxy virtio-net support Zhang Chen
2017-05-23 14:20 ` [Qemu-devel] [PATCH V5 1/9] net: Add vnet_hdr_len related arguments in NetClientState Zhang Chen
2017-05-23 14:24 ` Zhang Chen
2017-05-23 14:20 ` [Qemu-devel] [PATCH V5 2/9] net/filter-mirror.c: Make filter mirror support vnet support Zhang Chen
2017-05-25 6:04 ` Jason Wang
2017-05-25 12:55 ` Zhang Chen
2017-05-26 5:25 ` Jason Wang
2017-05-23 14:20 ` [Qemu-devel] [PATCH V5 3/9] net/filter-mirror.c: Add new option to enable vnet support for filter-redirector Zhang Chen
2017-05-25 6:10 ` Jason Wang
2017-05-25 12:58 ` Zhang Chen
2017-05-26 5:30 ` Jason Wang
2017-06-01 7:18 ` Zhang Chen
2017-05-23 14:20 ` [Qemu-devel] [PATCH V5 4/9] net/net.c: Add vnet_hdr support in SocketReadState Zhang Chen
2017-05-23 14:20 ` [Qemu-devel] [PATCH V5 5/9] net/colo.c: Make vnet_hdr_len as packet property Zhang Chen
2017-05-23 14:20 ` [Qemu-devel] [PATCH V5 6/9] net/colo-compare.c: Make colo-compare support vnet_hdr_len Zhang Chen
2017-05-25 6:22 ` Jason Wang [this message]
2017-05-25 13:18 ` Zhang Chen
2017-05-26 5:35 ` Jason Wang
2017-05-26 5:36 ` Jason Wang
2017-06-01 14:11 ` Zhang Chen
2017-05-23 14:20 ` [Qemu-devel] [PATCH V5 7/9] net/colo.c: Add vnet packet parse feature in colo-proxy Zhang Chen
2017-05-23 14:20 ` [Qemu-devel] [PATCH V5 8/9] net/colo-compare.c: Add vnet packet's tcp/udp/icmp compare Zhang Chen
2017-05-23 14:20 ` [Qemu-devel] [PATCH V5 9/9] 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=9f0e7f5e-7da7-4d78-95d9-be544b1bd28e@redhat.com \
--to=jasowang@redhat.com \
--cc=biannm@cn.fujitsu.com \
--cc=eddie.dong@intel.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
--cc=weifuqiang@huawei.com \
--cc=zhang.zhanghailiang@huawei.com \
--cc=zhangchen.fnst@cn.fujitsu.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).