aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/lib/loss_interval.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ccids/lib/loss_interval.h')
-rw-r--r--net/dccp/ccids/lib/loss_interval.h56
1 files changed, 55 insertions, 1 deletions
diff --git a/net/dccp/ccids/lib/loss_interval.h b/net/dccp/ccids/lib/loss_interval.h
index 27bee92dae1..5e3c5c54a49 100644
--- a/net/dccp/ccids/lib/loss_interval.h
+++ b/net/dccp/ccids/lib/loss_interval.h
@@ -3,6 +3,7 @@
3/* 3/*
4 * net/dccp/ccids/lib/loss_interval.h 4 * net/dccp/ccids/lib/loss_interval.h
5 * 5 *
6 * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
6 * Copyright (c) 2005-7 The University of Waikato, Hamilton, New Zealand. 7 * Copyright (c) 2005-7 The University of Waikato, Hamilton, New Zealand.
7 * Copyright (c) 2005-7 Ian McDonald <ian.mcdonald@jandi.co.nz> 8 * Copyright (c) 2005-7 Ian McDonald <ian.mcdonald@jandi.co.nz>
8 * Copyright (c) 2005 Arnaldo Carvalho de Melo <acme@conectiva.com.br> 9 * Copyright (c) 2005 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
@@ -12,11 +13,64 @@
12 * Software Foundation; either version 2 of the License, or (at your option) 13 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version. 14 * any later version.
14 */ 15 */
15
16#include <linux/ktime.h> 16#include <linux/ktime.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/slab.h>
19
20/*
21 * Number of loss intervals (RFC 4342, 8.6.1). The history size is one more than
22 * NINTERVAL, since the `open' interval I_0 is always stored as the first entry.
23 */
24#define NINTERVAL 8
25#define LIH_SIZE (NINTERVAL + 1)
26
27/**
28 * tfrc_loss_interval - Loss history record for TFRC-based protocols
29 * @li_seqno: Highest received seqno before the start of loss
30 * @li_ccval: The CCVal belonging to @li_seqno
31 * @li_is_closed: Whether @li_seqno is older than 1 RTT
32 * @li_length: Loss interval sequence length
33 */
34struct tfrc_loss_interval {
35 u64 li_seqno:48,
36 li_ccval:4,
37 li_is_closed:1;
38 u32 li_length;
39};
40
41/**
42 * tfrc_loss_hist - Loss record database
43 * @ring: Circular queue managed in LIFO manner
44 * @counter: Current count of entries (can be more than %LIH_SIZE)
45 * @i_mean: Current Average Loss Interval [RFC 3448, 5.4]
46 */
47struct tfrc_loss_hist {
48 struct tfrc_loss_interval *ring[LIH_SIZE];
49 u8 counter;
50 u32 i_mean;
51};
52
53static inline void tfrc_lh_init(struct tfrc_loss_hist *lh)
54{
55 memset(lh, 0, sizeof(struct tfrc_loss_hist));
56}
57
58static inline u8 tfrc_lh_is_initialised(struct tfrc_loss_hist *lh)
59{
60 return lh->counter > 0;
61}
62
63static inline u8 tfrc_lh_length(struct tfrc_loss_hist *lh)
64{
65 return min(lh->counter, (u8)LIH_SIZE);
66}
18 67
19extern void dccp_li_hist_purge(struct list_head *list); 68extern void dccp_li_hist_purge(struct list_head *list);
69struct tfrc_rx_hist;
70extern int tfrc_lh_interval_add(struct tfrc_loss_hist *, struct tfrc_rx_hist *,
71 u32 (*first_li)(struct sock *), struct sock *);
72extern u8 tfrc_lh_update_i_mean(struct tfrc_loss_hist *lh, struct sk_buff *);
73extern void tfrc_lh_cleanup(struct tfrc_loss_hist *lh);
20 74
21extern u32 dccp_li_hist_calc_i_mean(struct list_head *list); 75extern u32 dccp_li_hist_calc_i_mean(struct list_head *list);
22 76