From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: "Gonglei (Arei)" <arei.gonglei@huawei.com>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
"aliguori@amazon.com" <aliguori@amazon.com>,
"mst@redhat.com" <mst@redhat.com>,
Luonengjun <luonengjun@huawei.com>,
"Huangpeng (Peter)" <peter.huangpeng@huawei.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"stefanha@redhat.com" <stefanha@redhat.com>,
"akong@redhat.com" <akong@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] net: Flush queues when runstate changes back to running
Date: Thu, 14 Aug 2014 16:24:38 +0800 [thread overview]
Message-ID: <53EC7246.6030300@huawei.com> (raw)
In-Reply-To: <33183CC9F5247A488A2544077AF1902086C3622C@SZXEMA503-MBS.china.huawei.com>
On 2014/8/14 15:12, Gonglei (Arei) wrote:
> Hi,
>
>> Subject: [Qemu-devel] [PATCH 2/3] net: Flush queues when runstate changes
>> back to running
>>
>> When the runstate changes back to running, we definitely need to flush
>> queues to get packets flowing again.
>>
>> Here we implement this in the net layer:
>> (1) add a member 'VMChangeStateEntry *vmstate' to struct NICState,
>> Which will listen for VM runstate changes.
>
> Does this change will block migration during with different QEMU versions?
>
No, I have tested migration between qemu-1.5.1 with new qemu which has
merged this patches, everything seems ok!
>> (2) Register a handler function for VMstate change.
>> When vm changes back to running, we flush all queues in the callback function.
>>
>> Signed-off-by: zhanghailiang<zhang.zhanghailiang@huawei.com>
>> ---
>> include/net/net.h | 1 +
>> net/net.c | 26 ++++++++++++++++++++++++++
>> 2 files changed, 27 insertions(+)
>>
>> diff --git a/include/net/net.h b/include/net/net.h
>> index 312f728..a294277 100644
>> --- a/include/net/net.h
>> +++ b/include/net/net.h
>> @@ -97,6 +97,7 @@ typedef struct NICState {
>> NICConf *conf;
>> void *opaque;
>> bool peer_deleted;
>> + VMChangeStateEntry *vmstate;
>> } NICState;
>>
>> NetClientState *qemu_find_netdev(const char *id);
>> diff --git a/net/net.c b/net/net.c
>> index 5bb2821..506e58f 100644
>> --- a/net/net.c
>> +++ b/net/net.c
>> @@ -242,6 +242,29 @@ NetClientState *qemu_new_net_client(NetClientInfo
>> *info,
>> return nc;
>> }
>>
>> +static void nic_vmstate_change_handler(void *opaque,
>> + int running,
>> + RunState state)
>> +{
>> + NICState *nic = opaque;
>> + NetClientState *nc;
>> + int i, queues;
>> +
>> + if (!running) {
>> + return;
>> + }
>> +
>> + queues = MAX(1, nic->conf->peers.queues);
> ^
> A superfluous space.
>
Yes, Good catch, i will modify this. Thanks.
next prev parent reply other threads:[~2014-08-14 8:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-14 6:13 [Qemu-devel] [PATCH 0/3] forbid dealing with net packets when VM is not running zhanghailiang
2014-08-14 6:13 ` [Qemu-devel] [PATCH 1/3] net: Forbid dealing with " zhanghailiang
2014-08-14 6:13 ` [Qemu-devel] [PATCH 2/3] net: Flush queues when runstate changes back to running zhanghailiang
2014-08-14 7:12 ` Gonglei (Arei)
2014-08-14 8:24 ` zhanghailiang [this message]
2014-08-14 10:05 ` Michael S. Tsirkin
2014-08-18 0:45 ` zhanghailiang
2014-08-14 10:09 ` Michael S. Tsirkin
2014-08-18 0:46 ` zhanghailiang
2014-08-14 6:13 ` [Qemu-devel] [PATCH 3/3] virtio-net: Remove checking vm state in virtio_net_can_receive zhanghailiang
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=53EC7246.6030300@huawei.com \
--to=zhang.zhanghailiang@huawei.com \
--cc=akong@redhat.com \
--cc=aliguori@amazon.com \
--cc=arei.gonglei@huawei.com \
--cc=luonengjun@huawei.com \
--cc=mst@redhat.com \
--cc=peter.huangpeng@huawei.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).