summaryrefslogtreecommitdiffstats
path: root/src/core/xfer.c
diff options
context:
space:
mode:
authorMichael Brown2010-09-05 02:16:29 +0200
committerMichael Brown2010-09-05 04:12:17 +0200
commitc8199aacaa01a5ef3a13d958a8a46206bd0a6eea (patch)
treecc7f9124ad98a2b4677278933a15456e7553a870 /src/core/xfer.c
parent[infiniband] Add the concept of an Infiniband upper-layer driver (diff)
downloadipxe-c8199aacaa01a5ef3a13d958a8a46206bd0a6eea.tar.gz
ipxe-c8199aacaa01a5ef3a13d958a8a46206bd0a6eea.tar.xz
ipxe-c8199aacaa01a5ef3a13d958a8a46206bd0a6eea.zip
[xfer] Add xfer_window_changed()
xfer_window_changed() can be used to notify peers that an interface is now ready to accept data. This can potentially be used to eliminate the need for wasteful processes that simply poll xfer_window() until the window becomes non-zero. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core/xfer.c')
-rw-r--r--src/core/xfer.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/core/xfer.c b/src/core/xfer.c
index 222af52a..a755d438 100644
--- a/src/core/xfer.c
+++ b/src/core/xfer.c
@@ -105,6 +105,33 @@ size_t xfer_window ( struct interface *intf ) {
}
/**
+ * Report change of flow control window
+ *
+ * @v intf Data transfer interface
+ *
+ * Note that this method is used to indicate only unsolicited changes
+ * in the flow control window. In particular, this method must not be
+ * called as part of the response to xfer_deliver(), since that could
+ * easily lead to an infinite loop. Callers of xfer_deliver() should
+ * assume that the flow control window will have changed without
+ * generating an xfer_window_changed() message.
+ */
+void xfer_window_changed ( struct interface *intf ) {
+ struct interface *dest;
+ xfer_window_changed_TYPE ( void * ) *op =
+ intf_get_dest_op ( intf, xfer_window_changed, &dest );
+ void *object = intf_object ( dest );
+
+ if ( op ) {
+ op ( object );
+ } else {
+ /* Default is to do nothing */
+ }
+
+ intf_put ( dest );
+}
+
+/**
* Allocate I/O buffer
*
* @v intf Data transfer interface