diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2010-08-29 15:23:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-30 16:45:25 -0400 |
commit | d82b6f85c1d73340ef4a26bd0b247ac14610cd83 (patch) | |
tree | 633b7aa259c75a1620783cd65130436b5179a9fa /net/dccp/ccids/ccid2.c | |
parent | dca43c75e7e545694a9dd6288553f55c53e2a3a3 (diff) |
dccp ccid-2: Use u32 timestamps uniformly
Since CCID-2 is de facto a mini implementation of TCP, it makes sense to share
as much code as possible.
Hence this patch aligns CCID-2 timestamping with TCP timestamping.
This also halves the space consumption (on 64-bit systems).
The necessary include file <net/tcp.h> is already included by way of
net/dccp.h. Redundant includes have been removed.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ccids/ccid2.c')
-rw-r--r-- | net/dccp/ccids/ccid2.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index 7af3106c1f94..0cff637a4a51 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
@@ -25,8 +25,6 @@ | |||
25 | */ | 25 | */ |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include "../feat.h" | 27 | #include "../feat.h" |
28 | #include "../ccid.h" | ||
29 | #include "../dccp.h" | ||
30 | #include "ccid2.h" | 28 | #include "ccid2.h" |
31 | 29 | ||
32 | 30 | ||
@@ -175,7 +173,7 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len) | |||
175 | 173 | ||
176 | hc->tx_seqh->ccid2s_seq = dp->dccps_gss; | 174 | hc->tx_seqh->ccid2s_seq = dp->dccps_gss; |
177 | hc->tx_seqh->ccid2s_acked = 0; | 175 | hc->tx_seqh->ccid2s_acked = 0; |
178 | hc->tx_seqh->ccid2s_sent = jiffies; | 176 | hc->tx_seqh->ccid2s_sent = ccid2_time_stamp; |
179 | 177 | ||
180 | next = hc->tx_seqh->ccid2s_next; | 178 | next = hc->tx_seqh->ccid2s_next; |
181 | /* check if we need to alloc more space */ | 179 | /* check if we need to alloc more space */ |
@@ -250,7 +248,7 @@ static void ccid2_hc_tx_packet_sent(struct sock *sk, int more, unsigned int len) | |||
250 | struct ccid2_seq *seqp = hc->tx_seqt; | 248 | struct ccid2_seq *seqp = hc->tx_seqt; |
251 | 249 | ||
252 | while (seqp != hc->tx_seqh) { | 250 | while (seqp != hc->tx_seqh) { |
253 | ccid2_pr_debug("out seq=%llu acked=%d time=%lu\n", | 251 | ccid2_pr_debug("out seq=%llu acked=%d time=%u\n", |
254 | (unsigned long long)seqp->ccid2s_seq, | 252 | (unsigned long long)seqp->ccid2s_seq, |
255 | seqp->ccid2s_acked, seqp->ccid2s_sent); | 253 | seqp->ccid2s_acked, seqp->ccid2s_sent); |
256 | seqp = seqp->ccid2s_next; | 254 | seqp = seqp->ccid2s_next; |
@@ -431,19 +429,19 @@ static void ccid2_new_ack(struct sock *sk, struct ccid2_seq *seqp, | |||
431 | * The cleanest solution is to not use the ccid2s_sent field at all | 429 | * The cleanest solution is to not use the ccid2s_sent field at all |
432 | * and instead use DCCP timestamps: requires changes in other places. | 430 | * and instead use DCCP timestamps: requires changes in other places. |
433 | */ | 431 | */ |
434 | ccid2_rtt_estimator(sk, jiffies - seqp->ccid2s_sent); | 432 | ccid2_rtt_estimator(sk, ccid2_time_stamp - seqp->ccid2s_sent); |
435 | } | 433 | } |
436 | 434 | ||
437 | static void ccid2_congestion_event(struct sock *sk, struct ccid2_seq *seqp) | 435 | static void ccid2_congestion_event(struct sock *sk, struct ccid2_seq *seqp) |
438 | { | 436 | { |
439 | struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk); | 437 | struct ccid2_hc_tx_sock *hc = ccid2_hc_tx_sk(sk); |
440 | 438 | ||
441 | if (time_before(seqp->ccid2s_sent, hc->tx_last_cong)) { | 439 | if ((s32)(seqp->ccid2s_sent - hc->tx_last_cong) < 0) { |
442 | ccid2_pr_debug("Multiple losses in an RTT---treating as one\n"); | 440 | ccid2_pr_debug("Multiple losses in an RTT---treating as one\n"); |
443 | return; | 441 | return; |
444 | } | 442 | } |
445 | 443 | ||
446 | hc->tx_last_cong = jiffies; | 444 | hc->tx_last_cong = ccid2_time_stamp; |
447 | 445 | ||
448 | hc->tx_cwnd = hc->tx_cwnd / 2 ? : 1U; | 446 | hc->tx_cwnd = hc->tx_cwnd / 2 ? : 1U; |
449 | hc->tx_ssthresh = max(hc->tx_cwnd, 2U); | 447 | hc->tx_ssthresh = max(hc->tx_cwnd, 2U); |
@@ -683,7 +681,7 @@ static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk) | |||
683 | 681 | ||
684 | hc->tx_rto = DCCP_TIMEOUT_INIT; | 682 | hc->tx_rto = DCCP_TIMEOUT_INIT; |
685 | hc->tx_rpdupack = -1; | 683 | hc->tx_rpdupack = -1; |
686 | hc->tx_last_cong = jiffies; | 684 | hc->tx_last_cong = ccid2_time_stamp; |
687 | setup_timer(&hc->tx_rtotimer, ccid2_hc_tx_rto_expire, | 685 | setup_timer(&hc->tx_rtotimer, ccid2_hc_tx_rto_expire, |
688 | (unsigned long)sk); | 686 | (unsigned long)sk); |
689 | return 0; | 687 | return 0; |