|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 07/13 V6] remus: implement the API to buffer/release packages
From: Shriram Rajagopalan <rshriram@xxxxxxxxx>
This patch implements two APIs:
1. libxl__remus_netbuf_start_new_epoch()
It marks a new epoch. The packages before this epoch will
be flushed, and the packages after this epoch will be buffered.
It will be called after the guest is suspended.
2. libxl__remus_netbuf_release_prev_epoch()
It flushes the buffered packages to client, and it will be
called when a checkpoint finishes.
Signed-off-by: Shriram Rajagopalan <rshriram@xxxxxxxxx>
Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
Reviewed-by: Wen Congyang <wency@xxxxxxxxxxxxxx>
---
tools/libxl/libxl_internal.h | 6 +++++
tools/libxl/libxl_netbuffer.c | 49 +++++++++++++++++++++++++++++++++++++++++
tools/libxl/libxl_nonetbuffer.c | 14 ++++++++++++
3 files changed, 69 insertions(+)
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 0430307..7216f89 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2324,6 +2324,12 @@ _hidden void libxl__remus_setup_done(libxl__egc *egc,
_hidden void libxl__remus_netbuf_setup(libxl__egc *egc,
libxl__domain_suspend_state *dss);
+_hidden int libxl__remus_netbuf_start_new_epoch(libxl__gc *gc, uint32_t domid,
+ libxl__remus_state
*remus_state);
+
+_hidden int libxl__remus_netbuf_release_prev_epoch(libxl__gc *gc, uint32_t
domid,
+ libxl__remus_state
*remus_state);
+
struct libxl__domain_suspend_state {
/* set by caller of libxl__domain_suspend */
libxl__ao *ao;
diff --git a/tools/libxl/libxl_netbuffer.c b/tools/libxl/libxl_netbuffer.c
index 0be876c..1b61597 100644
--- a/tools/libxl/libxl_netbuffer.c
+++ b/tools/libxl/libxl_netbuffer.c
@@ -441,6 +441,55 @@ void libxl__remus_netbuf_setup(libxl__egc *egc,
libxl__remus_setup_done(egc, dss, rc);
}
+/* The buffer_op's value, not the value passed to kernel */
+enum {
+ tc_buffer_start,
+ tc_buffer_release
+};
+
+static int remus_netbuf_op(libxl__gc *gc, uint32_t domid,
+ libxl__remus_state *remus_state,
+ int buffer_op)
+{
+ int i, ret;
+
+ /* Convenience aliases */
+ libxl__remus_netbuf_state *const netbuf_state = remus_state->netbuf_state;
+
+ for (i = 0; i < netbuf_state->num_netbufs; ++i) {
+ if (buffer_op == tc_buffer_start)
+ ret = rtnl_qdisc_plug_buffer(netbuf_state->netbuf_qdisc_list[i]);
+ else
+ ret =
rtnl_qdisc_plug_release_one(netbuf_state->netbuf_qdisc_list[i]);
+
+ if (!ret)
+ ret = rtnl_qdisc_add(netbuf_state->nlsock,
+ netbuf_state->netbuf_qdisc_list[i],
+ NLM_F_REQUEST);
+ if (ret) {
+ LOG(ERROR, "Remus: cannot do netbuf op %s on %s:%s",
+ ((buffer_op == tc_buffer_start) ?
+ "start_new_epoch" : "release_prev_epoch"),
+ netbuf_state->ifb_list[i], nl_geterror(ret));
+ return ERROR_FAIL;
+ }
+ }
+
+ return 0;
+}
+
+int libxl__remus_netbuf_start_new_epoch(libxl__gc *gc, uint32_t domid,
+ libxl__remus_state *remus_state)
+{
+ return remus_netbuf_op(gc, domid, remus_state, tc_buffer_start);
+}
+
+int libxl__remus_netbuf_release_prev_epoch(libxl__gc *gc, uint32_t domid,
+ libxl__remus_state *remus_state)
+{
+ return remus_netbuf_op(gc, domid, remus_state, tc_buffer_release);
+}
+
/*
* Local variables:
* mode: C
diff --git a/tools/libxl/libxl_nonetbuffer.c b/tools/libxl/libxl_nonetbuffer.c
index acfa534..a3e3f5c 100644
--- a/tools/libxl/libxl_nonetbuffer.c
+++ b/tools/libxl/libxl_nonetbuffer.c
@@ -28,6 +28,20 @@ void libxl__remus_netbuf_setup(libxl__egc *egc,
{
}
+int libxl__remus_netbuf_start_new_epoch(libxl__gc *gc, uint32_t domid,
+ libxl__remus_state *remus_state)
+{
+ LOG(ERROR, "Remus: No support for network buffering");
+ return ERROR_FAIL;
+}
+
+int libxl__remus_netbuf_release_prev_epoch(libxl__gc *gc, uint32_t domid,
+ libxl__remus_state *remus_state)
+{
+ LOG(ERROR, "Remus: No support for network buffering");
+ return ERROR_FAIL;
+}
+
/*
* Local variables:
* mode: C
--
1.8.4.2
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |