summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2006-05-29 16:55:07 +0200
committerMichael Brown2006-05-29 16:55:07 +0200
commit1db1a6dad3209fa03221bb420665f04e8b6a8418 (patch)
tree1e05f9825d53088494e3df4af85a5ac5e2b2ac9b /src/include
parentHandle multi-sector reads by splitting them into subcommands. (diff)
downloadipxe-1db1a6dad3209fa03221bb420665f04e8b6a8418.tar.gz
ipxe-1db1a6dad3209fa03221bb420665f04e8b6a8418.tar.xz
ipxe-1db1a6dad3209fa03221bb420665f04e8b6a8418.zip
Added first sketch of a generic retry timer mechanism. The idea is to use
these timer objects in AoE and UDP protocols (where there is no underlying retransmission mechanism) without requiring each protocol to implement its own individual retry logic. Eventually, we should be able to use the same timer code for TCP retransmissions as well.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gpxe/retry.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/include/gpxe/retry.h b/src/include/gpxe/retry.h
new file mode 100644
index 000000000..8a9e2cf6f
--- /dev/null
+++ b/src/include/gpxe/retry.h
@@ -0,0 +1,36 @@
+#ifndef _GPXE_RETRY_H
+#define _GPXE_RETRY_H
+
+/** @file
+ *
+ * Retry timers
+ *
+ */
+
+#include <gpxe/list.h>
+
+/** Effective maximum retry count for exponential backoff calculation */
+#define BACKOFF_LIMIT 5
+
+/** A retry timer */
+struct retry_timer {
+ /** List of active timers */
+ struct list_head list;
+ /** Base timeout (in ticks) */
+ unsigned int base;
+ /** Retry count */
+ unsigned int retries;
+ /** Expiry time (in ticks) */
+ unsigned long expiry;
+ /** Timer expired callback
+ *
+ * @v timer Retry timer
+ */
+ void ( * expired ) ( struct retry_timer *timer );
+};
+
+extern void start_timer ( struct retry_timer *timer );
+extern void reset_timer ( struct retry_timer *timer );
+extern void stop_timer ( struct retry_timer *timer );
+
+#endif /* _GPXE_RETRY_H */