mirror of
https://github.com/ipxe/ipxe
synced 2025-12-19 19:49:45 +03:00
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.
This commit is contained in:
36
src/include/gpxe/retry.h
Normal file
36
src/include/gpxe/retry.h
Normal file
@@ -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 */
|
||||
Reference in New Issue
Block a user