blob: 8c95813bcc6795a89f23e4fcbba1a315421b51e4 [file] [log] [blame]
Andrea Bittau2a91aa32006-03-20 17:41:47 -08001/*
Andrea Bittau2a91aa32006-03-20 17:41:47 -08002 * Copyright (c) 2005, 2006 Andrea Bittau <a.bittau@cs.ucl.ac.uk>
3 *
4 * Changes to meet Linux coding standards, and DCCP infrastructure fixes.
5 *
6 * Copyright (c) 2006 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23/*
Gerrit Renker0e64e942006-10-24 16:17:51 -070024 * This implementation should follow RFC 4341
Andrea Bittau2a91aa32006-03-20 17:41:47 -080025 */
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090026#include <linux/slab.h>
Gerrit Renkere8ef9672008-11-12 00:43:40 -080027#include "../feat.h"
Andrea Bittau2a91aa32006-03-20 17:41:47 -080028#include "ccid2.h"
29
Gerrit Renker84116712006-11-20 18:26:03 -020030
31#ifdef CONFIG_IP_DCCP_CCID2_DEBUG
Andrea Bittau2a91aa32006-03-20 17:41:47 -080032static int ccid2_debug;
Gerrit Renker84116712006-11-20 18:26:03 -020033#define ccid2_pr_debug(format, a...) DCCP_PR_DEBUG(ccid2_debug, format, ##a)
Andrea Bittau2a91aa32006-03-20 17:41:47 -080034#else
Gerrit Renker84116712006-11-20 18:26:03 -020035#define ccid2_pr_debug(format, a...)
Andrea Bittau2a91aa32006-03-20 17:41:47 -080036#endif
37
Gerrit Renker77d2dd92009-10-05 00:53:12 +000038static int ccid2_hc_tx_alloc_seq(struct ccid2_hc_tx_sock *hc)
Andrea Bittau07978aa2006-09-19 13:13:37 -070039{
40 struct ccid2_seq *seqp;
41 int i;
42
43 /* check if we have space to preserve the pointer to the buffer */
Gerrit Renker77d2dd92009-10-05 00:53:12 +000044 if (hc->tx_seqbufc >= (sizeof(hc->tx_seqbuf) /
45 sizeof(struct ccid2_seq *)))
Andrea Bittau07978aa2006-09-19 13:13:37 -070046 return -ENOMEM;
47
48 /* allocate buffer and initialize linked list */
Gerrit Renkercd1f7d32007-10-04 14:41:00 -070049 seqp = kmalloc(CCID2_SEQBUF_LEN * sizeof(struct ccid2_seq), gfp_any());
Andrea Bittau07978aa2006-09-19 13:13:37 -070050 if (seqp == NULL)
51 return -ENOMEM;
52
Gerrit Renkercd1f7d32007-10-04 14:41:00 -070053 for (i = 0; i < (CCID2_SEQBUF_LEN - 1); i++) {
Andrea Bittau07978aa2006-09-19 13:13:37 -070054 seqp[i].ccid2s_next = &seqp[i + 1];
55 seqp[i + 1].ccid2s_prev = &seqp[i];
56 }
Gerrit Renkercd1f7d32007-10-04 14:41:00 -070057 seqp[CCID2_SEQBUF_LEN - 1].ccid2s_next = seqp;
58 seqp->ccid2s_prev = &seqp[CCID2_SEQBUF_LEN - 1];
Andrea Bittau07978aa2006-09-19 13:13:37 -070059
60 /* This is the first allocation. Initiate the head and tail. */
Gerrit Renker77d2dd92009-10-05 00:53:12 +000061 if (hc->tx_seqbufc == 0)
62 hc->tx_seqh = hc->tx_seqt = seqp;
Andrea Bittau07978aa2006-09-19 13:13:37 -070063 else {
64 /* link the existing list with the one we just created */
Gerrit Renker77d2dd92009-10-05 00:53:12 +000065 hc->tx_seqh->ccid2s_next = seqp;
66 seqp->ccid2s_prev = hc->tx_seqh;
Andrea Bittau07978aa2006-09-19 13:13:37 -070067
Gerrit Renker77d2dd92009-10-05 00:53:12 +000068 hc->tx_seqt->ccid2s_prev = &seqp[CCID2_SEQBUF_LEN - 1];
69 seqp[CCID2_SEQBUF_LEN - 1].ccid2s_next = hc->tx_seqt;
Andrea Bittau07978aa2006-09-19 13:13:37 -070070 }
71
72 /* store the original pointer to the buffer so we can free it */
Gerrit Renker77d2dd92009-10-05 00:53:12 +000073 hc->tx_seqbuf[hc->tx_seqbufc] = seqp;
74 hc->tx_seqbufc++;
Andrea Bittau07978aa2006-09-19 13:13:37 -070075
76 return 0;
77}
78
Gerrit Renker6b57c932006-11-28 19:55:06 -020079static int ccid2_hc_tx_send_packet(struct sock *sk, struct sk_buff *skb)
Andrea Bittau2a91aa32006-03-20 17:41:47 -080080{
Gerrit Renker77d2dd92009-10-05 00:53:12 +000081 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
Gerrit Renker410e27a2008-09-09 13:27:22 +020082
Gerrit Renker77d2dd92009-10-05 00:53:12 +000083 if (hc->tx_pipe < hc->tx_cwnd)
Gerrit Renker410e27a2008-09-09 13:27:22 +020084 return 0;
85
86 return 1; /* XXX CCID should dequeue when ready instead of polling */
Andrea Bittau2a91aa32006-03-20 17:41:47 -080087}
88
Gerrit Renkerdf054e12007-11-24 21:32:53 -020089static void ccid2_change_l_ack_ratio(struct sock *sk, u32 val)
Andrea Bittau2a91aa32006-03-20 17:41:47 -080090{
91 struct dccp_sock *dp = dccp_sk(sk);
Gerrit Renkerb1c00fe2009-10-05 00:53:10 +000092 u32 max_ratio = DIV_ROUND_UP(ccid2_hc_tx_sk(sk)->tx_cwnd, 2);
Gerrit Renkerd50ad162007-11-24 21:40:24 -020093
Andrea Bittau2a91aa32006-03-20 17:41:47 -080094 /*
Gerrit Renkerd50ad162007-11-24 21:40:24 -020095 * Ensure that Ack Ratio does not exceed ceil(cwnd/2), which is (2) from
96 * RFC 4341, 6.1.2. We ignore the statement that Ack Ratio 2 is always
97 * acceptable since this causes starvation/deadlock whenever cwnd < 2.
98 * The same problem arises when Ack Ratio is 0 (ie. Ack Ratio disabled).
Andrea Bittau2a91aa32006-03-20 17:41:47 -080099 */
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200100 if (val == 0 || val > max_ratio) {
101 DCCP_WARN("Limiting Ack Ratio (%u) to %u\n", val, max_ratio);
102 val = max_ratio;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800103 }
Gerrit Renkere8ef9672008-11-12 00:43:40 -0800104 if (val > DCCPF_ACK_RATIO_MAX)
105 val = DCCPF_ACK_RATIO_MAX;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800106
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200107 if (val == dp->dccps_l_ack_ratio)
108 return;
109
Gerrit Renkerdf054e12007-11-24 21:32:53 -0200110 ccid2_pr_debug("changing local ack ratio to %u\n", val);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800111 dp->dccps_l_ack_ratio = val;
112}
113
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800114static void ccid2_hc_tx_rto_expire(unsigned long data)
115{
116 struct sock *sk = (struct sock *)data;
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000117 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800118
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800119 bh_lock_sock(sk);
120 if (sock_owned_by_user(sk)) {
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000121 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + HZ / 5);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800122 goto out;
123 }
124
125 ccid2_pr_debug("RTO_EXPIRE\n");
126
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800127 /* back-off timer */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000128 hc->tx_rto <<= 1;
Gerrit Renker231cc2a2010-08-22 19:41:40 +0000129 if (hc->tx_rto > DCCP_RTO_MAX)
130 hc->tx_rto = DCCP_RTO_MAX;
Gerrit Renker410e27a2008-09-09 13:27:22 +0200131
Gerrit Renkerd26eeb02010-08-29 19:23:11 +0000132 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800133
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800134 /* adjust pipe, cwnd etc */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000135 hc->tx_ssthresh = hc->tx_cwnd / 2;
136 if (hc->tx_ssthresh < 2)
137 hc->tx_ssthresh = 2;
Gerrit Renker67b67e32010-08-22 19:41:36 +0000138 hc->tx_cwnd = 1;
139 hc->tx_pipe = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800140
141 /* clear state about stuff we sent */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000142 hc->tx_seqt = hc->tx_seqh;
143 hc->tx_packets_acked = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800144
145 /* clear ack ratio state. */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000146 hc->tx_rpseq = 0;
147 hc->tx_rpdupack = -1;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800148 ccid2_change_l_ack_ratio(sk, 1);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800149out:
150 bh_unlock_sock(sk);
Andrea Bittau77ff72d2006-03-20 17:57:52 -0800151 sock_put(sk);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800152}
153
Gerrit Renker410e27a2008-09-09 13:27:22 +0200154static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800155{
156 struct dccp_sock *dp = dccp_sk(sk);
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000157 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
Andrea Bittau07978aa2006-09-19 13:13:37 -0700158 struct ccid2_seq *next;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800159
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000160 hc->tx_pipe++;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800161
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000162 hc->tx_seqh->ccid2s_seq = dp->dccps_gss;
163 hc->tx_seqh->ccid2s_acked = 0;
Gerrit Renkerd82b6f82010-08-29 19:23:10 +0000164 hc->tx_seqh->ccid2s_sent = ccid2_time_stamp;
Andrea Bittau07978aa2006-09-19 13:13:37 -0700165
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000166 next = hc->tx_seqh->ccid2s_next;
Andrea Bittau07978aa2006-09-19 13:13:37 -0700167 /* check if we need to alloc more space */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000168 if (next == hc->tx_seqt) {
169 if (ccid2_hc_tx_alloc_seq(hc)) {
Gerrit Renker7d9e8932007-10-04 14:41:26 -0700170 DCCP_CRIT("packet history - out of memory!");
171 /* FIXME: find a more graceful way to bail out */
172 return;
173 }
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000174 next = hc->tx_seqh->ccid2s_next;
175 BUG_ON(next == hc->tx_seqt);
Andrea Bittau07978aa2006-09-19 13:13:37 -0700176 }
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000177 hc->tx_seqh = next;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800178
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000179 ccid2_pr_debug("cwnd=%d pipe=%d\n", hc->tx_cwnd, hc->tx_pipe);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800180
Gerrit Renker900bfed2007-11-24 21:58:33 -0200181 /*
182 * FIXME: The code below is broken and the variables have been removed
183 * from the socket struct. The `ackloss' variable was always set to 0,
184 * and with arsent there are several problems:
185 * (i) it doesn't just count the number of Acks, but all sent packets;
186 * (ii) it is expressed in # of packets, not # of windows, so the
187 * comparison below uses the wrong formula: Appendix A of RFC 4341
188 * comes up with the number K = cwnd / (R^2 - R) of consecutive windows
189 * of data with no lost or marked Ack packets. If arsent were the # of
190 * consecutive Acks received without loss, then Ack Ratio needs to be
191 * decreased by 1 when
192 * arsent >= K * cwnd / R = cwnd^2 / (R^3 - R^2)
193 * where cwnd / R is the number of Acks received per window of data
194 * (cf. RFC 4341, App. A). The problems are that
195 * - arsent counts other packets as well;
196 * - the comparison uses a formula different from RFC 4341;
197 * - computing a cubic/quadratic equation each time is too complicated.
198 * Hence a different algorithm is needed.
199 */
200#if 0
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800201 /* Ack Ratio. Need to maintain a concept of how many windows we sent */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000202 hc->tx_arsent++;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800203 /* We had an ack loss in this window... */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000204 if (hc->tx_ackloss) {
205 if (hc->tx_arsent >= hc->tx_cwnd) {
206 hc->tx_arsent = 0;
207 hc->tx_ackloss = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800208 }
Arnaldo Carvalho de Meloc0c736d2006-03-20 22:05:37 -0800209 } else {
210 /* No acks lost up to now... */
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800211 /* decrease ack ratio if enough packets were sent */
212 if (dp->dccps_l_ack_ratio > 1) {
213 /* XXX don't calculate denominator each time */
Arnaldo Carvalho de Meloc0c736d2006-03-20 22:05:37 -0800214 int denom = dp->dccps_l_ack_ratio * dp->dccps_l_ack_ratio -
215 dp->dccps_l_ack_ratio;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800216
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000217 denom = hc->tx_cwnd * hc->tx_cwnd / denom;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800218
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000219 if (hc->tx_arsent >= denom) {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800220 ccid2_change_l_ack_ratio(sk, dp->dccps_l_ack_ratio - 1);
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000221 hc->tx_arsent = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800222 }
Arnaldo Carvalho de Meloc0c736d2006-03-20 22:05:37 -0800223 } else {
224 /* we can't increase ack ratio further [1] */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000225 hc->tx_arsent = 0; /* or maybe set it to cwnd*/
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800226 }
227 }
Gerrit Renker900bfed2007-11-24 21:58:33 -0200228#endif
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800229
Gerrit Renkerd26eeb02010-08-29 19:23:11 +0000230 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto);
Arnaldo Carvalho de Meloc0c736d2006-03-20 22:05:37 -0800231
Andrea Bittau8d424f62006-09-19 13:12:44 -0700232#ifdef CONFIG_IP_DCCP_CCID2_DEBUG
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800233 do {
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000234 struct ccid2_seq *seqp = hc->tx_seqt;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800235
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000236 while (seqp != hc->tx_seqh) {
Gerrit Renkerd82b6f82010-08-29 19:23:10 +0000237 ccid2_pr_debug("out seq=%llu acked=%d time=%u\n",
Arnaldo Carvalho de Melo8109b022006-12-10 16:01:18 -0200238 (unsigned long long)seqp->ccid2s_seq,
Randy Dunlap234af482006-10-29 16:03:30 -0800239 seqp->ccid2s_acked, seqp->ccid2s_sent);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800240 seqp = seqp->ccid2s_next;
241 }
Arnaldo Carvalho de Meloc0c736d2006-03-20 22:05:37 -0800242 } while (0);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800243 ccid2_pr_debug("=========\n");
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800244#endif
245}
246
Gerrit Renker410e27a2008-09-09 13:27:22 +0200247/* XXX Lame code duplication!
248 * returns -1 if none was found.
249 * else returns the next offset to use in the function call.
Gerrit Renker14355622008-09-04 07:30:19 +0200250 */
Gerrit Renker410e27a2008-09-09 13:27:22 +0200251static int ccid2_ackvector(struct sock *sk, struct sk_buff *skb, int offset,
252 unsigned char **vec, unsigned char *veclen)
Gerrit Renker14355622008-09-04 07:30:19 +0200253{
Gerrit Renker410e27a2008-09-09 13:27:22 +0200254 const struct dccp_hdr *dh = dccp_hdr(skb);
255 unsigned char *options = (unsigned char *)dh + dccp_hdr_len(skb);
256 unsigned char *opt_ptr;
257 const unsigned char *opt_end = (unsigned char *)dh +
258 (dh->dccph_doff * 4);
259 unsigned char opt, len;
260 unsigned char *value;
Gerrit Renker14355622008-09-04 07:30:19 +0200261
Gerrit Renker410e27a2008-09-09 13:27:22 +0200262 BUG_ON(offset < 0);
263 options += offset;
264 opt_ptr = options;
265 if (opt_ptr >= opt_end)
266 return -1;
Gerrit Renker14355622008-09-04 07:30:19 +0200267
Gerrit Renker410e27a2008-09-09 13:27:22 +0200268 while (opt_ptr != opt_end) {
269 opt = *opt_ptr++;
270 len = 0;
271 value = NULL;
Gerrit Renker14355622008-09-04 07:30:19 +0200272
Gerrit Renker410e27a2008-09-09 13:27:22 +0200273 /* Check if this isn't a single byte option */
274 if (opt > DCCPO_MAX_RESERVED) {
275 if (opt_ptr == opt_end)
276 goto out_invalid_option;
277
278 len = *opt_ptr++;
279 if (len < 3)
280 goto out_invalid_option;
Gerrit Renker14355622008-09-04 07:30:19 +0200281 /*
Gerrit Renker410e27a2008-09-09 13:27:22 +0200282 * Remove the type and len fields, leaving
283 * just the value size
Gerrit Renker14355622008-09-04 07:30:19 +0200284 */
Gerrit Renker410e27a2008-09-09 13:27:22 +0200285 len -= 2;
286 value = opt_ptr;
287 opt_ptr += len;
Gerrit Renker14355622008-09-04 07:30:19 +0200288
Gerrit Renker410e27a2008-09-09 13:27:22 +0200289 if (opt_ptr > opt_end)
290 goto out_invalid_option;
Gerrit Renker14355622008-09-04 07:30:19 +0200291 }
292
Gerrit Renker410e27a2008-09-09 13:27:22 +0200293 switch (opt) {
294 case DCCPO_ACK_VECTOR_0:
295 case DCCPO_ACK_VECTOR_1:
296 *vec = value;
297 *veclen = len;
298 return offset + (opt_ptr - options);
Gerrit Renker14355622008-09-04 07:30:19 +0200299 }
300 }
301
Gerrit Renker410e27a2008-09-09 13:27:22 +0200302 return -1;
Gerrit Renker14355622008-09-04 07:30:19 +0200303
Gerrit Renker410e27a2008-09-09 13:27:22 +0200304out_invalid_option:
305 DCCP_BUG("Invalid option - this should not happen (previous parsing)!");
306 return -1;
Gerrit Renker14355622008-09-04 07:30:19 +0200307}
308
Gerrit Renker231cc2a2010-08-22 19:41:40 +0000309/**
310 * ccid2_rtt_estimator - Sample RTT and compute RTO using RFC2988 algorithm
311 * This code is almost identical with TCP's tcp_rtt_estimator(), since
312 * - it has a higher sampling frequency (recommended by RFC 1323),
313 * - the RTO does not collapse into RTT due to RTTVAR going towards zero,
314 * - it is simple (cf. more complex proposals such as Eifel timer or research
315 * which suggests that the gain should be set according to window size),
316 * - in tests it was found to work well with CCID2 [gerrit].
317 */
318static void ccid2_rtt_estimator(struct sock *sk, const long mrtt)
319{
320 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
321 long m = mrtt ? : 1;
322
323 if (hc->tx_srtt == 0) {
324 /* First measurement m */
325 hc->tx_srtt = m << 3;
326 hc->tx_mdev = m << 1;
327
328 hc->tx_mdev_max = max(TCP_RTO_MIN, hc->tx_mdev);
329 hc->tx_rttvar = hc->tx_mdev_max;
330 hc->tx_rtt_seq = dccp_sk(sk)->dccps_gss;
331 } else {
332 /* Update scaled SRTT as SRTT += 1/8 * (m - SRTT) */
333 m -= (hc->tx_srtt >> 3);
334 hc->tx_srtt += m;
335
336 /* Similarly, update scaled mdev with regard to |m| */
337 if (m < 0) {
338 m = -m;
339 m -= (hc->tx_mdev >> 2);
340 /*
341 * This neutralises RTO increase when RTT < SRTT - mdev
342 * (see P. Sarolahti, A. Kuznetsov,"Congestion Control
343 * in Linux TCP", USENIX 2002, pp. 49-62).
344 */
345 if (m > 0)
346 m >>= 3;
347 } else {
348 m -= (hc->tx_mdev >> 2);
349 }
350 hc->tx_mdev += m;
351
352 if (hc->tx_mdev > hc->tx_mdev_max) {
353 hc->tx_mdev_max = hc->tx_mdev;
354 if (hc->tx_mdev_max > hc->tx_rttvar)
355 hc->tx_rttvar = hc->tx_mdev_max;
356 }
357
358 /*
359 * Decay RTTVAR at most once per flight, exploiting that
360 * 1) pipe <= cwnd <= Sequence_Window = W (RFC 4340, 7.5.2)
361 * 2) AWL = GSS-W+1 <= GAR <= GSS (RFC 4340, 7.5.1)
362 * GAR is a useful bound for FlightSize = pipe.
363 * AWL is probably too low here, as it over-estimates pipe.
364 */
365 if (after48(dccp_sk(sk)->dccps_gar, hc->tx_rtt_seq)) {
366 if (hc->tx_mdev_max < hc->tx_rttvar)
367 hc->tx_rttvar -= (hc->tx_rttvar -
368 hc->tx_mdev_max) >> 2;
369 hc->tx_rtt_seq = dccp_sk(sk)->dccps_gss;
370 hc->tx_mdev_max = TCP_RTO_MIN;
371 }
372 }
373
374 /*
375 * Set RTO from SRTT and RTTVAR
376 * As in TCP, 4 * RTTVAR >= TCP_RTO_MIN, giving a minimum RTO of 200 ms.
377 * This agrees with RFC 4341, 5:
378 * "Because DCCP does not retransmit data, DCCP does not require
379 * TCP's recommended minimum timeout of one second".
380 */
381 hc->tx_rto = (hc->tx_srtt >> 3) + hc->tx_rttvar;
382
383 if (hc->tx_rto > DCCP_RTO_MAX)
384 hc->tx_rto = DCCP_RTO_MAX;
385}
386
387static void ccid2_new_ack(struct sock *sk, struct ccid2_seq *seqp,
388 unsigned int *maxincr)
Gerrit Renker410e27a2008-09-09 13:27:22 +0200389{
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000390 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
Gerrit Renker410e27a2008-09-09 13:27:22 +0200391
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000392 if (hc->tx_cwnd < hc->tx_ssthresh) {
393 if (*maxincr > 0 && ++hc->tx_packets_acked == 2) {
394 hc->tx_cwnd += 1;
395 *maxincr -= 1;
396 hc->tx_packets_acked = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800397 }
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000398 } else if (++hc->tx_packets_acked >= hc->tx_cwnd) {
399 hc->tx_cwnd += 1;
400 hc->tx_packets_acked = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800401 }
Gerrit Renker231cc2a2010-08-22 19:41:40 +0000402 /*
403 * FIXME: RTT is sampled several times per acknowledgment (for each
404 * entry in the Ack Vector), instead of once per Ack (as in TCP SACK).
405 * This causes the RTT to be over-estimated, since the older entries
406 * in the Ack Vector have earlier sending times.
407 * The cleanest solution is to not use the ccid2s_sent field at all
408 * and instead use DCCP timestamps: requires changes in other places.
409 */
Gerrit Renkerd82b6f82010-08-29 19:23:10 +0000410 ccid2_rtt_estimator(sk, ccid2_time_stamp - seqp->ccid2s_sent);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800411}
412
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200413static void ccid2_congestion_event(struct sock *sk, struct ccid2_seq *seqp)
Andrea Bittau374bcf32006-09-19 13:14:43 -0700414{
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000415 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200416
Gerrit Renkerd82b6f82010-08-29 19:23:10 +0000417 if ((s32)(seqp->ccid2s_sent - hc->tx_last_cong) < 0) {
Andrea Bittau374bcf32006-09-19 13:14:43 -0700418 ccid2_pr_debug("Multiple losses in an RTT---treating as one\n");
419 return;
420 }
421
Gerrit Renkerd82b6f82010-08-29 19:23:10 +0000422 hc->tx_last_cong = ccid2_time_stamp;
Andrea Bittau374bcf32006-09-19 13:14:43 -0700423
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000424 hc->tx_cwnd = hc->tx_cwnd / 2 ? : 1U;
425 hc->tx_ssthresh = max(hc->tx_cwnd, 2U);
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200426
427 /* Avoid spurious timeouts resulting from Ack Ratio > cwnd */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000428 if (dccp_sk(sk)->dccps_l_ack_ratio > hc->tx_cwnd)
429 ccid2_change_l_ack_ratio(sk, hc->tx_cwnd);
Gerrit Renkerc8bf4622008-09-04 07:30:19 +0200430}
431
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800432static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
433{
434 struct dccp_sock *dp = dccp_sk(sk);
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000435 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800436 u64 ackno, seqno;
437 struct ccid2_seq *seqp;
Gerrit Renker410e27a2008-09-09 13:27:22 +0200438 unsigned char *vector;
439 unsigned char veclen;
440 int offset = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800441 int done = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800442 unsigned int maxincr = 0;
443
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800444 /* check reverse path congestion */
445 seqno = DCCP_SKB_CB(skb)->dccpd_seq;
446
447 /* XXX this whole "algorithm" is broken. Need to fix it to keep track
448 * of the seqnos of the dupacks so that rpseq and rpdupack are correct
449 * -sorbo.
450 */
451 /* need to bootstrap */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000452 if (hc->tx_rpdupack == -1) {
453 hc->tx_rpdupack = 0;
454 hc->tx_rpseq = seqno;
Arnaldo Carvalho de Meloc0c736d2006-03-20 22:05:37 -0800455 } else {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800456 /* check if packet is consecutive */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000457 if (dccp_delta_seqno(hc->tx_rpseq, seqno) == 1)
458 hc->tx_rpseq = seqno;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800459 /* it's a later packet */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000460 else if (after48(seqno, hc->tx_rpseq)) {
461 hc->tx_rpdupack++;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800462
463 /* check if we got enough dupacks */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000464 if (hc->tx_rpdupack >= NUMDUPACK) {
465 hc->tx_rpdupack = -1; /* XXX lame */
466 hc->tx_rpseq = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800467
Gerrit Renkerdf054e12007-11-24 21:32:53 -0200468 ccid2_change_l_ack_ratio(sk, 2 * dp->dccps_l_ack_ratio);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800469 }
470 }
471 }
472
473 /* check forward path congestion */
Gerrit Renker410e27a2008-09-09 13:27:22 +0200474 /* still didn't send out new data packets */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000475 if (hc->tx_seqh == hc->tx_seqt)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800476 return;
477
Gerrit Renker410e27a2008-09-09 13:27:22 +0200478 switch (DCCP_SKB_CB(skb)->dccpd_type) {
479 case DCCP_PKT_ACK:
480 case DCCP_PKT_DATAACK:
481 break;
482 default:
483 return;
484 }
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800485
486 ackno = DCCP_SKB_CB(skb)->dccpd_ack_seq;
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000487 if (after48(ackno, hc->tx_high_ack))
488 hc->tx_high_ack = ackno;
Andrea Bittau32aac182006-11-16 14:28:40 -0200489
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000490 seqp = hc->tx_seqt;
Andrea Bittau32aac182006-11-16 14:28:40 -0200491 while (before48(seqp->ccid2s_seq, ackno)) {
492 seqp = seqp->ccid2s_next;
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000493 if (seqp == hc->tx_seqh) {
494 seqp = hc->tx_seqh->ccid2s_prev;
Andrea Bittau32aac182006-11-16 14:28:40 -0200495 break;
496 }
497 }
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800498
Gerrit Renkera3020022007-11-24 22:10:29 -0200499 /*
500 * In slow-start, cwnd can increase up to a maximum of Ack Ratio/2
501 * packets per acknowledgement. Rounding up avoids that cwnd is not
502 * advanced when Ack Ratio is 1 and gives a slight edge otherwise.
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800503 */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000504 if (hc->tx_cwnd < hc->tx_ssthresh)
Gerrit Renkera3020022007-11-24 22:10:29 -0200505 maxincr = DIV_ROUND_UP(dp->dccps_l_ack_ratio, 2);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800506
507 /* go through all ack vectors */
Gerrit Renker410e27a2008-09-09 13:27:22 +0200508 while ((offset = ccid2_ackvector(sk, skb, offset,
509 &vector, &veclen)) != -1) {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800510 /* go through this ack vector */
Gerrit Renker410e27a2008-09-09 13:27:22 +0200511 while (veclen--) {
512 const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK;
513 u64 ackno_end_rl = SUB48(ackno, rl);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800514
Gerrit Renker410e27a2008-09-09 13:27:22 +0200515 ccid2_pr_debug("ackvec start:%llu end:%llu\n",
Randy Dunlap234af482006-10-29 16:03:30 -0800516 (unsigned long long)ackno,
Gerrit Renker410e27a2008-09-09 13:27:22 +0200517 (unsigned long long)ackno_end_rl);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800518 /* if the seqno we are analyzing is larger than the
519 * current ackno, then move towards the tail of our
520 * seqnos.
521 */
522 while (after48(seqp->ccid2s_seq, ackno)) {
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000523 if (seqp == hc->tx_seqt) {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800524 done = 1;
525 break;
526 }
527 seqp = seqp->ccid2s_prev;
528 }
529 if (done)
530 break;
531
532 /* check all seqnos in the range of the vector
533 * run length
534 */
535 while (between48(seqp->ccid2s_seq,ackno_end_rl,ackno)) {
Gerrit Renker410e27a2008-09-09 13:27:22 +0200536 const u8 state = *vector &
537 DCCP_ACKVEC_STATE_MASK;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800538
539 /* new packet received or marked */
Gerrit Renker410e27a2008-09-09 13:27:22 +0200540 if (state != DCCP_ACKVEC_STATE_NOT_RECEIVED &&
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800541 !seqp->ccid2s_acked) {
Gerrit Renker410e27a2008-09-09 13:27:22 +0200542 if (state ==
543 DCCP_ACKVEC_STATE_ECN_MARKED) {
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200544 ccid2_congestion_event(sk,
Andrea Bittau374bcf32006-09-19 13:14:43 -0700545 seqp);
Gerrit Renker410e27a2008-09-09 13:27:22 +0200546 } else
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800547 ccid2_new_ack(sk, seqp,
548 &maxincr);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800549
550 seqp->ccid2s_acked = 1;
551 ccid2_pr_debug("Got ack for %llu\n",
Randy Dunlap234af482006-10-29 16:03:30 -0800552 (unsigned long long)seqp->ccid2s_seq);
Gerrit Renkerc38c92a2010-08-22 19:41:39 +0000553 hc->tx_pipe--;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800554 }
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000555 if (seqp == hc->tx_seqt) {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800556 done = 1;
557 break;
558 }
Gerrit Renker3de54892007-11-24 20:37:48 -0200559 seqp = seqp->ccid2s_prev;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800560 }
561 if (done)
562 break;
563
Gerrit Renkercfbbeab2007-11-24 20:43:59 -0200564 ackno = SUB48(ackno_end_rl, 1);
Gerrit Renker410e27a2008-09-09 13:27:22 +0200565 vector++;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800566 }
567 if (done)
568 break;
569 }
570
571 /* The state about what is acked should be correct now
572 * Check for NUMDUPACK
573 */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000574 seqp = hc->tx_seqt;
575 while (before48(seqp->ccid2s_seq, hc->tx_high_ack)) {
Andrea Bittau32aac182006-11-16 14:28:40 -0200576 seqp = seqp->ccid2s_next;
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000577 if (seqp == hc->tx_seqh) {
578 seqp = hc->tx_seqh->ccid2s_prev;
Andrea Bittau32aac182006-11-16 14:28:40 -0200579 break;
580 }
581 }
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800582 done = 0;
583 while (1) {
584 if (seqp->ccid2s_acked) {
585 done++;
Gerrit Renker63df18a2007-11-24 22:04:35 -0200586 if (done == NUMDUPACK)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800587 break;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800588 }
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000589 if (seqp == hc->tx_seqt)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800590 break;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800591 seqp = seqp->ccid2s_prev;
592 }
593
594 /* If there are at least 3 acknowledgements, anything unacknowledged
595 * below the last sequence number is considered lost
596 */
Gerrit Renker63df18a2007-11-24 22:04:35 -0200597 if (done == NUMDUPACK) {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800598 struct ccid2_seq *last_acked = seqp;
599
600 /* check for lost packets */
601 while (1) {
602 if (!seqp->ccid2s_acked) {
Andrea Bittau374bcf32006-09-19 13:14:43 -0700603 ccid2_pr_debug("Packet lost: %llu\n",
Randy Dunlap234af482006-10-29 16:03:30 -0800604 (unsigned long long)seqp->ccid2s_seq);
Andrea Bittau374bcf32006-09-19 13:14:43 -0700605 /* XXX need to traverse from tail -> head in
606 * order to detect multiple congestion events in
607 * one ack vector.
608 */
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200609 ccid2_congestion_event(sk, seqp);
Gerrit Renkerc38c92a2010-08-22 19:41:39 +0000610 hc->tx_pipe--;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800611 }
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000612 if (seqp == hc->tx_seqt)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800613 break;
614 seqp = seqp->ccid2s_prev;
615 }
616
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000617 hc->tx_seqt = last_acked;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800618 }
619
620 /* trim acked packets in tail */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000621 while (hc->tx_seqt != hc->tx_seqh) {
622 if (!hc->tx_seqt->ccid2s_acked)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800623 break;
624
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000625 hc->tx_seqt = hc->tx_seqt->ccid2s_next;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800626 }
Gerrit Renkerc38c92a2010-08-22 19:41:39 +0000627
628 /* restart RTO timer if not all outstanding data has been acked */
629 if (hc->tx_pipe == 0)
630 sk_stop_timer(sk, &hc->tx_rtotimer);
631 else
632 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800633}
634
Arnaldo Carvalho de Melo91f0ebf2006-03-20 19:21:44 -0800635static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800636{
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000637 struct ccid2_hc_tx_sock *hc = ccid_priv(ccid);
Gerrit Renkerb00d2bb2007-11-24 21:44:30 -0200638 struct dccp_sock *dp = dccp_sk(sk);
639 u32 max_ratio;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800640
Gerrit Renkerb00d2bb2007-11-24 21:44:30 -0200641 /* RFC 4341, 5: initialise ssthresh to arbitrarily high (max) value */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000642 hc->tx_ssthresh = ~0U;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800643
Gerrit Renker410e27a2008-09-09 13:27:22 +0200644 /*
645 * RFC 4341, 5: "The cwnd parameter is initialized to at most four
646 * packets for new connections, following the rules from [RFC3390]".
647 * We need to convert the bytes of RFC3390 into the packets of RFC 4341.
648 */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000649 hc->tx_cwnd = clamp(4380U / dp->dccps_mss_cache, 2U, 4U);
Gerrit Renkerb00d2bb2007-11-24 21:44:30 -0200650
651 /* Make sure that Ack Ratio is enabled and within bounds. */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000652 max_ratio = DIV_ROUND_UP(hc->tx_cwnd, 2);
Gerrit Renkerb00d2bb2007-11-24 21:44:30 -0200653 if (dp->dccps_l_ack_ratio == 0 || dp->dccps_l_ack_ratio > max_ratio)
654 dp->dccps_l_ack_ratio = max_ratio;
655
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800656 /* XXX init ~ to window size... */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000657 if (ccid2_hc_tx_alloc_seq(hc))
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800658 return -ENOMEM;
Arnaldo Carvalho de Melo91f0ebf2006-03-20 19:21:44 -0800659
Gerrit Renker231cc2a2010-08-22 19:41:40 +0000660 hc->tx_rto = DCCP_TIMEOUT_INIT;
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000661 hc->tx_rpdupack = -1;
Gerrit Renkerd82b6f82010-08-29 19:23:10 +0000662 hc->tx_last_cong = ccid2_time_stamp;
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000663 setup_timer(&hc->tx_rtotimer, ccid2_hc_tx_rto_expire,
Gerrit Renker410e27a2008-09-09 13:27:22 +0200664 (unsigned long)sk);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800665 return 0;
666}
667
668static void ccid2_hc_tx_exit(struct sock *sk)
669{
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000670 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
Andrea Bittau07978aa2006-09-19 13:13:37 -0700671 int i;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800672
Gerrit Renkerd26eeb02010-08-29 19:23:11 +0000673 sk_stop_timer(sk, &hc->tx_rtotimer);
Andrea Bittau07978aa2006-09-19 13:13:37 -0700674
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000675 for (i = 0; i < hc->tx_seqbufc; i++)
676 kfree(hc->tx_seqbuf[i]);
677 hc->tx_seqbufc = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800678}
679
680static void ccid2_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
681{
682 const struct dccp_sock *dp = dccp_sk(sk);
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000683 struct ccid2_hc_rx_sock *hc = ccid2_hc_rx_sk(sk);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800684
685 switch (DCCP_SKB_CB(skb)->dccpd_type) {
686 case DCCP_PKT_DATA:
687 case DCCP_PKT_DATAACK:
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000688 hc->rx_data++;
689 if (hc->rx_data >= dp->dccps_r_ack_ratio) {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800690 dccp_send_ack(sk);
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000691 hc->rx_data = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800692 }
693 break;
694 }
695}
696
Gerrit Renkerddebc972009-01-04 21:42:53 -0800697struct ccid_operations ccid2_ops = {
Gerrit Renker410e27a2008-09-09 13:27:22 +0200698 .ccid_id = DCCPC_CCID2,
699 .ccid_name = "TCP-like",
Gerrit Renker410e27a2008-09-09 13:27:22 +0200700 .ccid_hc_tx_obj_size = sizeof(struct ccid2_hc_tx_sock),
701 .ccid_hc_tx_init = ccid2_hc_tx_init,
702 .ccid_hc_tx_exit = ccid2_hc_tx_exit,
703 .ccid_hc_tx_send_packet = ccid2_hc_tx_send_packet,
704 .ccid_hc_tx_packet_sent = ccid2_hc_tx_packet_sent,
705 .ccid_hc_tx_packet_recv = ccid2_hc_tx_packet_recv,
706 .ccid_hc_rx_obj_size = sizeof(struct ccid2_hc_rx_sock),
707 .ccid_hc_rx_packet_recv = ccid2_hc_rx_packet_recv,
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800708};
709
Gerrit Renker84116712006-11-20 18:26:03 -0200710#ifdef CONFIG_IP_DCCP_CCID2_DEBUG
Gerrit Renker43264992008-08-23 13:28:27 +0200711module_param(ccid2_debug, bool, 0644);
Gerrit Renkerddebc972009-01-04 21:42:53 -0800712MODULE_PARM_DESC(ccid2_debug, "Enable CCID-2 debug messages");
Gerrit Renker84116712006-11-20 18:26:03 -0200713#endif