Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
loss_interval.h
Go to the documentation of this file.
1 #ifndef _DCCP_LI_HIST_
2 #define _DCCP_LI_HIST_
3 /*
4  * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
5  * Copyright (c) 2005-7 The University of Waikato, Hamilton, New Zealand.
6  * Copyright (c) 2005-7 Ian McDonald <[email protected]>
7  * Copyright (c) 2005 Arnaldo Carvalho de Melo <[email protected]>
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU General Public License as published by the Free
11  * Software Foundation; either version 2 of the License, or (at your option)
12  * any later version.
13  */
14 #include <linux/ktime.h>
15 #include <linux/list.h>
16 #include <linux/slab.h>
17 
18 /*
19  * Number of loss intervals (RFC 4342, 8.6.1). The history size is one more than
20  * NINTERVAL, since the `open' interval I_0 is always stored as the first entry.
21  */
22 #define NINTERVAL 8
23 #define LIH_SIZE (NINTERVAL + 1)
24 
34  li_ccval:4,
35  li_is_closed:1;
37 };
38 
49 };
50 
51 static inline void tfrc_lh_init(struct tfrc_loss_hist *lh)
52 {
53  memset(lh, 0, sizeof(struct tfrc_loss_hist));
54 }
55 
56 static inline u8 tfrc_lh_is_initialised(struct tfrc_loss_hist *lh)
57 {
58  return lh->counter > 0;
59 }
60 
61 static inline u8 tfrc_lh_length(struct tfrc_loss_hist *lh)
62 {
63  return min(lh->counter, (u8)LIH_SIZE);
64 }
65 
66 struct tfrc_rx_hist;
67 
68 extern int tfrc_lh_interval_add(struct tfrc_loss_hist *, struct tfrc_rx_hist *,
69  u32 (*first_li)(struct sock *), struct sock *);
70 extern u8 tfrc_lh_update_i_mean(struct tfrc_loss_hist *lh, struct sk_buff *);
71 extern void tfrc_lh_cleanup(struct tfrc_loss_hist *lh);
72 
73 #endif /* _DCCP_LI_HIST_ */