From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
To: Jason Wang <jasowang@redhat.com>, qemu devel <qemu-devel@nongnu.org>
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>,
Gui jianfeng <guijianfeng@cn.fujitsu.com>,
Wen Congyang <wency@cn.fujitsu.com>,
zhanghailiang <zhang.zhanghailiang@huawei.com>,
Yang Hongyang <hongyang.yang@easystack.cn>,
"eddie.dong" <eddie.dong@intel.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH V3 2/4] colo-compare: track connection and enqueue packet
Date: Fri, 29 Apr 2016 15:24:52 +0800 [thread overview]
Message-ID: <57230C44.3070007@cn.fujitsu.com> (raw)
In-Reply-To: <5722C15E.4090100@redhat.com>
On 04/29/2016 10:05 AM, Jason Wang wrote:
> On 04/28/2016 06:25 PM, Zhang Chen wrote:
>>>> +static Packet *packet_new(CompareState *s, const void *data,
>>>> + int size, ConnectionKey *key)
>>>> +{
>>>> + Packet *pkt = g_slice_new(Packet);
>>>> +
>>>> + pkt->data = g_memdup(data, size);
>>>> + pkt->size = size;
>>>> + pkt->s = s;
>>>> +
>>>> + if (connection_key_init(pkt, key)) {
>>>> + packet_destroy(pkt, NULL);
>>>> + pkt = NULL;
>>>> + }
>>> Can we do connection_key_init() first, this can avoid packet_desctory()
>>> if it fails.
>> Do you mean we should call connection_key_init() first
>> and then call packet_new()?
> Yes, only when connection_key_init() succeed.
OK~ will fix in next.
>>>> +
>>>> + return pkt;
>>>> +}
>>>> +
>>>> +/*
>>>> + * Return 0 on success, if return -1 means the pkt
>>>> + * is unsupported(arp and ipv6) and will be sent later
>>>> + */
>>>> +static int packet_enqueue(CompareState *s, int mode)
>>>> +{
>>>> + ConnectionKey key = {{ 0 } };
>>>> + Packet *pkt = NULL;
>>>> + Connection *conn;
>>>> +
>>>> + if (mode == PRIMARY_IN) {
>>>> + pkt = packet_new(s, s->pri_rs.buf, s->pri_rs.packet_len,
>>>> &key);
>>>> + } else {
>>>> + pkt = packet_new(s, s->sec_rs.buf, s->sec_rs.packet_len,
>>>> &key);
>>>> + }
>>>> + if (!pkt) {
>>>> + return -1;
>>>> + }
>>>> +
>>>> + conn = connection_get(s, &key);
>>>> + if (!conn->processing) {
>>>> + qemu_mutex_lock(&s->conn_list_lock);
>>>> + g_queue_push_tail(&s->conn_list, conn);
>>>> + qemu_mutex_unlock(&s->conn_list_lock);
>>>> + conn->processing = true;
>>>> + }
>>>> +
>>>> + qemu_mutex_lock(&conn->list_lock);
>>>> + if (mode == PRIMARY_IN) {
>>>> + g_queue_push_tail(&conn->primary_list, pkt);
>>>> + } else {
>>>> + g_queue_push_tail(&conn->secondary_list, pkt);
>>>> + }
>>>> + qemu_mutex_unlock(&conn->list_lock);
>>>> +
>>>> + return 0;
>>>> +}
>>>> +
>>>> +static void packet_destroy(void *opaque, void *user_data)
>>>> +{
>>>> + Packet *pkt = opaque;
>>>> +
>>>> + g_free(pkt->data);
>>>> + g_slice_free(Packet, pkt);
>>>> +}
>>>> +
>>>> static int compare_chr_send(CharDriverState *out,
>>>> const uint8_t *buf,
>>>> uint32_t size)
>>>> @@ -158,8 +437,10 @@ static void compare_pri_chr_in(void *opaque,
>>>> const uint8_t *buf, int size)
>>>> ret = compare_chr_fill_rstate(&s->pri_rs, buf, size);
>>>> if (ret == 1) {
>>>> - /* FIXME: enqueue to primary packet list */
>>>> - compare_chr_send(s->chr_out, s->pri_rs.buf,
>>>> s->pri_rs.packet_len);
>>>> + if (packet_enqueue(s, PRIMARY_IN)) {
>>>> + trace_colo_compare_main("primary: unsupported packet in");
>>>> + compare_chr_send(s->chr_out, s->pri_rs.buf,
>>>> s->pri_rs.packet_len);
>>> Looks like if a packet was not recognized by connection_key_init(), it
>>> will be sent directly without comparing it with the packet sent from
>>> secondary? Is this expected?
>> Yes,we will send primary's arp packet to get mac first.
>>
>> Thanks
>> zhangchen
> But what if the packet was not arp?
>
>
> .
rarp packet will be sent, ip packet will be enqueue.
--
Thanks
zhangchen
next prev parent reply other threads:[~2016-04-29 7:26 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-18 11:11 [Qemu-devel] [RFC PATCH V3 0/4] Introduce COLO-compare Zhang Chen
2016-04-18 11:11 ` [Qemu-devel] [RFC PATCH V3 1/4] colo-compare: introduce colo compare initlization Zhang Chen
2016-04-28 6:53 ` Jason Wang
2016-04-28 7:16 ` Jason Wang
2016-04-28 7:55 ` Zhang Chen
2016-04-28 8:17 ` Jason Wang
2016-04-28 9:04 ` Zhang Chen
2016-04-29 2:03 ` Jason Wang
2016-04-29 2:08 ` Zhang Chen
2016-05-06 5:42 ` Zhang Chen
2016-05-06 6:37 ` Jason Wang
2016-05-09 10:49 ` Zhang Chen
2016-05-12 6:49 ` Zhang Chen
2016-05-12 8:01 ` Jason Wang
2016-05-12 8:16 ` Zhang Chen
2016-05-13 3:48 ` Jason Wang
2016-05-20 2:46 ` Jason Wang
2016-05-20 6:52 ` Fam Zheng
2016-04-28 7:53 ` Zhang Chen
2016-04-28 8:23 ` Jason Wang
2016-04-28 20:55 ` Eric Blake
2016-04-29 1:28 ` Zhang Chen
2016-04-18 11:11 ` [Qemu-devel] [RFC PATCH V3 2/4] colo-compare: track connection and enqueue packet Zhang Chen
2016-04-28 7:47 ` Jason Wang
2016-04-28 10:25 ` Zhang Chen
2016-04-29 2:05 ` Jason Wang
2016-04-29 7:24 ` Zhang Chen [this message]
2016-04-18 11:11 ` [Qemu-devel] [RFC PATCH V3 3/4] colo-compare: introduce packet comparison thread Zhang Chen
2016-04-28 7:58 ` Jason Wang
2016-04-28 10:31 ` Zhang Chen
2016-04-29 2:07 ` Jason Wang
2016-04-29 8:28 ` Zhang Chen
2016-04-29 11:20 ` Dr. David Alan Gilbert
2016-04-18 11:11 ` [Qemu-devel] [RFC PATCH V3 4/4] colo-compare: add TCP, UDP, ICMP packet comparison Zhang Chen
2016-04-28 8:15 ` Jason Wang
2016-04-28 19:44 ` Dr. David Alan Gilbert
2016-05-05 3:03 ` Zhang Chen
2016-05-05 3:10 ` Zhang Chen
2016-04-27 11:54 ` [Qemu-devel] [RFC PATCH V3 0/4] Introduce COLO-compare 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=57230C44.3070007@cn.fujitsu.com \
--to=zhangchen.fnst@cn.fujitsu.com \
--cc=dgilbert@redhat.com \
--cc=eddie.dong@intel.com \
--cc=guijianfeng@cn.fujitsu.com \
--cc=hongyang.yang@easystack.cn \
--cc=jasowang@redhat.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
--cc=wency@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.