2 * Packet RX/TX history data structures and routines for TFRC-based protocols.
4 * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
5 * Copyright (c) 2005-6 The University of Waikato, Hamilton, New Zealand.
7 * This code has been developed by the University of Waikato WAND
8 * research group. For further information please see http://www.wand.net.nz/
9 * or e-mail Ian McDonald - ian.mcdonald@jandi.co.nz
11 * This code also uses code from Lulea University, rereleased as GPL by its
13 * Copyright (c) 2003 Nils-Erik Mattsson, Joacim Haggmark, Magnus Erixzon
15 * Changes to meet Linux coding standards, to make it meet latest ccid3 draft
16 * and to make it work as a loadable module in the DCCP stack written by
17 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>.
19 * Copyright (c) 2005 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 2 of the License, or
24 * (at your option) any later version.
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software
33 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
36 #ifndef _DCCP_PKT_HIST_
37 #define _DCCP_PKT_HIST_
39 #include <linux/ktime.h>
40 #include <linux/list.h>
41 #include <linux/slab.h>
44 /* Number of later packets received before one is considered lost */
45 #define TFRC_RECV_NUM_LATE_LOSS 3
47 #define TFRC_WIN_COUNT_PER_RTT 4
48 #define TFRC_WIN_COUNT_LIMIT 16
50 struct tfrc_tx_hist_entry
;
52 extern int tfrc_tx_hist_add(struct tfrc_tx_hist_entry
**headp
, u64 seqno
);
53 extern void tfrc_tx_hist_purge(struct tfrc_tx_hist_entry
**headp
);
54 extern u32
tfrc_tx_hist_rtt(struct tfrc_tx_hist_entry
*head
,
55 const u64 seqno
, const ktime_t now
);
58 * Receiver History data structures and declarations
60 struct dccp_rx_hist_entry
{
61 struct list_head dccphrx_node
;
65 u32 dccphrx_ndp
; /* In fact it is from 8 to 24 bits */
66 ktime_t dccphrx_tstamp
;
70 struct kmem_cache
*dccprxh_slab
;
73 extern struct dccp_rx_hist
*dccp_rx_hist_new(const char *name
);
74 extern void dccp_rx_hist_delete(struct dccp_rx_hist
*hist
);
76 static inline struct dccp_rx_hist_entry
*
77 dccp_rx_hist_entry_new(struct dccp_rx_hist
*hist
,
79 const struct sk_buff
*skb
,
82 struct dccp_rx_hist_entry
*entry
= kmem_cache_alloc(hist
->dccprxh_slab
,
86 const struct dccp_hdr
*dh
= dccp_hdr(skb
);
88 entry
->dccphrx_seqno
= DCCP_SKB_CB(skb
)->dccpd_seq
;
89 entry
->dccphrx_ccval
= dh
->dccph_ccval
;
90 entry
->dccphrx_type
= dh
->dccph_type
;
91 entry
->dccphrx_ndp
= ndp
;
92 entry
->dccphrx_tstamp
= ktime_get_real();
98 static inline struct dccp_rx_hist_entry
*
99 dccp_rx_hist_head(struct list_head
*list
)
101 struct dccp_rx_hist_entry
*head
= NULL
;
103 if (!list_empty(list
))
104 head
= list_entry(list
->next
, struct dccp_rx_hist_entry
,
109 extern int dccp_rx_hist_find_entry(const struct list_head
*list
, const u64 seq
,
111 extern struct dccp_rx_hist_entry
*
112 dccp_rx_hist_find_data_packet(const struct list_head
*list
);
114 extern void dccp_rx_hist_add_packet(struct dccp_rx_hist
*hist
,
115 struct list_head
*rx_list
,
116 struct list_head
*li_list
,
117 struct dccp_rx_hist_entry
*packet
,
120 static inline void dccp_rx_hist_entry_delete(struct dccp_rx_hist
*hist
,
121 struct dccp_rx_hist_entry
*entry
)
124 kmem_cache_free(hist
->dccprxh_slab
, entry
);
127 extern void dccp_rx_hist_purge(struct dccp_rx_hist
*hist
,
128 struct list_head
*list
);
131 dccp_rx_hist_entry_data_packet(const struct dccp_rx_hist_entry
*entry
)
133 return entry
->dccphrx_type
== DCCP_PKT_DATA
||
134 entry
->dccphrx_type
== DCCP_PKT_DATAACK
;
137 extern u64
dccp_rx_hist_detect_loss(struct list_head
*rx_list
,
138 struct list_head
*li_list
, u8
*win_loss
);
140 #endif /* _DCCP_PKT_HIST_ */
This page took 0.041222 seconds and 5 git commands to generate.