aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ccids/ccid2.c14
-rw-r--r--net/dccp/ccids/ccid2.h15
2 files changed, 16 insertions, 13 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
437static void ccid2_congestion_event(struct sock *sk, struct ccid2_seq *seqp) 435static 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;
diff --git a/net/dccp/ccids/ccid2.h b/net/dccp/ccids/ccid2.h
index b017843ba44d..9731c2dc1487 100644
--- a/net/dccp/ccids/ccid2.h
+++ b/net/dccp/ccids/ccid2.h
@@ -18,18 +18,23 @@
18#ifndef _DCCP_CCID2_H_ 18#ifndef _DCCP_CCID2_H_
19#define _DCCP_CCID2_H_ 19#define _DCCP_CCID2_H_
20 20
21#include <linux/dccp.h>
22#include <linux/timer.h> 21#include <linux/timer.h>
23#include <linux/types.h> 22#include <linux/types.h>
24#include "../ccid.h" 23#include "../ccid.h"
24#include "../dccp.h"
25
26/*
27 * CCID-2 timestamping faces the same issues as TCP timestamping.
28 * Hence we reuse/share as much of the code as possible.
29 */
30#define ccid2_time_stamp tcp_time_stamp
31
25/* NUMDUPACK parameter from RFC 4341, p. 6 */ 32/* NUMDUPACK parameter from RFC 4341, p. 6 */
26#define NUMDUPACK 3 33#define NUMDUPACK 3
27 34
28struct sock;
29
30struct ccid2_seq { 35struct ccid2_seq {
31 u64 ccid2s_seq; 36 u64 ccid2s_seq;
32 unsigned long ccid2s_sent; 37 u32 ccid2s_sent;
33 int ccid2s_acked; 38 int ccid2s_acked;
34 struct ccid2_seq *ccid2s_prev; 39 struct ccid2_seq *ccid2s_prev;
35 struct ccid2_seq *ccid2s_next; 40 struct ccid2_seq *ccid2s_next;
@@ -72,7 +77,7 @@ struct ccid2_hc_tx_sock {
72 77
73 u64 tx_rpseq; 78 u64 tx_rpseq;
74 int tx_rpdupack; 79 int tx_rpdupack;
75 unsigned long tx_last_cong; 80 u32 tx_last_cong;
76 u64 tx_high_ack; 81 u64 tx_high_ack;
77}; 82};
78 83