[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 06/10 V7] 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(+), 0 deletions(-) diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 4006174..c13296b 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2330,6 +2330,12 @@ _hidden void libxl__remus_teardown_done(libxl__egc *egc, _hidden void libxl__remus_netbuf_teardown(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 2c77076..f358f4b 100644 --- a/tools/libxl/libxl_netbuffer.c +++ b/tools/libxl/libxl_netbuffer.c @@ -503,6 +503,55 @@ void libxl__remus_netbuf_teardown(libxl__egc *egc, libxl__remus_teardown_done(egc, dss); } +/* 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 559d0a6..92f35bc 100644 --- a/tools/libxl/libxl_nonetbuffer.c +++ b/tools/libxl/libxl_nonetbuffer.c @@ -33,6 +33,20 @@ void libxl__remus_netbuf_teardown(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.7.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |