[CCID3]: The receiver of a half-connection does not set window counter values
[deliverable/linux.git] / net / dccp / ccids / lib / packet_history.h
CommitLineData
8c60f3fa 1/*
276f2edc 2 * Packet RX/TX history data structures and routines for TFRC-based protocols.
8c60f3fa 3 *
276f2edc 4 * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
e6bccd35 5 * Copyright (c) 2005-6 The University of Waikato, Hamilton, New Zealand.
8c60f3fa 6 *
8c60f3fa
ACM
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/
e6bccd35 9 * or e-mail Ian McDonald - ian.mcdonald@jandi.co.nz
8c60f3fa
ACM
10 *
11 * This code also uses code from Lulea University, rereleased as GPL by its
12 * authors:
13 * Copyright (c) 2003 Nils-Erik Mattsson, Joacim Haggmark, Magnus Erixzon
14 *
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>.
18 *
19 * Copyright (c) 2005 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
20 *
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.
25 *
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.
30 *
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.
34 */
35
36#ifndef _DCCP_PKT_HIST_
37#define _DCCP_PKT_HIST_
38
e7c23357 39#include <linux/ktime.h>
8c60f3fa
ACM
40#include <linux/list.h>
41#include <linux/slab.h>
c40616c5 42#include "tfrc.h"
8c60f3fa 43
072ab6c6
ACM
44/* Number of later packets received before one is considered lost */
45#define TFRC_RECV_NUM_LATE_LOSS 3
46
47#define TFRC_WIN_COUNT_PER_RTT 4
48#define TFRC_WIN_COUNT_LIMIT 16
49
9108d5f4 50struct tfrc_tx_hist_entry;
8c60f3fa 51
276f2edc
ACM
52extern int tfrc_tx_hist_add(struct tfrc_tx_hist_entry **headp, u64 seqno);
53extern void tfrc_tx_hist_purge(struct tfrc_tx_hist_entry **headp);
9108d5f4
ACM
54extern u32 tfrc_tx_hist_rtt(struct tfrc_tx_hist_entry *head,
55 const u64 seqno, const ktime_t now);
8c60f3fa 56
85dcb1f7
GR
57/*
58 * Receiver History data structures and declarations
59 */
d58d1af0
ACM
60struct tfrc_rx_hist_entry {
61 struct list_head tfrchrx_node;
62 u64 tfrchrx_seqno:48,
63 tfrchrx_ccval:4,
64 tfrchrx_type:4;
65 u32 tfrchrx_ndp; /* In fact it is from 8 to 24 bits */
66 ktime_t tfrchrx_tstamp;
85dcb1f7 67};
8c60f3fa 68
d58d1af0
ACM
69extern struct tfrc_rx_hist_entry *
70 tfrc_rx_hist_entry_new(const u32 ndp,
85dcb1f7 71 const struct sk_buff *skb,
34a9e7ea 72 const gfp_t prio);
8c60f3fa 73
d58d1af0
ACM
74static inline struct tfrc_rx_hist_entry *
75 tfrc_rx_hist_head(struct list_head *list)
8c60f3fa 76{
d58d1af0 77 struct tfrc_rx_hist_entry *head = NULL;
8c60f3fa
ACM
78
79 if (!list_empty(list))
d58d1af0
ACM
80 head = list_entry(list->next, struct tfrc_rx_hist_entry,
81 tfrchrx_node);
8c60f3fa
ACM
82 return head;
83}
84
d58d1af0 85extern int tfrc_rx_hist_find_entry(const struct list_head *list, const u64 seq,
c9eaf173 86 u8 *ccval);
d58d1af0
ACM
87extern struct tfrc_rx_hist_entry *
88 tfrc_rx_hist_find_data_packet(const struct list_head *list);
85dcb1f7 89
d58d1af0 90extern void tfrc_rx_hist_add_packet(struct list_head *rx_list,
85dcb1f7 91 struct list_head *li_list,
d58d1af0 92 struct tfrc_rx_hist_entry *packet,
85dcb1f7
GR
93 u64 nonloss_seqno);
94
d58d1af0 95extern void tfrc_rx_hist_purge(struct list_head *list);
85dcb1f7 96
8c60f3fa 97static inline int
d58d1af0 98 tfrc_rx_hist_entry_data_packet(const struct tfrc_rx_hist_entry *entry)
8c60f3fa 99{
d58d1af0
ACM
100 return entry->tfrchrx_type == DCCP_PKT_DATA ||
101 entry->tfrchrx_type == DCCP_PKT_DATAACK;
8c60f3fa
ACM
102}
103
d58d1af0 104extern u64 tfrc_rx_hist_detect_loss(struct list_head *rx_list,
29e4f8b3
ACM
105 struct list_head *li_list, u8 *win_loss);
106
8c60f3fa 107#endif /* _DCCP_PKT_HIST_ */
This page took 0.28015 seconds and 5 git commands to generate.