blob: dc18172b1e5911637ab47c83ade8b2425db358ef [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
Gerrit Renker4886fca2010-08-29 19:23:13 +0000328 hc->tx_mdev_max = max(hc->tx_mdev, tcp_rto_min(sk));
Gerrit Renker231cc2a2010-08-22 19:41:40 +0000329 hc->tx_rttvar = hc->tx_mdev_max;
Gerrit Renker4886fca2010-08-29 19:23:13 +0000330
Gerrit Renker231cc2a2010-08-22 19:41:40 +0000331 hc->tx_rtt_seq = dccp_sk(sk)->dccps_gss;
332 } else {
333 /* Update scaled SRTT as SRTT += 1/8 * (m - SRTT) */
334 m -= (hc->tx_srtt >> 3);
335 hc->tx_srtt += m;
336
337 /* Similarly, update scaled mdev with regard to |m| */
338 if (m < 0) {
339 m = -m;
340 m -= (hc->tx_mdev >> 2);
341 /*
342 * This neutralises RTO increase when RTT < SRTT - mdev
343 * (see P. Sarolahti, A. Kuznetsov,"Congestion Control
344 * in Linux TCP", USENIX 2002, pp. 49-62).
345 */
346 if (m > 0)
347 m >>= 3;
348 } else {
349 m -= (hc->tx_mdev >> 2);
350 }
351 hc->tx_mdev += m;
352
353 if (hc->tx_mdev > hc->tx_mdev_max) {
354 hc->tx_mdev_max = hc->tx_mdev;
355 if (hc->tx_mdev_max > hc->tx_rttvar)
356 hc->tx_rttvar = hc->tx_mdev_max;
357 }
358
359 /*
360 * Decay RTTVAR at most once per flight, exploiting that
361 * 1) pipe <= cwnd <= Sequence_Window = W (RFC 4340, 7.5.2)
362 * 2) AWL = GSS-W+1 <= GAR <= GSS (RFC 4340, 7.5.1)
363 * GAR is a useful bound for FlightSize = pipe.
364 * AWL is probably too low here, as it over-estimates pipe.
365 */
366 if (after48(dccp_sk(sk)->dccps_gar, hc->tx_rtt_seq)) {
367 if (hc->tx_mdev_max < hc->tx_rttvar)
368 hc->tx_rttvar -= (hc->tx_rttvar -
369 hc->tx_mdev_max) >> 2;
370 hc->tx_rtt_seq = dccp_sk(sk)->dccps_gss;
Gerrit Renker4886fca2010-08-29 19:23:13 +0000371 hc->tx_mdev_max = tcp_rto_min(sk);
Gerrit Renker231cc2a2010-08-22 19:41:40 +0000372 }
373 }
374
375 /*
376 * Set RTO from SRTT and RTTVAR
377 * As in TCP, 4 * RTTVAR >= TCP_RTO_MIN, giving a minimum RTO of 200 ms.
378 * This agrees with RFC 4341, 5:
379 * "Because DCCP does not retransmit data, DCCP does not require
380 * TCP's recommended minimum timeout of one second".
381 */
382 hc->tx_rto = (hc->tx_srtt >> 3) + hc->tx_rttvar;
383
384 if (hc->tx_rto > DCCP_RTO_MAX)
385 hc->tx_rto = DCCP_RTO_MAX;
386}
387
388static void ccid2_new_ack(struct sock *sk, struct ccid2_seq *seqp,
389 unsigned int *maxincr)
Gerrit Renker410e27a2008-09-09 13:27:22 +0200390{
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000391 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
Gerrit Renker410e27a2008-09-09 13:27:22 +0200392
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000393 if (hc->tx_cwnd < hc->tx_ssthresh) {
394 if (*maxincr > 0 && ++hc->tx_packets_acked == 2) {
395 hc->tx_cwnd += 1;
396 *maxincr -= 1;
397 hc->tx_packets_acked = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800398 }
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000399 } else if (++hc->tx_packets_acked >= hc->tx_cwnd) {
400 hc->tx_cwnd += 1;
401 hc->tx_packets_acked = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800402 }
Gerrit Renker231cc2a2010-08-22 19:41:40 +0000403 /*
404 * FIXME: RTT is sampled several times per acknowledgment (for each
405 * entry in the Ack Vector), instead of once per Ack (as in TCP SACK).
406 * This causes the RTT to be over-estimated, since the older entries
407 * in the Ack Vector have earlier sending times.
408 * The cleanest solution is to not use the ccid2s_sent field at all
409 * and instead use DCCP timestamps: requires changes in other places.
410 */
Gerrit Renkerd82b6f82010-08-29 19:23:10 +0000411 ccid2_rtt_estimator(sk, ccid2_time_stamp - seqp->ccid2s_sent);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800412}
413
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200414static void ccid2_congestion_event(struct sock *sk, struct ccid2_seq *seqp)
Andrea Bittau374bcf32006-09-19 13:14:43 -0700415{
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000416 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200417
Gerrit Renkerd82b6f82010-08-29 19:23:10 +0000418 if ((s32)(seqp->ccid2s_sent - hc->tx_last_cong) < 0) {
Andrea Bittau374bcf32006-09-19 13:14:43 -0700419 ccid2_pr_debug("Multiple losses in an RTT---treating as one\n");
420 return;
421 }
422
Gerrit Renkerd82b6f82010-08-29 19:23:10 +0000423 hc->tx_last_cong = ccid2_time_stamp;
Andrea Bittau374bcf32006-09-19 13:14:43 -0700424
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000425 hc->tx_cwnd = hc->tx_cwnd / 2 ? : 1U;
426 hc->tx_ssthresh = max(hc->tx_cwnd, 2U);
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200427
428 /* Avoid spurious timeouts resulting from Ack Ratio > cwnd */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000429 if (dccp_sk(sk)->dccps_l_ack_ratio > hc->tx_cwnd)
430 ccid2_change_l_ack_ratio(sk, hc->tx_cwnd);
Gerrit Renkerc8bf4622008-09-04 07:30:19 +0200431}
432
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800433static void ccid2_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
434{
435 struct dccp_sock *dp = dccp_sk(sk);
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000436 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800437 u64 ackno, seqno;
438 struct ccid2_seq *seqp;
Gerrit Renker410e27a2008-09-09 13:27:22 +0200439 unsigned char *vector;
440 unsigned char veclen;
441 int offset = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800442 int done = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800443 unsigned int maxincr = 0;
444
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800445 /* check reverse path congestion */
446 seqno = DCCP_SKB_CB(skb)->dccpd_seq;
447
448 /* XXX this whole "algorithm" is broken. Need to fix it to keep track
449 * of the seqnos of the dupacks so that rpseq and rpdupack are correct
450 * -sorbo.
451 */
452 /* need to bootstrap */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000453 if (hc->tx_rpdupack == -1) {
454 hc->tx_rpdupack = 0;
455 hc->tx_rpseq = seqno;
Arnaldo Carvalho de Meloc0c736d2006-03-20 22:05:37 -0800456 } else {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800457 /* check if packet is consecutive */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000458 if (dccp_delta_seqno(hc->tx_rpseq, seqno) == 1)
459 hc->tx_rpseq = seqno;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800460 /* it's a later packet */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000461 else if (after48(seqno, hc->tx_rpseq)) {
462 hc->tx_rpdupack++;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800463
464 /* check if we got enough dupacks */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000465 if (hc->tx_rpdupack >= NUMDUPACK) {
466 hc->tx_rpdupack = -1; /* XXX lame */
467 hc->tx_rpseq = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800468
Gerrit Renkerdf054e12007-11-24 21:32:53 -0200469 ccid2_change_l_ack_ratio(sk, 2 * dp->dccps_l_ack_ratio);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800470 }
471 }
472 }
473
474 /* check forward path congestion */
Gerrit Renker410e27a2008-09-09 13:27:22 +0200475 /* still didn't send out new data packets */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000476 if (hc->tx_seqh == hc->tx_seqt)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800477 return;
478
Gerrit Renker410e27a2008-09-09 13:27:22 +0200479 switch (DCCP_SKB_CB(skb)->dccpd_type) {
480 case DCCP_PKT_ACK:
481 case DCCP_PKT_DATAACK:
482 break;
483 default:
484 return;
485 }
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800486
487 ackno = DCCP_SKB_CB(skb)->dccpd_ack_seq;
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000488 if (after48(ackno, hc->tx_high_ack))
489 hc->tx_high_ack = ackno;
Andrea Bittau32aac182006-11-16 14:28:40 -0200490
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000491 seqp = hc->tx_seqt;
Andrea Bittau32aac182006-11-16 14:28:40 -0200492 while (before48(seqp->ccid2s_seq, ackno)) {
493 seqp = seqp->ccid2s_next;
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000494 if (seqp == hc->tx_seqh) {
495 seqp = hc->tx_seqh->ccid2s_prev;
Andrea Bittau32aac182006-11-16 14:28:40 -0200496 break;
497 }
498 }
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800499
Gerrit Renkera3020022007-11-24 22:10:29 -0200500 /*
501 * In slow-start, cwnd can increase up to a maximum of Ack Ratio/2
502 * packets per acknowledgement. Rounding up avoids that cwnd is not
503 * advanced when Ack Ratio is 1 and gives a slight edge otherwise.
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800504 */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000505 if (hc->tx_cwnd < hc->tx_ssthresh)
Gerrit Renkera3020022007-11-24 22:10:29 -0200506 maxincr = DIV_ROUND_UP(dp->dccps_l_ack_ratio, 2);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800507
508 /* go through all ack vectors */
Gerrit Renker410e27a2008-09-09 13:27:22 +0200509 while ((offset = ccid2_ackvector(sk, skb, offset,
510 &vector, &veclen)) != -1) {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800511 /* go through this ack vector */
Gerrit Renker410e27a2008-09-09 13:27:22 +0200512 while (veclen--) {
513 const u8 rl = *vector & DCCP_ACKVEC_LEN_MASK;
514 u64 ackno_end_rl = SUB48(ackno, rl);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800515
Gerrit Renker410e27a2008-09-09 13:27:22 +0200516 ccid2_pr_debug("ackvec start:%llu end:%llu\n",
Randy Dunlap234af482006-10-29 16:03:30 -0800517 (unsigned long long)ackno,
Gerrit Renker410e27a2008-09-09 13:27:22 +0200518 (unsigned long long)ackno_end_rl);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800519 /* if the seqno we are analyzing is larger than the
520 * current ackno, then move towards the tail of our
521 * seqnos.
522 */
523 while (after48(seqp->ccid2s_seq, ackno)) {
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000524 if (seqp == hc->tx_seqt) {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800525 done = 1;
526 break;
527 }
528 seqp = seqp->ccid2s_prev;
529 }
530 if (done)
531 break;
532
533 /* check all seqnos in the range of the vector
534 * run length
535 */
536 while (between48(seqp->ccid2s_seq,ackno_end_rl,ackno)) {
Gerrit Renker410e27a2008-09-09 13:27:22 +0200537 const u8 state = *vector &
538 DCCP_ACKVEC_STATE_MASK;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800539
540 /* new packet received or marked */
Gerrit Renker410e27a2008-09-09 13:27:22 +0200541 if (state != DCCP_ACKVEC_STATE_NOT_RECEIVED &&
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800542 !seqp->ccid2s_acked) {
Gerrit Renker410e27a2008-09-09 13:27:22 +0200543 if (state ==
544 DCCP_ACKVEC_STATE_ECN_MARKED) {
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200545 ccid2_congestion_event(sk,
Andrea Bittau374bcf32006-09-19 13:14:43 -0700546 seqp);
Gerrit Renker410e27a2008-09-09 13:27:22 +0200547 } else
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800548 ccid2_new_ack(sk, seqp,
549 &maxincr);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800550
551 seqp->ccid2s_acked = 1;
552 ccid2_pr_debug("Got ack for %llu\n",
Randy Dunlap234af482006-10-29 16:03:30 -0800553 (unsigned long long)seqp->ccid2s_seq);
Gerrit Renkerc38c92a2010-08-22 19:41:39 +0000554 hc->tx_pipe--;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800555 }
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000556 if (seqp == hc->tx_seqt) {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800557 done = 1;
558 break;
559 }
Gerrit Renker3de54892007-11-24 20:37:48 -0200560 seqp = seqp->ccid2s_prev;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800561 }
562 if (done)
563 break;
564
Gerrit Renkercfbbeab2007-11-24 20:43:59 -0200565 ackno = SUB48(ackno_end_rl, 1);
Gerrit Renker410e27a2008-09-09 13:27:22 +0200566 vector++;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800567 }
568 if (done)
569 break;
570 }
571
572 /* The state about what is acked should be correct now
573 * Check for NUMDUPACK
574 */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000575 seqp = hc->tx_seqt;
576 while (before48(seqp->ccid2s_seq, hc->tx_high_ack)) {
Andrea Bittau32aac182006-11-16 14:28:40 -0200577 seqp = seqp->ccid2s_next;
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000578 if (seqp == hc->tx_seqh) {
579 seqp = hc->tx_seqh->ccid2s_prev;
Andrea Bittau32aac182006-11-16 14:28:40 -0200580 break;
581 }
582 }
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800583 done = 0;
584 while (1) {
585 if (seqp->ccid2s_acked) {
586 done++;
Gerrit Renker63df18a2007-11-24 22:04:35 -0200587 if (done == NUMDUPACK)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800588 break;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800589 }
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000590 if (seqp == hc->tx_seqt)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800591 break;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800592 seqp = seqp->ccid2s_prev;
593 }
594
595 /* If there are at least 3 acknowledgements, anything unacknowledged
596 * below the last sequence number is considered lost
597 */
Gerrit Renker63df18a2007-11-24 22:04:35 -0200598 if (done == NUMDUPACK) {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800599 struct ccid2_seq *last_acked = seqp;
600
601 /* check for lost packets */
602 while (1) {
603 if (!seqp->ccid2s_acked) {
Andrea Bittau374bcf32006-09-19 13:14:43 -0700604 ccid2_pr_debug("Packet lost: %llu\n",
Randy Dunlap234af482006-10-29 16:03:30 -0800605 (unsigned long long)seqp->ccid2s_seq);
Andrea Bittau374bcf32006-09-19 13:14:43 -0700606 /* XXX need to traverse from tail -> head in
607 * order to detect multiple congestion events in
608 * one ack vector.
609 */
Gerrit Renkerd50ad162007-11-24 21:40:24 -0200610 ccid2_congestion_event(sk, seqp);
Gerrit Renkerc38c92a2010-08-22 19:41:39 +0000611 hc->tx_pipe--;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800612 }
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000613 if (seqp == hc->tx_seqt)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800614 break;
615 seqp = seqp->ccid2s_prev;
616 }
617
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000618 hc->tx_seqt = last_acked;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800619 }
620
621 /* trim acked packets in tail */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000622 while (hc->tx_seqt != hc->tx_seqh) {
623 if (!hc->tx_seqt->ccid2s_acked)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800624 break;
625
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000626 hc->tx_seqt = hc->tx_seqt->ccid2s_next;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800627 }
Gerrit Renkerc38c92a2010-08-22 19:41:39 +0000628
629 /* restart RTO timer if not all outstanding data has been acked */
630 if (hc->tx_pipe == 0)
631 sk_stop_timer(sk, &hc->tx_rtotimer);
632 else
633 sk_reset_timer(sk, &hc->tx_rtotimer, jiffies + hc->tx_rto);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800634}
635
Arnaldo Carvalho de Melo91f0ebf2006-03-20 19:21:44 -0800636static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk)
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800637{
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000638 struct ccid2_hc_tx_sock *hc = ccid_priv(ccid);
Gerrit Renkerb00d2bb2007-11-24 21:44:30 -0200639 struct dccp_sock *dp = dccp_sk(sk);
640 u32 max_ratio;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800641
Gerrit Renkerb00d2bb2007-11-24 21:44:30 -0200642 /* RFC 4341, 5: initialise ssthresh to arbitrarily high (max) value */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000643 hc->tx_ssthresh = ~0U;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800644
Gerrit Renker22b71c82010-08-29 19:23:12 +0000645 /* Use larger initial windows (RFC 4341, section 5). */
646 hc->tx_cwnd = rfc3390_bytes_to_packets(dp->dccps_mss_cache);
Gerrit Renkerb00d2bb2007-11-24 21:44:30 -0200647
648 /* Make sure that Ack Ratio is enabled and within bounds. */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000649 max_ratio = DIV_ROUND_UP(hc->tx_cwnd, 2);
Gerrit Renkerb00d2bb2007-11-24 21:44:30 -0200650 if (dp->dccps_l_ack_ratio == 0 || dp->dccps_l_ack_ratio > max_ratio)
651 dp->dccps_l_ack_ratio = max_ratio;
652
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800653 /* XXX init ~ to window size... */
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000654 if (ccid2_hc_tx_alloc_seq(hc))
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800655 return -ENOMEM;
Arnaldo Carvalho de Melo91f0ebf2006-03-20 19:21:44 -0800656
Gerrit Renker231cc2a2010-08-22 19:41:40 +0000657 hc->tx_rto = DCCP_TIMEOUT_INIT;
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000658 hc->tx_rpdupack = -1;
Gerrit Renkerd82b6f82010-08-29 19:23:10 +0000659 hc->tx_last_cong = ccid2_time_stamp;
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000660 setup_timer(&hc->tx_rtotimer, ccid2_hc_tx_rto_expire,
Gerrit Renker410e27a2008-09-09 13:27:22 +0200661 (unsigned long)sk);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800662 return 0;
663}
664
665static void ccid2_hc_tx_exit(struct sock *sk)
666{
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000667 struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk);
Andrea Bittau07978aa2006-09-19 13:13:37 -0700668 int i;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800669
Gerrit Renkerd26eeb02010-08-29 19:23:11 +0000670 sk_stop_timer(sk, &hc->tx_rtotimer);
Andrea Bittau07978aa2006-09-19 13:13:37 -0700671
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000672 for (i = 0; i < hc->tx_seqbufc; i++)
673 kfree(hc->tx_seqbuf[i]);
674 hc->tx_seqbufc = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800675}
676
677static void ccid2_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
678{
679 const struct dccp_sock *dp = dccp_sk(sk);
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000680 struct ccid2_hc_rx_sock *hc = ccid2_hc_rx_sk(sk);
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800681
682 switch (DCCP_SKB_CB(skb)->dccpd_type) {
683 case DCCP_PKT_DATA:
684 case DCCP_PKT_DATAACK:
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000685 hc->rx_data++;
686 if (hc->rx_data >= dp->dccps_r_ack_ratio) {
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800687 dccp_send_ack(sk);
Gerrit Renker77d2dd92009-10-05 00:53:12 +0000688 hc->rx_data = 0;
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800689 }
690 break;
691 }
692}
693
Gerrit Renkerddebc972009-01-04 21:42:53 -0800694struct ccid_operations ccid2_ops = {
Gerrit Renker410e27a2008-09-09 13:27:22 +0200695 .ccid_id = DCCPC_CCID2,
696 .ccid_name = "TCP-like",
Gerrit Renker410e27a2008-09-09 13:27:22 +0200697 .ccid_hc_tx_obj_size = sizeof(struct ccid2_hc_tx_sock),
698 .ccid_hc_tx_init = ccid2_hc_tx_init,
699 .ccid_hc_tx_exit = ccid2_hc_tx_exit,
700 .ccid_hc_tx_send_packet = ccid2_hc_tx_send_packet,
701 .ccid_hc_tx_packet_sent = ccid2_hc_tx_packet_sent,
702 .ccid_hc_tx_packet_recv = ccid2_hc_tx_packet_recv,
703 .ccid_hc_rx_obj_size = sizeof(struct ccid2_hc_rx_sock),
704 .ccid_hc_rx_packet_recv = ccid2_hc_rx_packet_recv,
Andrea Bittau2a91aa32006-03-20 17:41:47 -0800705};
706
Gerrit Renker84116712006-11-20 18:26:03 -0200707#ifdef CONFIG_IP_DCCP_CCID2_DEBUG
Gerrit Renker43264992008-08-23 13:28:27 +0200708module_param(ccid2_debug, bool, 0644);
Gerrit Renkerddebc972009-01-04 21:42:53 -0800709MODULE_PARM_DESC(ccid2_debug, "Enable CCID-2 debug messages");
Gerrit Renker84116712006-11-20 18:26:03 -0200710#endif