blob: 43bf78269d1d5f3fa96ec600ff420855e98da4cb [file] [log] [blame]
Arnaldo Carvalho de Meloae6706f2005-08-27 23:03:09 -03001#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
Arnaldo Carvalho de Meloae6706f2005-08-27 23:03:09 -030016#include <linux/list.h>
17#include <linux/slab.h>
18#include <linux/time.h>
19
20#define DCCP_LI_HIST_IVAL_F_LENGTH 8
21
22struct dccp_li_hist {
23 kmem_cache_t *dccplih_slab;
24};
25
26extern struct dccp_li_hist *dccp_li_hist_new(const char *name);
27extern void dccp_li_hist_delete(struct dccp_li_hist *hist);
28
29struct dccp_li_hist_entry {
30 struct list_head dccplih_node;
31 u64 dccplih_seqno:48,
32 dccplih_win_count:4;
33 u32 dccplih_interval;
34};
35
36static inline struct dccp_li_hist_entry *
37 dccp_li_hist_entry_new(struct dccp_li_hist *hist,
Al Virodd0fc662005-10-07 07:46:04 +010038 const gfp_t prio)
Arnaldo Carvalho de Meloae6706f2005-08-27 23:03:09 -030039{
40 return kmem_cache_alloc(hist->dccplih_slab, prio);
41}
42
43static inline void dccp_li_hist_entry_delete(struct dccp_li_hist *hist,
44 struct dccp_li_hist_entry *entry)
45{
46 if (entry != NULL)
47 kmem_cache_free(hist->dccplih_slab, entry);
48}
49
50extern void dccp_li_hist_purge(struct dccp_li_hist *hist,
51 struct list_head *list);
52
53extern u32 dccp_li_hist_calc_i_mean(struct list_head *list);
54
55extern struct dccp_li_hist_entry *
56 dccp_li_hist_interval_new(struct dccp_li_hist *hist,
57 struct list_head *list,
58 const u64 seq_loss,
59 const u8 win_loss);
60#endif /* _DCCP_LI_HIST_ */