req_ctx: Convert from hand-coded linked lists to linuxlist.h

This also removes the actual queuing code from req_ctx, and
leaves this to the caller.  Only tw out of the existing states actually
required the ordering requirement enforced by the qeue, and in the
future we will need to have per-endpoint queues anyway.  Both means it
is better to manage queues outside the req_ctx, and leve that as a pure
memory allocator.
This commit is contained in:
Harald Welte
2016-02-29 14:08:12 +01:00
parent b66ce249d0
commit f672e9d63a
4 changed files with 371 additions and 90 deletions

View File

@@ -5,8 +5,7 @@
#define MAX_HDRSIZE sizeof(struct openpcd_hdr)
#include <stdint.h>
#define REQ_CTX_LISTS
#include "linuxlist.h"
#define __ramfunc
@@ -37,12 +36,12 @@ enum req_ctx_state {
};
struct req_ctx {
/* if this req_ctx is on a queue... */
struct llist_head list;
uint32_t ep;
/* enum req_ctx_state */
volatile uint32_t state;
#ifdef REQ_CTX_LISTS
/* pointers for queues */
volatile struct req_ctx *prev, *next;
#endif
/* size of th 'data' buffer */
uint16_t size;
/* total number of used bytes in buffer */