| 1 |
#ifndef XFRAME_QUEUE_H |
| 2 |
#define XFRAME_QUEUE_H |
| 3 |
|
| 4 |
#include <linux/list.h> |
| 5 |
#include <linux/spinlock.h> |
| 6 |
#include "xdefs.h" |
| 7 |
|
| 8 |
#define XFRAME_QUEUE_MARGIN 10 |
| 9 |
|
| 10 |
struct xframe_queue { |
| 11 |
struct list_head head; |
| 12 |
bool disabled; |
| 13 |
unsigned int count; |
| 14 |
unsigned int max_count; |
| 15 |
unsigned int steady_state_count; |
| 16 |
spinlock_t lock; |
| 17 |
const char *name; |
| 18 |
void *priv; |
| 19 |
/* statistics */ |
| 20 |
unsigned int worst_count; |
| 21 |
unsigned int overflows; |
| 22 |
unsigned long worst_lag_usec; /* since xframe creation */ |
| 23 |
}; |
| 24 |
|
| 25 |
void xframe_queue_init(struct xframe_queue *q, unsigned int steady_state_count, |
| 26 |
unsigned int max_count, const char *name, void *priv); |
| 27 |
__must_check bool xframe_enqueue(struct xframe_queue *q, xframe_t *xframe); |
| 28 |
__must_check xframe_t *xframe_dequeue(struct xframe_queue *q); |
| 29 |
void xframe_queue_clearstats(struct xframe_queue *q); |
| 30 |
void xframe_queue_disable(struct xframe_queue *q, bool disabled); |
| 31 |
void xframe_queue_clear(struct xframe_queue *q); |
| 32 |
uint xframe_queue_count(struct xframe_queue *q); |
| 33 |
|
| 34 |
#endif /* XFRAME_QUEUE_ */ |