From 1d3b6619e5e35eecc29efcef6eb1dd3564a2eb45 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Wed, 21 Jul 2010 12:01:50 +0100 Subject: [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 --- src/include/ipxe/list.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/include') diff --git a/src/include/ipxe/list.h b/src/include/ipxe/list.h index 743a3e260..a40fb681e 100644 --- a/src/include/ipxe/list.h +++ b/src/include/ipxe/list.h @@ -162,6 +162,18 @@ static inline int list_empty ( const struct list_head *head ) { &pos->member != (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 * -- cgit v1.2.3-55-g7522