|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V9 08/12] remus: implement the API to buffer/release packages
From: Shriram Rajagopalan <rshriram@xxxxxxxxx>
This patch implements two APIs:
1. 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. 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_netbuffer.c | 57 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
diff --git a/tools/libxl/libxl_netbuffer.c b/tools/libxl/libxl_netbuffer.c
index a5f2b9a..4b4bc9d 100644
--- a/tools/libxl/libxl_netbuffer.c
+++ b/tools/libxl/libxl_netbuffer.c
@@ -416,9 +416,66 @@ static int nic_teardown(libxl__remus_device *remus_dev,
return REMUS_INPROGRESS;
}
+/* The buffer_op's value, not the value passed to kernel */
+enum {
+ tc_buffer_start,
+ tc_buffer_release
+};
+
+static int remus_netbuf_op(libxl__remus_device_nic *remus_nic,
+ libxl__remus_netbuf_state *netbuf_state,
+ int buffer_op)
+{
+ int ret;
+
+ STATE_AO_GC(netbuf_state->ao);
+
+ if (buffer_op == tc_buffer_start)
+ ret = rtnl_qdisc_plug_buffer(remus_nic->qdisc);
+ else
+ ret = rtnl_qdisc_plug_release_one(remus_nic->qdisc);
+
+ if (!ret) {
+ ret = rtnl_qdisc_add(netbuf_state->nlsock,
+ remus_nic->qdisc,
+ NLM_F_REQUEST);
+ if (ret)
+ goto out;
+ }
+
+ return REMUS_OK;
+
+out:
+ LOG(ERROR, "Remus: cannot do netbuf op %s on %s:%s",
+ ((buffer_op == tc_buffer_start) ?
+ "start_new_epoch" : "release_prev_epoch"),
+ remus_nic->ifb, nl_geterror(ret));
+ return REMUS_FAIL;
+}
+
+static int netbuf_start_new_epoch(libxl__remus_device *remus_dev)
+{
+ libxl__remus_device_nic *remus_nic =
+ CONTAINER_OF(remus_dev, *remus_nic, remus_dev);
+ libxl__remus_netbuf_state *netbuf_state = remus_dev->dev_type->data;
+
+ return remus_netbuf_op(remus_nic, netbuf_state, tc_buffer_start);
+}
+
+static int netbuf_release_prev_epoch(libxl__remus_device *remus_dev)
+{
+ libxl__remus_device_nic *remus_nic =
+ CONTAINER_OF(remus_dev, *remus_nic, remus_dev);
+ libxl__remus_netbuf_state *netbuf_state = remus_dev->dev_type->data;
+
+ return remus_netbuf_op(remus_nic, netbuf_state, tc_buffer_release);
+}
+
libxl__remus_device_type remus_device_nic = {
.init = nic_init,
.destroy = nic_destroy,
+ .postsuspend = netbuf_start_new_epoch,
+ .commit = netbuf_release_prev_epoch,
.match = nic_match,
.setup = nic_setup,
.teardown = nic_teardown,
--
1.8.3.2
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |