1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
/* $KAME: dccp_tcplike.h,v 1.10 2005/07/22 09:31:14 nishida Exp $ */
/* $NetBSD: dccp_tcplike.h,v 1.3 2019/06/04 10:15:22 msaitoh Exp $ */
/*
* Copyright (c) 2003 Magnus Erixzon
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Headerfile for TCP-like congestion control for DCCP
*/
#ifndef _NETINET_DCCP_TCPLIKE_H_
#define _NETINET_DCCP_TCPLIKE_H_
/*
* TCPlike sender
*/
/* Parameter to decide when a packet is considered lost */
#define TCPLIKE_NUMDUPACK 3
/* Upperbound timeout value */
#define TIMEOUT_UBOUND (30 * hz)
#define TCPLIKE_MIN_RTT (hz >> 3)
#define TCPLIKE_INITIAL_CWND 3
#define TCPLIKE_INITIAL_CWNDVECTOR 512
/* TCPlike sender congestion control block (ccb) */
struct tcplike_send_ccb
{
kmutex_t mutex;
struct dccpcb *pcb; /* Pointer to associated dccpcb */
dccp_seq cwnd; /* congestion window */
dccp_seq ssthresh;
dccp_seq oldcwnd_ts; /* old cwnd tail seqnr */
u_int16_t rtt; /* estimated round trip-time */
u_int16_t rto; /* Timeout value */
u_int16_t rtt_d;
int16_t outstanding; /* Number of unacked packets sent */
u_int16_t rcvr_ackratio; /* Receiver ack ratio */
u_int16_t acked_in_win; /* No of acked packets in the window */
u_int8_t acked_windows; /* No of acked windows with no lost Acks */
u_int32_t ack_last; /* Last ok Ack packet */
u_int32_t ack_miss; /* oldest missing Ack packet */
struct callout free_timer;
struct callout rto_timer;
u_int rto_timer_callout;
u_char *cwndvector; /* 2 bits per packet */
u_char *cv_hp; /* head ptr for cwndvector */
u_int16_t cv_size;
dccp_seq cv_hs, cv_ts; /* lowest/highest seq no in cwndvector */
u_int8_t sample_rtt;
u_int32_t timestamp;
dccp_seq rcvd_ack, lost_ack;
};
#ifdef _KERNEL
/* Functions declared in struct dccp_cc_sw */
/*
* Initialises the sender side
* args: pcb - pointer to dccpcb of associated connection
* returns: pointer to a tcplike_send_ccb struct on success, otherwise 0
*/
void *tcplike_send_init(struct dccpcb *);
/*
* Free the sender side
* args: ccb - ccb of sender
*/
void tcplike_send_free(void *);
/*
* Ask TCPlike wheter one can send a packet or not
* args: ccb - ccb block for current connection
* returns: 0 if ok, else <> 0.
*/
int tcplike_send_packet(void *, long);
void tcplike_send_packet_sent(void *, int, long);
/*
* Notify that an ack package was received
* args: ccb - ccb block for current connection
*/
void tcplike_send_packet_recv(void *, char *, int);
#endif
/*
* TFRC Receiver
*/
struct ack_list
{
u_int64_t localseq, ackthru;
struct ack_list *next;
};
/* TCPlike receiver congestion control block (ccb) */
struct tcplike_recv_ccb {
kmutex_t mutex;
struct dccpcb *pcb; /* Pointer to associated dccpcb */
/* No ack ratio or vector here. it's a global feature */
struct ack_list *av_list;
u_int16_t unacked; /* no of unacked packets */
struct callout free_timer;
};
#ifdef _KERNEL
/* Functions declared in struct dccp_cc_sw */
/*
* Initialises the receiver side
* args: pcb - pointer to dccpcb of associated connection
* returns: pointer to a tcplike_recv_ccb struct on success, otherwise 0
*/
void *tcplike_recv_init(struct dccpcb *);
/*
* Free the receiver side
* args: ccb - ccb of receiver
*/
void tcplike_recv_free(void *);
/*
* Tell TCPlike that a packet has been received
* args: ccb - ccb block for current connection
*/
void tcplike_recv_packet_recv(void *, char *, int);
/*
int tcplike_option_recv(void);
*/
#endif
#endif
|