summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/list.h
diff options
context:
space:
mode:
authorMichael Brown2010-07-21 13:01:50 +0200
committerMichael Brown2010-07-21 13:01:50 +0200
commit1d3b6619e5e35eecc29efcef6eb1dd3564a2eb45 (patch)
tree8dbfdea795e921626cf40bdbfde9bbeb01b2a185 /src/include/ipxe/list.h
parent[malloc] Add cache discard mechanism (diff)
downloadipxe-1d3b6619e5e35eecc29efcef6eb1dd3564a2eb45.tar.gz
ipxe-1d3b6619e5e35eecc29efcef6eb1dd3564a2eb45.tar.xz
ipxe-1d3b6619e5e35eecc29efcef6eb1dd3564a2eb45.zip
[tcp] Allow out-of-order receive queue to be discarded
Allow packets in the receive queue to be discarded in order to free up memory. This avoids a potential deadlock condition in which the missing packet can never be received because the receive queue is occupying all of the memory available for further RX buffers. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe/list.h')
-rw-r--r--src/include/ipxe/list.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/include/ipxe/list.h b/src/include/ipxe/list.h
index 743a3e26..a40fb681 100644
--- a/src/include/ipxe/list.h
+++ b/src/include/ipxe/list.h
@@ -163,6 +163,18 @@ static inline int list_empty ( const struct list_head *head ) {
pos = list_entry ( pos->member.next, typeof ( *pos ), member ) )
/**
+ * Iterate over entries in a list in reverse order
+ *
+ * @v pos The type * to use as a loop counter
+ * @v head The head for your list
+ * @v member The name of the list_struct within the struct
+ */
+#define list_for_each_entry_reverse( pos, head, member ) \
+ for ( pos = list_entry ( (head)->prev, typeof ( *pos ), member ); \
+ &pos->member != (head); \
+ pos = list_entry ( pos->member.prev, typeof ( *pos ), member ) )
+
+/**
* Iterate over entries in a list, safe against deletion of entries
*
* @v pos The type * to use as a loop counter