xframe_queue.h 1010 B

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