aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ccids')
-rw-r--r--net/dccp/ccids/ccid3.c22
-rw-r--r--net/dccp/ccids/ccid3.h2
2 files changed, 6 insertions, 18 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 721efc7ed319..cf8c07b2704f 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -137,8 +137,7 @@ static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now)
137 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 137 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
138 const __u32 old_x = hctx->ccid3hctx_x; 138 const __u32 old_x = hctx->ccid3hctx_x;
139 139
140 /* To avoid large error in calcX */ 140 if (hctx->ccid3hctx_p > 0) {
141 if (hctx->ccid3hctx_p >= TFRC_SMALLEST_P) {
142 hctx->ccid3hctx_x_calc = tfrc_calc_x(hctx->ccid3hctx_s, 141 hctx->ccid3hctx_x_calc = tfrc_calc_x(hctx->ccid3hctx_s,
143 hctx->ccid3hctx_rtt, 142 hctx->ccid3hctx_rtt,
144 hctx->ccid3hctx_p); 143 hctx->ccid3hctx_p);
@@ -226,16 +225,14 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
226 ccid3_tx_state_name(hctx->ccid3hctx_state)); 225 ccid3_tx_state_name(hctx->ccid3hctx_state));
227 /* Halve sending rate */ 226 /* Halve sending rate */
228 227
229 /* If (X_calc > 2 * X_recv) 228 /* If (p == 0 || X_calc > 2 * X_recv)
230 * X_recv = max(X_recv / 2, s / (2 * t_mbi)); 229 * X_recv = max(X_recv / 2, s / (2 * t_mbi));
231 * Else 230 * Else
232 * X_recv = X_calc / 4; 231 * X_recv = X_calc / 4;
233 */ 232 */
234 BUG_ON(hctx->ccid3hctx_p >= TFRC_SMALLEST_P && 233 BUG_ON(hctx->ccid3hctx_p && !hctx->ccid3hctx_x_calc);
235 hctx->ccid3hctx_x_calc == 0);
236 234
237 /* check also if p is zero -> x_calc is infinity? */ 235 if (hctx->ccid3hctx_p == 0 ||
238 if (hctx->ccid3hctx_p < TFRC_SMALLEST_P ||
239 hctx->ccid3hctx_x_calc > 2 * hctx->ccid3hctx_x_recv) 236 hctx->ccid3hctx_x_calc > 2 * hctx->ccid3hctx_x_recv)
240 hctx->ccid3hctx_x_recv = max_t(u32, hctx->ccid3hctx_x_recv / 2, 237 hctx->ccid3hctx_x_recv = max_t(u32, hctx->ccid3hctx_x_recv / 2,
241 hctx->ccid3hctx_s / (2 * TFRC_T_MBI)); 238 hctx->ccid3hctx_s / (2 * TFRC_T_MBI));
@@ -449,15 +446,8 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
449 pinv = opt_recv->ccid3or_loss_event_rate; 446 pinv = opt_recv->ccid3or_loss_event_rate;
450 if (pinv == ~0U || pinv == 0) 447 if (pinv == ~0U || pinv == 0)
451 hctx->ccid3hctx_p = 0; 448 hctx->ccid3hctx_p = 0;
452 else { 449 else
453 hctx->ccid3hctx_p = 1000000 / pinv; 450 hctx->ccid3hctx_p = 1000000 / pinv;
454
455 if (hctx->ccid3hctx_p < TFRC_SMALLEST_P) {
456 hctx->ccid3hctx_p = TFRC_SMALLEST_P;
457 ccid3_pr_debug("%s, sk=%p, Smallest p used!\n",
458 dccp_role(sk), sk);
459 }
460 }
461 451
462 dccp_timestamp(sk, &now); 452 dccp_timestamp(sk, &now);
463 453
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h
index 27cb20ae1da8..07596d704ef9 100644
--- a/net/dccp/ccids/ccid3.h
+++ b/net/dccp/ccids/ccid3.h
@@ -51,8 +51,6 @@
51/* Parameter t_mbi from [RFC 3448, 4.3]: backoff interval in seconds */ 51/* Parameter t_mbi from [RFC 3448, 4.3]: backoff interval in seconds */
52#define TFRC_T_MBI 64 52#define TFRC_T_MBI 64
53 53
54#define TFRC_SMALLEST_P 40
55
56enum ccid3_options { 54enum ccid3_options {
57 TFRC_OPT_LOSS_EVENT_RATE = 192, 55 TFRC_OPT_LOSS_EVENT_RATE = 192,
58 TFRC_OPT_LOSS_INTERVALS = 193, 56 TFRC_OPT_LOSS_INTERVALS = 193,