loss_interval.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _DCCP_LI_HIST_
  2. #define _DCCP_LI_HIST_
  3. /*
  4. * net/dccp/ccids/lib/loss_interval.h
  5. *
  6. * Copyright (c) 2005 The University of Waikato, Hamilton, New Zealand.
  7. * Copyright (c) 2005 Ian McDonald <iam4@cs.waikato.ac.nz>
  8. * Copyright (c) 2005 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the Free
  12. * Software Foundation; either version 2 of the License, or (at your option)
  13. * any later version.
  14. */
  15. #include <linux/config.h>
  16. #include <linux/list.h>
  17. #include <linux/slab.h>
  18. #include <linux/time.h>
  19. #define DCCP_LI_HIST_IVAL_F_LENGTH 8
  20. struct dccp_li_hist {
  21. kmem_cache_t *dccplih_slab;
  22. };
  23. extern struct dccp_li_hist *dccp_li_hist_new(const char *name);
  24. extern void dccp_li_hist_delete(struct dccp_li_hist *hist);
  25. struct dccp_li_hist_entry {
  26. struct list_head dccplih_node;
  27. u64 dccplih_seqno:48,
  28. dccplih_win_count:4;
  29. u32 dccplih_interval;
  30. };
  31. static inline struct dccp_li_hist_entry *
  32. dccp_li_hist_entry_new(struct dccp_li_hist *hist,
  33. const gfp_t prio)
  34. {
  35. return kmem_cache_alloc(hist->dccplih_slab, prio);
  36. }
  37. static inline void dccp_li_hist_entry_delete(struct dccp_li_hist *hist,
  38. struct dccp_li_hist_entry *entry)
  39. {
  40. if (entry != NULL)
  41. kmem_cache_free(hist->dccplih_slab, entry);
  42. }
  43. extern void dccp_li_hist_purge(struct dccp_li_hist *hist,
  44. struct list_head *list);
  45. extern u32 dccp_li_hist_calc_i_mean(struct list_head *list);
  46. extern struct dccp_li_hist_entry *
  47. dccp_li_hist_interval_new(struct dccp_li_hist *hist,
  48. struct list_head *list,
  49. const u64 seq_loss,
  50. const u8 win_loss);
  51. #endif /* _DCCP_LI_HIST_ */