[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V7 3/5] net: model specific announcing support
From: |
Jason Wang |
Subject: |
[Qemu-devel] [PATCH V7 3/5] net: model specific announcing support |
Date: |
Thu, 7 Mar 2013 16:23:49 +0800 |
This patch introduces a function pointer in NetClientInfo which is called during
self announcement. With this, each kind of card can announce the link with a
model specific way. The old method is still kept for cards that have not
implemented this or old guest. The first user would be virtio-net.
Signed-off-by: Jason Wang <address@hidden>
---
include/net/net.h | 2 ++
savevm.c | 8 ++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/net/net.h b/include/net/net.h
index cb049a1..49031b4 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -44,6 +44,7 @@ typedef ssize_t (NetReceiveIOV)(NetClientState *, const
struct iovec *, int);
typedef void (NetCleanup) (NetClientState *);
typedef void (LinkStatusChanged)(NetClientState *);
typedef void (NetClientDestructor)(NetClientState *);
+typedef int (NetAnnounce)(NetClientState *);
typedef struct NetClientInfo {
NetClientOptionsKind type;
@@ -55,6 +56,7 @@ typedef struct NetClientInfo {
NetCleanup *cleanup;
LinkStatusChanged *link_status_changed;
NetPoll *poll;
+ NetAnnounce *announce;
} NetClientInfo;
struct NetClientState {
diff --git a/savevm.c b/savevm.c
index a8a53ef..fd69e32 100644
--- a/savevm.c
+++ b/savevm.c
@@ -76,12 +76,16 @@ static int announce_self_create(uint8_t *buf,
static void qemu_announce_self_iter(NICState *nic, void *opaque)
{
+ NetClientState *nc = qemu_get_queue(nic);
+ NetAnnounce *announce = nc->info->announce;
uint8_t buf[60];
int len;
- len = announce_self_create(buf, nic->conf->macaddr.a);
+ if (!announce || announce(nc)) {
+ len = announce_self_create(buf, nic->conf->macaddr.a);
- qemu_send_packet_raw(qemu_get_queue(nic), buf, len);
+ qemu_send_packet_raw(qemu_get_queue(nic), buf, len);
+ }
}
--
1.7.1
- [Qemu-devel] [PATCH V7 0/5] Send the gratuitous by guest, Jason Wang, 2013/03/07
- [Qemu-devel] [PATCH V7 1/5] runstate: introduce prelaunch-migrate state, Jason Wang, 2013/03/07
- [Qemu-devel] [PATCH V7 2/5] net: announce self after vm is started, Jason Wang, 2013/03/07
- [Qemu-devel] [PATCH V7 3/5] net: model specific announcing support,
Jason Wang <=
- [Qemu-devel] [PATCH V7 4/5] virtio-net: notify guest to annouce itself, Jason Wang, 2013/03/07
- [Qemu-devel] [PATCH V7 5/5] virtio-net: compat guest announce, Jason Wang, 2013/03/07
- Re: [Qemu-devel] [PATCH V7 0/5] Send the gratuitous by guest, Michael S. Tsirkin, 2013/03/07
- Re: [Qemu-devel] [PATCH V7 0/5] Send the gratuitous by guest, Jason Wang, 2013/03/07
- Re: [Qemu-devel] [PATCH V7 0/5] Send the gratuitous by guest, Michael S. Tsirkin, 2013/03/07
- Re: [Qemu-devel] [PATCH V7 0/5] Send the gratuitous by guest, Jason Wang, 2013/03/07
- Re: [Qemu-devel] [PATCH V7 0/5] Send the gratuitous by guest, Michael S. Tsirkin, 2013/03/07
- Re: [Qemu-devel] [PATCH V7 0/5] Send the gratuitous by guest, Jason Wang, 2013/03/07
- Re: [Qemu-devel] [PATCH V7 0/5] Send the gratuitous by guest, Stefan Hajnoczi, 2013/03/08
- Re: [Qemu-devel] [PATCH V7 0/5] Send the gratuitous by guest, Jason Wang, 2013/03/11