[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Frame v18 31/34] net: Add notifier/callback for
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH COLO-Frame v18 31/34] net: Add notifier/callback for netdev init |
Date: |
Wed, 3 Aug 2016 20:26:09 +0800 |
We can register some callback for this notifier,
this will be used by COLO to register a callback which
will add each netdev a buffer filter.
Signed-off-by: zhanghailiang <address@hidden>
Cc: Jason Wang <address@hidden>
Cc: Yang Hongyang <address@hidden>
---
v17:
- Rename netdev_init_add_notifier() to netdev_register_init_notifier()
v16:
- Simplify the codes by using some helpers in QEMU
v14:
- New patch
---
include/net/net.h | 3 +++
net/net.c | 12 ++++++++++++
2 files changed, 15 insertions(+)
diff --git a/include/net/net.h b/include/net/net.h
index e8d9e9e..b67fe20 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -8,6 +8,7 @@
#include "net/queue.h"
#include "migration/vmstate.h"
#include "qapi-types.h"
+#include "qemu/notify.h"
#define MAC_FMT "%02X:%02X:%02X:%02X:%02X:%02X"
#define MAC_ARG(x) ((uint8_t *)(x))[0], ((uint8_t *)(x))[1], \
@@ -195,6 +196,8 @@ struct NICInfo {
int nvectors;
};
+void netdev_register_init_notifier(Notifier *notify);
+
extern int nb_nics;
extern NICInfo nd_table[MAX_NICS];
extern const char *host_net_devices[];
diff --git a/net/net.c b/net/net.c
index c124b11..4e8268d 100644
--- a/net/net.c
+++ b/net/net.c
@@ -56,6 +56,9 @@
static VMChangeStateEntry *net_change_state_entry;
static QTAILQ_HEAD(, NetClientState) net_clients;
+static NotifierList netdev_init_notifiers =
+ NOTIFIER_LIST_INITIALIZER(netdev_init_notifiers);
+
const char *host_net_devices[] = {
"tap",
"socket",
@@ -929,6 +932,10 @@ static int net_init_nic(const Netdev *netdev, const char
*name,
return idx;
}
+void netdev_register_init_notifier(Notifier *notify)
+{
+ notifier_list_add(&netdev_init_notifiers, notify);
+}
static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])(
const Netdev *netdev,
@@ -1056,6 +1063,11 @@ static int net_client_init1(const void *object, bool
is_netdev, Error **errp)
}
return -1;
}
+ if (is_netdev) {
+ const Netdev *netdev = object;
+
+ notifier_list_notify(&netdev_init_notifiers, netdev->id);
+ }
return 0;
}
--
1.8.3.1
- Re: [Qemu-devel] [PATCH COLO-Frame v18 12/34] COLO: Load VMState into buffer before restore it, (continued)
- [Qemu-devel] [PATCH COLO-Frame v18 28/34] COLO: Separate the process of saving/loading ram and device state, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 10/34] COLO: Load PVM's dirty pages into SVM's RAM cache temporarily, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 24/34] COLO: Update the global runstate after going into colo state, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 20/34] qmp event: Add COLO_EXIT event to notify users while exited from COLO, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 05/34] migration: Integrate COLO checkpoint process into loadvm, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 11/34] ram/COLO: Record the dirty pages that SVM received, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 02/34] migration: Introduce capability 'x-colo' to migration, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 32/34] COLO/filter: Add each netdev a buffer filter, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 31/34] net: Add notifier/callback for netdev init,
zhanghailiang <=
- [Qemu-devel] [PATCH COLO-Frame v18 06/34] COLO/migration: Create a new communication path from destination to source, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 03/34] COLO: migrate colo related info to secondary node, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 17/34] COLO failover: Introduce state to record failover process, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 25/34] savevm: Introduce two helper functions for save/find loadvm_handlers entry, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 27/34] migration/savevm: Export two helper functions for savevm process, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 34/34] COLO: Add block replication into colo process, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 04/34] migration: Integrate COLO checkpoint process into migration, zhanghailiang, 2016/08/03
- [Qemu-devel] [PATCH COLO-Frame v18 29/34] COLO: Split qemu_savevm_state_begin out of checkpoint process, zhanghailiang, 2016/08/03